svn commit: r212619 - head/sys/sparc64/sparc64

2010-09-14 Thread Marius Strobl
Author: marius
Date: Tue Sep 14 19:35:43 2010
New Revision: 212619
URL: http://svn.freebsd.org/changeset/base/212619

Log:
  Remove redundant raising of the PIL to PIL_TICK as the respective locore
  code already did that.

Modified:
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sparc64/sparc64/mp_machdep.c

Modified: head/sys/sparc64/sparc64/machdep.c
==
--- head/sys/sparc64/sparc64/machdep.c  Tue Sep 14 18:58:51 2010
(r212618)
+++ head/sys/sparc64/sparc64/machdep.c  Tue Sep 14 19:35:43 2010
(r212619)
@@ -587,7 +587,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*

Modified: head/sys/sparc64/sparc64/mp_machdep.c
==
--- head/sys/sparc64/sparc64/mp_machdep.c   Tue Sep 14 18:58:51 2010
(r212618)
+++ head/sys/sparc64/sparc64/mp_machdep.c   Tue Sep 14 19:35:43 2010
(r212619)
@@ -446,7 +446,6 @@ cpu_mp_bootstrap(struct pcpu *pc)
cpu_setregs(pc);
 
/* Enable interrupts. */
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
smp_cpus++;
___
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: r212620 - in head/sys: sparc64/sparc64 sun4v/sun4v

2010-09-14 Thread Marius Strobl
Author: marius
Date: Tue Sep 14 20:31:09 2010
New Revision: 212620
URL: http://svn.freebsd.org/changeset/base/212620

Log:
  Remove a KASSERT which will also trigger for perfectly valid combinations
  of small maxsize and "large" (including BUS_SPACE_UNRESTRICTED) nsegments
  parameters. Generally using a presz of 0 (which indeed might indicate the
  use of bogus parameters for DMA tag creation) is not fatal, it just means
  that no additional DVMA space will be preallocated.

Modified:
  head/sys/sparc64/sparc64/iommu.c
  head/sys/sun4v/sun4v/hviommu.c

Modified: head/sys/sparc64/sparc64/iommu.c
==
--- head/sys/sparc64/sparc64/iommu.cTue Sep 14 19:35:43 2010
(r212619)
+++ head/sys/sparc64/sparc64/iommu.cTue Sep 14 20:31:09 2010
(r212620)
@@ -874,9 +874,6 @@ iommu_dvmamap_create(bus_dma_tag_t dt, i
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("%s: bogus preallocation size , nsegments = %d, "
-   "maxpre = %d, maxsize = %lu", __func__, dt->dt_nsegments, maxpre,
-   dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = iommu_dvma_valloc(dt, is, *mapp, currsz);

Modified: head/sys/sun4v/sun4v/hviommu.c
==
--- head/sys/sun4v/sun4v/hviommu.c  Tue Sep 14 19:35:43 2010
(r212619)
+++ head/sys/sun4v/sun4v/hviommu.c  Tue Sep 14 20:31:09 2010
(r212620)
@@ -513,9 +513,6 @@ hviommu_dvmamap_create(bus_dma_tag_t dt,
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("hviommu_dvmamap_create: bogus preallocation size "
-   ", nsegments = %d, maxpre = %d, maxsize = %lu", dt->dt_nsegments,
-   maxpre, dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = hviommu_dvma_valloc(dt, him, *mapp, currsz);
___
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: r212621 - head/sys/dev/usb

2010-09-14 Thread Marius Strobl
Author: marius
Date: Tue Sep 14 20:41:06 2010
New Revision: 212621
URL: http://svn.freebsd.org/changeset/base/212621

Log:
  Use saner nsegments and maxsegsz parameters when creating certain DMA tags;
  tags for 1-byte allocations cannot possibly be split across 2 segments and
  maxsegsz must not exceed maxsize.

Modified:
  head/sys/dev/usb/usb_busdma.c

Modified: head/sys/dev/usb/usb_busdma.c
==
--- head/sys/dev/usb/usb_busdma.c   Tue Sep 14 20:31:09 2010
(r212620)
+++ head/sys/dev/usb/usb_busdma.c   Tue Sep 14 20:41:06 2010
(r212621)
@@ -366,9 +366,9 @@ usb_dma_tag_create(struct usb_dma_tag *u
 /* filter*/ NULL,
 /* filterarg */ NULL,
 /* maxsize   */ size,
-/* nsegments */ (align == 1) ?
+/* nsegments */ (align == 1 && size > 1) ?
(2 + (size / USB_PAGE_SIZE)) : 1,
-/* maxsegsz  */ (align == 1) ?
+/* maxsegsz  */ (align == 1 && size > USB_PAGE_SIZE) ?
USB_PAGE_SIZE : size,
 /* flags */ BUS_DMA_KEEP_PG_OFFSET,
 /* lockfn*/ &usb_dma_lock_cb,
___
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: r212663 - head/sys/sparc64/sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 15:18:41 2010
New Revision: 212663
URL: http://svn.freebsd.org/changeset/base/212663

Log:
  - Update the comment in swi_vm() regarding busdma bounce buffers; it's
unlikely that support for these ever will be implemented on sparc64 as
the IOMMUs are able to translate to up to the maximum physical address
supported by the respective machine, bypassing the IOMMU is affected
by hardware errata and being able to support DMA engines which cannot
do at least 32-bit DMA does not justify the costs.
  - The page zeroing in uma_small_alloc() may use the VIS-based block zero
function so take advantage of it.

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

Modified: head/sys/sparc64/sparc64/vm_machdep.c
==
--- head/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 15 15:17:54 2010
(r212662)
+++ head/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 15 15:18:41 2010
(r212663)
@@ -492,10 +492,7 @@ void
 swi_vm(void *v)
 {
 
-   /*
-* Nothing to do here yet - busdma bounce buffers are not yet
-* implemented.
-*/
+   /* Nothing to do here - busdma bounce buffers are not implemented. */
 }
 
 void *
@@ -540,7 +537,7 @@ uma_small_alloc(uma_zone_t zone, int byt
}
va = (void *)TLB_PHYS_TO_DIRECT(pa);
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
-   bzero(va, PAGE_SIZE);
+   cpu_block_zero(va, PAGE_SIZE);
return (va);
 }
 
___
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: r212676 - in head/sys: sparc64/sparc64 sun4v/sun4v

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 17:11:15 2010
New Revision: 212676
URL: http://svn.freebsd.org/changeset/base/212676

Log:
  Sync with other platforms:
  - make dflt_lock() always panic,
  - add kludge to use contigmalloc() when the alignment is larger than the size
and print a diagnostic when we didn't satisfy the alignment.

Modified:
  head/sys/sparc64/sparc64/bus_machdep.c
  head/sys/sun4v/sun4v/bus_machdep.c

Modified: head/sys/sparc64/sparc64/bus_machdep.c
==
--- head/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 15 16:42:57 2010
(r212675)
+++ head/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 15 17:11:15 2010
(r212676)
@@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -631,9 +628,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -646,6 +652,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -657,11 +665,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
free(vaddr, M_DEVBUF);
-   else {
+   else
contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF);
-   }
 }
 
 struct bus_dma_methods nexus_dma_methods = {

Modified: head/sys/sun4v/sun4v/bus_machdep.c
==
--- head/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 15 16:42:57 2010
(r212675)
+++ head/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 15 17:11:15 2010
(r212676)
@@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -673,11 +681,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
free(vaddr, M_DEVBUF);
-   else {
+   else
contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF);
-   }
 }
 
 struct bus_dma_methods nexus_dma_methods = {
___
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-unsubsc

svn commit: r212679 - stable/8/sys/geom/part

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 17:38:59 2010
New Revision: 212679
URL: http://svn.freebsd.org/changeset/base/212679

Log:
  MFC: r208515
  
  Fix some whitespace nits.

Modified:
  stable/8/sys/geom/part/g_part_vtoc8.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/geom/part/g_part_vtoc8.c
==
--- stable/8/sys/geom/part/g_part_vtoc8.c   Wed Sep 15 17:25:51 2010
(r212678)
+++ stable/8/sys/geom/part/g_part_vtoc8.c   Wed Sep 15 17:38:59 2010
(r212679)
@@ -55,19 +55,19 @@ static int g_part_vtoc8_add(struct g_par
 struct g_part_parms *);
 static int g_part_vtoc8_create(struct g_part_table *, struct g_part_parms *);
 static int g_part_vtoc8_destroy(struct g_part_table *, struct g_part_parms *);
-static void g_part_vtoc8_dumpconf(struct g_part_table *, struct g_part_entry *,
-struct sbuf *, const char *);
+static void g_part_vtoc8_dumpconf(struct g_part_table *,
+struct g_part_entry *, struct sbuf *, const char *);
 static int g_part_vtoc8_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_vtoc8_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_vtoc8_modify(struct g_part_table *, struct g_part_entry *,
 struct g_part_parms *);
-static const char *g_part_vtoc8_name(struct g_part_table *, struct 
g_part_entry *,
-char *, size_t);
+static const char *g_part_vtoc8_name(struct g_part_table *,
+struct g_part_entry *, char *, size_t);
 static int g_part_vtoc8_probe(struct g_part_table *, struct g_consumer *);
 static int g_part_vtoc8_read(struct g_part_table *, struct g_consumer *);
-static const char *g_part_vtoc8_type(struct g_part_table *, struct 
g_part_entry *,
-char *, size_t);
+static const char *g_part_vtoc8_type(struct g_part_table *,
+struct g_part_entry *, char *, size_t);
 static int g_part_vtoc8_write(struct g_part_table *, struct g_consumer *);
-static int g_part_vtoc8_resize(struct g_part_table *, struct g_part_entry *,  
+static int g_part_vtoc8_resize(struct g_part_table *, struct g_part_entry *,
 struct g_part_parms *);
 
 static kobj_method_t g_part_vtoc8_methods[] = {
@@ -263,7 +263,8 @@ g_part_vtoc8_dumpconf(struct g_part_tabl
 }
 
 static int
-g_part_vtoc8_dumpto(struct g_part_table *basetable, struct g_part_entry 
*entry)  
+g_part_vtoc8_dumpto(struct g_part_table *basetable,
+struct g_part_entry *entry)
 {
struct g_part_vtoc8_table *table;
uint16_t tag;
@@ -479,7 +480,7 @@ g_part_vtoc8_read(struct g_part_table *b
 }
 
 static const char *
-g_part_vtoc8_type(struct g_part_table *basetable, struct g_part_entry *entry, 
+g_part_vtoc8_type(struct g_part_table *basetable, struct g_part_entry *entry,
 char *buf, size_t bufsz)
 {
struct g_part_vtoc8_table *table;
___
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: r212680 - stable/7/sys/geom/part

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 17:39:15 2010
New Revision: 212680
URL: http://svn.freebsd.org/changeset/base/212680

Log:
  MFC: r208515
  
  Fix some whitespace nits.

Modified:
  stable/7/sys/geom/part/g_part_vtoc8.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/geom/part/g_part_vtoc8.c
==
--- stable/7/sys/geom/part/g_part_vtoc8.c   Wed Sep 15 17:38:59 2010
(r212679)
+++ stable/7/sys/geom/part/g_part_vtoc8.c   Wed Sep 15 17:39:15 2010
(r212680)
@@ -55,17 +55,17 @@ static int g_part_vtoc8_add(struct g_par
 struct g_part_parms *);
 static int g_part_vtoc8_create(struct g_part_table *, struct g_part_parms *);
 static int g_part_vtoc8_destroy(struct g_part_table *, struct g_part_parms *);
-static void g_part_vtoc8_dumpconf(struct g_part_table *, struct g_part_entry *,
-struct sbuf *, const char *);
+static void g_part_vtoc8_dumpconf(struct g_part_table *,
+struct g_part_entry *, struct sbuf *, const char *);
 static int g_part_vtoc8_dumpto(struct g_part_table *, struct g_part_entry *);
-static int g_part_vtoc8_modify(struct g_part_table *, struct g_part_entry *,  
+static int g_part_vtoc8_modify(struct g_part_table *, struct g_part_entry *,
 struct g_part_parms *);
-static const char *g_part_vtoc8_name(struct g_part_table *, struct 
g_part_entry *,
-char *, size_t);
+static const char *g_part_vtoc8_name(struct g_part_table *,
+struct g_part_entry *, char *, size_t);
 static int g_part_vtoc8_probe(struct g_part_table *, struct g_consumer *);
 static int g_part_vtoc8_read(struct g_part_table *, struct g_consumer *);
-static const char *g_part_vtoc8_type(struct g_part_table *, struct 
g_part_entry *,
-char *, size_t);
+static const char *g_part_vtoc8_type(struct g_part_table *,
+struct g_part_entry *, char *, size_t);
 static int g_part_vtoc8_write(struct g_part_table *, struct g_consumer *);
 
 static kobj_method_t g_part_vtoc8_methods[] = {
@@ -260,7 +260,8 @@ g_part_vtoc8_dumpconf(struct g_part_tabl
 }
 
 static int
-g_part_vtoc8_dumpto(struct g_part_table *basetable, struct g_part_entry 
*entry)  
+g_part_vtoc8_dumpto(struct g_part_table *basetable,
+struct g_part_entry *entry)
 {
struct g_part_vtoc8_table *table;
uint16_t tag;
@@ -456,7 +457,7 @@ g_part_vtoc8_read(struct g_part_table *b
 }
 
 static const char *
-g_part_vtoc8_type(struct g_part_table *basetable, struct g_part_entry *entry, 
+g_part_vtoc8_type(struct g_part_table *basetable, struct g_part_entry *entry,
 char *buf, size_t bufsz)
 {
struct g_part_vtoc8_table *table;
___
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: r212683 - in stable/7/sys: sparc64/include sparc64/sparc64 sun4v/include sun4v/sun4v

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 18:09:15 2010
New Revision: 212683
URL: http://svn.freebsd.org/changeset/base/212683

Log:
  MFC: r210176
  
  Allocate proper amount of memory for interrupt names on sparc64 and
  sun4v, same as done on other architectures. This removes garbage from
  `vmstat -ia` output.

Modified:
  stable/7/sys/sparc64/include/intr_machdep.h
  stable/7/sys/sparc64/sparc64/exception.S
  stable/7/sys/sparc64/sparc64/genassym.c
  stable/7/sys/sun4v/include/intr_machdep.h
  stable/7/sys/sun4v/sun4v/exception.S
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/intr_machdep.h
==
--- stable/7/sys/sparc64/include/intr_machdep.h Wed Sep 15 17:59:22 2010
(r212682)
+++ stable/7/sys/sparc64/include/intr_machdep.h Wed Sep 15 18:09:15 2010
(r212683)
@@ -33,7 +33,6 @@
 
 #definePIL_MAX (1 << 4)
 #defineIV_MAX  (1 << 11)
-#defineIV_NAMLEN   1024
 
 #defineIR_FREE (PIL_MAX * 2)
 

Modified: stable/7/sys/sparc64/sparc64/exception.S
==
--- stable/7/sys/sparc64/sparc64/exception.SWed Sep 15 17:59:22 2010
(r212682)
+++ stable/7/sys/sparc64/sparc64/exception.SWed Sep 15 18:09:15 2010
(r212683)
@@ -365,7 +365,7 @@ ENTRY(rsf_fatal)
sir
 END(rsf_fatal)
 
-   .comm   intrnames, IV_NAMLEN
+   .comm   intrnames, IV_MAX * (MAXCOMLEN + 1)
.comm   eintrnames, 0
 
.comm   intrcnt, IV_MAX * 8

Modified: stable/7/sys/sparc64/sparc64/genassym.c
==
--- stable/7/sys/sparc64/sparc64/genassym.c Wed Sep 15 17:59:22 2010
(r212682)
+++ stable/7/sys/sparc64/sparc64/genassym.c Wed Sep 15 18:09:15 2010
(r212683)
@@ -160,6 +160,7 @@ ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT
 
 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
 
+ASSYM(MAXCOMLEN, MAXCOMLEN);
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));

Modified: stable/7/sys/sun4v/include/intr_machdep.h
==
--- stable/7/sys/sun4v/include/intr_machdep.h   Wed Sep 15 17:59:22 2010
(r212682)
+++ stable/7/sys/sun4v/include/intr_machdep.h   Wed Sep 15 18:09:15 2010
(r212683)
@@ -33,7 +33,6 @@
 
 #definePIL_MAX (1 << 4)
 #defineIV_MAX  (1 << 11)
-#define IV_NAMLEN  1024
 
 #defineIR_FREE (PIL_MAX * 2)
 

Modified: stable/7/sys/sun4v/sun4v/exception.S
==
--- stable/7/sys/sun4v/sun4v/exception.SWed Sep 15 17:59:22 2010
(r212682)
+++ stable/7/sys/sun4v/sun4v/exception.SWed Sep 15 18:09:15 2010
(r212683)
@@ -1948,7 +1948,7 @@ END(fork_trampoline)
 
 
 
-   .comm   intrnames, IV_NAMLEN
+   .comm   intrnames, IV_MAX * (MAXCOMLEN + 1)
.comm   eintrnames, 0
 
.comm   intrcnt, IV_MAX * 8
___
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: r212684 - in stable/8/sys: sparc64/include sparc64/sparc64 sun4v/include sun4v/sun4v

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 18:09:16 2010
New Revision: 212684
URL: http://svn.freebsd.org/changeset/base/212684

Log:
  MFC: r210176
  
  Allocate proper amount of memory for interrupt names on sparc64 and
  sun4v, same as done on other architectures. This removes garbage from
  `vmstat -ia` output.

Modified:
  stable/8/sys/sparc64/include/intr_machdep.h
  stable/8/sys/sparc64/sparc64/exception.S
  stable/8/sys/sparc64/sparc64/genassym.c
  stable/8/sys/sun4v/include/intr_machdep.h
  stable/8/sys/sun4v/sun4v/exception.S
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/intr_machdep.h
==
--- stable/8/sys/sparc64/include/intr_machdep.h Wed Sep 15 18:09:15 2010
(r212683)
+++ stable/8/sys/sparc64/include/intr_machdep.h Wed Sep 15 18:09:16 2010
(r212684)
@@ -33,7 +33,6 @@
 
 #definePIL_MAX (1 << 4)
 #defineIV_MAX  (1 << 11)
-#defineIV_NAMLEN   1024
 
 #defineIR_FREE (PIL_MAX * 2)
 

Modified: stable/8/sys/sparc64/sparc64/exception.S
==
--- stable/8/sys/sparc64/sparc64/exception.SWed Sep 15 18:09:15 2010
(r212683)
+++ stable/8/sys/sparc64/sparc64/exception.SWed Sep 15 18:09:16 2010
(r212684)
@@ -365,7 +365,7 @@ ENTRY(rsf_fatal)
sir
 END(rsf_fatal)
 
-   .comm   intrnames, IV_NAMLEN
+   .comm   intrnames, IV_MAX * (MAXCOMLEN + 1)
.comm   eintrnames, 0
 
.comm   intrcnt, IV_MAX * 8

Modified: stable/8/sys/sparc64/sparc64/genassym.c
==
--- stable/8/sys/sparc64/sparc64/genassym.c Wed Sep 15 18:09:15 2010
(r212683)
+++ stable/8/sys/sparc64/sparc64/genassym.c Wed Sep 15 18:09:16 2010
(r212684)
@@ -160,6 +160,7 @@ ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT
 
 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
 
+ASSYM(MAXCOMLEN, MAXCOMLEN);
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));

Modified: stable/8/sys/sun4v/include/intr_machdep.h
==
--- stable/8/sys/sun4v/include/intr_machdep.h   Wed Sep 15 18:09:15 2010
(r212683)
+++ stable/8/sys/sun4v/include/intr_machdep.h   Wed Sep 15 18:09:16 2010
(r212684)
@@ -33,7 +33,6 @@
 
 #definePIL_MAX (1 << 4)
 #defineIV_MAX  (1 << 11)
-#define IV_NAMLEN  1024
 
 #defineIR_FREE (PIL_MAX * 2)
 

Modified: stable/8/sys/sun4v/sun4v/exception.S
==
--- stable/8/sys/sun4v/sun4v/exception.SWed Sep 15 18:09:15 2010
(r212683)
+++ stable/8/sys/sun4v/sun4v/exception.SWed Sep 15 18:09:16 2010
(r212684)
@@ -1948,7 +1948,7 @@ END(fork_trampoline)
 
 
 
-   .comm   intrnames, IV_NAMLEN
+   .comm   intrnames, IV_MAX * (MAXCOMLEN + 1)
.comm   eintrnames, 0
 
.comm   intrcnt, IV_MAX * 8
___
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: r212685 - in stable/8/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 18:51:14 2010
New Revision: 212685
URL: http://svn.freebsd.org/changeset/base/212685

Log:
  MFC: r211049, r211568
  
  For CPUs which ignore TD_CV and support hardware unaliasing don't
  bother doing page coloring. This results in a small but measurable
  performance improvement in buildworld times.

Modified:
  stable/8/sys/sparc64/include/cache.h
  stable/8/sys/sparc64/sparc64/cache.c
  stable/8/sys/sparc64/sparc64/mem.c
  stable/8/sys/sparc64/sparc64/pmap.c
  stable/8/sys/sparc64/sparc64/uio_machdep.c
  stable/8/sys/sparc64/sparc64/vm_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/cache.h
==
--- stable/8/sys/sparc64/include/cache.hWed Sep 15 18:09:16 2010
(r212684)
+++ stable/8/sys/sparc64/include/cache.hWed Sep 15 18:51:14 2010
(r212685)
@@ -49,7 +49,7 @@
 #defineDCACHE_COLORS   (1 << DCACHE_COLOR_BITS)
 #defineDCACHE_COLOR_MASK   (DCACHE_COLORS - 1)
 #defineDCACHE_COLOR(va)(((va) >> PAGE_SHIFT) & 
DCACHE_COLOR_MASK)
-#defineDCACHE_OTHER_COLOR(color) \
+#defineDCACHE_OTHER_COLOR(color)   
\
((color) ^ DCACHE_COLOR_BITS)
 
 #defineDC_TAG_SHIFT2
@@ -89,6 +89,8 @@ struct cacheinfo {
 
 #ifdef _KERNEL
 
+extern u_int dcache_color_ignore;
+
 struct pcpu;
 
 typedef void cache_enable_t(u_int cpu_impl);

Modified: stable/8/sys/sparc64/sparc64/cache.c
==
--- stable/8/sys/sparc64/sparc64/cache.cWed Sep 15 18:09:16 2010
(r212684)
+++ stable/8/sys/sparc64/sparc64/cache.cWed Sep 15 18:51:14 2010
(r212685)
@@ -88,6 +88,8 @@ cache_flush_t *cache_flush;
 dcache_page_inval_t *dcache_page_inval;
 icache_page_inval_t *icache_page_inval;
 
+u_int dcache_color_ignore;
+
 #defineOF_GET(h, n, v) OF_getprop((h), (n), &(v), sizeof(v))
 
 static u_int cache_new_prop(u_int cpu_impl);
@@ -114,6 +116,13 @@ cache_init(struct pcpu *pcpu)
u_long set;
u_int use_new_prop;
 
+   /*
+* For CPUs which ignore TD_CV and support hardware unaliasing don't
+* bother doing page coloring.  This is equal across all CPUs.
+*/
+   if (pcpu->pc_cpuid == 0 && pcpu->pc_impl == CPU_IMPL_SPARC64V)
+   dcache_color_ignore = 1;
+
use_new_prop = cache_new_prop(pcpu->pc_impl);
if (OF_GET(pcpu->pc_node, !use_new_prop ? "icache-size" :
"l1-icache-size", pcpu->pc_cache.ic_size) == -1 ||
@@ -145,9 +154,8 @@ cache_init(struct pcpu *pcpu)
 * For CPUs which don't support unaliasing in hardware ensure that
 * the data cache doesn't have too many virtual colors.
 */
-   if (pcpu->pc_impl != CPU_IMPL_SPARC64V &&
-   ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) /
-   PAGE_SIZE) != DCACHE_COLORS)
+   if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size /
+   pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS)
panic("cache_init: too many D$ colors");
set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc;
if ((set & ~(1UL << (ffs(set) - 1))) != 0)

Modified: stable/8/sys/sparc64/sparc64/mem.c
==
--- stable/8/sys/sparc64/sparc64/mem.c  Wed Sep 15 18:09:16 2010
(r212684)
+++ stable/8/sys/sparc64/sparc64/mem.c  Wed Sep 15 18:51:14 2010
(r212685)
@@ -95,8 +95,10 @@ memrw(struct cdev *dev, struct uio *uio,
vm_page_t m;
int error;
int i;
+   uint32_t colors;
 
cnt = 0;
+   colors = 1;
error = 0;
ova = 0;
 
@@ -134,20 +136,20 @@ memrw(struct cdev *dev, struct uio *uio,
}
 
if (m != NULL) {
+   if (ova == 0) {
 #ifndef SUN4V
-   if (ova == 0)
+   if (dcache_color_ignore == 0)
+   colors = DCACHE_COLORS;
+#endif
ova = kmem_alloc_wait(kernel_map,
-   PAGE_SIZE * DCACHE_COLORS);
-   if (m->md.color != -1)
+   PAGE_SIZE * colors);
+   }
+#ifndef SUN4V
+   if (colors != 1 && m->md.color != -1)
va = ova + m->md.color * PAGE_SIZE;

svn commit: r212686 - in stable/7/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 18:51:15 2010
New Revision: 212686
URL: http://svn.freebsd.org/changeset/base/212686

Log:
  MFC: r211049, r211568
  
  For CPUs which ignore TD_CV and support hardware unaliasing don't
  bother doing page coloring. This results in a small but measurable
  performance improvement in buildworld times.

Modified:
  stable/7/sys/sparc64/include/cache.h
  stable/7/sys/sparc64/sparc64/cache.c
  stable/7/sys/sparc64/sparc64/mem.c
  stable/7/sys/sparc64/sparc64/pmap.c
  stable/7/sys/sparc64/sparc64/uio_machdep.c
  stable/7/sys/sparc64/sparc64/vm_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/cache.h
==
--- stable/7/sys/sparc64/include/cache.hWed Sep 15 18:51:14 2010
(r212685)
+++ stable/7/sys/sparc64/include/cache.hWed Sep 15 18:51:15 2010
(r212686)
@@ -49,7 +49,7 @@
 #defineDCACHE_COLORS   (1 << DCACHE_COLOR_BITS)
 #defineDCACHE_COLOR_MASK   (DCACHE_COLORS - 1)
 #defineDCACHE_COLOR(va)(((va) >> PAGE_SHIFT) & 
DCACHE_COLOR_MASK)
-#defineDCACHE_OTHER_COLOR(color) \
+#defineDCACHE_OTHER_COLOR(color)   
\
((color) ^ DCACHE_COLOR_BITS)
 
 #defineDC_TAG_SHIFT2
@@ -89,6 +89,8 @@ struct cacheinfo {
 
 #ifdef _KERNEL
 
+extern u_int dcache_color_ignore;
+
 struct pcpu;
 
 typedef void cache_enable_t(u_int cpu_impl);

Modified: stable/7/sys/sparc64/sparc64/cache.c
==
--- stable/7/sys/sparc64/sparc64/cache.cWed Sep 15 18:51:14 2010
(r212685)
+++ stable/7/sys/sparc64/sparc64/cache.cWed Sep 15 18:51:15 2010
(r212686)
@@ -88,6 +88,8 @@ cache_flush_t *cache_flush;
 dcache_page_inval_t *dcache_page_inval;
 icache_page_inval_t *icache_page_inval;
 
+u_int dcache_color_ignore;
+
 #defineOF_GET(h, n, v) OF_getprop((h), (n), &(v), sizeof(v))
 
 static u_int cache_new_prop(u_int cpu_impl);
@@ -114,6 +116,13 @@ cache_init(struct pcpu *pcpu)
u_long set;
u_int use_new_prop;
 
+   /*
+* For CPUs which ignore TD_CV and support hardware unaliasing don't
+* bother doing page coloring.  This is equal across all CPUs.
+*/
+   if (pcpu->pc_cpuid == 0 && pcpu->pc_impl == CPU_IMPL_SPARC64V)
+   dcache_color_ignore = 1;
+
use_new_prop = cache_new_prop(pcpu->pc_impl);
if (OF_GET(pcpu->pc_node, !use_new_prop ? "icache-size" :
"l1-icache-size", pcpu->pc_cache.ic_size) == -1 ||
@@ -145,9 +154,8 @@ cache_init(struct pcpu *pcpu)
 * For CPUs which don't support unaliasing in hardware ensure that
 * the data cache doesn't have too many virtual colors.
 */
-   if (pcpu->pc_impl != CPU_IMPL_SPARC64V &&
-   ((pcpu->pc_cache.dc_size / pcpu->pc_cache.dc_assoc) /
-   PAGE_SIZE) != DCACHE_COLORS)
+   if (dcache_color_ignore == 0 && ((pcpu->pc_cache.dc_size /
+   pcpu->pc_cache.dc_assoc) / PAGE_SIZE) != DCACHE_COLORS)
panic("cache_init: too many D$ colors");
set = pcpu->pc_cache.ec_size / pcpu->pc_cache.ec_assoc;
if ((set & ~(1UL << (ffs(set) - 1))) != 0)

Modified: stable/7/sys/sparc64/sparc64/mem.c
==
--- stable/7/sys/sparc64/sparc64/mem.c  Wed Sep 15 18:51:14 2010
(r212685)
+++ stable/7/sys/sparc64/sparc64/mem.c  Wed Sep 15 18:51:15 2010
(r212686)
@@ -95,8 +95,10 @@ memrw(struct cdev *dev, struct uio *uio,
vm_page_t m;
int error;
int i;
+   uint32_t colors;
 
cnt = 0;
+   colors = 1;
error = 0;
ova = 0;
 
@@ -134,20 +136,20 @@ memrw(struct cdev *dev, struct uio *uio,
}
 
if (m != NULL) {
+   if (ova == 0) {
 #ifndef SUN4V
-   if (ova == 0)
+   if (dcache_color_ignore == 0)
+   colors = DCACHE_COLORS;
+#endif
ova = kmem_alloc_wait(kernel_map,
-   PAGE_SIZE * DCACHE_COLORS);
-   if (m->md.color != -1)
+   PAGE_SIZE * colors);
+   }
+#ifndef SUN4V
+   if (colors != 1 && m->md.color != -1)
va = ova + m->md.color * PAGE_SIZE;
else
-   va = ova;
-#else
-  

svn commit: r212689 - in stable/8/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 19:27:30 2010
New Revision: 212689
URL: http://svn.freebsd.org/changeset/base/212689

Log:
  MFC: r211050 (partial)
  
  - Introduce a cpu_ipi_single() function pointer in order to send IPIs
to single CPUs more efficiently with Cheetah(-class) and Jalapeno CPUs.
  - Factor out the Jalapeno support from the Cheetah IPI send functions
in order to be able to more easily and efficiently implement support
for more than 32 target CPUs as well as a workaround for Cheetah+
erratum 25 for the latter.

Modified:
  stable/8/sys/sparc64/include/smp.h
  stable/8/sys/sparc64/sparc64/mp_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/smp.h
==
--- stable/8/sys/sparc64/include/smp.h  Wed Sep 15 19:20:29 2010
(r212688)
+++ stable/8/sys/sparc64/include/smp.h  Wed Sep 15 19:27:30 2010
(r212689)
@@ -96,6 +96,8 @@ void  cpu_mp_shutdown(void);
 
 typedefvoid cpu_ipi_selected_t(u_int, u_long, u_long, u_long);
 extern cpu_ipi_selected_t *cpu_ipi_selected;
+typedefvoid cpu_ipi_single_t(u_int, u_long, u_long, u_long);
+extern cpu_ipi_single_t *cpu_ipi_single;
 
 void   mp_init(u_int cpu_impl);
 
@@ -230,7 +232,8 @@ ipi_tlb_range_demap(struct pmap *pm, vm_
ita->ita_pmap = pm;
ita->ita_start = start;
ita->ita_end = end;
-   cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, (u_long)ita);
+   cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap,
+   (u_long)ita);
return (&ita->ita_mask);
 }
 

Modified: stable/8/sys/sparc64/sparc64/mp_machdep.c
==
--- stable/8/sys/sparc64/sparc64/mp_machdep.c   Wed Sep 15 19:20:29 2010
(r212688)
+++ stable/8/sys/sparc64/sparc64/mp_machdep.c   Wed Sep 15 19:27:30 2010
(r212689)
@@ -29,7 +29,7 @@
  */
 /*-
  * Copyright (c) 2002 Jake Burkholder.
- * Copyright (c) 2007 Marius Strobl 
+ * Copyright (c) 2007 - 2010 Marius Strobl 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -113,6 +113,7 @@ struct  pcb stoppcbs[MAXCPU];
 struct mtx ipi_mtx;
 
 cpu_ipi_selected_t *cpu_ipi_selected;
+cpu_ipi_single_t *cpu_ipi_single;
 
 static vm_offset_t mp_tramp;
 static u_int cpuid_to_mid[MAXCPU];
@@ -124,11 +125,14 @@ static void ap_start(phandle_t node, u_i
 static void cpu_mp_unleash(void *v);
 static void foreach_ap(phandle_t node, void (*func)(phandle_t node,
 u_int mid, u_int cpu_impl));
-static void spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
 static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg);
 
 static cpu_ipi_selected_t cheetah_ipi_selected;
+static cpu_ipi_single_t cheetah_ipi_single;
+static cpu_ipi_selected_t jalapeno_ipi_selected;
+static cpu_ipi_single_t jalapeno_ipi_single;
 static cpu_ipi_selected_t spitfire_ipi_selected;
+static cpu_ipi_single_t spitfire_ipi_single;
 
 SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
 
@@ -162,13 +166,18 @@ mp_init(u_int cpu_impl)
 * cpu_mp_start() wasn't so initialize these here.
 */
if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi ||
-   cpu_impl == CPU_IMPL_ULTRASPARCIIIip)
+   cpu_impl == CPU_IMPL_ULTRASPARCIIIip) {
isjbus = 1;
-   if (cpu_impl == CPU_IMPL_SPARC64V ||
-   cpu_impl >= CPU_IMPL_ULTRASPARCIII)
+   cpu_ipi_selected = jalapeno_ipi_selected;
+   cpu_ipi_single = jalapeno_ipi_single;
+   } else if (cpu_impl == CPU_IMPL_SPARC64V ||
+   cpu_impl >= CPU_IMPL_ULTRASPARCIII) {
cpu_ipi_selected = cheetah_ipi_selected;
-   else
+   cpu_ipi_single = cheetah_ipi_single;
+   } else {
cpu_ipi_selected = spitfire_ipi_selected;
+   cpu_ipi_single = spitfire_ipi_single;
+   }
 }
 
 static void
@@ -179,7 +188,7 @@ foreach_ap(phandle_t node, void (*func)(
phandle_t child;
u_int cpuid;
uint32_t cpu_impl;
- 
+
/* There's no need to traverse the whole OFW tree twice. */
if (mp_maxid > 0 && mp_ncpus >= mp_maxid + 1)
return;
@@ -199,7 +208,7 @@ foreach_ap(phandle_t node, void (*func)(
panic("%s: couldn't determine CPU "
"implementation", __func__);
if (OF_getprop(node, cpu_cpuid_prop(cpu_impl), &cpuid,
-sizeof(cpuid)) <= 0)
+   

svn commit: r212690 - in stable/7/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 19:28:06 2010
New Revision: 212690
URL: http://svn.freebsd.org/changeset/base/212690

Log:
  MFC: r211050 (partial)
  
  - Introduce a cpu_ipi_single() function pointer in order to send IPIs
to single CPUs more efficiently with Cheetah(-class) and Jalapeno CPUs.
  - Factor out the Jalapeno support from the Cheetah IPI send functions
in order to be able to more easily and efficiently implement support
for more than 32 target CPUs as well as a workaround for Cheetah+
erratum 25 for the latter.

Modified:
  stable/7/sys/sparc64/include/smp.h
  stable/7/sys/sparc64/sparc64/mp_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/smp.h
==
--- stable/7/sys/sparc64/include/smp.h  Wed Sep 15 19:27:30 2010
(r212689)
+++ stable/7/sys/sparc64/include/smp.h  Wed Sep 15 19:28:06 2010
(r212690)
@@ -95,6 +95,8 @@ void  cpu_mp_shutdown(void);
 
 typedefvoid cpu_ipi_selected_t(u_int, u_long, u_long, u_long);
 extern cpu_ipi_selected_t *cpu_ipi_selected;
+typedefvoid cpu_ipi_single_t(u_int, u_long, u_long, u_long);
+extern cpu_ipi_single_t *cpu_ipi_single;
 
 void   mp_init(u_int cpu_impl);
 
@@ -229,7 +231,8 @@ ipi_tlb_range_demap(struct pmap *pm, vm_
ita->ita_pmap = pm;
ita->ita_start = start;
ita->ita_end = end;
-   cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap, (u_long)ita);
+   cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_range_demap,
+   (u_long)ita);
return (&ita->ita_mask);
 }
 

Modified: stable/7/sys/sparc64/sparc64/mp_machdep.c
==
--- stable/7/sys/sparc64/sparc64/mp_machdep.c   Wed Sep 15 19:27:30 2010
(r212689)
+++ stable/7/sys/sparc64/sparc64/mp_machdep.c   Wed Sep 15 19:28:06 2010
(r212690)
@@ -29,7 +29,7 @@
  */
 /*-
  * Copyright (c) 2002 Jake Burkholder.
- * Copyright (c) 2007 Marius Strobl 
+ * Copyright (c) 2007 - 2010 Marius Strobl 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -113,6 +113,7 @@ struct  pcb stoppcbs[MAXCPU];
 struct mtx ipi_mtx;
 
 cpu_ipi_selected_t *cpu_ipi_selected;
+cpu_ipi_single_t *cpu_ipi_single;
 
 static vm_offset_t mp_tramp;
 static u_int cpuid_to_mid[MAXCPU];
@@ -124,11 +125,14 @@ static void ap_start(phandle_t node, u_i
 static void cpu_mp_unleash(void *v);
 static void foreach_ap(phandle_t node, void (*func)(phandle_t node,
 u_int mid, u_int cpu_impl));
-static void spitfire_ipi_send(u_int mid, u_long d0, u_long d1, u_long d2);
 static void sun4u_startcpu(phandle_t cpu, void *func, u_long arg);
 
 static cpu_ipi_selected_t cheetah_ipi_selected;
+static cpu_ipi_single_t cheetah_ipi_single;
+static cpu_ipi_selected_t jalapeno_ipi_selected;
+static cpu_ipi_single_t jalapeno_ipi_single;
 static cpu_ipi_selected_t spitfire_ipi_selected;
+static cpu_ipi_single_t spitfire_ipi_single;
 
 SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL);
 
@@ -162,13 +166,18 @@ mp_init(u_int cpu_impl)
 * cpu_mp_start() wasn't so initialize these here.
 */
if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi ||
-   cpu_impl == CPU_IMPL_ULTRASPARCIIIip)
+   cpu_impl == CPU_IMPL_ULTRASPARCIIIip) {
isjbus = 1;
-   if (cpu_impl == CPU_IMPL_SPARC64V ||
-   cpu_impl >= CPU_IMPL_ULTRASPARCIII)
+   cpu_ipi_selected = jalapeno_ipi_selected;
+   cpu_ipi_single = jalapeno_ipi_single;
+   } else if (cpu_impl == CPU_IMPL_SPARC64V ||
+   cpu_impl >= CPU_IMPL_ULTRASPARCIII) {
cpu_ipi_selected = cheetah_ipi_selected;
-   else
+   cpu_ipi_single = cheetah_ipi_single;
+   } else {
cpu_ipi_selected = spitfire_ipi_selected;
+   cpu_ipi_single = spitfire_ipi_single;
+   }
 }
 
 static void
@@ -179,7 +188,7 @@ foreach_ap(phandle_t node, void (*func)(
phandle_t child;
u_int cpuid;
uint32_t cpu_impl;
- 
+
/* There's no need to traverse the whole OFW tree twice. */
if (mp_maxid > 0 && mp_ncpus >= mp_maxid + 1)
return;
@@ -199,7 +208,7 @@ foreach_ap(phandle_t node, void (*func)(
panic("%s: couldn't determine CPU "
"implementation", __func__);
if (OF_getprop(node, cpu_cpuid_prop(cpu_impl), &cpuid,
-sizeof(cpuid)) <= 0)
+   sizeof(cpuid)) <= 0)
panic(&qu

svn commit: r212695 - in stable/8/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 20:17:18 2010
New Revision: 212695
URL: http://svn.freebsd.org/changeset/base/212695

Log:
  MFC: r210601 (partial), r211071, r211073
  
  - As it is not possible for sched_bind(9) to context switch with
td_critnest > 1 when not already running on the desired CPU read the
TICK counter of the BSP via a direct cross trap request in that case
instead.
  - Provide a STICK based timecounter.

Modified:
  stable/8/sys/sparc64/include/smp.h
  stable/8/sys/sparc64/sparc64/genassym.c
  stable/8/sys/sparc64/sparc64/mp_exception.S
  stable/8/sys/sparc64/sparc64/mp_machdep.c
  stable/8/sys/sparc64/sparc64/tick.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/smp.h
==
--- stable/8/sys/sparc64/include/smp.h  Wed Sep 15 19:55:26 2010
(r212694)
+++ stable/8/sys/sparc64/include/smp.h  Wed Sep 15 20:17:18 2010
(r212695)
@@ -79,6 +79,11 @@ struct ipi_cache_args {
vm_paddr_t ica_pa;
 };
 
+struct ipi_rd_args {
+   u_int   ira_mask;
+   register_t *ira_val;
+};
+
 struct ipi_tlb_args {
u_int   ita_mask;
struct  pmap *ita_pmap;
@@ -103,6 +108,7 @@ voidmp_init(u_int cpu_impl);
 
 extern struct mtx ipi_mtx;
 extern struct ipi_cache_args ipi_cache_args;
+extern struct ipi_rd_args ipi_rd_args;
 extern struct ipi_tlb_args ipi_tlb_args;
 
 extern char *mp_tramp_code;
@@ -117,6 +123,10 @@ extern char tl_ipi_spitfire_dcache_page_
 extern char tl_ipi_spitfire_icache_page_inval[];
 
 extern char tl_ipi_level[];
+
+extern char tl_ipi_stick_rd[];
+extern char tl_ipi_tick_rd[];
+
 extern char tl_ipi_tlb_context_demap[];
 extern char tl_ipi_tlb_page_demap[];
 extern char tl_ipi_tlb_range_demap[];
@@ -170,6 +180,22 @@ ipi_icache_page_inval(void *func, vm_pad
 }
 
 static __inline void *
+ipi_rd(u_int cpu, void *func, u_long *val)
+{
+   struct ipi_rd_args *ira;
+
+   if (smp_cpus == 1)
+   return (NULL);
+   sched_pin();
+   ira = &ipi_rd_args;
+   mtx_lock_spin(&ipi_mtx);
+   ira->ira_mask = 1 << cpu | PCPU_GET(cpumask);
+   ira->ira_val = val;
+   cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira);
+   return (&ira->ira_mask);
+}
+
+static __inline void *
 ipi_tlb_context_demap(struct pmap *pm)
 {
struct ipi_tlb_args *ita;
@@ -274,6 +300,13 @@ ipi_icache_page_inval(void *func __unuse
 }
 
 static __inline void *
+ipi_rd(u_int cpu __unused, void *func __unused, u_long *val __unused)
+{
+
+   return (NULL);
+}
+
+static __inline void *
 ipi_tlb_context_demap(struct pmap *pm __unused)
 {
 

Modified: stable/8/sys/sparc64/sparc64/genassym.c
==
--- stable/8/sys/sparc64/sparc64/genassym.c Wed Sep 15 19:55:26 2010
(r212694)
+++ stable/8/sys/sparc64/sparc64/genassym.c Wed Sep 15 20:17:18 2010
(r212695)
@@ -105,10 +105,6 @@ ASSYM(IC_SIZE, offsetof(struct cacheinfo
 ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
 #endif
 
-#ifdef SMP
-ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
-#endif
-
 ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
 ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
 ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
@@ -215,7 +211,12 @@ ASSYM(IR_ARG, offsetof(struct intr_reque
 ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
 ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
 
-#ifdef SMP
+#if defined(SUN4U) && defined(SMP)
+ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
+
+ASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask));
+ASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val));
+
 ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
 ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
 ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));

Modified: stable/8/sys/sparc64/sparc64/mp_exception.S
==
--- stable/8/sys/sparc64/sparc64/mp_exception.S Wed Sep 15 19:55:26 2010
(r212694)
+++ stable/8/sys/sparc64/sparc64/mp_exception.S Wed Sep 15 20:17:18 2010
(r212695)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
  */
 ENTRY(tl_ipi_spitfire_dcache_page_inval)
 #if KTR_COMPILE & KTR_SMP
-   CATR(KTR_SMP, "ipi_dcache_page_inval: pa=%#lx"
+   CATR(KTR_SMP, "tl_ipi_spitfire_dcache_page_inval: pa=%#lx"
, %g1, %g2, %g3, 7, 8, 9)
ldx [%g5 + ICA_PA], %g2
stx %g2, [%g1 + KTR_PARM1]
@@ -87,7 +87,7 @@ END(tl_ipi_spitfire_dcache_page_inval)
  */
 ENTRY(tl_ipi_spitfire_icache_page_inval)
 #if KTR_COMPILE & KTR_SMP
- 

svn commit: r212696 - in stable/7/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 20:17:20 2010
New Revision: 212696
URL: http://svn.freebsd.org/changeset/base/212696

Log:
  MFC: r210601 (partial), r211071, r211073
  
  - As it is not possible for sched_bind(9) to context switch with
td_critnest > 1 when not already running on the desired CPU read the
TICK counter of the BSP via a direct cross trap request in that case
instead.
  - Provide a STICK based timecounter.

Modified:
  stable/7/sys/sparc64/include/smp.h
  stable/7/sys/sparc64/sparc64/genassym.c
  stable/7/sys/sparc64/sparc64/mp_exception.S
  stable/7/sys/sparc64/sparc64/mp_machdep.c
  stable/7/sys/sparc64/sparc64/tick.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/smp.h
==
--- stable/7/sys/sparc64/include/smp.h  Wed Sep 15 20:17:18 2010
(r212695)
+++ stable/7/sys/sparc64/include/smp.h  Wed Sep 15 20:17:20 2010
(r212696)
@@ -78,6 +78,11 @@ struct ipi_cache_args {
vm_paddr_t ica_pa;
 };
 
+struct ipi_rd_args {
+   u_int   ira_mask;
+   register_t *ira_val;
+};
+
 struct ipi_tlb_args {
u_int   ita_mask;
struct  pmap *ita_pmap;
@@ -102,6 +107,7 @@ voidmp_init(u_int cpu_impl);
 
 extern struct mtx ipi_mtx;
 extern struct ipi_cache_args ipi_cache_args;
+extern struct ipi_rd_args ipi_rd_args;
 extern struct ipi_tlb_args ipi_tlb_args;
 
 extern char *mp_tramp_code;
@@ -116,6 +122,10 @@ extern char tl_ipi_spitfire_dcache_page_
 extern char tl_ipi_spitfire_icache_page_inval[];
 
 extern char tl_ipi_level[];
+
+extern char tl_ipi_stick_rd[];
+extern char tl_ipi_tick_rd[];
+
 extern char tl_ipi_tlb_context_demap[];
 extern char tl_ipi_tlb_page_demap[];
 extern char tl_ipi_tlb_range_demap[];
@@ -169,6 +179,22 @@ ipi_icache_page_inval(void *func, vm_pad
 }
 
 static __inline void *
+ipi_rd(u_int cpu, void *func, u_long *val)
+{
+   struct ipi_rd_args *ira;
+
+   if (smp_cpus == 1)
+   return (NULL);
+   sched_pin();
+   ira = &ipi_rd_args;
+   mtx_lock_spin(&ipi_mtx);
+   ira->ira_mask = 1 << cpu | PCPU_GET(cpumask);
+   ira->ira_val = val;
+   cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira);
+   return (&ira->ira_mask);
+}
+
+static __inline void *
 ipi_tlb_context_demap(struct pmap *pm)
 {
struct ipi_tlb_args *ita;
@@ -273,6 +299,13 @@ ipi_icache_page_inval(void *func __unuse
 }
 
 static __inline void *
+ipi_rd(u_int cpu __unused, void *func __unused, u_long *val __unused)
+{
+
+   return (NULL);
+}
+
+static __inline void *
 ipi_tlb_context_demap(struct pmap *pm __unused)
 {
 

Modified: stable/7/sys/sparc64/sparc64/genassym.c
==
--- stable/7/sys/sparc64/sparc64/genassym.c Wed Sep 15 20:17:18 2010
(r212695)
+++ stable/7/sys/sparc64/sparc64/genassym.c Wed Sep 15 20:17:20 2010
(r212696)
@@ -105,10 +105,6 @@ ASSYM(IC_SIZE, offsetof(struct cacheinfo
 ASSYM(IC_LINESIZE, offsetof(struct cacheinfo, ic_linesize));
 #endif
 
-#ifdef SMP
-ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
-#endif
-
 ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry));
 ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line));
 ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file));
@@ -215,7 +211,12 @@ ASSYM(IR_ARG, offsetof(struct intr_reque
 ASSYM(IR_PRI, offsetof(struct intr_request, ir_pri));
 ASSYM(IR_VEC, offsetof(struct intr_request, ir_vec));
 
-#ifdef SMP
+#if defined(SUN4U) && defined(SMP)
+ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa));
+
+ASSYM(IRA_MASK, offsetof(struct ipi_rd_args, ira_mask));
+ASSYM(IRA_VAL, offsetof(struct ipi_rd_args, ira_val));
+
 ASSYM(ITA_MASK, offsetof(struct ipi_tlb_args, ita_mask));
 ASSYM(ITA_PMAP, offsetof(struct ipi_tlb_args, ita_pmap));
 ASSYM(ITA_START, offsetof(struct ipi_tlb_args, ita_start));

Modified: stable/7/sys/sparc64/sparc64/mp_exception.S
==
--- stable/7/sys/sparc64/sparc64/mp_exception.S Wed Sep 15 20:17:18 2010
(r212695)
+++ stable/7/sys/sparc64/sparc64/mp_exception.S Wed Sep 15 20:17:20 2010
(r212696)
@@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$");
  */
 ENTRY(tl_ipi_spitfire_dcache_page_inval)
 #if KTR_COMPILE & KTR_SMP
-   CATR(KTR_SMP, "ipi_dcache_page_inval: pa=%#lx"
+   CATR(KTR_SMP, "tl_ipi_spitfire_dcache_page_inval: pa=%#lx"
, %g1, %g2, %g3, 7, 8, 9)
ldx [%g5 + ICA_PA], %g2
stx %g2, [%g1 + KTR_PARM1]
@@ -87,7 +87,7 @@ END(tl_ipi_spitfire_dcache_page_inval)
  */
 ENTRY(tl_ipi_spitfire_icache_page_inval)
 #if KTR_COMPILE & KTR_SMP
-   CATR(KTR_SMP, "ipi_icache_page_inval: pa=%#lx"
+   CATR(KTR_SMP, "tl_ipi_spitfire_icache_pa

svn commit: r212697 - stable/8/cddl/lib/libzpool

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 20:40:27 2010
New Revision: 212697
URL: http://svn.freebsd.org/changeset/base/212697

Log:
  MFC: r208459
  
  Use real atomic operations for sparc64.

Modified:
  stable/8/cddl/lib/libzpool/Makefile
Directory Properties:
  stable/8/cddl/lib/libzpool/   (props changed)

Modified: stable/8/cddl/lib/libzpool/Makefile
==
--- stable/8/cddl/lib/libzpool/Makefile Wed Sep 15 20:17:20 2010
(r212696)
+++ stable/8/cddl/lib/libzpool/Makefile Wed Sep 15 20:40:27 2010
(r212697)
@@ -11,7 +11,7 @@
 # LIST_SRCS
 .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os
 # ATOMIC_SRCS
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} 
== "ia64"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} 
== "ia64" || ${MACHINE_ARCH} == "sparc64"
 .PATH: 
${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 ATOMIC_SRCS=   opensolaris_atomic.S
 .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: r212698 - stable/7/cddl/lib/libzpool

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 20:40:29 2010
New Revision: 212698
URL: http://svn.freebsd.org/changeset/base/212698

Log:
  MFC: r208459
  
  Use real atomic operations for sparc64.

Modified:
  stable/7/cddl/lib/libzpool/Makefile
Directory Properties:
  stable/7/cddl/lib/libzpool/   (props changed)

Modified: stable/7/cddl/lib/libzpool/Makefile
==
--- stable/7/cddl/lib/libzpool/Makefile Wed Sep 15 20:40:27 2010
(r212697)
+++ stable/7/cddl/lib/libzpool/Makefile Wed Sep 15 20:40:29 2010
(r212698)
@@ -11,7 +11,7 @@
 # LIST_SRCS
 .PATH: ${.CURDIR}/../../../sys/cddl/contrib/opensolaris/uts/common/os
 # ATOMIC_SRCS
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} 
== "ia64"
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} 
== "ia64" || ${MACHINE_ARCH} == "sparc64"
 .PATH: 
${.CURDIR}/../../../sys/cddl/contrib/opensolaris/common/atomic/${MACHINE_ARCH}
 ATOMIC_SRCS=   opensolaris_atomic.S
 .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: r212705 - head/sys/sparc64/include

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 21:11:29 2010
New Revision: 212705
URL: http://svn.freebsd.org/changeset/base/212705

Log:
  Add macros for alternate entry points.

Modified:
  head/sys/sparc64/include/asm.h

Modified: head/sys/sparc64/include/asm.h
==
--- head/sys/sparc64/include/asm.h  Wed Sep 15 21:08:57 2010
(r212704)
+++ head/sys/sparc64/include/asm.h  Wed Sep 15 21:11:29 2010
(r212705)
@@ -76,7 +76,7 @@
_ALIGN_TEXT
 
 /*
- * Define a function entry point.
+ * Define function entry and alternate entry points.
  *
  * The compiler produces #function for the .type pseudo-op, but the '#'
  * character has special meaning in cpp macros, so we use @function like
@@ -86,12 +86,19 @@
  * value.  Since this is difficult to predict and its expected that
  * assembler code is already optimized, we leave it out.
  */
+
+#define_ALTENTRY(x) \
+   .globl  CNAME(x) ; \
+   .type   CNAME(x),@function ; \
+CNAME(x):
+
 #define_ENTRY(x) \
_START_ENTRY ; \
.globl  CNAME(x) ; \
.type   CNAME(x),@function ; \
 CNAME(x):
 
+#defineALTENTRY(x) _ALTENTRY(x)
 #defineENTRY(x)_ENTRY(x)
 #defineEND(x)  .size x, . - x
 
___
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: r212709 - in head/sys/sparc64: include sparc64

2010-09-15 Thread Marius Strobl
Author: marius
Date: Wed Sep 15 21:44:31 2010
New Revision: 212709
URL: http://svn.freebsd.org/changeset/base/212709

Log:
  Add a VIS-based block copy function for SPARC64 V and later, which
  additionally takes advantage of the prefetch cache of these CPUs.
  Unlike the uncommitted US-III version, which provide no measurable
  speedup or even resulted in a slight slowdown on certain CPUs models
  compared to using the US-I version with these, the SPARC64 version
  actually results in a slight improvement.

Modified:
  head/sys/sparc64/include/md_var.h
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sparc64/sparc64/support.S

Modified: head/sys/sparc64/include/md_var.h
==
--- head/sys/sparc64/include/md_var.h   Wed Sep 15 21:37:26 2010
(r212708)
+++ head/sys/sparc64/include/md_var.h   Wed Sep 15 21:44:31 2010
(r212709)
@@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut
 
 cpu_block_copy_t spitfire_block_copy;
 cpu_block_zero_t spitfire_block_zero;
+cpu_block_copy_t zeus_block_copy;
+cpu_block_zero_t zeus_block_zero;
 
 extern cpu_block_copy_t *cpu_block_copy;
 extern cpu_block_zero_t *cpu_block_zero;

Modified: head/sys/sparc64/sparc64/machdep.c
==
--- head/sys/sparc64/sparc64/machdep.c  Wed Sep 15 21:37:26 2010
(r212708)
+++ head/sys/sparc64/sparc64/machdep.c  Wed Sep 15 21:44:31 2010
(r212709)
@@ -495,7 +495,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
if (cpu_use_vis) {
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
-   case CPU_IMPL_SPARC64V:
case CPU_IMPL_ULTRASPARCI:
case CPU_IMPL_ULTRASPARCII:
case CPU_IMPL_ULTRASPARCIIi:
@@ -509,6 +508,12 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
cpu_block_copy = spitfire_block_copy;
cpu_block_zero = spitfire_block_zero;
break;
+   case CPU_IMPL_SPARC64V:
+   cpu_block_copy = zeus_block_copy;
+   cpu_block_zero = zeus_block_zero;
+   cpu_block_copy = spitfire_block_copy;
+   cpu_block_zero = spitfire_block_zero;
+   break;
}
}
 

Modified: head/sys/sparc64/sparc64/support.S
==
--- head/sys/sparc64/sparc64/support.S  Wed Sep 15 21:37:26 2010
(r212708)
+++ head/sys/sparc64/sparc64/support.S  Wed Sep 15 21:44:31 2010
(r212709)
@@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy)
 END(spitfire_block_copy)
 
 /*
+ * void zeus_block_copy(void *src, void *dst, size_t len)
+ */
+ENTRY(zeus_block_copy)
+   prefetch [%o0 + (0 * 64)], 0
+
+   rdpr%pil, %o3
+   wrpr%g0, PIL_TICK, %pil
+
+   wr  %g0, ASI_BLK_S, %asi
+   wr  %g0, FPRS_FEF, %fprs
+
+   sub PCB_REG, TF_SIZEOF, %o4
+   ldx [%o4 + TF_FPRS], %o5
+   andcc   %o5, FPRS_FEF, %g0
+   bz,a,pt %xcc, 1f
+nop
+   stda%f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi
+   stda%f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi
+   stda%f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi
+   stda%f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi
+   membar  #Sync
+
+   andn%o5, FPRS_FEF, %o5
+   stx %o5, [%o4 + TF_FPRS]
+   ldx [PCB_REG + PCB_FLAGS], %o4
+   or  %o4, PCB_FEF, %o4
+   stx %o4, [PCB_REG + PCB_FLAGS]
+
+1: wrpr%o3, 0, %pil
+
+   ldd [%o0 + (0 * 8)], %f0
+   prefetch [%o0 + (1 * 64)], 0
+   ldd [%o0 + (1 * 8)], %f2
+   prefetch [%o0 + (2 * 64)], 0
+   fmovd   %f0, %f32
+   ldd [%o0 + (2 * 8)], %f4
+   prefetch [%o0 + (3 * 64)], 0
+   fmovd   %f2, %f34
+   ldd [%o0 + (3 * 8)], %f6
+   prefetch [%o0 + (4 * 64)], 1
+   fmovd   %f4, %f36
+   ldd [%o0 + (4 * 8)], %f8
+   prefetch [%o0 + (8 * 64)], 1
+   fmovd   %f6, %f38
+   ldd [%o0 + (5 * 8)], %f10
+   prefetch [%o0 + (12 * 64)], 1
+   fmovd   %f8, %f40
+   ldd [%o0 + (6 * 8)], %f12
+   prefetch [%o0 + (16 * 64)], 1
+   fmovd   %f10, %f42
+   ldd [%o0 + (7 * 8)], %f14
+   ldd [%o0 + (8 * 8)], %f0
+   sub %o2, 64, %o2
+   add %o0, 64, %o0
+   prefetch [%o0 + (19 * 64)], 1
+   ba,pt   %xcc, 2f
+prefetch [%o0 + (23 * 64)], 1
+   .align  32
+
+2: ldd [%o0 + (1 * 8)], %f2
+   fmovd   %f12, %f44
+   ldd [%o0 + (2 * 8)], %f4
+   fmovd   %f14, %f46
+   stda%f32, [%o1] %asi
+   ldd [%o0 + (3 * 8)], %f6
+   fmovd   %f0, %f32
+   ldd [%o0 + (4 * 8)], %f8
+   fmovd   %f2, %f34
+   ldd [%o0 + (5 * 8)], %f10
+   fmovd   %f4, %f36
+   ldd [%o0 + (6 * 8)], %f12
+  

svn commit: r212725 - in head/sys: dev/gem modules/gem

2010-09-16 Thread Marius Strobl
Author: marius
Date: Thu Sep 16 09:29:48 2010
New Revision: 212725
URL: http://svn.freebsd.org/changeset/base/212725

Log:
  Merge r207585 from cas(4):
  - Don't probe for PHYs if we already know to use a SERDES. Unlike as with
cas(4) this only serves to speed up the the device attach though and can
only be determined via the OFW device tree but not from the VPD.
  - Don't touch the MIF when using a SERDES.
  - Add some missing bus space barriers, mainly in the PCS code path.

Modified:
  head/sys/dev/gem/if_gem.c
  head/sys/dev/gem/if_gem_pci.c
  head/sys/dev/gem/if_gem_sbus.c
  head/sys/modules/gem/Makefile

Modified: head/sys/dev/gem/if_gem.c
==
--- head/sys/dev/gem/if_gem.c   Thu Sep 16 08:16:53 2010(r212724)
+++ head/sys/dev/gem/if_gem.c   Thu Sep 16 09:29:48 2010(r212725)
@@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc)
sc->sc_rxsoft[i].rxs_mbuf = NULL;
}
 
+   /* Bypass probing PHYs if we already know for sure to use a SERDES. */
+   if ((sc->sc_flags & GEM_SERDES) != 0)
+   goto serdes;
+
/* Bad things will happen when touching this register on ERI. */
-   if (sc->sc_variant != GEM_SUN_ERI)
+   if (sc->sc_variant != GEM_SUN_ERI) {
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_MII);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+   }
 
gem_mifinit(sc);
 
@@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc)
if ((v & GEM_MIF_CONFIG_MDI1) != 0) {
v |= GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
@@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc)
((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) {
v &= ~GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
case GEM_APPLE_K2_GMAC:
@@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc)
 * Try the external PCS SERDES if we didn't find any PHYs.
 */
if (error != 0 && sc->sc_variant == GEM_SUN_GEM) {
+ serdes:
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_SERDES);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL,
GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D);
+   GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE);
+   GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,
+   BUS_SPACE_BARRIER_WRITE);
sc->sc_flags |= GEM_SERDES;
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
gem_mediachange, gem_mediastatus);
}
-
if (error != 0) {
device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
goto fail_rxd;
@@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc)
__func__);
 #endif
 
-   /* Re-initialize the MIF. */
-   gem_mifinit(sc);
+   if ((sc->sc_flags & GEM_SERDES) == 0)
+   /* Re-initialize the MIF. */
+   gem_mifinit(sc);
 
/* step 3.  Setup data structures in host memory. */
if (gem_meminit(sc) != 0)
@@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc)
/* Configure the MIF in frame mode. */
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG,
GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, 
GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,
BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_ANAR, val);
+   GEM_BANK1_BARRIER(sc, GEM_MII_ANAR, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL,
GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D);
+   G

svn commit: r212729 - head/sys/boot/sparc64/boot1

2010-09-16 Thread Marius Strobl
Author: marius
Date: Thu Sep 16 12:05:00 2010
New Revision: 212729
URL: http://svn.freebsd.org/changeset/base/212729

Log:
  Merge from powerpc:
  - Change putc_func_t to use a char instead of an int for the character.
  - Make functions and variables not used outside of this source file static.
  - Remove unused prototypes and variables.
  - The OFW read and seek methods take 3 and not 4 input arguments.

Modified:
  head/sys/boot/sparc64/boot1/boot1.c

Modified: head/sys/boot/sparc64/boot1/boot1.c
==
--- head/sys/boot/sparc64/boot1/boot1.c Thu Sep 16 11:40:41 2010
(r212728)
+++ head/sys/boot/sparc64/boot1/boot1.c Thu Sep 16 12:05:00 2010
(r212729)
@@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$");
 #define _PATH_LOADER   "/boot/loader"
 #define _PATH_KERNEL   "/boot/kernel/kernel"
 
-#define BSIZEMAX   16384
-
-typedef int putc_func_t(int c, void *arg);
+typedef int putc_func_t(char c, void *arg);
 typedef int32_t ofwh_t;
 
 struct sp_data {
@@ -44,11 +42,6 @@ static char bootargs[128];
 
 static ofwh_t bootdev;
 
-static struct fs fs;
-static ino_t inomap;
-static char blkbuf[BSIZEMAX];
-static unsigned int fsblks;
-
 static uint32_t fs_off;
 
 int main(int ac, char **av);
@@ -66,14 +59,13 @@ static int mount(const char *device);
 
 static void panic(const char *fmt, ...) __dead2;
 static int printf(const char *fmt, ...);
-static int putchar(int c, void *arg);
+static int putchar(char c, void *arg);
 static int vprintf(const char *fmt, va_list ap);
 static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap);
 
 static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap);
-static int __putc(int c, void *arg);
 static int __puts(const char *s, putc_func_t *putc, void *arg);
-static int __sputc(int c, void *arg);
+static int __sputc(char c, void *arg);
 static char *__uitoa(char *buf, u_int val, int base);
 static char *__ultoa(char *buf, u_long val, int base);
 
@@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v
 typedef u_int64_t  ofwcell_t;
 typedef u_int32_t  u_ofwh_t;
 typedef int (*ofwfp_t)(ofwcell_t []);
-ofwfp_t ofw;   /* the prom Open Firmware entry */
+static ofwfp_t ofw;/* the PROM Open Firmware entry */
 
 void ofw_init(int, int, int, int, ofwfp_t);
-ofwh_t ofw_finddevice(const char *);
-ofwh_t ofw_open(const char *);
-int ofw_getprop(ofwh_t, const char *, void *, size_t);
-int ofw_read(ofwh_t, void *, size_t);
-int ofw_write(ofwh_t, const void *, size_t);
-int ofw_seek(ofwh_t, u_int64_t);
-void ofw_exit(void) __dead2;
+static ofwh_t ofw_finddevice(const char *);
+static ofwh_t ofw_open(const char *);
+static int ofw_getprop(ofwh_t, const char *, void *, size_t);
+static int ofw_read(ofwh_t, void *, size_t);
+static int ofw_write(ofwh_t, const void *, size_t);
+static int ofw_seek(ofwh_t, u_int64_t);
+static void ofw_exit(void) __dead2;
 
-ofwh_t bootdevh;
-ofwh_t stdinh, stdouth;
+static ofwh_t stdinh, stdouth;
 
 /*
  * This has to stay here, as the PROM seems to ignore the
@@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, 
exit(main(ac, av));
 }
 
-ofwh_t
+static ofwh_t
 ofw_finddevice(const char *name)
 {
ofwcell_t args[] = {
@@ -156,7 +147,7 @@ ofw_finddevice(const char *name)
return (args[4]);
 }
 
-int
+static int
 ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam
return (0);
 }
 
-ofwh_t
+static ofwh_t
 ofw_open(const char *path)
 {
ofwcell_t args[] = {
@@ -196,7 +187,7 @@ ofw_open(const char *path)
return (args[4]);
 }
 
-int
+static int
 ofw_close(ofwh_t devh)
 {
ofwcell_t args[] = {
@@ -213,12 +204,12 @@ ofw_close(ofwh_t devh)
return (0);
 }
 
-int
+static int
 ofw_read(ofwh_t devh, void *buf, size_t len)
 {
ofwcell_t args[] = {
(ofwcell_t)"read",
-   4,
+   3,
1,
(u_ofwh_t)devh,
(ofwcell_t)buf,
@@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t 
return (0);
 }
 
-int
+static int
 ofw_write(ofwh_t devh, const void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, 
return (0);
 }
 
-int
+static int
 ofw_seek(ofwh_t devh, u_int64_t off)
 {
ofwcell_t args[] = {
(ofwcell_t)"seek",
-   4,
+   3,
1,
(u_ofwh_t)devh,
off >> 32,
@@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off)
return (0);
 }
 
-void
+static void
 ofw_exit(void)
 {
ofwcell_t args[3];
@@ -299,6 +290,7 @@ bcopy(const void *src, void *dst, size_t
 static void
 memcpy(void *dst, const void *src, size_t len)
 {
+
bcopy(src, dst, len);
 }
 
@@ -314,6 +306,7 @@ bzero(void *b, size

svn commit: r212730 - head/sys/sparc64/sparc64

2010-09-16 Thread Marius Strobl
Author: marius
Date: Thu Sep 16 12:05:46 2010
New Revision: 212730
URL: http://svn.freebsd.org/changeset/base/212730

Log:
  Remove accidentally committed test code which effectively prevented the
  use of the SPARC64 V VIS-based block copy function added in r212709.
  Reported by:  Michael Moll

Modified:
  head/sys/sparc64/sparc64/machdep.c

Modified: head/sys/sparc64/sparc64/machdep.c
==
--- head/sys/sparc64/sparc64/machdep.c  Thu Sep 16 12:05:00 2010
(r212729)
+++ head/sys/sparc64/sparc64/machdep.c  Thu Sep 16 12:05:46 2010
(r212730)
@@ -511,8 +511,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
case CPU_IMPL_SPARC64V:
cpu_block_copy = zeus_block_copy;
cpu_block_zero = zeus_block_zero;
-   cpu_block_copy = spitfire_block_copy;
-   cpu_block_zero = spitfire_block_zero;
break;
}
}
___
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: r212814 - stable/8/sys/sparc64/sparc64

2010-09-18 Thread Marius Strobl
Author: marius
Date: Sat Sep 18 08:18:53 2010
New Revision: 212814
URL: http://svn.freebsd.org/changeset/base/212814

Log:
  MFC: r212619
  
  Remove redundant raising of the PIL to PIL_TICK as the respective locore
  code already did that.

Modified:
  stable/8/sys/sparc64/sparc64/machdep.c
  stable/8/sys/sparc64/sparc64/mp_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/machdep.c
==
--- stable/8/sys/sparc64/sparc64/machdep.c  Sat Sep 18 07:45:54 2010
(r212813)
+++ stable/8/sys/sparc64/sparc64/machdep.c  Sat Sep 18 08:18:53 2010
(r212814)
@@ -586,7 +586,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*

Modified: stable/8/sys/sparc64/sparc64/mp_machdep.c
==
--- stable/8/sys/sparc64/sparc64/mp_machdep.c   Sat Sep 18 07:45:54 2010
(r212813)
+++ stable/8/sys/sparc64/sparc64/mp_machdep.c   Sat Sep 18 08:18:53 2010
(r212814)
@@ -444,7 +444,6 @@ cpu_mp_bootstrap(struct pcpu *pc)
cpu_setregs(pc);
 
/* Enable interrupts. */
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/* Start the (S)TICK interrupts. */
___
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: r212815 - stable/7/sys/sparc64/sparc64

2010-09-18 Thread Marius Strobl
Author: marius
Date: Sat Sep 18 08:18:56 2010
New Revision: 212815
URL: http://svn.freebsd.org/changeset/base/212815

Log:
  MFC: r212619
  
  Remove redundant raising of the PIL to PIL_TICK as the respective locore
  code already did that.

Modified:
  stable/7/sys/sparc64/sparc64/machdep.c
  stable/7/sys/sparc64/sparc64/mp_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/machdep.c
==
--- stable/7/sys/sparc64/sparc64/machdep.c  Sat Sep 18 08:18:53 2010
(r212814)
+++ stable/7/sys/sparc64/sparc64/machdep.c  Sat Sep 18 08:18:56 2010
(r212815)
@@ -576,7 +576,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*

Modified: stable/7/sys/sparc64/sparc64/mp_machdep.c
==
--- stable/7/sys/sparc64/sparc64/mp_machdep.c   Sat Sep 18 08:18:53 2010
(r212814)
+++ stable/7/sys/sparc64/sparc64/mp_machdep.c   Sat Sep 18 08:18:56 2010
(r212815)
@@ -436,7 +436,6 @@ cpu_mp_bootstrap(struct pcpu *pc)
cpu_setregs(pc);
 
/* Enable interrupts. */
-   wrpr(pil, 0, PIL_TICK);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/* Start the (S)TICK interrupts. */
___
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: r212816 - in stable/8/sys: sparc64/sparc64 sun4v/sun4v

2010-09-18 Thread Marius Strobl
Author: marius
Date: Sat Sep 18 08:20:36 2010
New Revision: 212816
URL: http://svn.freebsd.org/changeset/base/212816

Log:
  MFC: r212620
  
  Remove a KASSERT which will also trigger for perfectly valid combinations
  of small maxsize and "large" (including BUS_SPACE_UNRESTRICTED) nsegments
  parameters. Generally using a presz of 0 (which indeed might indicate the
  use of bogus parameters for DMA tag creation) is not fatal, it just means
  that no additional DVMA space will be preallocated.

Modified:
  stable/8/sys/sparc64/sparc64/iommu.c
  stable/8/sys/sun4v/sun4v/hviommu.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/iommu.c
==
--- stable/8/sys/sparc64/sparc64/iommu.cSat Sep 18 08:18:56 2010
(r212815)
+++ stable/8/sys/sparc64/sparc64/iommu.cSat Sep 18 08:20:36 2010
(r212816)
@@ -874,9 +874,6 @@ iommu_dvmamap_create(bus_dma_tag_t dt, i
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("%s: bogus preallocation size , nsegments = %d, "
-   "maxpre = %d, maxsize = %lu", __func__, dt->dt_nsegments, maxpre,
-   dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = iommu_dvma_valloc(dt, is, *mapp, currsz);

Modified: stable/8/sys/sun4v/sun4v/hviommu.c
==
--- stable/8/sys/sun4v/sun4v/hviommu.c  Sat Sep 18 08:18:56 2010
(r212815)
+++ stable/8/sys/sun4v/sun4v/hviommu.c  Sat Sep 18 08:20:36 2010
(r212816)
@@ -513,9 +513,6 @@ hviommu_dvmamap_create(bus_dma_tag_t dt,
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("hviommu_dvmamap_create: bogus preallocation size "
-   ", nsegments = %d, maxpre = %d, maxsize = %lu", dt->dt_nsegments,
-   maxpre, dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = hviommu_dvma_valloc(dt, him, *mapp, currsz);
___
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: r212817 - in stable/7/sys: sparc64/sparc64 sun4v/sun4v

2010-09-18 Thread Marius Strobl
Author: marius
Date: Sat Sep 18 08:20:39 2010
New Revision: 212817
URL: http://svn.freebsd.org/changeset/base/212817

Log:
  MFC: r212620
  
  Remove a KASSERT which will also trigger for perfectly valid combinations
  of small maxsize and "large" (including BUS_SPACE_UNRESTRICTED) nsegments
  parameters. Generally using a presz of 0 (which indeed might indicate the
  use of bogus parameters for DMA tag creation) is not fatal, it just means
  that no additional DVMA space will be preallocated.

Modified:
  stable/7/sys/sparc64/sparc64/iommu.c
  stable/7/sys/sun4v/sun4v/hviommu.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/iommu.c
==
--- stable/7/sys/sparc64/sparc64/iommu.cSat Sep 18 08:20:36 2010
(r212816)
+++ stable/7/sys/sparc64/sparc64/iommu.cSat Sep 18 08:20:39 2010
(r212817)
@@ -874,9 +874,6 @@ iommu_dvmamap_create(bus_dma_tag_t dt, i
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("%s: bogus preallocation size , nsegments = %d, "
-   "maxpre = %d, maxsize = %lu", __func__, dt->dt_nsegments, maxpre,
-   dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = iommu_dvma_valloc(dt, is, *mapp, currsz);

Modified: stable/7/sys/sun4v/sun4v/hviommu.c
==
--- stable/7/sys/sun4v/sun4v/hviommu.c  Sat Sep 18 08:20:36 2010
(r212816)
+++ stable/7/sys/sun4v/sun4v/hviommu.c  Sat Sep 18 08:20:39 2010
(r212817)
@@ -513,9 +513,6 @@ hviommu_dvmamap_create(bus_dma_tag_t dt,
 */
maxpre = imin(dt->dt_nsegments, IOMMU_MAX_PRE_SEG);
presz = dt->dt_maxsize / maxpre;
-   KASSERT(presz != 0, ("hviommu_dvmamap_create: bogus preallocation size "
-   ", nsegments = %d, maxpre = %d, maxsize = %lu", dt->dt_nsegments,
-   maxpre, dt->dt_maxsize));
for (i = 1; i < maxpre && totsz < IOMMU_MAX_PRE; i++) {
currsz = round_io_page(ulmin(presz, IOMMU_MAX_PRE - totsz));
error = hviommu_dvma_valloc(dt, him, *mapp, currsz);
___
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: r212819 - stable/8/sys/dev/usb

2010-09-18 Thread Marius Strobl
Author: marius
Date: Sat Sep 18 08:25:12 2010
New Revision: 212819
URL: http://svn.freebsd.org/changeset/base/212819

Log:
  MFC: r212621
  
  Use saner nsegments and maxsegsz parameters when creating certain DMA tags;
  tags for 1-byte allocations cannot possibly be split across 2 segments and
  maxsegsz must not exceed maxsize.
  
  Reviewed by:  Hans Petter Selasky

Modified:
  stable/8/sys/dev/usb/usb_busdma.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/usb/usb_busdma.c
==
--- stable/8/sys/dev/usb/usb_busdma.c   Sat Sep 18 08:23:45 2010
(r212818)
+++ stable/8/sys/dev/usb/usb_busdma.c   Sat Sep 18 08:25:12 2010
(r212819)
@@ -366,9 +366,9 @@ usb_dma_tag_create(struct usb_dma_tag *u
 /* filter*/ NULL,
 /* filterarg */ NULL,
 /* maxsize   */ size,
-/* nsegments */ (align == 1) ?
+/* nsegments */ (align == 1 && size > 1) ?
(2 + (size / USB_PAGE_SIZE)) : 1,
-/* maxsegsz  */ (align == 1) ?
+/* maxsegsz  */ (align == 1 && size > USB_PAGE_SIZE) ?
USB_PAGE_SIZE : size,
 /* flags */ BUS_DMA_KEEP_PG_OFFSET,
 /* lockfn*/ &usb_dma_lock_cb,
___
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: r213014 - stable/8/sys/sparc64/sparc64

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 19:55:37 2010
New Revision: 213014
URL: http://svn.freebsd.org/changeset/base/213014

Log:
  MFC: r212663
  
  - Update the comment in swi_vm() regarding busdma bounce buffers; it's
unlikely that support for these ever will be implemented on sparc64 as
the IOMMUs are able to translate to up to the maximum physical address
supported by the respective machine, bypassing the IOMMU is affected
by hardware errata and being able to support DMA engines which cannot
do at least 32-bit DMA does not justify the costs.
  - The page zeroing in uma_small_alloc() may use the VIS-based block zero
function so take advantage of it.

Modified:
  stable/8/sys/sparc64/sparc64/vm_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/vm_machdep.c
==
--- stable/8/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 22 19:41:01 2010
(r213013)
+++ stable/8/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 22 19:55:37 2010
(r213014)
@@ -492,10 +492,7 @@ void
 swi_vm(void *v)
 {
 
-   /*
-* Nothing to do here yet - busdma bounce buffers are not yet
-* implemented.
-*/
+   /* Nothing to do here - busdma bounce buffers are not implemented. */
 }
 
 void *
@@ -540,7 +537,7 @@ uma_small_alloc(uma_zone_t zone, int byt
}
va = (void *)TLB_PHYS_TO_DIRECT(pa);
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
-   bzero(va, PAGE_SIZE);
+   cpu_block_zero(va, PAGE_SIZE);
return (va);
 }
 
___
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: r213015 - stable/7/sys/sparc64/sparc64

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 19:55:40 2010
New Revision: 213015
URL: http://svn.freebsd.org/changeset/base/213015

Log:
  MFC: r212663
  
  - Update the comment in swi_vm() regarding busdma bounce buffers; it's
unlikely that support for these ever will be implemented on sparc64 as
the IOMMUs are able to translate to up to the maximum physical address
supported by the respective machine, bypassing the IOMMU is affected
by hardware errata and being able to support DMA engines which cannot
do at least 32-bit DMA does not justify the costs.
  - The page zeroing in uma_small_alloc() may use the VIS-based block zero
function so take advantage of it.

Modified:
  stable/7/sys/sparc64/sparc64/vm_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/vm_machdep.c
==
--- stable/7/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 22 19:55:37 2010
(r213014)
+++ stable/7/sys/sparc64/sparc64/vm_machdep.c   Wed Sep 22 19:55:40 2010
(r213015)
@@ -456,10 +456,7 @@ void
 swi_vm(void *v)
 {
 
-   /*
-* Nothing to do here yet - busdma bounce buffers are not yet
-* implemented.
-*/
+   /* Nothing to do here - busdma bounce buffers are not implemented. */
 }
 
 void *
@@ -504,7 +501,7 @@ uma_small_alloc(uma_zone_t zone, int byt
}
va = (void *)TLB_PHYS_TO_DIRECT(pa);
if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0)
-   bzero(va, PAGE_SIZE);
+   cpu_block_zero(va, PAGE_SIZE);
return (va);
 }
 
___
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: r213017 - in stable/7/sys: sparc64/sparc64 sun4v/sun4v

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 19:59:11 2010
New Revision: 213017
URL: http://svn.freebsd.org/changeset/base/213017

Log:
  MFC: r212676
  
  Sync with other platforms:
  - make dflt_lock() always panic,
  - add kludge to use contigmalloc() when the alignment is larger than the size
and print a diagnostic when we didn't satisfy the alignment.

Modified:
  stable/7/sys/sparc64/sparc64/bus_machdep.c
  stable/7/sys/sun4v/sun4v/bus_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/bus_machdep.c
==
--- stable/7/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213016)
+++ stable/7/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213017)
@@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -638,9 +635,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -653,6 +659,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -664,11 +672,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
free(vaddr, M_DEVBUF);
-   else {
+   else
contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF);
-   }
 }
 
 struct bus_dma_methods nexus_dma_methods = {

Modified: stable/7/sys/sun4v/sun4v/bus_machdep.c
==
--- stable/7/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213016)
+++ stable/7/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213017)
@@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -673,11 +681,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
free(vaddr, M_DEVBUF);
-   else {
+   else
contigfree(vaddr, dmat->dt_maxsize, M

svn commit: r213016 - in stable/8/sys: sparc64/sparc64 sun4v/sun4v

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 19:59:11 2010
New Revision: 213016
URL: http://svn.freebsd.org/changeset/base/213016

Log:
  MFC: r212676
  
  Sync with other platforms:
  - make dflt_lock() always panic,
  - add kludge to use contigmalloc() when the alignment is larger than the size
and print a diagnostic when we didn't satisfy the alignment.

Modified:
  stable/8/sys/sparc64/sparc64/bus_machdep.c
  stable/8/sys/sun4v/sun4v/bus_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/bus_machdep.c
==
--- stable/8/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 22 19:55:40 2010
(r213015)
+++ stable/8/sys/sparc64/sparc64/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213016)
@@ -182,11 +182,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -631,9 +628,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -646,6 +652,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -657,11 +665,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
free(vaddr, M_DEVBUF);
-   else {
+   else
contigfree(vaddr, dmat->dt_maxsize, M_DEVBUF);
-   }
 }
 
 struct bus_dma_methods nexus_dma_methods = {

Modified: stable/8/sys/sun4v/sun4v/bus_machdep.c
==
--- stable/8/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 22 19:55:40 2010
(r213015)
+++ stable/8/sys/sun4v/sun4v/bus_machdep.c  Wed Sep 22 19:59:11 2010
(r213016)
@@ -181,11 +181,8 @@ busdma_lock_mutex(void *arg, bus_dma_loc
 static void
 dflt_lock(void *arg, bus_dma_lock_op_t op)
 {
-#ifdef INVARIANTS
+
panic("driver error: busdma dflt_lock called");
-#else
-   printf("DRIVER_ERROR: busdma dflt_lock called\n");
-#endif
 }
 
 /*
@@ -647,9 +644,18 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
if (flags & BUS_DMA_ZERO)
mflags |= M_ZERO;
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE)) {
+   /*
+* XXX:
+* (dmat->dt_alignment < dmat->dt_maxsize) is just a quick hack; the
+* exact alignment guarantees of malloc need to be nailed down, and
+* the code below should be rewritten to take that into account.
+*
+* In the meantime, we'll warn the user if malloc gets it wrong.
+*/
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
*vaddr = malloc(dmat->dt_maxsize, M_DEVBUF, mflags);
-   } else {
+   else {
/*
 * XXX use contigmalloc until it is merged into this
 * facility and handles multi-seg allocations.  Nobody
@@ -662,6 +668,8 @@ nexus_dmamem_alloc(bus_dma_tag_t dmat, v
}
if (*vaddr == NULL)
return (ENOMEM);
+   if ((uintptr_t)*vaddr % dmat->dt_alignment)
+   printf("%s: failed to align memory properly.\n", __func__);
return (0);
 }
 
@@ -673,11 +681,11 @@ static void
 nexus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map)
 {
 
-   if ((dmat->dt_maxsize <= PAGE_SIZE))
+   if (dmat->dt_maxsize <= PAGE_SIZE &&
+   dmat->dt_alignment < dmat->dt_maxsize)
fre

svn commit: r213018 - stable/8/sys/sparc64/include

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:01:33 2010
New Revision: 213018
URL: http://svn.freebsd.org/changeset/base/213018

Log:
  MFC: r212705
  
  Add macros for alternate entry points.

Modified:
  stable/8/sys/sparc64/include/asm.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/asm.h
==
--- stable/8/sys/sparc64/include/asm.h  Wed Sep 22 19:59:11 2010
(r213017)
+++ stable/8/sys/sparc64/include/asm.h  Wed Sep 22 20:01:33 2010
(r213018)
@@ -76,7 +76,7 @@
_ALIGN_TEXT
 
 /*
- * Define a function entry point.
+ * Define function entry and alternate entry points.
  *
  * The compiler produces #function for the .type pseudo-op, but the '#'
  * character has special meaning in cpp macros, so we use @function like
@@ -86,12 +86,19 @@
  * value.  Since this is difficult to predict and its expected that
  * assembler code is already optimized, we leave it out.
  */
+
+#define_ALTENTRY(x) \
+   .globl  CNAME(x) ; \
+   .type   CNAME(x),@function ; \
+CNAME(x):
+
 #define_ENTRY(x) \
_START_ENTRY ; \
.globl  CNAME(x) ; \
.type   CNAME(x),@function ; \
 CNAME(x):
 
+#defineALTENTRY(x) _ALTENTRY(x)
 #defineENTRY(x)_ENTRY(x)
 #defineEND(x)  .size x, . - x
 
___
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: r213019 - stable/7/sys/sparc64/include

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:01:35 2010
New Revision: 213019
URL: http://svn.freebsd.org/changeset/base/213019

Log:
  MFC: r212705
  
  Add macros for alternate entry points.

Modified:
  stable/7/sys/sparc64/include/asm.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/asm.h
==
--- stable/7/sys/sparc64/include/asm.h  Wed Sep 22 20:01:33 2010
(r213018)
+++ stable/7/sys/sparc64/include/asm.h  Wed Sep 22 20:01:35 2010
(r213019)
@@ -76,7 +76,7 @@
_ALIGN_TEXT
 
 /*
- * Define a function entry point.
+ * Define function entry and alternate entry points.
  *
  * The compiler produces #function for the .type pseudo-op, but the '#'
  * character has special meaning in cpp macros, so we use @function like
@@ -86,12 +86,19 @@
  * value.  Since this is difficult to predict and its expected that
  * assembler code is already optimized, we leave it out.
  */
+
+#define_ALTENTRY(x) \
+   .globl  CNAME(x) ; \
+   .type   CNAME(x),@function ; \
+CNAME(x):
+
 #define_ENTRY(x) \
_START_ENTRY ; \
.globl  CNAME(x) ; \
.type   CNAME(x),@function ; \
 CNAME(x):
 
+#defineALTENTRY(x) _ALTENTRY(x)
 #defineENTRY(x)_ENTRY(x)
 #defineEND(x)  .size x, . - x
 
___
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: r213020 - in stable/8/sys/sparc64: include sparc64

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:03:59 2010
New Revision: 213020
URL: http://svn.freebsd.org/changeset/base/213020

Log:
  MFC: rr212709, r212730
  
  Add a VIS-based block copy function for SPARC64 V and later, which
  additionally takes advantage of the prefetch cache of these CPUs.
  Unlike the uncommitted US-III version, which provide no measurable
  speedup or even resulted in a slight slowdown on certain CPUs models
  compared to using the US-I version with these, the SPARC64 version
  actually results in a slight improvement.

Modified:
  stable/8/sys/sparc64/include/md_var.h
  stable/8/sys/sparc64/sparc64/machdep.c
  stable/8/sys/sparc64/sparc64/support.S
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/include/md_var.h
==
--- stable/8/sys/sparc64/include/md_var.h   Wed Sep 22 20:01:35 2010
(r213019)
+++ stable/8/sys/sparc64/include/md_var.h   Wed Sep 22 20:03:59 2010
(r213020)
@@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut
 
 cpu_block_copy_t spitfire_block_copy;
 cpu_block_zero_t spitfire_block_zero;
+cpu_block_copy_t zeus_block_copy;
+cpu_block_zero_t zeus_block_zero;
 
 extern cpu_block_copy_t *cpu_block_copy;
 extern cpu_block_zero_t *cpu_block_zero;

Modified: stable/8/sys/sparc64/sparc64/machdep.c
==
--- stable/8/sys/sparc64/sparc64/machdep.c  Wed Sep 22 20:01:35 2010
(r213019)
+++ stable/8/sys/sparc64/sparc64/machdep.c  Wed Sep 22 20:03:59 2010
(r213020)
@@ -494,7 +494,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
if (cpu_use_vis) {
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
-   case CPU_IMPL_SPARC64V:
case CPU_IMPL_ULTRASPARCI:
case CPU_IMPL_ULTRASPARCII:
case CPU_IMPL_ULTRASPARCIIi:
@@ -508,6 +507,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
cpu_block_copy = spitfire_block_copy;
cpu_block_zero = spitfire_block_zero;
break;
+   case CPU_IMPL_SPARC64V:
+   cpu_block_copy = zeus_block_copy;
+   cpu_block_zero = zeus_block_zero;
+   break;
}
}
 

Modified: stable/8/sys/sparc64/sparc64/support.S
==
--- stable/8/sys/sparc64/sparc64/support.S  Wed Sep 22 20:01:35 2010
(r213019)
+++ stable/8/sys/sparc64/sparc64/support.S  Wed Sep 22 20:03:59 2010
(r213020)
@@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy)
 END(spitfire_block_copy)
 
 /*
+ * void zeus_block_copy(void *src, void *dst, size_t len)
+ */
+ENTRY(zeus_block_copy)
+   prefetch [%o0 + (0 * 64)], 0
+
+   rdpr%pil, %o3
+   wrpr%g0, PIL_TICK, %pil
+
+   wr  %g0, ASI_BLK_S, %asi
+   wr  %g0, FPRS_FEF, %fprs
+
+   sub PCB_REG, TF_SIZEOF, %o4
+   ldx [%o4 + TF_FPRS], %o5
+   andcc   %o5, FPRS_FEF, %g0
+   bz,a,pt %xcc, 1f
+nop
+   stda%f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi
+   stda%f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi
+   stda%f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi
+   stda%f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi
+   membar  #Sync
+
+   andn%o5, FPRS_FEF, %o5
+   stx %o5, [%o4 + TF_FPRS]
+   ldx [PCB_REG + PCB_FLAGS], %o4
+   or  %o4, PCB_FEF, %o4
+   stx %o4, [PCB_REG + PCB_FLAGS]
+
+1: wrpr%o3, 0, %pil
+
+   ldd [%o0 + (0 * 8)], %f0
+   prefetch [%o0 + (1 * 64)], 0
+   ldd [%o0 + (1 * 8)], %f2
+   prefetch [%o0 + (2 * 64)], 0
+   fmovd   %f0, %f32
+   ldd [%o0 + (2 * 8)], %f4
+   prefetch [%o0 + (3 * 64)], 0
+   fmovd   %f2, %f34
+   ldd [%o0 + (3 * 8)], %f6
+   prefetch [%o0 + (4 * 64)], 1
+   fmovd   %f4, %f36
+   ldd [%o0 + (4 * 8)], %f8
+   prefetch [%o0 + (8 * 64)], 1
+   fmovd   %f6, %f38
+   ldd [%o0 + (5 * 8)], %f10
+   prefetch [%o0 + (12 * 64)], 1
+   fmovd   %f8, %f40
+   ldd [%o0 + (6 * 8)], %f12
+   prefetch [%o0 + (16 * 64)], 1
+   fmovd   %f10, %f42
+   ldd [%o0 + (7 * 8)], %f14
+   ldd [%o0 + (8 * 8)], %f0
+   sub %o2, 64, %o2
+   add %o0, 64, %o0
+   prefetch [%o0 + (19 * 64)], 1
+   ba,pt   %xcc, 2f
+prefetch [%o0 + (23 * 64)], 1
+   .align  32
+
+2: ldd [%o0 + (1 * 8)], %f2
+   fmovd   %f12, %f44
+   ldd [%o0 + (2 * 8)], %f4
+

svn commit: r213021 - in stable/7/sys/sparc64: include sparc64

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:04:03 2010
New Revision: 213021
URL: http://svn.freebsd.org/changeset/base/213021

Log:
  MFC: rr212709, r212730
  
  Add a VIS-based block copy function for SPARC64 V and later, which
  additionally takes advantage of the prefetch cache of these CPUs.
  Unlike the uncommitted US-III version, which provide no measurable
  speedup or even resulted in a slight slowdown on certain CPUs models
  compared to using the US-I version with these, the SPARC64 version
  actually results in a slight improvement.

Modified:
  stable/7/sys/sparc64/include/md_var.h
  stable/7/sys/sparc64/sparc64/machdep.c
  stable/7/sys/sparc64/sparc64/support.S
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/include/md_var.h
==
--- stable/7/sys/sparc64/include/md_var.h   Wed Sep 22 20:03:59 2010
(r213020)
+++ stable/7/sys/sparc64/include/md_var.h   Wed Sep 22 20:04:03 2010
(r213021)
@@ -58,6 +58,8 @@ struct md_utrap *utrap_hold(struct md_ut
 
 cpu_block_copy_t spitfire_block_copy;
 cpu_block_zero_t spitfire_block_zero;
+cpu_block_copy_t zeus_block_copy;
+cpu_block_zero_t zeus_block_zero;
 
 extern cpu_block_copy_t *cpu_block_copy;
 extern cpu_block_zero_t *cpu_block_zero;

Modified: stable/7/sys/sparc64/sparc64/machdep.c
==
--- stable/7/sys/sparc64/sparc64/machdep.c  Wed Sep 22 20:03:59 2010
(r213020)
+++ stable/7/sys/sparc64/sparc64/machdep.c  Wed Sep 22 20:04:03 2010
(r213021)
@@ -486,7 +486,6 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
if (cpu_use_vis) {
switch (cpu_impl) {
case CPU_IMPL_SPARC64:
-   case CPU_IMPL_SPARC64V:
case CPU_IMPL_ULTRASPARCI:
case CPU_IMPL_ULTRASPARCII:
case CPU_IMPL_ULTRASPARCIIi:
@@ -500,6 +499,10 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
cpu_block_copy = spitfire_block_copy;
cpu_block_zero = spitfire_block_zero;
break;
+   case CPU_IMPL_SPARC64V:
+   cpu_block_copy = zeus_block_copy;
+   cpu_block_zero = zeus_block_zero;
+   break;
}
}
 

Modified: stable/7/sys/sparc64/sparc64/support.S
==
--- stable/7/sys/sparc64/sparc64/support.S  Wed Sep 22 20:03:59 2010
(r213020)
+++ stable/7/sys/sparc64/sparc64/support.S  Wed Sep 22 20:04:03 2010
(r213021)
@@ -661,8 +661,121 @@ ENTRY(spitfire_block_copy)
 END(spitfire_block_copy)
 
 /*
+ * void zeus_block_copy(void *src, void *dst, size_t len)
+ */
+ENTRY(zeus_block_copy)
+   prefetch [%o0 + (0 * 64)], 0
+
+   rdpr%pil, %o3
+   wrpr%g0, PIL_TICK, %pil
+
+   wr  %g0, ASI_BLK_S, %asi
+   wr  %g0, FPRS_FEF, %fprs
+
+   sub PCB_REG, TF_SIZEOF, %o4
+   ldx [%o4 + TF_FPRS], %o5
+   andcc   %o5, FPRS_FEF, %g0
+   bz,a,pt %xcc, 1f
+nop
+   stda%f0, [PCB_REG + PCB_UFP + (0 * 64)] %asi
+   stda%f16, [PCB_REG + PCB_UFP + (1 * 64)] %asi
+   stda%f32, [PCB_REG + PCB_UFP + (2 * 64)] %asi
+   stda%f48, [PCB_REG + PCB_UFP + (3 * 64)] %asi
+   membar  #Sync
+
+   andn%o5, FPRS_FEF, %o5
+   stx %o5, [%o4 + TF_FPRS]
+   ldx [PCB_REG + PCB_FLAGS], %o4
+   or  %o4, PCB_FEF, %o4
+   stx %o4, [PCB_REG + PCB_FLAGS]
+
+1: wrpr%o3, 0, %pil
+
+   ldd [%o0 + (0 * 8)], %f0
+   prefetch [%o0 + (1 * 64)], 0
+   ldd [%o0 + (1 * 8)], %f2
+   prefetch [%o0 + (2 * 64)], 0
+   fmovd   %f0, %f32
+   ldd [%o0 + (2 * 8)], %f4
+   prefetch [%o0 + (3 * 64)], 0
+   fmovd   %f2, %f34
+   ldd [%o0 + (3 * 8)], %f6
+   prefetch [%o0 + (4 * 64)], 1
+   fmovd   %f4, %f36
+   ldd [%o0 + (4 * 8)], %f8
+   prefetch [%o0 + (8 * 64)], 1
+   fmovd   %f6, %f38
+   ldd [%o0 + (5 * 8)], %f10
+   prefetch [%o0 + (12 * 64)], 1
+   fmovd   %f8, %f40
+   ldd [%o0 + (6 * 8)], %f12
+   prefetch [%o0 + (16 * 64)], 1
+   fmovd   %f10, %f42
+   ldd [%o0 + (7 * 8)], %f14
+   ldd [%o0 + (8 * 8)], %f0
+   sub %o2, 64, %o2
+   add %o0, 64, %o0
+   prefetch [%o0 + (19 * 64)], 1
+   ba,pt   %xcc, 2f
+prefetch [%o0 + (23 * 64)], 1
+   .align  32
+
+2: ldd [%o0 + (1 * 8)], %f2
+   fmovd   %f12, %f44
+   ldd [%o0 + (2 * 8)], %f4
+   fmovd   %f14, %f46
+   stda%f32, [%o1] %asi
+   ldd [%o0 + (3 * 8)], %f6
+

svn commit: r213023 - in stable/8/sys: dev/gem modules/gem

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:15:34 2010
New Revision: 213023
URL: http://svn.freebsd.org/changeset/base/213023

Log:
  MFC: r212725
  
  Merge r207585 (MFC'ed to stable/8 in r208086) from cas(4):
  - Don't probe for PHYs if we already know to use a SERDES. Unlike as with
cas(4) this only serves to speed up the the device attach though and can
only be determined via the OFW device tree but not from the VPD.
  - Don't touch the MIF when using a SERDES.
  - Add some missing bus space barriers, mainly in the PCS code path.

Modified:
  stable/8/sys/dev/gem/if_gem.c
  stable/8/sys/dev/gem/if_gem_pci.c
  stable/8/sys/dev/gem/if_gem_sbus.c
  stable/8/sys/modules/gem/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/gem/if_gem.c
==
--- stable/8/sys/dev/gem/if_gem.c   Wed Sep 22 20:07:02 2010
(r213022)
+++ stable/8/sys/dev/gem/if_gem.c   Wed Sep 22 20:15:34 2010
(r213023)
@@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc)
sc->sc_rxsoft[i].rxs_mbuf = NULL;
}
 
+   /* Bypass probing PHYs if we already know for sure to use a SERDES. */
+   if ((sc->sc_flags & GEM_SERDES) != 0)
+   goto serdes;
+
/* Bad things will happen when touching this register on ERI. */
-   if (sc->sc_variant != GEM_SUN_ERI)
+   if (sc->sc_variant != GEM_SUN_ERI) {
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_MII);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+   }
 
gem_mifinit(sc);
 
@@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc)
if ((v & GEM_MIF_CONFIG_MDI1) != 0) {
v |= GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
@@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc)
((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) {
v &= ~GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
case GEM_APPLE_K2_GMAC:
@@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc)
 * Try the external PCS SERDES if we didn't find any PHYs.
 */
if (error != 0 && sc->sc_variant == GEM_SUN_GEM) {
+ serdes:
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_SERDES);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL,
GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D);
+   GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE);
+   GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,
+   BUS_SPACE_BARRIER_WRITE);
sc->sc_flags |= GEM_SERDES;
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
gem_mediachange, gem_mediastatus);
}
-
if (error != 0) {
device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
goto fail_rxd;
@@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc)
__func__);
 #endif
 
-   /* Re-initialize the MIF. */
-   gem_mifinit(sc);
+   if ((sc->sc_flags & GEM_SERDES) == 0)
+   /* Re-initialize the MIF. */
+   gem_mifinit(sc);
 
/* step 3.  Setup data structures in host memory. */
if (gem_meminit(sc) != 0)
@@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc)
/* Configure the MIF in frame mode. */
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG,
GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, 
GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,

svn commit: r213024 - in stable/7/sys: dev/gem modules/gem

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:15:38 2010
New Revision: 213024
URL: http://svn.freebsd.org/changeset/base/213024

Log:
  MFC: r212725
  
  Merge r207585 (MFC'ed to stable/7 in r208087) from cas(4):
  - Don't probe for PHYs if we already know to use a SERDES. Unlike as with
cas(4) this only serves to speed up the the device attach though and can
only be determined via the OFW device tree but not from the VPD.
  - Don't touch the MIF when using a SERDES.
  - Add some missing bus space barriers, mainly in the PCS code path.

Modified:
  stable/7/sys/dev/gem/if_gem.c
  stable/7/sys/dev/gem/if_gem_pci.c
  stable/7/sys/dev/gem/if_gem_sbus.c
  stable/7/sys/modules/gem/Makefile
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/gem/if_gem.c
==
--- stable/7/sys/dev/gem/if_gem.c   Wed Sep 22 20:15:34 2010
(r213023)
+++ stable/7/sys/dev/gem/if_gem.c   Wed Sep 22 20:15:38 2010
(r213024)
@@ -268,10 +268,17 @@ gem_attach(struct gem_softc *sc)
sc->sc_rxsoft[i].rxs_mbuf = NULL;
}
 
+   /* Bypass probing PHYs if we already know for sure to use a SERDES. */
+   if ((sc->sc_flags & GEM_SERDES) != 0)
+   goto serdes;
+
/* Bad things will happen when touching this register on ERI. */
-   if (sc->sc_variant != GEM_SUN_ERI)
+   if (sc->sc_variant != GEM_SUN_ERI) {
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_MII);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+   }
 
gem_mifinit(sc);
 
@@ -283,6 +290,8 @@ gem_attach(struct gem_softc *sc)
if ((v & GEM_MIF_CONFIG_MDI1) != 0) {
v |= GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
@@ -304,6 +313,8 @@ gem_attach(struct gem_softc *sc)
((v & GEM_MIF_CONFIG_MDI0) != 0 || GEM_IS_APPLE(sc))) {
v &= ~GEM_MIF_CONFIG_PHY_SEL;
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG, v);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
switch (sc->sc_variant) {
case GEM_SUN_ERI:
case GEM_APPLE_K2_GMAC:
@@ -324,17 +335,23 @@ gem_attach(struct gem_softc *sc)
 * Try the external PCS SERDES if we didn't find any PHYs.
 */
if (error != 0 && sc->sc_variant == GEM_SUN_GEM) {
+ serdes:
GEM_BANK1_WRITE_4(sc, GEM_MII_DATAPATH_MODE,
GEM_MII_DATAPATH_SERDES);
+   GEM_BANK1_BARRIER(sc, GEM_MII_DATAPATH_MODE, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_SLINK_CONTROL,
GEM_MII_SLINK_LOOPBACK | GEM_MII_SLINK_EN_SYNC_D);
+   GEM_BANK1_BARRIER(sc, GEM_MII_SLINK_CONTROL, 4,
+   BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_CONFIG, GEM_MII_CONFIG_ENABLE);
+   GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,
+   BUS_SPACE_BARRIER_WRITE);
sc->sc_flags |= GEM_SERDES;
sc->sc_phyad = GEM_PHYAD_EXTERNAL;
error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus,
gem_mediachange, gem_mediastatus);
}
-
if (error != 0) {
device_printf(sc->sc_dev, "PHY probe failed: %d\n", error);
goto fail_rxd;
@@ -918,8 +935,9 @@ gem_init_locked(struct gem_softc *sc)
__func__);
 #endif
 
-   /* Re-initialize the MIF. */
-   gem_mifinit(sc);
+   if ((sc->sc_flags & GEM_SERDES) == 0)
+   /* Re-initialize the MIF. */
+   gem_mifinit(sc);
 
/* step 3.  Setup data structures in host memory. */
if (gem_meminit(sc) != 0)
@@ -1800,6 +1818,8 @@ gem_mifinit(struct gem_softc *sc)
/* Configure the MIF in frame mode. */
GEM_BANK1_WRITE_4(sc, GEM_MIF_CONFIG,
GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & ~GEM_MIF_CONFIG_BB_ENA);
+   GEM_BANK1_BARRIER(sc, GEM_MIF_CONFIG, 4,
+   BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
 }
 
 /*
@@ -1914,10 +1934,16 @@ gem_mii_writereg(device_t dev, int phy, 
GEM_BANK1_BARRIER(sc, GEM_MII_CONFIG, 4,
BUS_SPACE_BARRIER_WRITE);
GEM_BANK1_WRITE_4(sc, GEM_MII_A

svn commit: r213026 - stable/7/sys/boot/sparc64/boot1

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:17:34 2010
New Revision: 213026
URL: http://svn.freebsd.org/changeset/base/213026

Log:
  MFC: r212729
  
  Merge from powerpc:
  - Change putc_func_t to use a char instead of an int for the character.
  - Make functions and variables not used outside of this source file static.
  - Remove unused prototypes and variables.
  - The OFW read and seek methods take 3 and not 4 input arguments.

Modified:
  stable/7/sys/boot/sparc64/boot1/boot1.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/boot/sparc64/boot1/boot1.c
==
--- stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:33 2010
(r213025)
+++ stable/7/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:34 2010
(r213026)
@@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$");
 #define _PATH_LOADER   "/boot/loader"
 #define _PATH_KERNEL   "/boot/kernel/kernel"
 
-#define BSIZEMAX   16384
-
-typedef int putc_func_t(int c, void *arg);
+typedef int putc_func_t(char c, void *arg);
 typedef int32_t ofwh_t;
 
 struct sp_data {
@@ -44,11 +42,6 @@ static char bootargs[128];
 
 static ofwh_t bootdev;
 
-static struct fs fs;
-static ino_t inomap;
-static char blkbuf[BSIZEMAX];
-static unsigned int fsblks;
-
 static uint32_t fs_off;
 
 int main(int ac, char **av);
@@ -66,14 +59,13 @@ static int mount(const char *device);
 
 static void panic(const char *fmt, ...) __dead2;
 static int printf(const char *fmt, ...);
-static int putchar(int c, void *arg);
+static int putchar(char c, void *arg);
 static int vprintf(const char *fmt, va_list ap);
 static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap);
 
 static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap);
-static int __putc(int c, void *arg);
 static int __puts(const char *s, putc_func_t *putc, void *arg);
-static int __sputc(int c, void *arg);
+static int __sputc(char c, void *arg);
 static char *__uitoa(char *buf, u_int val, int base);
 static char *__ultoa(char *buf, u_long val, int base);
 
@@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v
 typedef u_int64_t  ofwcell_t;
 typedef u_int32_t  u_ofwh_t;
 typedef int (*ofwfp_t)(ofwcell_t []);
-ofwfp_t ofw;   /* the prom Open Firmware entry */
+static ofwfp_t ofw;/* the PROM Open Firmware entry */
 
 void ofw_init(int, int, int, int, ofwfp_t);
-ofwh_t ofw_finddevice(const char *);
-ofwh_t ofw_open(const char *);
-int ofw_getprop(ofwh_t, const char *, void *, size_t);
-int ofw_read(ofwh_t, void *, size_t);
-int ofw_write(ofwh_t, const void *, size_t);
-int ofw_seek(ofwh_t, u_int64_t);
-void ofw_exit(void) __dead2;
+static ofwh_t ofw_finddevice(const char *);
+static ofwh_t ofw_open(const char *);
+static int ofw_getprop(ofwh_t, const char *, void *, size_t);
+static int ofw_read(ofwh_t, void *, size_t);
+static int ofw_write(ofwh_t, const void *, size_t);
+static int ofw_seek(ofwh_t, u_int64_t);
+static void ofw_exit(void) __dead2;
 
-ofwh_t bootdevh;
-ofwh_t stdinh, stdouth;
+static ofwh_t stdinh, stdouth;
 
 /*
  * This has to stay here, as the PROM seems to ignore the
@@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, 
exit(main(ac, av));
 }
 
-ofwh_t
+static ofwh_t
 ofw_finddevice(const char *name)
 {
ofwcell_t args[] = {
@@ -156,7 +147,7 @@ ofw_finddevice(const char *name)
return (args[4]);
 }
 
-int
+static int
 ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam
return (0);
 }
 
-ofwh_t
+static ofwh_t
 ofw_open(const char *path)
 {
ofwcell_t args[] = {
@@ -196,7 +187,7 @@ ofw_open(const char *path)
return (args[4]);
 }
 
-int
+static int
 ofw_close(ofwh_t devh)
 {
ofwcell_t args[] = {
@@ -213,12 +204,12 @@ ofw_close(ofwh_t devh)
return (0);
 }
 
-int
+static int
 ofw_read(ofwh_t devh, void *buf, size_t len)
 {
ofwcell_t args[] = {
(ofwcell_t)"read",
-   4,
+   3,
1,
(u_ofwh_t)devh,
(ofwcell_t)buf,
@@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t 
return (0);
 }
 
-int
+static int
 ofw_write(ofwh_t devh, const void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, 
return (0);
 }
 
-int
+static int
 ofw_seek(ofwh_t devh, u_int64_t off)
 {
ofwcell_t args[] = {
(ofwcell_t)"seek",
-   4,
+   3,
1,
(u_ofwh_t)devh,
off >> 32,
@@ -273,7 +264,7 @@ ofw_seek(ofwh_t devh, u_int64_t off)
return (0);
 }
 
-void
+stat

svn commit: r213025 - stable/8/sys/boot/sparc64/boot1

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:17:33 2010
New Revision: 213025
URL: http://svn.freebsd.org/changeset/base/213025

Log:
  MFC: r212729
  
  Merge from powerpc:
  - Change putc_func_t to use a char instead of an int for the character.
  - Make functions and variables not used outside of this source file static.
  - Remove unused prototypes and variables.
  - The OFW read and seek methods take 3 and not 4 input arguments.

Modified:
  stable/8/sys/boot/sparc64/boot1/boot1.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/boot/sparc64/boot1/boot1.c
==
--- stable/8/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:15:38 2010
(r213024)
+++ stable/8/sys/boot/sparc64/boot1/boot1.c Wed Sep 22 20:17:33 2010
(r213025)
@@ -26,9 +26,7 @@ __FBSDID("$FreeBSD$");
 #define _PATH_LOADER   "/boot/loader"
 #define _PATH_KERNEL   "/boot/kernel/kernel"
 
-#define BSIZEMAX   16384
-
-typedef int putc_func_t(int c, void *arg);
+typedef int putc_func_t(char c, void *arg);
 typedef int32_t ofwh_t;
 
 struct sp_data {
@@ -44,11 +42,6 @@ static char bootargs[128];
 
 static ofwh_t bootdev;
 
-static struct fs fs;
-static ino_t inomap;
-static char blkbuf[BSIZEMAX];
-static unsigned int fsblks;
-
 static uint32_t fs_off;
 
 int main(int ac, char **av);
@@ -66,14 +59,13 @@ static int mount(const char *device);
 
 static void panic(const char *fmt, ...) __dead2;
 static int printf(const char *fmt, ...);
-static int putchar(int c, void *arg);
+static int putchar(char c, void *arg);
 static int vprintf(const char *fmt, va_list ap);
 static int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap);
 
 static int __printf(const char *fmt, putc_func_t *putc, void *arg, va_list ap);
-static int __putc(int c, void *arg);
 static int __puts(const char *s, putc_func_t *putc, void *arg);
-static int __sputc(int c, void *arg);
+static int __sputc(char c, void *arg);
 static char *__uitoa(char *buf, u_int val, int base);
 static char *__ultoa(char *buf, u_long val, int base);
 
@@ -83,19 +75,18 @@ static char *__ultoa(char *buf, u_long v
 typedef u_int64_t  ofwcell_t;
 typedef u_int32_t  u_ofwh_t;
 typedef int (*ofwfp_t)(ofwcell_t []);
-ofwfp_t ofw;   /* the prom Open Firmware entry */
+static ofwfp_t ofw;/* the PROM Open Firmware entry */
 
 void ofw_init(int, int, int, int, ofwfp_t);
-ofwh_t ofw_finddevice(const char *);
-ofwh_t ofw_open(const char *);
-int ofw_getprop(ofwh_t, const char *, void *, size_t);
-int ofw_read(ofwh_t, void *, size_t);
-int ofw_write(ofwh_t, const void *, size_t);
-int ofw_seek(ofwh_t, u_int64_t);
-void ofw_exit(void) __dead2;
+static ofwh_t ofw_finddevice(const char *);
+static ofwh_t ofw_open(const char *);
+static int ofw_getprop(ofwh_t, const char *, void *, size_t);
+static int ofw_read(ofwh_t, void *, size_t);
+static int ofw_write(ofwh_t, const void *, size_t);
+static int ofw_seek(ofwh_t, u_int64_t);
+static void ofw_exit(void) __dead2;
 
-ofwh_t bootdevh;
-ofwh_t stdinh, stdouth;
+static ofwh_t stdinh, stdouth;
 
 /*
  * This has to stay here, as the PROM seems to ignore the
@@ -138,7 +129,7 @@ ofw_init(int d, int d1, int d2, int d3, 
exit(main(ac, av));
 }
 
-ofwh_t
+static ofwh_t
 ofw_finddevice(const char *name)
 {
ofwcell_t args[] = {
@@ -156,7 +147,7 @@ ofw_finddevice(const char *name)
return (args[4]);
 }
 
-int
+static int
 ofw_getprop(ofwh_t ofwh, const char *name, void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -178,7 +169,7 @@ ofw_getprop(ofwh_t ofwh, const char *nam
return (0);
 }
 
-ofwh_t
+static ofwh_t
 ofw_open(const char *path)
 {
ofwcell_t args[] = {
@@ -196,7 +187,7 @@ ofw_open(const char *path)
return (args[4]);
 }
 
-int
+static int
 ofw_close(ofwh_t devh)
 {
ofwcell_t args[] = {
@@ -213,12 +204,12 @@ ofw_close(ofwh_t devh)
return (0);
 }
 
-int
+static int
 ofw_read(ofwh_t devh, void *buf, size_t len)
 {
ofwcell_t args[] = {
(ofwcell_t)"read",
-   4,
+   3,
1,
(u_ofwh_t)devh,
(ofwcell_t)buf,
@@ -233,7 +224,7 @@ ofw_read(ofwh_t devh, void *buf, size_t 
return (0);
 }
 
-int
+static int
 ofw_write(ofwh_t devh, const void *buf, size_t len)
 {
ofwcell_t args[] = {
@@ -253,12 +244,12 @@ ofw_write(ofwh_t devh, const void *buf, 
return (0);
 }
 
-int
+static int
 ofw_seek(ofwh_t devh, u_int64_t off)
 {
ofwcell_t args[] = {
(ofwcell_t)"seek",
-   4,
+   3,
1,
(u_ofwh_t)devh,
off

svn commit: r213027 - stable/7/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 20:27:59 2010
New Revision: 213027
URL: http://svn.freebsd.org/changeset/base/213027

Log:
  MFC: r173852
  
  Add the -W options, which acts the same as -w but will generate
  unique names based on the submitted filename, a strftime(3) format
  string and a two digit sequence number.
  
  By default the strftime(3) format string is %Y%m%d (MMDD), but
  this can be changed by the -F option.
  
  PR:   bin/106049 (based on patch in that PR)
  Approved by:  grog@ (mentor)

Modified:
  stable/7/libexec/tftpd/Makefile
  stable/7/libexec/tftpd/tftpd.8
  stable/7/libexec/tftpd/tftpd.c
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)

Modified: stable/7/libexec/tftpd/Makefile
==
--- stable/7/libexec/tftpd/Makefile Wed Sep 22 20:17:34 2010
(r213026)
+++ stable/7/libexec/tftpd/Makefile Wed Sep 22 20:27:59 2010
(r213027)
@@ -5,6 +5,7 @@ PROG=   tftpd
 SRCS=  tftpd.c tftpsubs.c
 DPADD= ${LIBUTIL}
 LDADD= -lutil
+WFORMAT=0
 MAN=   tftpd.8
 CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp
 .PATH: ${.CURDIR}/../../usr.bin/tftp

Modified: stable/7/libexec/tftpd/tftpd.8
==
--- stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 20:17:34 2010
(r213026)
+++ stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 20:27:59 2010
(r213027)
@@ -40,7 +40,8 @@
 .Nd Internet Trivial File Transfer Protocol server
 .Sh SYNOPSIS
 .Nm tftpd
-.Op Fl cClnw
+.Op Fl cClnwW
+.Op Fl F Ar strftime-format
 .Op Fl s Ar directory
 .Op Fl u Ar user
 .Op Fl U Ar umask
@@ -142,6 +143,13 @@ except it falls back to
 specified via
 .Fl s
 if a directory does not exist for the client's IP.
+.It Fl F
+Use this
+.Xr strftime 3
+compatible format string for the creation of the suffix if
+.Fl W
+is specified.
+By default the string "%Y%m%d" is used.
 .It Fl l
 Log all requests using
 .Xr syslog 3
@@ -184,6 +192,17 @@ Allow write requests to create new files
 By default
 .Nm
 requires that the file specified in a write request exist.
+Note that this only works in directories writable by the user
+specified with
+.Fl u
+option
+.It Fl W
+As
+.Fl w
+but append a MMDD.nn sequence number to the end of the filename.
+Note that the string MMDD can be changed the
+.Fl F
+option.
 .El
 .Sh SEE ALSO
 .Xr tftp 1 ,
@@ -212,10 +231,17 @@ the
 .Fl u
 option was introduced in
 .Fx 4.2 ,
-and the
+the
 .Fl c
 option was introduced in
-.Fx 4.3 .
+.Fx 4.3 ,
+and the
+.Fl F
+and
+.Fl W
+options were introduced in
+.Fx 7 .
+.Pp
 .Sh BUGS
 Files larger than 33488896 octets (65535 blocks) cannot be transferred
 without client and server supporting blocksize negotiation (RFC1783).

Modified: stable/7/libexec/tftpd/tftpd.c
==
--- stable/7/libexec/tftpd/tftpd.c  Wed Sep 22 20:17:34 2010
(r213026)
+++ stable/7/libexec/tftpd/tftpd.c  Wed Sep 22 20:27:59 2010
(r213027)
@@ -110,6 +110,8 @@ static int  suppress_naks;
 static int logging;
 static int ipchroot;
 static int create_new = 0;
+static char*newfile_format = "%Y%m%d";
+static int increase_name = 0;
 static mode_t  mask = S_IWGRP|S_IWOTH;
 
 static const char *errtomsg(int);
@@ -134,7 +136,7 @@ main(int argc, char *argv[])
tzset();/* syslog in localtime */
 
openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
-   while ((ch = getopt(argc, argv, "cClns:u:U:w")) != -1) {
+   while ((ch = getopt(argc, argv, "cCF:lns:u:U:wW")) != -1) {
switch (ch) {
case 'c':
ipchroot = 1;
@@ -142,6 +144,9 @@ main(int argc, char *argv[])
case 'C':
ipchroot = 2;
break;
+   case 'F':
+   newfile_format = optarg;
+   break;
case 'l':
logging = 1;
break;
@@ -160,6 +165,10 @@ main(int argc, char *argv[])
case 'w':
create_new = 1;
break;
+   case 'W':
+   create_new = 1;
+   increase_name = 1;
+   break;
default:
syslog(LOG_WARNING, "ignoring unknown option -%c", ch);
}
@@ -513,6 +522,57 @@ option_fail:
 FILE *file;
 
 /*
+ * Find the next value for MMDD.nn when the file to be written should
+ * be unique. Due to the limitations of nn, we will fail if nn reaches 100.
+ * Besides, that is four updates per hour on a file, which is kind of
+ * execessive anyway.
+ */
+static int
+find_next_name(char *filename, int *fd)
+{
+   int i;
+   time_t tval;
+   size_t len;
+   struct tm lt;
+   char mmdd[MAXPATHLEN];
+ 

svn commit: r213029 - stable/7/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:02:51 2010
New Revision: 213029
URL: http://svn.freebsd.org/changeset/base/213029

Log:
  MFC: r173854
  
  Add "with" to make the line go smoother.

Modified:
  stable/7/libexec/tftpd/tftpd.8
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)

Modified: stable/7/libexec/tftpd/tftpd.8
==
--- stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 21:02:43 2010
(r213028)
+++ stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 21:02:51 2010
(r213029)
@@ -200,7 +200,7 @@ option
 As
 .Fl w
 but append a MMDD.nn sequence number to the end of the filename.
-Note that the string MMDD can be changed the
+Note that the string MMDD can be changed with the
 .Fl F
 option.
 .El
___
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: r213030 - stable/8/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:06:41 2010
New Revision: 213030
URL: http://svn.freebsd.org/changeset/base/213030

Log:
  MFC: r205076 (partial)
  
  Fix several typos in macros or macro misusage.
  
  Found by: make manlint
  Reviewed by:  ru
  Approved by:  philip (mentor)

Modified:
  stable/8/libexec/tftpd/tftpd.8
Directory Properties:
  stable/8/libexec/tftpd/   (props changed)

Modified: stable/8/libexec/tftpd/tftpd.8
==
--- stable/8/libexec/tftpd/tftpd.8  Wed Sep 22 21:02:51 2010
(r213029)
+++ stable/8/libexec/tftpd/tftpd.8  Wed Sep 22 21:06:41 2010
(r213030)
@@ -240,7 +240,7 @@ and the
 and
 .Fl W
 options were introduced in
-.Fx 7 .
+.Fx 8.0 .
 .Pp
 .Sh BUGS
 Files larger than 33488896 octets (65535 blocks) cannot be transferred
___
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: r213031 - stable/7/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:06:43 2010
New Revision: 213031
URL: http://svn.freebsd.org/changeset/base/213031

Log:
  MFC: r205076 (partial)
  
  Fix several typos in macros or macro misusage.
  
  Found by: make manlint
  Reviewed by:  ru
  Approved by:  philip (mentor)

Modified:
  stable/7/libexec/tftpd/tftpd.8
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)

Modified: stable/7/libexec/tftpd/tftpd.8
==
--- stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 21:06:41 2010
(r213030)
+++ stable/7/libexec/tftpd/tftpd.8  Wed Sep 22 21:06:43 2010
(r213031)
@@ -240,7 +240,7 @@ and the
 and
 .Fl W
 options were introduced in
-.Fx 7 .
+.Fx 8.0 .
 .Pp
 .Sh BUGS
 Files larger than 33488896 octets (65535 blocks) cannot be transferred
___
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: r213034 - stable/7/usr.bin/tftp

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:43:48 2010
New Revision: 213034
URL: http://svn.freebsd.org/changeset/base/213034

Log:
  MFC: r183857
  
  Use strlcpy() instead of strncpy() when we want the string to be
  NUL-terminated.

Modified:
  stable/7/usr.bin/tftp/main.c
Directory Properties:
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/usr.bin/tftp/main.c
==
--- stable/7/usr.bin/tftp/main.cWed Sep 22 21:14:18 2010
(r213033)
+++ stable/7/usr.bin/tftp/main.cWed Sep 22 21:43:48 2010
(r213034)
@@ -233,11 +233,10 @@ setpeer0(host, port)
/* res->ai_addr <= sizeof(peeraddr) is guaranteed */
memcpy(&peeraddr, res->ai_addr, res->ai_addrlen);
if (res->ai_canonname) {
-   (void) strncpy(hostname, res->ai_canonname,
+   (void) strlcpy(hostname, res->ai_canonname,
sizeof(hostname));
} else
-   (void) strncpy(hostname, host, sizeof(hostname));
-   hostname[sizeof(hostname)-1] = 0;
+   (void) strlcpy(hostname, host, sizeof(hostname));
connected = 1;
}
 
___
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: r213035 - stable/7/usr.bin/tftp

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:44:55 2010
New Revision: 213035
URL: http://svn.freebsd.org/changeset/base/213035

Log:
  MFC: r183858
  
  ANSIfy, plus constify interfaces where possible.

Modified:
  stable/7/usr.bin/tftp/extern.h
  stable/7/usr.bin/tftp/main.c
  stable/7/usr.bin/tftp/tftp.c
  stable/7/usr.bin/tftp/tftpsubs.c
Directory Properties:
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/usr.bin/tftp/extern.h
==
--- stable/7/usr.bin/tftp/extern.h  Wed Sep 22 21:43:48 2010
(r213034)
+++ stable/7/usr.bin/tftp/extern.h  Wed Sep 22 21:44:55 2010
(r213035)
@@ -34,5 +34,5 @@
  * $FreeBSD$
  */
 
-void   recvfile(int, char *, char *);
-void   xmitfile(int, char *, char *);
+void   recvfile(int, const char *, const char *);
+void   xmitfile(int, const char *, const char *);

Modified: stable/7/usr.bin/tftp/main.c
==
--- stable/7/usr.bin/tftp/main.cWed Sep 22 21:43:48 2010
(r213034)
+++ stable/7/usr.bin/tftp/main.cWed Sep 22 21:44:55 2010
(r213035)
@@ -109,9 +109,9 @@ voidstatus(int, char **);
 static void command(void) __dead2;
 static const char *command_prompt(void);
 
-static void getusage(char *);
+static void getusage(const char *);
 static void makeargv(void);
-static void putusage(char *);
+static void putusage(const char *);
 static void settftpmode(const char *);
 
 char   *tail(char *);
@@ -157,9 +157,7 @@ struct cmd cmdtab[] = {
 };
 
 int
-main(argc, argv)
-   int argc;
-   char *argv[];
+main(int argc, char *argv[])
 {
f = -1;
strcpy(mode, "netascii");
@@ -177,9 +175,7 @@ main(argc, argv)
 charhostname[MAXHOSTNAMELEN];
 
 void
-setpeer0(host, port)
-   char *host;
-   const char *port;
+setpeer0(char *host, const char *port)
 {
struct addrinfo hints, *res0, *res;
int error;
@@ -244,9 +240,7 @@ setpeer0(host, port)
 }
 
 void
-setpeer(argc, argv)
-   int argc;
-   char *argv[];
+setpeer(int argc, char *argv[])
 {
 
if (argc < 2) {
@@ -281,9 +275,7 @@ struct  modes {
 };
 
 void
-modecmd(argc, argv)
-   int argc;
-   char *argv[];
+modecmd(int argc, char *argv[])
 {
struct modes *p;
const char *sep;
@@ -316,26 +308,21 @@ modecmd(argc, argv)
 }
 
 void
-setbinary(argc, argv)
-   int argc __unused;
-   char *argv[] __unused;
+setbinary(int argc __unused, char *argv[] __unused)
 {
 
settftpmode("octet");
 }
 
 void
-setascii(argc, argv)
-   int argc __unused;
-   char *argv[] __unused;
+setascii(int argc __unused, char *argv[] __unused)
 {
 
settftpmode("netascii");
 }
 
 static void
-settftpmode(newmode)
-   const char *newmode;
+settftpmode(const char *newmode)
 {
strcpy(mode, newmode);
if (verbose)
@@ -347,9 +334,7 @@ settftpmode(newmode)
  * Send file(s).
  */
 void
-put(argc, argv)
-   int argc;
-   char *argv[];
+put(int argc, char *argv[])
 {
int fd;
int n;
@@ -421,8 +406,7 @@ put(argc, argv)
 }
 
 static void
-putusage(s)
-   char *s;
+putusage(const char *s)
 {
printf("usage: %s file [[host:]remotename]\n", s);
printf("   %s file1 file2 ... fileN [[host:]remote-directory]\n", 
s);
@@ -432,9 +416,7 @@ putusage(s)
  * Receive file(s).
  */
 void
-get(argc, argv)
-   int argc;
-   char *argv[];
+get(int argc, char *argv[])
 {
int fd;
int n;
@@ -504,8 +486,7 @@ get(argc, argv)
 }
 
 static void
-getusage(s)
-   char *s;
+getusage(const char *s)
 {
printf("usage: %s [host:]file [localname]\n", s);
printf("   %s [host1:]file1 [host2:]file2 ... [hostN:]fileN\n", s);
@@ -514,9 +495,7 @@ getusage(s)
 intrexmtval = TIMEOUT;
 
 void
-setrexmt(argc, argv)
-   int argc;
-   char *argv[];
+setrexmt(int argc, char *argv[])
 {
int t;
 
@@ -542,9 +521,7 @@ setrexmt(argc, argv)
 intmaxtimeout = 5 * TIMEOUT;
 
 void
-settimeout(argc, argv)
-   int argc;
-   char *argv[];
+settimeout(int argc, char *argv[])
 {
int t;
 
@@ -568,9 +545,7 @@ settimeout(argc, argv)
 }
 
 void
-status(argc, argv)
-   int argc __unused;
-   char *argv[] __unused;
+status(int argc __unused, char *argv[] __unused)
 {
if (connected)
printf("Connected to %s.\n", hostname);
@@ -583,8 +558,7 @@ status(argc, argv)
 }
 
 void
-intr(dummy)
-   int dummy __unused;
+intr(int dummy __unused)
 {
 
signal(SIGALRM, SIG_IGN);
@@ -593,8 +567,7 @@ intr(dummy)
 }
 
 char *
-tail(filename)
-   char *filename;
+tail(char *filename)
 {
char *s;
 
@@ -610,7 +583,7 @@ tail(filename)
 }
 
 static const char *
-command_prompt()
+command_prompt(void)
 {
 
return ("tftp> ");
@@ -620,7 +593,7 @@ command_prompt()
  * Command parser.
  */
 static void
-command()
+command(void)
 {
Hi

svn commit: r213036 - stable/8/usr.bin/tftp

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:54:13 2010
New Revision: 213036
URL: http://svn.freebsd.org/changeset/base/213036

Log:
  MFC: r207607, r207621, r209112, r209550, r209551
  
  Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
  lot better than what's in the tree now.  Edwin tested it at a prior
  employer, but can't test it today.  I've found that it works a lot
  better with the various uboot versions that I've used in my embedded
  work.  Here's the pkg-descr from the port that describes the changes:
  
  It all started when we got some new routers, which told me the
  following when trying to upload configuration or download images
  from it: The TFTP server doesn't support the blocksize option.
  
  My curiousity was triggered, it took me some reading of RFCs and
  other documentation to find out what was possible and what could
  be done. Was plain TFTP very simple in its handshake, TFTP with
  options was kind of messy because of its backwards capability: The
  first packet returned could either be an acknowledgement of options,
  or the first data packet.
  
  Going through the source code of src/libexec/tftpd and going through
  the code of src/usr.bin/tftp showed that there was a lot of duplicate
  code, and the addition of options would only increase the amount
  of duplicate code. After all, both the client and the server can
  act as a sender and receiver.
  
  At the end, it ended up with a nearly complete rewrite of the tftp
  client and server. It has been tested against the following TFTP
  clients and servers:
  
  - Itself (yay!)
  - The standard FreeBSD tftp client and server
  - The Fedora Core 6 tftp client and server
  - Cisco router tftp client
  - Extreme Networks tftp client
  
  It supports the following RFCs:
  
  RFC1350 - THE TFTP PROTOCOL (REVISION 2)
  RFC2347 - TFTP Option Extension
  RFC2348 - TFTP Blocksize Option
  RFC2349 - TFTP Timeout Interval and Transfer Size Options
  RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
Statement for the Trivial File Transfer Protocol (TFTP)
  
  It supports the following unofficial TFTP Options as described at
  http://www.compuphase.com/tftp.htm:
  
  blksize2 - Block size restricted to powers of 2, excluding protocol headers
  rollover - Block counter roll-over (roll back to zero or to one)
  
  From the tftp program point of view the following things are changed:
  
  - New commands: "blocksize", "blocksize2", "rollover" and "options"
  - Development features: "debug" and "packetdrop"
  
  If you try this tftp/tftpd implementation, please let me know if
  it works (or doesn't work) and against which implementaion so I can
  get a list of confirmed working systems.
  
  Author: Edwin Groothuis 

Added:
  stable/8/usr.bin/tftp/tftp.h
 - copied unchanged from r207621, head/usr.bin/tftp/tftp.h
Deleted:
  stable/8/usr.bin/tftp/extern.h
  stable/8/usr.bin/tftp/tftpsubs.c
  stable/8/usr.bin/tftp/tftpsubs.h
Modified:
  stable/8/usr.bin/tftp/Makefile
  stable/8/usr.bin/tftp/main.c
  stable/8/usr.bin/tftp/tftp.1
  stable/8/usr.bin/tftp/tftp.c
Directory Properties:
  stable/8/usr.bin/tftp/   (props changed)

Modified: stable/8/usr.bin/tftp/Makefile
==
--- stable/8/usr.bin/tftp/Makefile  Wed Sep 22 21:44:55 2010
(r213035)
+++ stable/8/usr.bin/tftp/Makefile  Wed Sep 22 21:54:13 2010
(r213036)
@@ -1,9 +1,13 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+CFLAGS=-g -Wall
+WARNS= 3
 PROG=  tftp
-SRCS=  main.c tftp.c tftpsubs.c
+SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
 DPADD= ${LIBEDIT} ${LIBTERMCAP}
 LDADD= -ledit -ltermcap
+CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp
+.PATH:  ${.CURDIR}/../../libexec/tftpd
 
 .include 

Modified: stable/8/usr.bin/tftp/main.c
==
--- stable/8/usr.bin/tftp/main.cWed Sep 22 21:44:55 2010
(r213035)
+++ stable/8/usr.bin/tftp/main.cWed Sep 22 21:54:13 2010
(r213036)
@@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
-
 #include 
+#include 
 
 #include 
 #include 
@@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "extern.h"
+#include "tftp-utils.h"
+#include "tftp-io.h"
+#include "tftp-options.h"
+#include "tftp.h"
 
 #defineMAXLINE 200
 #defineTIMEOUT 5   /* secs between rexmt's */
 
-struct sockaddr_storage peeraddr;
-intf;
-inttrace;
-intverbose;
-intconnected;
-char   mode[32];
-char   line[MAXLINE];
-intmargc;
+static struct  sockaddr_storage peeraddr;
+static int connected;
+static charmode[32];
+jmp_buftoplevel;
+volatile int   txrx_error;
+static int peer;
+
 #de

svn commit: r213038 - stable/8/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:54:30 2010
New Revision: 213038
URL: http://svn.freebsd.org/changeset/base/213038

Log:
  MFC: r207608, r207614, r212651, r212665
  
  Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
  lot better than what's in the tree now.  Edwin tested it at a prior
  employer, but can't test it today.  I've found that it works a lot
  better with the various uboot versions that I've used in my embedded
  work.  Here's the pkg-descr from the port that describes the changes:
  
  It all started when we got some new routers, which told me the
  following when trying to upload configuration or download images
  from it: The TFTP server doesn't support the blocksize option.
  
  My curiousity was triggered, it took me some reading of RFCs and
  other documentation to find out what was possible and what could
  be done. Was plain TFTP very simple in its handshake, TFTP with
  options was kind of messy because of its backwards capability: The
  first packet returned could either be an acknowledgement of options,
  or the first data packet.
  
  Going through the source code of src/libexec/tftpd and going through
  the code of src/usr.bin/tftp showed that there was a lot of duplicate
  code, and the addition of options would only increase the amount
  of duplicate code. After all, both the client and the server can
  act as a sender and receiver.
  
  At the end, it ended up with a nearly complete rewrite of the tftp
  client and server. It has been tested against the following TFTP
  clients and servers:
  
  - Itself (yay!)
  - The standard FreeBSD tftp client and server
  - The Fedora Core 6 tftp client and server
  - Cisco router tftp client
  - Extreme Networks tftp client
  
  It supports the following RFCs:
  
  RFC1350 - THE TFTP PROTOCOL (REVISION 2)
  RFC2347 - TFTP Option Extension
  RFC2348 - TFTP Blocksize Option
  RFC2349 - TFTP Timeout Interval and Transfer Size Options
  RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
Statement for the Trivial File Transfer Protocol (TFTP)
  
  It supports the following unofficial TFTP Options as described at
  http://www.compuphase.com/tftp.htm:
  
  blksize2 - Block size restricted to powers of 2, excluding protocol headers
  rollover - Block counter roll-over (roll back to zero or to one)
  
  From the tftp program point of view the following things are changed:
  
  - New commands: "blocksize", "blocksize2", "rollover" and "options"
  - Development features: "debug" and "packetdrop"
  
  If you try this tftp/tftpd implementation, please let me know if
  it works (or doesn't work) and against which implementaion so I can
  get a list of confirmed working systems.
  
  Author: Edwin Groothuis 

Added:
  stable/8/libexec/tftpd/tftp-file.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-file.c
  stable/8/libexec/tftpd/tftp-file.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-file.h
  stable/8/libexec/tftpd/tftp-io.c
 - copied, changed from r207614, head/libexec/tftpd/tftp-io.c
  stable/8/libexec/tftpd/tftp-io.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-io.h
  stable/8/libexec/tftpd/tftp-options.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-options.c
  stable/8/libexec/tftpd/tftp-options.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-options.h
  stable/8/libexec/tftpd/tftp-transfer.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.c
  stable/8/libexec/tftpd/tftp-transfer.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.h
  stable/8/libexec/tftpd/tftp-utils.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.c
  stable/8/libexec/tftpd/tftp-utils.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.h
Modified:
  stable/8/libexec/tftpd/Makefile
  stable/8/libexec/tftpd/tftpd.8
  stable/8/libexec/tftpd/tftpd.c
Directory Properties:
  stable/8/libexec/tftpd/   (props changed)

Modified: stable/8/libexec/tftpd/Makefile
==
--- stable/8/libexec/tftpd/Makefile Wed Sep 22 21:54:16 2010
(r213037)
+++ stable/8/libexec/tftpd/Makefile Wed Sep 22 21:54:30 2010
(r213038)
@@ -2,12 +2,13 @@
 # $FreeBSD$
 
 PROG=  tftpd
-SRCS=  tftpd.c tftpsubs.c
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+SRCS=  tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c 
tftp-options.c
+WARNS= 3
 WFORMAT=0
 MAN=   tftpd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp
+CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd
 .PATH: ${.CURDIR}/../../usr.bin/tftp
+COPTFLAGS = -O
+LDFLAGS= -lwrap
 
 .include 

Copied: stable/8/libexec/tftpd/tftp-file.c (from r207614, 
head/libexec/tftpd/tftp-file.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/libe

svn commit: r213037 - stable/7/usr.bin/tftp

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:54:16 2010
New Revision: 213037
URL: http://svn.freebsd.org/changeset/base/213037

Log:
  MFC: r207607, r207621, r209112, r209550, r209551
  
  Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
  lot better than what's in the tree now.  Edwin tested it at a prior
  employer, but can't test it today.  I've found that it works a lot
  better with the various uboot versions that I've used in my embedded
  work.  Here's the pkg-descr from the port that describes the changes:
  
  It all started when we got some new routers, which told me the
  following when trying to upload configuration or download images
  from it: The TFTP server doesn't support the blocksize option.
  
  My curiousity was triggered, it took me some reading of RFCs and
  other documentation to find out what was possible and what could
  be done. Was plain TFTP very simple in its handshake, TFTP with
  options was kind of messy because of its backwards capability: The
  first packet returned could either be an acknowledgement of options,
  or the first data packet.
  
  Going through the source code of src/libexec/tftpd and going through
  the code of src/usr.bin/tftp showed that there was a lot of duplicate
  code, and the addition of options would only increase the amount
  of duplicate code. After all, both the client and the server can
  act as a sender and receiver.
  
  At the end, it ended up with a nearly complete rewrite of the tftp
  client and server. It has been tested against the following TFTP
  clients and servers:
  
  - Itself (yay!)
  - The standard FreeBSD tftp client and server
  - The Fedora Core 6 tftp client and server
  - Cisco router tftp client
  - Extreme Networks tftp client
  
  It supports the following RFCs:
  
  RFC1350 - THE TFTP PROTOCOL (REVISION 2)
  RFC2347 - TFTP Option Extension
  RFC2348 - TFTP Blocksize Option
  RFC2349 - TFTP Timeout Interval and Transfer Size Options
  RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
Statement for the Trivial File Transfer Protocol (TFTP)
  
  It supports the following unofficial TFTP Options as described at
  http://www.compuphase.com/tftp.htm:
  
  blksize2 - Block size restricted to powers of 2, excluding protocol headers
  rollover - Block counter roll-over (roll back to zero or to one)
  
  From the tftp program point of view the following things are changed:
  
  - New commands: "blocksize", "blocksize2", "rollover" and "options"
  - Development features: "debug" and "packetdrop"
  
  If you try this tftp/tftpd implementation, please let me know if
  it works (or doesn't work) and against which implementaion so I can
  get a list of confirmed working systems.
  
  Author: Edwin Groothuis 

Added:
  stable/7/usr.bin/tftp/tftp.h
 - copied unchanged from r207621, head/usr.bin/tftp/tftp.h
Deleted:
  stable/7/usr.bin/tftp/extern.h
  stable/7/usr.bin/tftp/tftpsubs.c
  stable/7/usr.bin/tftp/tftpsubs.h
Modified:
  stable/7/usr.bin/tftp/Makefile
  stable/7/usr.bin/tftp/main.c
  stable/7/usr.bin/tftp/tftp.1
  stable/7/usr.bin/tftp/tftp.c
Directory Properties:
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/usr.bin/tftp/Makefile
==
--- stable/7/usr.bin/tftp/Makefile  Wed Sep 22 21:54:13 2010
(r213036)
+++ stable/7/usr.bin/tftp/Makefile  Wed Sep 22 21:54:16 2010
(r213037)
@@ -1,9 +1,13 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
+CFLAGS=-g -Wall
+WARNS= 3
 PROG=  tftp
-SRCS=  main.c tftp.c tftpsubs.c
+SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
 DPADD= ${LIBEDIT} ${LIBTERMCAP}
 LDADD= -ledit -ltermcap
+CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp
+.PATH:  ${.CURDIR}/../../libexec/tftpd
 
 .include 

Modified: stable/7/usr.bin/tftp/main.c
==
--- stable/7/usr.bin/tftp/main.cWed Sep 22 21:54:13 2010
(r213036)
+++ stable/7/usr.bin/tftp/main.cWed Sep 22 21:54:16 2010
(r213037)
@@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
-
 #include 
+#include 
 
 #include 
 #include 
@@ -72,119 +74,212 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "extern.h"
+#include "tftp-utils.h"
+#include "tftp-io.h"
+#include "tftp-options.h"
+#include "tftp.h"
 
 #defineMAXLINE 200
 #defineTIMEOUT 5   /* secs between rexmt's */
 
-struct sockaddr_storage peeraddr;
-intf;
-inttrace;
-intverbose;
-intconnected;
-char   mode[32];
-char   line[MAXLINE];
-intmargc;
+static struct  sockaddr_storage peeraddr;
+static int connected;
+static charmode[32];
+jmp_buftoplevel;
+volatile int   txrx_error;
+static int peer;
+
 #de

svn commit: r213039 - stable/7/libexec/tftpd

2010-09-22 Thread Marius Strobl
Author: marius
Date: Wed Sep 22 21:54:34 2010
New Revision: 213039
URL: http://svn.freebsd.org/changeset/base/213039

Log:
  MFC: r207608, r207614, r212651, r212665
  
  Go ahead and merge the work edwin@ on tftpd into the tree.  It is a
  lot better than what's in the tree now.  Edwin tested it at a prior
  employer, but can't test it today.  I've found that it works a lot
  better with the various uboot versions that I've used in my embedded
  work.  Here's the pkg-descr from the port that describes the changes:
  
  It all started when we got some new routers, which told me the
  following when trying to upload configuration or download images
  from it: The TFTP server doesn't support the blocksize option.
  
  My curiousity was triggered, it took me some reading of RFCs and
  other documentation to find out what was possible and what could
  be done. Was plain TFTP very simple in its handshake, TFTP with
  options was kind of messy because of its backwards capability: The
  first packet returned could either be an acknowledgement of options,
  or the first data packet.
  
  Going through the source code of src/libexec/tftpd and going through
  the code of src/usr.bin/tftp showed that there was a lot of duplicate
  code, and the addition of options would only increase the amount
  of duplicate code. After all, both the client and the server can
  act as a sender and receiver.
  
  At the end, it ended up with a nearly complete rewrite of the tftp
  client and server. It has been tested against the following TFTP
  clients and servers:
  
  - Itself (yay!)
  - The standard FreeBSD tftp client and server
  - The Fedora Core 6 tftp client and server
  - Cisco router tftp client
  - Extreme Networks tftp client
  
  It supports the following RFCs:
  
  RFC1350 - THE TFTP PROTOCOL (REVISION 2)
  RFC2347 - TFTP Option Extension
  RFC2348 - TFTP Blocksize Option
  RFC2349 - TFTP Timeout Interval and Transfer Size Options
  RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability
Statement for the Trivial File Transfer Protocol (TFTP)
  
  It supports the following unofficial TFTP Options as described at
  http://www.compuphase.com/tftp.htm:
  
  blksize2 - Block size restricted to powers of 2, excluding protocol headers
  rollover - Block counter roll-over (roll back to zero or to one)
  
  From the tftp program point of view the following things are changed:
  
  - New commands: "blocksize", "blocksize2", "rollover" and "options"
  - Development features: "debug" and "packetdrop"
  
  If you try this tftp/tftpd implementation, please let me know if
  it works (or doesn't work) and against which implementaion so I can
  get a list of confirmed working systems.
  
  Author: Edwin Groothuis 

Added:
  stable/7/libexec/tftpd/tftp-file.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-file.c
  stable/7/libexec/tftpd/tftp-file.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-file.h
  stable/7/libexec/tftpd/tftp-io.c
 - copied, changed from r207614, head/libexec/tftpd/tftp-io.c
  stable/7/libexec/tftpd/tftp-io.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-io.h
  stable/7/libexec/tftpd/tftp-options.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-options.c
  stable/7/libexec/tftpd/tftp-options.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-options.h
  stable/7/libexec/tftpd/tftp-transfer.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.c
  stable/7/libexec/tftpd/tftp-transfer.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-transfer.h
  stable/7/libexec/tftpd/tftp-utils.c
 - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.c
  stable/7/libexec/tftpd/tftp-utils.h
 - copied unchanged from r207614, head/libexec/tftpd/tftp-utils.h
Modified:
  stable/7/libexec/tftpd/Makefile
  stable/7/libexec/tftpd/tftpd.8
  stable/7/libexec/tftpd/tftpd.c
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)

Modified: stable/7/libexec/tftpd/Makefile
==
--- stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:30 2010
(r213038)
+++ stable/7/libexec/tftpd/Makefile Wed Sep 22 21:54:34 2010
(r213039)
@@ -2,12 +2,13 @@
 # $FreeBSD$
 
 PROG=  tftpd
-SRCS=  tftpd.c tftpsubs.c
-DPADD= ${LIBUTIL}
-LDADD= -lutil
+SRCS=  tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c 
tftp-options.c
+WARNS= 3
 WFORMAT=0
 MAN=   tftpd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp
+CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd
 .PATH: ${.CURDIR}/../../usr.bin/tftp
+COPTFLAGS = -O
+LDFLAGS= -lwrap
 
 .include 

Copied: stable/7/libexec/tftpd/tftp-file.c (from r207614, 
head/libexec/tftpd/tftp-file.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/7/libe

svn commit: r213053 - head/usr.bin/tftp

2010-09-23 Thread Marius Strobl
Author: marius
Date: Thu Sep 23 10:03:03 2010
New Revision: 213053
URL: http://svn.freebsd.org/changeset/base/213053

Log:
  Remove an explicit assignment of the CFLAGS variable intended for
  debugging purposes only.
  
  MFC after:3 days

Modified:
  head/usr.bin/tftp/Makefile

Modified: head/usr.bin/tftp/Makefile
==
--- head/usr.bin/tftp/Makefile  Thu Sep 23 09:56:02 2010(r213052)
+++ head/usr.bin/tftp/Makefile  Thu Sep 23 10:03:03 2010(r213053)
@@ -1,7 +1,6 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-CFLAGS=-g -Wall
 WARNS= 3
 PROG=  tftp
 SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
___
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: r213075 - in head: libexec/tftpd usr.bin/tftp

2010-09-23 Thread Marius Strobl
Author: marius
Date: Thu Sep 23 14:06:15 2010
New Revision: 213075
URL: http://svn.freebsd.org/changeset/base/213075

Log:
  Try to adhere to style.Makefile(5).
  
  MFC after:3 days

Modified:
  head/libexec/tftpd/Makefile
  head/usr.bin/tftp/Makefile

Modified: head/libexec/tftpd/Makefile
==
--- head/libexec/tftpd/Makefile Thu Sep 23 12:04:12 2010(r213074)
+++ head/libexec/tftpd/Makefile Thu Sep 23 14:06:15 2010(r213075)
@@ -2,13 +2,11 @@
 # $FreeBSD$
 
 PROG=  tftpd
-SRCS=  tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c 
tftp-options.c
+MAN=   tftpd.8
+SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
+SRCS+= tftpd.c
 WARNS= 3
 WFORMAT=0
-MAN=   tftpd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd
-.PATH: ${.CURDIR}/../../usr.bin/tftp
-COPTFLAGS = -O
 LDFLAGS= -lwrap
 
 .include 

Modified: head/usr.bin/tftp/Makefile
==
--- head/usr.bin/tftp/Makefile  Thu Sep 23 12:04:12 2010(r213074)
+++ head/usr.bin/tftp/Makefile  Thu Sep 23 14:06:15 2010(r213075)
@@ -1,12 +1,14 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-WARNS= 3
+.PATH:  ${.CURDIR}/../../libexec/tftpd
+
 PROG=  tftp
-SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
+SRCS=  main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c
+SRCS+= tftp-utils.c tftp.c
+WARNS= 3
+CFLAGS+=-I${.CURDIR}/../../libexec/tftpd
 DPADD= ${LIBEDIT} ${LIBTERMCAP}
 LDADD= -ledit -ltermcap
-CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp
-.PATH:  ${.CURDIR}/../../libexec/tftpd
 
 .include 
___
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: r213099 - in head: libexec/tftpd usr.bin/tftp

2010-09-24 Thread Marius Strobl
Author: marius
Date: Fri Sep 24 10:40:17 2010
New Revision: 213099
URL: http://svn.freebsd.org/changeset/base/213099

Log:
  Make WARNS=6 clean.
  
  MFC after:1 week

Modified:
  head/libexec/tftpd/Makefile
  head/libexec/tftpd/tftp-file.c
  head/libexec/tftpd/tftp-options.c
  head/libexec/tftpd/tftp-utils.c
  head/libexec/tftpd/tftp-utils.h
  head/libexec/tftpd/tftpd.c
  head/usr.bin/tftp/Makefile
  head/usr.bin/tftp/main.c

Modified: head/libexec/tftpd/Makefile
==
--- head/libexec/tftpd/Makefile Fri Sep 24 09:04:16 2010(r213098)
+++ head/libexec/tftpd/Makefile Fri Sep 24 10:40:17 2010(r213099)
@@ -5,7 +5,6 @@ PROG=   tftpd
 MAN=   tftpd.8
 SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
 SRCS+= tftpd.c
-WARNS= 3
 WFORMAT=0
 LDFLAGS= -lwrap
 

Modified: head/libexec/tftpd/tftp-file.c
==
--- head/libexec/tftpd/tftp-file.c  Fri Sep 24 09:04:16 2010
(r213098)
+++ head/libexec/tftpd/tftp-file.c  Fri Sep 24 10:40:17 2010
(r213099)
@@ -103,13 +103,13 @@ static size_t
 convert_to_net(char *buffer, size_t count, int init)
 {
size_t i;
-   static size_t n = 0, read = 0;
+   static size_t n = 0, in = 0;
static int newline = 0;
 
if (init) {
newline = 0;
n = 0;
-   read = 0;
+   in = 0;
return 0 ;
}
 
@@ -124,13 +124,13 @@ convert_to_net(char *buffer, size_t coun
}
 
while (i < count) {
-   if (n == read) {
+   if (n == in) {
/* When done we're done */
if (feof(file)) break;
 
/* Otherwise read another bunch */
-   read = fread(convbuffer, 1, count, file);
-   if (read == 0) break;
+   in = fread(convbuffer, 1, count, file);
+   if (in == 0) break;
n = 0;
}
 
@@ -250,7 +250,7 @@ read_close(void)
 
 
 int
-synchnet(int peer)
+synchnet(int peer __unused)
 {
 
return 0;

Modified: head/libexec/tftpd/tftp-options.c
==
--- head/libexec/tftpd/tftp-options.c   Fri Sep 24 09:04:16 2010
(r213098)
+++ head/libexec/tftpd/tftp-options.c   Fri Sep 24 10:40:17 2010
(r213099)
@@ -79,7 +79,8 @@ int options_extra_enabled = 1;
  */
 
 int
-option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf)
+option_tsize(int peer __unused, struct tftphdr *tp __unused, int mode,
+struct stat *stbuf)
 {
 
if (options[OPT_TSIZE].o_request == NULL)
@@ -159,21 +160,19 @@ option_rollover(int peer)
 int
 option_blksize(int peer)
 {
-   int *maxdgram;
-   char maxbuffer[100];
+   u_long maxdgram;
size_t len;
 
if (options[OPT_BLKSIZE].o_request == NULL)
return (0);
 
/* maximum size of an UDP packet according to the system */
-   len = sizeof(maxbuffer);
+   len = sizeof(maxdgram);
if (sysctlbyname("net.inet.udp.maxdgram",
-   maxbuffer, &len, NULL, 0) < 0) {
+   &maxdgram, &len, NULL, 0) < 0) {
tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram");
return (acting_as_client ? 1 : 0);
}
-   maxdgram = (int *)maxbuffer;
 
int size = atoi(options[OPT_BLKSIZE].o_request);
if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {
@@ -191,20 +190,20 @@ option_blksize(int peer)
}
}
 
-   if (size > *maxdgram) {
+   if (size > (int)maxdgram) {
if (acting_as_client) {
tftp_log(LOG_ERR,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
+   "%d bytes.\n", size, maxdgram);
send_error(peer, EBADOP);
return (1);
} else {
tftp_log(LOG_WARNING,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
-   size = *maxdgram;
+   "%d bytes.\n", size, maxdgram);
+   size = maxdgram;
/* No reason to return */
}
}
@@ -220,10 +219,9 @@ option_blksize(int peer)
 }
 
 int
-option_blksize2(int peer)
+option_blksize2(int peer __unused)
 {
-   int *maxdgram;
-   charmaxbuffer[100];
+   u_long  maxdgram;
int size, i;
size_t  len;
 
@@ -236,13 +234,12 @@ option_blksiz

svn commit: r213102 - head/libexec/tftpd

2010-09-24 Thread Marius Strobl
Author: marius
Date: Fri Sep 24 14:44:04 2010
New Revision: 213102
URL: http://svn.freebsd.org/changeset/base/213102

Log:
  Remove the duplicate logging of failed read requests, whose error message
  also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not
  just the case the -n option is intended to deal with and thus really spammed
  us with ~20 messages in the default configuration when booting a diskless
  FreeBSD client, introduced with r207608 again.
  
  MFC after:1 week

Modified:
  head/libexec/tftpd/tftpd.c

Modified: head/libexec/tftpd/tftpd.c
==
--- head/libexec/tftpd/tftpd.c  Fri Sep 24 14:38:54 2010(r213101)
+++ head/libexec/tftpd/tftpd.c  Fri Sep 24 14:44:04 2010(r213102)
@@ -604,7 +604,6 @@ tftp_rrq(int peer, char *recvbuffer, ssi
 */
if (suppress_naks && *filename != '/' && ecode == ENOTFOUND)
exit(0);
-   tftp_log(LOG_ERR, "Prevent NAK storm");
send_error(peer, ecode);
exit(1);
}
___
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: r213104 - head/sys/sparc64/sparc64

2010-09-24 Thread Marius Strobl
Author: marius
Date: Fri Sep 24 15:12:18 2010
New Revision: 213104
URL: http://svn.freebsd.org/changeset/base/213104

Log:
  minor simplifications and cosmetics

Modified:
  head/sys/sparc64/sparc64/elf_machdep.c

Modified: head/sys/sparc64/sparc64/elf_machdep.c
==
--- head/sys/sparc64/sparc64/elf_machdep.c  Fri Sep 24 15:01:45 2010
(r213103)
+++ head/sys/sparc64/sparc64/elf_machdep.c  Fri Sep 24 15:12:18 2010
(r213104)
@@ -132,8 +132,8 @@ void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
 size_t *off __unused)
 {
-}
 
+}
 
 /*
  * The following table holds for each relocation type:
@@ -219,7 +219,7 @@ static const int reloc_target_flags[] = 
 };
 
 #if 0
-static const char *reloc_names[] = {
+static const char *const reloc_names[] = {
"NONE", "RELOC_8", "RELOC_16", "RELOC_32", "DISP_8",
"DISP_16", "DISP_32", "WDISP_30", "WDISP_22", "HI22",
"22", "13", "LO10", "GOT10", "GOT13",
@@ -275,10 +275,9 @@ static const long reloc_target_bitmask[]
 
 int
 elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
-int type, elf_lookup_fn lookup)
+int type, elf_lookup_fn lookup __unused)
 {
const Elf_Rela *rela;
-   Elf_Addr value;
Elf_Addr *where;
 
if (type != ELF_RELOC_RELA)
@@ -288,10 +287,8 @@ elf_reloc_local(linker_file_t lf, Elf_Ad
if (ELF64_R_TYPE_ID(rela->r_info) != R_SPARC_RELATIVE)
return (-1);
 
-   value = rela->r_addend + (Elf_Addr)lf->address;
-   where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset);
-
-   *where = elf_relocaddr(lf, value);
+   where = (Elf_Addr *)(relocbase + rela->r_offset);
+   *where = elf_relocaddr(lf, rela->r_addend + relocbase);
 
return (0);
 }
@@ -346,9 +343,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel
if (RELOC_PC_RELATIVE(rtype))
value -= (Elf_Addr)where;
 
-   if (RELOC_BASE_RELATIVE(rtype)) {
+   if (RELOC_BASE_RELATIVE(rtype))
value = elf_relocaddr(lf, value + relocbase);
-   }
 
mask = RELOC_VALUE_BITMASK(rtype);
value >>= RELOC_VALUE_RIGHTSHIFT(rtype);
___
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: r213105 - head/sys/dev/mpt

2010-09-24 Thread Marius Strobl
Author: marius
Date: Fri Sep 24 16:40:46 2010
New Revision: 213105
URL: http://svn.freebsd.org/changeset/base/213105

Log:
  Improve r56796; the reply handler actually may remove the request from
  the chain in which case it shouldn't be removed twice.
  Reported by:  Staale Kristoffersen
  
  MFC after:1 week

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

Modified: head/sys/dev/mpt/mpt.c
==
--- head/sys/dev/mpt/mpt.c  Fri Sep 24 15:12:18 2010(r213104)
+++ head/sys/dev/mpt/mpt.c  Fri Sep 24 16:40:46 2010(r213105)
@@ -844,13 +844,14 @@ mpt_complete_request_chain(struct mpt_so
MSG_REQUEST_HEADER *msg_hdr;
u_int   cb_index;
 
-   TAILQ_REMOVE(chain, req, links);
msg_hdr = (MSG_REQUEST_HEADER *)req->req_vbuf;
ioc_status_frame.Function = msg_hdr->Function;
ioc_status_frame.MsgContext = msg_hdr->MsgContext;
cb_index = MPT_CONTEXT_TO_CBI(le32toh(msg_hdr->MsgContext));
mpt_reply_handlers[cb_index](mpt, req, msg_hdr->MsgContext,
&ioc_status_frame);
+   if (mpt_req_on_pending_list(mpt, req) != 0)
+   TAILQ_REMOVE(chain, req, links);
}
 }
 
___
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: r213147 - head/sys/dev/mpt

2010-09-24 Thread Marius Strobl
Author: marius
Date: Fri Sep 24 23:54:03 2010
New Revision: 213147
URL: http://svn.freebsd.org/changeset/base/213147

Log:
  Take mpt_req_on_{free,pending}_list() out from under INVARIANTS as these
  are generally useful and not just for debugging.

Modified:
  head/sys/dev/mpt/mpt.h

Modified: head/sys/dev/mpt/mpt.h
==
--- head/sys/dev/mpt/mpt.h  Fri Sep 24 23:51:45 2010(r213146)
+++ head/sys/dev/mpt/mpt.h  Fri Sep 24 23:54:03 2010(r213147)
@@ -1157,19 +1157,13 @@ mpt_tag_2_req(struct mpt_softc *mpt, uin
KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer"));
return (mpt->tgt_cmd_ptrs[rtg]);
 }
-
+#endif
 
 static __inline int
 mpt_req_on_free_list(struct mpt_softc *, request_t *);
 static __inline int
 mpt_req_on_pending_list(struct mpt_softc *, request_t *);
 
-static __inline void
-mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
-static __inline void
-mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
-
-
 /*
  * Is request on freelist?
  */
@@ -1202,6 +1196,12 @@ mpt_req_on_pending_list(struct mpt_softc
return (0);
 }
 
+#ifdef INVARIANTS
+static __inline void
+mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
+static __inline void
+mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
+
 /*
  * Make sure that req *is* part of one of the special lists
  */
___
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"


Re: svn commit: r213105 - head/sys/dev/mpt

2010-09-25 Thread Marius Strobl
On Sat, Sep 25, 2010 at 01:45:44PM +1000, Lawrence Stewart wrote:
> Hi Marius,
> 
> On 09/25/10 02:40, Marius Strobl wrote:
> > Author: marius
> > Date: Fri Sep 24 16:40:46 2010
> > New Revision: 213105
> > URL: http://svn.freebsd.org/changeset/base/213105
> > 
> > Log:
> >   Improve r56796; the reply handler actually may remove the request from
> >   the chain in which case it shouldn't be removed twice.
> >   Reported by:  Staale Kristoffersen
> 
> Can you please provide a bit of extra commentary about the symptoms of
> the issue this patch addresses? Like Staale, I'm running a FreeBSD
> server which uses mpt for its disk subsystem (SunFire X4100 with 2 x
> SATA 2.5" disks in RAID-1) and I've had a series of long running
> problems with the performance of the controller. I'm keeping a close eye
> on all mpt related commits and hope to find the cause sometime.
> 

In case the reply handler also removed the request this triggered
a sanity check in TAILQ_REMOVE with INVARIANTS compiled in, causing
a panic. I don't think it had a negative impact with INVARIANTS
disabled. Also, in order to hit the problem you first had to run
into a timeout leading to an IOC rest like here:
http://folk.uio.no/stalk/mpt/timeout.txt
i.e. I don't think this is related to your performance issue.

Marius

___
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: r213188 - head/sys/dev/mii

2010-09-26 Thread Marius Strobl
Author: marius
Date: Sun Sep 26 22:11:41 2010
New Revision: 213188
URL: http://svn.freebsd.org/changeset/base/213188

Log:
  - Remove clause 3 and 4 from TNF licenses.
  - Remove closes 3 & 4 from Manuel Bouyer's license.
  
  Obtained from:NetBSD

Modified:
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii.h
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/tlphyreg.h
  head/sys/dev/mii/ukphy.c

Modified: head/sys/dev/mii/acphy.c
==
--- head/sys/dev/mii/acphy.cSun Sep 26 21:48:32 2010(r213187)
+++ head/sys/dev/mii/acphy.cSun Sep 26 22:11:41 2010(r213188)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: head/sys/dev/mii/bmtphy.c
==
--- head/sys/dev/mii/bmtphy.c   Sun Sep 26 21:48:32 2010(r213187)
+++ head/sys/dev/mii/bmtphy.c   Sun Sep 26 22:11:41 2010(r213188)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by the NetBSD
- *  Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: head/sys/dev/mii/exphy.c
==
--- head/sys/dev/mii/exphy.cSun Sep 26 21:48:32 2010(r213187)
+++ head/sys/dev/mii/exphy.cSun Sep 26 22:11:41 2010(r213188)
@@ -16,13 +16,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * T

svn commit: r213229 - in head/sys/dev: dc mii

2010-09-27 Thread Marius Strobl
Author: marius
Date: Mon Sep 27 20:31:03 2010
New Revision: 213229
URL: http://svn.freebsd.org/changeset/base/213229

Log:
  Use the mii_data provided via mii_attach_args and mii_pdata respectively
  instead of reaching out for the softc of the parent.

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii_physubr.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/dc/dcphy.c Mon Sep 27 20:31:03 2010(r213229)
@@ -146,7 +146,7 @@ dcphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/dc/pnphy.c
==
--- head/sys/dev/dc/pnphy.c Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/dc/pnphy.c Mon Sep 27 20:31:03 2010(r213229)
@@ -129,7 +129,7 @@ pnphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/mii/acphy.c
==
--- head/sys/dev/mii/acphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/acphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -129,7 +129,7 @@ acphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/mii/amphy.c
==
--- head/sys/dev/mii/amphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/amphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -106,7 +106,7 @@ amphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/atphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -110,7 +110,7 @@ atphy_attach(device_t dev)
sc = &asc->mii_sc;
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/mii/axphy.c
==
--- head/sys/dev/mii/axphy.cMon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/axphy.cMon Sep 27 20:31:03 2010(r213229)
@@ -96,7 +96,7 @@ axphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: head/sys/dev/mii/bmtphy.c
==
--- head/sys/dev/mii/bmtphy.c   Mon Sep 27 20:12:57 2010(r213228)
+++ head/sys/dev/mii/bmtphy.c  

svn commit: r213361 - head/sys/dev/mii

2010-10-02 Thread Marius Strobl
Author: marius
Date: Sat Oct  2 17:20:30 2010
New Revision: 213361
URL: http://svn.freebsd.org/changeset/base/213361

Log:
  Try to adhere to style(9) and be consistent within this file.

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

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Sat Oct  2 17:19:38 2010(r213360)
+++ head/sys/dev/mii/mii.c  Sat Oct  2 17:20:30 2010(r213361)
@@ -128,7 +128,7 @@ miibus_probe(device_t dev)
 */
bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
if (bmsr == 0 || bmsr == 0x ||
-   (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+   (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
/* Assume no PHY at this address. */
continue;
}
@@ -154,11 +154,11 @@ miibus_probe(device_t dev)
}
 
if (child == NULL)
-   return(ENXIO);
+   return (ENXIO);
 
device_set_desc(dev, "MII bus");
 
-   return(0);
+   return (0);
 }
 
 int
@@ -180,7 +180,7 @@ miibus_attach(device_t dev)
ivars->ifmedia_sts);
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 int
@@ -193,7 +193,7 @@ miibus_detach(device_t dev)
ifmedia_removeall(&mii->mii_media);
mii->mii_ifp = NULL;
 
-   return(0);
+   return (0);
 }
 
 static int
@@ -214,10 +214,12 @@ static int
 miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
-   MII_OUI(maa->mii_id1, maa->mii_id2),
-   MII_MODEL(maa->mii_id2), MII_REV(maa->mii_id2));
+   MII_OUI(ma->mii_id1, ma->mii_id2),
+   MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
return (0);
 }
 
@@ -225,8 +227,10 @@ static int
 miibus_child_location_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
-   snprintf(buf, buflen, "phyno=%d", maa->mii_phyno);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
+   snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
return (0);
 }
 
@@ -236,7 +240,7 @@ miibus_readreg(device_t dev, int phy, in
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_READREG(parent, phy, reg));
+   return (MIIBUS_READREG(parent, phy, reg));
 }
 
 static int
@@ -245,7 +249,7 @@ miibus_writereg(device_t dev, int phy, i
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_WRITEREG(parent, phy, reg, data));
+   return (MIIBUS_WRITEREG(parent, phy, reg, data));
 }
 
 static void
@@ -259,7 +263,6 @@ miibus_statchg(device_t dev)
 
mii = device_get_softc(dev);
mii->mii_ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
-   return;
 }
 
 static void
@@ -297,13 +300,11 @@ miibus_mediainit(device_t dev)
mii = device_get_softc(dev);
LIST_FOREACH(m, &mii->mii_media.ifm_list, ifm_list) {
media = m->ifm_media;
-   if (media == (IFM_ETHER|IFM_AUTO))
+   if (media == (IFM_ETHER | IFM_AUTO))
break;
}
 
ifmedia_set(&mii->mii_media, media);
-
-   return;
 }
 
 int
@@ -324,7 +325,7 @@ mii_phy_probe(device_t dev, device_t *ch
for (i = 0; i < MII_NPHY; i++) {
bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
 if (bmsr == 0 || bmsr == 0x ||
-(bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+(bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
 /* Assume no PHY at this address. */
 continue;
 } else
@@ -334,12 +335,12 @@ mii_phy_probe(device_t dev, device_t *ch
if (i == MII_NPHY) {
device_delete_child(dev, *child);
*child = NULL;
-   return(ENXIO);
+   return (ENXIO);
}
 
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 /*
@@ -371,7 +372,7 @@ mii_tick(struct mii_data *mii)
struct mii_softc *child;
 
LIST_FOREACH(child, &mii->mii_phys, mii_list)
-   (void) (*child->mii_service)(child, mii, MII_TICK);
+   (void)(*child->mii_service)(child, mii, MII_TICK);
 }
 
 /*
@@ -386,7 +387,7 @@ mii_pollstat(struct mii_data *mii)
mii->mii_media_active = IFM_NONE;
 
LIST_FOREACH(child, &mii->mii_phys, mii_list)
-   (void) (*child->mii_service)(child, mii, MII_POLLSTAT);
+   (void)(*child->mii_service)(child, mii, MII_P

svn commit: r213364 - in head/sys/dev: dc mii

2010-10-02 Thread Marius Strobl
Author: marius
Date: Sat Oct  2 18:53:12 2010
New Revision: 213364
URL: http://svn.freebsd.org/changeset/base/213364

Log:
  - In the spirit of previous simplifications factor out the checks for a
different PHY instance being selected and isolation out into the wrappers
around the service methods rather than duplicating them over and over
again (besides, a PHY driver shouldn't need to care about which instance
it actually is).
  - Centralize the check for the need to isolate a non-zero PHY instance not
supporting isolation in mii_mediachg() and just ignore it rather than
panicing, which should sufficient given that a) things are likely to
just work anyway if one doesn't plug in more than one port at a time and
b) refusing to attach in this case just leaves us in a unknown but most
likely also not exactly correct configuration (besides several drivers
setting MIIF_NOISOLATE didn't care about these anyway, probably due to
setting this flag for no real reason).
  - Minor fixes like removing unnecessary setting of sc->mii_anegticks,
using sc->mii_anegticks instead of hardcoded values etc.

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Sat Oct  2 17:58:57 2010(r213363)
+++ head/sys/dev/dc/dcphy.c Sat Oct  2 18:53:12 2010(r213364)
@@ -149,7 +149,7 @@ dcphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-   sc->mii_inst = mii->mii_instance;
+   sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = dcphy_service;
sc->mii_pdata = mii;
@@ -159,8 +159,6 @@ dcphy_attach(device_t dev)
 */
sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
-   mii->mii_instance++;
-
/*dcphy_reset(sc);*/
dc_sc = mii->mii_ifp->if_softc;
CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0);
@@ -204,22 +202,10 @@ dcphy_service(struct mii_softc *sc, stru
 
switch (cmd) {
case MII_POLLSTAT:
-   /*
-* If we're not polling our PHY instance, just return.
-*/
-   if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-   return (0);
break;
 
case MII_MEDIACHG:
/*
-* If the media indicates a different PHY instance,
-* isolate ourselves.
-*/
-   if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-   return (0);
-
-   /*
 * If the interface is not up, don't do anything.
 */
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
@@ -276,12 +262,6 @@ dcphy_service(struct mii_softc *sc, stru
 
case MII_TICK:
/*
-* If we're not currently selected, just return.
-*/
-   if (IFM_INST(ife->ifm_media) != sc->mii_inst)
-   return (0);
-
-   /*
 * Is the interface even up?
 */
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)

Modified: head/sys/dev/dc/pnphy.c
==
--- head/sys/dev/dc/pnphy.c Sat Oct  2 17:58:57 2010(r213363)
+++ head/sys/dev/dc/pnphy.c Sat Oct  2 18:53:12 2010(r213364)
@@ -132,7 +132,7 @@ pnphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
-   sc->mii_inst = mii->mii_instance;
+   sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = pnphy_service;
sc->mii_pdata = mii;
@@ -142,8 +142,6 @@ pnphy_attach(device_t dev)
 */
sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP;
 
-   mii->mii_instance++;
-
sc->mii_capabilities =
BMSR_100TXFDX | BMSR_100TXHDX | BMSR_10TFDX | BMSR_1

svn commit: r213384 - in head/sys/dev: dc mii

2010-10-03 Thread Marius Strobl
Author: marius
Date: Sun Oct  3 17:00:57 2010
New Revision: 213384
URL: http://svn.freebsd.org/changeset/base/213384

Log:
  Consistently always explicitly set IFM_HDX for half-duplex.
  
  Obtained from:OpenBSD (mostly)

Modified:
  head/sys/dev/dc/dcphy.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/ukphy_subr.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Sun Oct  3 16:02:53 2010(r213383)
+++ head/sys/dev/dc/dcphy.c Sun Oct  3 17:00:57 2010(r213384)
@@ -341,14 +341,14 @@ dcphy_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_100_TX | IFM_FDX;
else if (anlpar & ANLPAR_T4 &&
sc->mii_capabilities & BMSR_100T4)
-   mii->mii_media_active |= IFM_100_T4;
+   mii->mii_media_active |= IFM_100_T4 | IFM_HDX;
else if (anlpar & ANLPAR_TX &&
sc->mii_capabilities & BMSR_100TXHDX)
-   mii->mii_media_active |= IFM_100_TX;
+   mii->mii_media_active |= IFM_100_TX | IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
mii->mii_media_active |= IFM_10_T | IFM_FDX;
else if (anlpar & ANLPAR_10)
-   mii->mii_media_active |= IFM_10_T;
+   mii->mii_media_active |= IFM_10_T | IFM_HDX;
else
mii->mii_media_active |= IFM_NONE;
if (DC_IS_INTEL(dc_sc))
@@ -366,9 +366,9 @@ dcphy_status(struct mii_softc *sc)
 * change the media settings if we're wrong.
 */
if (!(reg & DC_TSTAT_LS100))
-   mii->mii_media_active |= IFM_100_TX;
+   mii->mii_media_active |= IFM_100_TX | IFM_HDX;
else if (!(reg & DC_TSTAT_LS10))
-   mii->mii_media_active |= IFM_10_T;
+   mii->mii_media_active |= IFM_10_T | IFM_HDX;
else
mii->mii_media_active |= IFM_NONE;
if (DC_IS_INTEL(dc_sc))
@@ -383,6 +383,8 @@ skip:
mii->mii_media_active |= IFM_100_TX;
if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX)
mii->mii_media_active |= IFM_FDX;
+   else
+   mii->mii_media_active |= IFM_HDX;
 }
 
 static int

Modified: head/sys/dev/dc/pnphy.c
==
--- head/sys/dev/dc/pnphy.c Sun Oct  3 16:02:53 2010(r213383)
+++ head/sys/dev/dc/pnphy.c Sun Oct  3 17:00:57 2010(r213384)
@@ -237,4 +237,6 @@ pnphy_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_100_TX;
if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX)
mii->mii_media_active |= IFM_FDX;
+   else
+   mii->mii_media_active |= IFM_HDX;
 }

Modified: head/sys/dev/mii/acphy.c
==
--- head/sys/dev/mii/acphy.cSun Oct  3 16:02:53 2010(r213383)
+++ head/sys/dev/mii/acphy.cSun Oct  3 17:00:57 2010(r213384)
@@ -245,6 +245,8 @@ acphy_status(struct mii_softc *sc)
 
if (diag & AC_DIAG_DUPLEX)
mii->mii_media_active |= IFM_FDX;
+   else
+   mii->mii_media_active |= IFM_HDX;
} else
mii->mii_media_active = ife->ifm_media;
 }

Modified: head/sys/dev/mii/amphy.c
==
--- head/sys/dev/mii/amphy.cSun Oct  3 16:02:53 2010(r213383)
+++ head/sys/dev/mii/amphy.cSun Oct  3 17:00:57 2010(r213384)
@@ -206,13 +206,13 @@ amphy_status(struct mii_softc *sc)
if (anlpar & ANLPAR_TX_FD)
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
else if (anlpar & ANLPAR_T4)
-   mii->mii_media_active |= IFM_100_T4;
+   mii->mii_media_active |= IFM_100_T4|IFM_HDX;
else if (anlpar & ANLPAR_TX)
-   mii->mii_media_active |= IFM_100_TX;
+   mii->mii_media_active |= IFM_100_TX|IFM_HDX;
else if (anlpar & ANLPAR_10_FD)
 

svn commit: r213385 - head/sys/dev/mii

2010-10-03 Thread Marius Strobl
Author: marius
Date: Sun Oct  3 17:05:25 2010
New Revision: 213385
URL: http://svn.freebsd.org/changeset/base/213385

Log:
  Remove an header that apart from the license is empty.

Deleted:
  head/sys/dev/mii/axphyreg.h
Modified:
  head/sys/dev/mii/axphy.c

Modified: head/sys/dev/mii/axphy.c
==
--- head/sys/dev/mii/axphy.cSun Oct  3 17:00:57 2010(r213384)
+++ head/sys/dev/mii/axphy.cSun Oct  3 17:05:25 2010(r213385)
@@ -45,8 +45,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include "miidevs.h"
 
-#include 
-
 #include "miibus_if.h"
 
 static int axphy_probe(device_t dev);
___
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: r213413 - stable/8/usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:39:51 2010
New Revision: 213413
URL: http://svn.freebsd.org/changeset/base/213413

Log:
  MFC: r213053
  
  Remove an explicit assignment of the CFLAGS variable intended for
  debugging purposes only.

Modified:
  stable/8/usr.bin/tftp/Makefile
Directory Properties:
  stable/8/usr.bin/tftp/   (props changed)

Modified: stable/8/usr.bin/tftp/Makefile
==
--- stable/8/usr.bin/tftp/Makefile  Mon Oct  4 18:16:38 2010
(r213412)
+++ stable/8/usr.bin/tftp/Makefile  Mon Oct  4 19:39:51 2010
(r213413)
@@ -1,7 +1,6 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-CFLAGS=-g -Wall
 WARNS= 3
 PROG=  tftp
 SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
___
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: r213414 - stable/7/usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:40:01 2010
New Revision: 213414
URL: http://svn.freebsd.org/changeset/base/213414

Log:
  MFC: r213053
  
  Remove an explicit assignment of the CFLAGS variable intended for
  debugging purposes only.

Modified:
  stable/7/usr.bin/tftp/Makefile
Directory Properties:
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/usr.bin/tftp/Makefile
==
--- stable/7/usr.bin/tftp/Makefile  Mon Oct  4 19:39:51 2010
(r213413)
+++ stable/7/usr.bin/tftp/Makefile  Mon Oct  4 19:40:01 2010
(r213414)
@@ -1,7 +1,6 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-CFLAGS=-g -Wall
 WARNS= 3
 PROG=  tftp
 SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
___
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: r213415 - in stable/8: libexec/tftpd usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:51:15 2010
New Revision: 213415
URL: http://svn.freebsd.org/changeset/base/213415

Log:
  MFC: 213075
  
  Try to adhere to style.Makefile(5).

Modified:
  stable/8/libexec/tftpd/Makefile
  stable/8/usr.bin/tftp/Makefile
Directory Properties:
  stable/8/libexec/tftpd/   (props changed)
  stable/8/usr.bin/tftp/   (props changed)

Modified: stable/8/libexec/tftpd/Makefile
==
--- stable/8/libexec/tftpd/Makefile Mon Oct  4 19:40:01 2010
(r213414)
+++ stable/8/libexec/tftpd/Makefile Mon Oct  4 19:51:15 2010
(r213415)
@@ -2,13 +2,11 @@
 # $FreeBSD$
 
 PROG=  tftpd
-SRCS=  tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c 
tftp-options.c
+MAN=   tftpd.8
+SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
+SRCS+= tftpd.c
 WARNS= 3
 WFORMAT=0
-MAN=   tftpd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd
-.PATH: ${.CURDIR}/../../usr.bin/tftp
-COPTFLAGS = -O
 LDFLAGS= -lwrap
 
 .include 

Modified: stable/8/usr.bin/tftp/Makefile
==
--- stable/8/usr.bin/tftp/Makefile  Mon Oct  4 19:40:01 2010
(r213414)
+++ stable/8/usr.bin/tftp/Makefile  Mon Oct  4 19:51:15 2010
(r213415)
@@ -1,12 +1,14 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-WARNS= 3
+.PATH:  ${.CURDIR}/../../libexec/tftpd
+
 PROG=  tftp
-SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
+SRCS=  main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c
+SRCS+= tftp-utils.c tftp.c
+WARNS= 3
+CFLAGS+=-I${.CURDIR}/../../libexec/tftpd
 DPADD= ${LIBEDIT} ${LIBTERMCAP}
 LDADD= -ledit -ltermcap
-CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp
-.PATH:  ${.CURDIR}/../../libexec/tftpd
 
 .include 
___
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: r213416 - in stable/7: libexec/tftpd usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:51:16 2010
New Revision: 213416
URL: http://svn.freebsd.org/changeset/base/213416

Log:
  MFC: r213075
  
  Try to adhere to style.Makefile(5).

Modified:
  stable/7/libexec/tftpd/Makefile
  stable/7/usr.bin/tftp/Makefile
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/libexec/tftpd/Makefile
==
--- stable/7/libexec/tftpd/Makefile Mon Oct  4 19:51:15 2010
(r213415)
+++ stable/7/libexec/tftpd/Makefile Mon Oct  4 19:51:16 2010
(r213416)
@@ -2,13 +2,11 @@
 # $FreeBSD$
 
 PROG=  tftpd
-SRCS=  tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c 
tftp-options.c
+MAN=   tftpd.8
+SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
+SRCS+= tftpd.c
 WARNS= 3
 WFORMAT=0
-MAN=   tftpd.8
-CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd
-.PATH: ${.CURDIR}/../../usr.bin/tftp
-COPTFLAGS = -O
 LDFLAGS= -lwrap
 
 .include 

Modified: stable/7/usr.bin/tftp/Makefile
==
--- stable/7/usr.bin/tftp/Makefile  Mon Oct  4 19:51:15 2010
(r213415)
+++ stable/7/usr.bin/tftp/Makefile  Mon Oct  4 19:51:16 2010
(r213416)
@@ -1,12 +1,14 @@
 #  @(#)Makefile8.1 (Berkeley) 6/6/93
 # $FreeBSD$
 
-WARNS= 3
+.PATH:  ${.CURDIR}/../../libexec/tftpd
+
 PROG=  tftp
-SRCS=  main.c tftp.c tftp-utils.c tftp-io.c tftp-file.c tftp-transfer.c 
tftp-options.c
+SRCS=  main.c tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c
+SRCS+= tftp-utils.c tftp.c
+WARNS= 3
+CFLAGS+=-I${.CURDIR}/../../libexec/tftpd
 DPADD= ${LIBEDIT} ${LIBTERMCAP}
 LDADD= -ledit -ltermcap
-CFLAGS+=-I${.CURDIR}/../../libexec/tftpd -I${.CURDIR}/../../usr.bin/tftp
-.PATH:  ${.CURDIR}/../../libexec/tftpd
 
 .include 
___
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: r213417 - in stable/8: libexec/tftpd usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:59:08 2010
New Revision: 213417
URL: http://svn.freebsd.org/changeset/base/213417

Log:
  MFC: r213099
  
  Make WARNS=6 clean.

Modified:
  stable/8/libexec/tftpd/Makefile
  stable/8/libexec/tftpd/tftp-file.c
  stable/8/libexec/tftpd/tftp-options.c
  stable/8/libexec/tftpd/tftp-utils.c
  stable/8/libexec/tftpd/tftp-utils.h
  stable/8/libexec/tftpd/tftpd.c
  stable/8/usr.bin/tftp/Makefile
  stable/8/usr.bin/tftp/main.c
Directory Properties:
  stable/8/libexec/tftpd/   (props changed)
  stable/8/usr.bin/tftp/   (props changed)

Modified: stable/8/libexec/tftpd/Makefile
==
--- stable/8/libexec/tftpd/Makefile Mon Oct  4 19:51:16 2010
(r213416)
+++ stable/8/libexec/tftpd/Makefile Mon Oct  4 19:59:08 2010
(r213417)
@@ -5,7 +5,7 @@ PROG=   tftpd
 MAN=   tftpd.8
 SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
 SRCS+= tftpd.c
-WARNS= 3
+WARNS= 6
 WFORMAT=0
 LDFLAGS= -lwrap
 

Modified: stable/8/libexec/tftpd/tftp-file.c
==
--- stable/8/libexec/tftpd/tftp-file.c  Mon Oct  4 19:51:16 2010
(r213416)
+++ stable/8/libexec/tftpd/tftp-file.c  Mon Oct  4 19:59:08 2010
(r213417)
@@ -103,13 +103,13 @@ static size_t
 convert_to_net(char *buffer, size_t count, int init)
 {
size_t i;
-   static size_t n = 0, read = 0;
+   static size_t n = 0, in = 0;
static int newline = 0;
 
if (init) {
newline = 0;
n = 0;
-   read = 0;
+   in = 0;
return 0 ;
}
 
@@ -124,13 +124,13 @@ convert_to_net(char *buffer, size_t coun
}
 
while (i < count) {
-   if (n == read) {
+   if (n == in) {
/* When done we're done */
if (feof(file)) break;
 
/* Otherwise read another bunch */
-   read = fread(convbuffer, 1, count, file);
-   if (read == 0) break;
+   in = fread(convbuffer, 1, count, file);
+   if (in == 0) break;
n = 0;
}
 
@@ -250,7 +250,7 @@ read_close(void)
 
 
 int
-synchnet(int peer)
+synchnet(int peer __unused)
 {
 
return 0;

Modified: stable/8/libexec/tftpd/tftp-options.c
==
--- stable/8/libexec/tftpd/tftp-options.c   Mon Oct  4 19:51:16 2010
(r213416)
+++ stable/8/libexec/tftpd/tftp-options.c   Mon Oct  4 19:59:08 2010
(r213417)
@@ -79,7 +79,8 @@ int options_extra_enabled = 1;
  */
 
 int
-option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf)
+option_tsize(int peer __unused, struct tftphdr *tp __unused, int mode,
+struct stat *stbuf)
 {
 
if (options[OPT_TSIZE].o_request == NULL)
@@ -159,21 +160,19 @@ option_rollover(int peer)
 int
 option_blksize(int peer)
 {
-   int *maxdgram;
-   char maxbuffer[100];
+   u_long maxdgram;
size_t len;
 
if (options[OPT_BLKSIZE].o_request == NULL)
return (0);
 
/* maximum size of an UDP packet according to the system */
-   len = sizeof(maxbuffer);
+   len = sizeof(maxdgram);
if (sysctlbyname("net.inet.udp.maxdgram",
-   maxbuffer, &len, NULL, 0) < 0) {
+   &maxdgram, &len, NULL, 0) < 0) {
tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram");
return (acting_as_client ? 1 : 0);
}
-   maxdgram = (int *)maxbuffer;
 
int size = atoi(options[OPT_BLKSIZE].o_request);
if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {
@@ -191,20 +190,20 @@ option_blksize(int peer)
}
}
 
-   if (size > *maxdgram) {
+   if (size > (int)maxdgram) {
if (acting_as_client) {
tftp_log(LOG_ERR,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
+   "%d bytes.\n", size, maxdgram);
send_error(peer, EBADOP);
return (1);
} else {
tftp_log(LOG_WARNING,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
-   size = *maxdgram;
+   "%d bytes.\n", size, maxdgram);
+   size = maxdgram;
/* No reason to return */
}
}
@@ -220,10 +219,9 @@ option_blksize(int peer)
 }
 
 int
-option_blksize2(int peer)
+option_blksize2(i

svn commit: r213418 - in stable/7: libexec/tftpd usr.bin/tftp

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 19:59:11 2010
New Revision: 213418
URL: http://svn.freebsd.org/changeset/base/213418

Log:
  MFC: r213099
  
  Make WARNS=6 clean.

Modified:
  stable/7/libexec/tftpd/Makefile
  stable/7/libexec/tftpd/tftp-file.c
  stable/7/libexec/tftpd/tftp-options.c
  stable/7/libexec/tftpd/tftp-utils.c
  stable/7/libexec/tftpd/tftp-utils.h
  stable/7/libexec/tftpd/tftpd.c
  stable/7/usr.bin/tftp/Makefile
  stable/7/usr.bin/tftp/main.c
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)
  stable/7/usr.bin/tftp/   (props changed)

Modified: stable/7/libexec/tftpd/Makefile
==
--- stable/7/libexec/tftpd/Makefile Mon Oct  4 19:59:08 2010
(r213417)
+++ stable/7/libexec/tftpd/Makefile Mon Oct  4 19:59:11 2010
(r213418)
@@ -5,7 +5,7 @@ PROG=   tftpd
 MAN=   tftpd.8
 SRCS=  tftp-file.c tftp-io.c tftp-options.c tftp-transfer.c tftp-utils.c
 SRCS+= tftpd.c
-WARNS= 3
+WARNS= 6
 WFORMAT=0
 LDFLAGS= -lwrap
 

Modified: stable/7/libexec/tftpd/tftp-file.c
==
--- stable/7/libexec/tftpd/tftp-file.c  Mon Oct  4 19:59:08 2010
(r213417)
+++ stable/7/libexec/tftpd/tftp-file.c  Mon Oct  4 19:59:11 2010
(r213418)
@@ -103,13 +103,13 @@ static size_t
 convert_to_net(char *buffer, size_t count, int init)
 {
size_t i;
-   static size_t n = 0, read = 0;
+   static size_t n = 0, in = 0;
static int newline = 0;
 
if (init) {
newline = 0;
n = 0;
-   read = 0;
+   in = 0;
return 0 ;
}
 
@@ -124,13 +124,13 @@ convert_to_net(char *buffer, size_t coun
}
 
while (i < count) {
-   if (n == read) {
+   if (n == in) {
/* When done we're done */
if (feof(file)) break;
 
/* Otherwise read another bunch */
-   read = fread(convbuffer, 1, count, file);
-   if (read == 0) break;
+   in = fread(convbuffer, 1, count, file);
+   if (in == 0) break;
n = 0;
}
 
@@ -250,7 +250,7 @@ read_close(void)
 
 
 int
-synchnet(int peer)
+synchnet(int peer __unused)
 {
 
return 0;

Modified: stable/7/libexec/tftpd/tftp-options.c
==
--- stable/7/libexec/tftpd/tftp-options.c   Mon Oct  4 19:59:08 2010
(r213417)
+++ stable/7/libexec/tftpd/tftp-options.c   Mon Oct  4 19:59:11 2010
(r213418)
@@ -79,7 +79,8 @@ int options_extra_enabled = 1;
  */
 
 int
-option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf)
+option_tsize(int peer __unused, struct tftphdr *tp __unused, int mode,
+struct stat *stbuf)
 {
 
if (options[OPT_TSIZE].o_request == NULL)
@@ -159,21 +160,19 @@ option_rollover(int peer)
 int
 option_blksize(int peer)
 {
-   int *maxdgram;
-   char maxbuffer[100];
+   u_long maxdgram;
size_t len;
 
if (options[OPT_BLKSIZE].o_request == NULL)
return (0);
 
/* maximum size of an UDP packet according to the system */
-   len = sizeof(maxbuffer);
+   len = sizeof(maxdgram);
if (sysctlbyname("net.inet.udp.maxdgram",
-   maxbuffer, &len, NULL, 0) < 0) {
+   &maxdgram, &len, NULL, 0) < 0) {
tftp_log(LOG_ERR, "sysctl: net.inet.udp.maxdgram");
return (acting_as_client ? 1 : 0);
}
-   maxdgram = (int *)maxbuffer;
 
int size = atoi(options[OPT_BLKSIZE].o_request);
if (size < BLKSIZE_MIN || size > BLKSIZE_MAX) {
@@ -191,20 +190,20 @@ option_blksize(int peer)
}
}
 
-   if (size > *maxdgram) {
+   if (size > (int)maxdgram) {
if (acting_as_client) {
tftp_log(LOG_ERR,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
+   "%d bytes.\n", size, maxdgram);
send_error(peer, EBADOP);
return (1);
} else {
tftp_log(LOG_WARNING,
"Invalid blocksize (%d bytes), "
"net.inet.udp.maxdgram sysctl limits it to "
-   "%d bytes.\n", size, *maxdgram);
-   size = *maxdgram;
+   "%d bytes.\n", size, maxdgram);
+   size = maxdgram;
/* No reason to return */
}
}
@@ -220,10 +219,9 @@ option_blksize(int peer)
 }
 
 int
-option_blksize2(int peer)
+option_blksize2(i

svn commit: r213419 - stable/8/libexec/tftpd

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 20:02:48 2010
New Revision: 213419
URL: http://svn.freebsd.org/changeset/base/213419

Log:
  MFC: r213102
  
  Remove the duplicate logging of failed read requests, whose error message
  also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not
  just the case the -n option is intended to deal with and thus really spammed
  us with ~20 messages in the default configuration when booting a diskless
  FreeBSD client, introduced with r207608 (commited to stable/8 in 213038)
  again.

Modified:
  stable/8/libexec/tftpd/tftpd.c
Directory Properties:
  stable/8/libexec/tftpd/   (props changed)

Modified: stable/8/libexec/tftpd/tftpd.c
==
--- stable/8/libexec/tftpd/tftpd.c  Mon Oct  4 19:59:11 2010
(r213418)
+++ stable/8/libexec/tftpd/tftpd.c  Mon Oct  4 20:02:48 2010
(r213419)
@@ -604,7 +604,6 @@ tftp_rrq(int peer, char *recvbuffer, ssi
 */
if (suppress_naks && *filename != '/' && ecode == ENOTFOUND)
exit(0);
-   tftp_log(LOG_ERR, "Prevent NAK storm");
send_error(peer, ecode);
exit(1);
}
___
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: r213420 - stable/7/libexec/tftpd

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 20:02:54 2010
New Revision: 213420
URL: http://svn.freebsd.org/changeset/base/213420

Log:
  MFC: r213102
  
  Remove the duplicate logging of failed read requests, whose error message
  also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not
  just the case the -n option is intended to deal with and thus really spammed
  us with ~20 messages in the default configuration when booting a diskless
  FreeBSD client, introduced with r207608 commited to stable/7 in r213039)
  again.

Modified:
  stable/7/libexec/tftpd/tftpd.c
Directory Properties:
  stable/7/libexec/tftpd/   (props changed)

Modified: stable/7/libexec/tftpd/tftpd.c
==
--- stable/7/libexec/tftpd/tftpd.c  Mon Oct  4 20:02:48 2010
(r213419)
+++ stable/7/libexec/tftpd/tftpd.c  Mon Oct  4 20:02:54 2010
(r213420)
@@ -604,7 +604,6 @@ tftp_rrq(int peer, char *recvbuffer, ssi
 */
if (suppress_naks && *filename != '/' && ecode == ENOTFOUND)
exit(0);
-   tftp_log(LOG_ERR, "Prevent NAK storm");
send_error(peer, ecode);
exit(1);
}
___
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: r213421 - stable/8/sys/dev/mpt

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 20:13:19 2010
New Revision: 213421
URL: http://svn.freebsd.org/changeset/base/213421

Log:
  MFC: r213105, r213147
  
  Improve r56796; the reply handler actually may remove the request from
  the chain in which case it shouldn't be removed twice.
  Reported by:  Staale Kristoffersen

Modified:
  stable/8/sys/dev/mpt/mpt.c
  stable/8/sys/dev/mpt/mpt.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mpt/mpt.c
==
--- stable/8/sys/dev/mpt/mpt.c  Mon Oct  4 20:02:54 2010(r213420)
+++ stable/8/sys/dev/mpt/mpt.c  Mon Oct  4 20:13:19 2010(r213421)
@@ -844,13 +844,14 @@ mpt_complete_request_chain(struct mpt_so
MSG_REQUEST_HEADER *msg_hdr;
u_int   cb_index;
 
-   TAILQ_REMOVE(chain, req, links);
msg_hdr = (MSG_REQUEST_HEADER *)req->req_vbuf;
ioc_status_frame.Function = msg_hdr->Function;
ioc_status_frame.MsgContext = msg_hdr->MsgContext;
cb_index = MPT_CONTEXT_TO_CBI(le32toh(msg_hdr->MsgContext));
mpt_reply_handlers[cb_index](mpt, req, msg_hdr->MsgContext,
&ioc_status_frame);
+   if (mpt_req_on_pending_list(mpt, req) != 0)
+   TAILQ_REMOVE(chain, req, links);
}
 }
 

Modified: stable/8/sys/dev/mpt/mpt.h
==
--- stable/8/sys/dev/mpt/mpt.h  Mon Oct  4 20:02:54 2010(r213420)
+++ stable/8/sys/dev/mpt/mpt.h  Mon Oct  4 20:13:19 2010(r213421)
@@ -1157,19 +1157,13 @@ mpt_tag_2_req(struct mpt_softc *mpt, uin
KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer"));
return (mpt->tgt_cmd_ptrs[rtg]);
 }
-
+#endif
 
 static __inline int
 mpt_req_on_free_list(struct mpt_softc *, request_t *);
 static __inline int
 mpt_req_on_pending_list(struct mpt_softc *, request_t *);
 
-static __inline void
-mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
-static __inline void
-mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
-
-
 /*
  * Is request on freelist?
  */
@@ -1202,6 +1196,12 @@ mpt_req_on_pending_list(struct mpt_softc
return (0);
 }
 
+#ifdef INVARIANTS
+static __inline void
+mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
+static __inline void
+mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
+
 /*
  * Make sure that req *is* part of one of the special lists
  */
___
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: r213422 - stable/7/sys/dev/mpt

2010-10-04 Thread Marius Strobl
Author: marius
Date: Mon Oct  4 20:13:21 2010
New Revision: 213422
URL: http://svn.freebsd.org/changeset/base/213422

Log:
  MFC: r213105, r213147
  
  Improve r56796; the reply handler actually may remove the request from
  the chain in which case it shouldn't be removed twice.
  Reported by:  Staale Kristoffersen

Modified:
  stable/7/sys/dev/mpt/mpt.c
  stable/7/sys/dev/mpt/mpt.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mpt/mpt.c
==
--- stable/7/sys/dev/mpt/mpt.c  Mon Oct  4 20:13:19 2010(r213421)
+++ stable/7/sys/dev/mpt/mpt.c  Mon Oct  4 20:13:21 2010(r213422)
@@ -842,13 +842,14 @@ mpt_complete_request_chain(struct mpt_so
MSG_REQUEST_HEADER *msg_hdr;
u_int   cb_index;
 
-   TAILQ_REMOVE(chain, req, links);
msg_hdr = (MSG_REQUEST_HEADER *)req->req_vbuf;
ioc_status_frame.Function = msg_hdr->Function;
ioc_status_frame.MsgContext = msg_hdr->MsgContext;
cb_index = MPT_CONTEXT_TO_CBI(le32toh(msg_hdr->MsgContext));
mpt_reply_handlers[cb_index](mpt, req, msg_hdr->MsgContext,
&ioc_status_frame);
+   if (mpt_req_on_pending_list(mpt, req) != 0)
+   TAILQ_REMOVE(chain, req, links);
}
 }
 

Modified: stable/7/sys/dev/mpt/mpt.h
==
--- stable/7/sys/dev/mpt/mpt.h  Mon Oct  4 20:13:19 2010(r213421)
+++ stable/7/sys/dev/mpt/mpt.h  Mon Oct  4 20:13:21 2010(r213422)
@@ -1155,19 +1155,13 @@ mpt_tag_2_req(struct mpt_softc *mpt, uin
KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer"));
return (mpt->tgt_cmd_ptrs[rtg]);
 }
-
+#endif
 
 static __inline int
 mpt_req_on_free_list(struct mpt_softc *, request_t *);
 static __inline int
 mpt_req_on_pending_list(struct mpt_softc *, request_t *);
 
-static __inline void
-mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
-static __inline void
-mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
-
-
 /*
  * Is request on freelist?
  */
@@ -1200,6 +1194,12 @@ mpt_req_on_pending_list(struct mpt_softc
return (0);
 }
 
+#ifdef INVARIANTS
+static __inline void
+mpt_req_spcl(struct mpt_softc *, request_t *, const char *, int);
+static __inline void
+mpt_req_not_spcl(struct mpt_softc *, request_t *, const char *, int);
+
 /*
  * Make sure that req *is* part of one of the special lists
  */
___
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: r213575 - head/sys/sun4v/include

2010-10-08 Thread Marius Strobl
Author: marius
Date: Fri Oct  8 14:50:58 2010
New Revision: 213575
URL: http://svn.freebsd.org/changeset/base/213575

Log:
  Just use the sparc64 version of this header rather than duplicating it.

Modified:
  head/sys/sun4v/include/endian.h

Modified: head/sys/sun4v/include/endian.h
==
--- head/sys/sun4v/include/endian.h Fri Oct  8 14:31:49 2010
(r213574)
+++ head/sys/sun4v/include/endian.h Fri Oct  8 14:50:58 2010
(r213575)
@@ -1,122 +1,7 @@
 /*-
- * Copyright (c) 1987, 1991, 1993
- * The Regents of the University of California.  All rights reserved.
+ * This file is in the public domain.
  *
- * 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.
- * 4. Neither the name of the University nor the names of its contributors
- *may be used to endorse or promote products derived from this software
- *without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * @(#)endian.h8.1 (Berkeley) 6/10/93
  * $FreeBSD$
  */
 
-#ifndef _MACHINE_ENDIAN_H_
-#define_MACHINE_ENDIAN_H_
-
-#include 
-#include 
-
-/*
- * Define the order of 32-bit words in 64-bit words.
- */
-#define_QUAD_HIGHWORD 0
-#define_QUAD_LOWWORD 1
-
-/*
- * Definitions for byte order, according to byte significance from low
- * address to high.
- */
-#define_LITTLE_ENDIAN  1234/* LSB first: i386, vax */
-#define_BIG_ENDIAN 4321/* MSB first: 68000, ibm, net */
-#define_PDP_ENDIAN 3412/* LSB first in word, MSW first in long 
*/
-
-#define_BYTE_ORDER _BIG_ENDIAN
-
-/*
- * Deprecated variants that don't have enough underscores to be useful in more
- * strict namespaces.
- */
-#if __BSD_VISIBLE
-#defineLITTLE_ENDIAN   _LITTLE_ENDIAN
-#defineBIG_ENDIAN  _BIG_ENDIAN
-#definePDP_ENDIAN  _PDP_ENDIAN
-#defineBYTE_ORDER  _BYTE_ORDER
-#endif
-
-#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
-#define__is_constant(x)__builtin_constant_p(x)
-#else
-#define__is_constant(x)0
-#endif
-
-#define__bswap16_const(x)  x) >> 8) & 0xff) |  
\
-   (((x) << 8) & 0xff00))
-#define__bswap32_const(x)  x) >> 24) & 0xff) | 
\
-   (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff) |   \
-   (((x) << 24) & 0xff00))
-#define__bswap64_const(x)  x) >> 56) & 0xff) | 
\
-   (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff) | \
-   (((x) >> 8) & 0xff00) | \
-   (((x) << 8) & ((__uint64_t)0xff << 32)) |   \
-   (((x) << 24) & ((__uint64_t)0xff << 40)) |  \
-   (((x) << 40) & ((__uint64_t)0xff << 48)) |  \
-   (((x) << 56) & ((__uint64_t)0xff << 56)))
-
-static __inline __uint16_t
-__bswap16_var(__uint16_t _x)
-{
-
-   return ((_x >> 8) | ((_x << 8) & 0xff00));
-}
-
-static __inline __uint32_t
-__bswap32_var(__uint32_t _x)
-{
-
-   return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff) |
-   ((_x << 24) & 0xff00));
-}
-
-static __inline __uint64_t
-__bswap64_var(__uint64_t _x)
-{
-
-   return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff) |
-   ((_x >> 8) & 0xff00) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
-   ((_x << 24) & ((__uint64_t)0xff << 40)) |
-   ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
-}
-
-#define__bswap16(x)(__is_constant(x) ? __bswap16_const(x) : \
-   __bswap16_var(x))
-#define__bswap32(x)(__is_co

svn commit: r213578 - head/sys/sparc64/include

2010-10-08 Thread Marius Strobl
Author: marius
Date: Fri Oct  8 14:59:45 2010
New Revision: 213578
URL: http://svn.freebsd.org/changeset/base/213578

Log:
  In the replacement text of the __bswapN_const() macros cast the argument
  to the expected type so they work like the corresponding __bswapN_var()
  functions and the compiler doesn't complain when arguments of different
  width are passed.

Modified:
  head/sys/sparc64/include/endian.h

Modified: head/sys/sparc64/include/endian.h
==
--- head/sys/sparc64/include/endian.h   Fri Oct  8 14:59:14 2010
(r213577)
+++ head/sys/sparc64/include/endian.h   Fri Oct  8 14:59:45 2010
(r213578)
@@ -69,18 +69,20 @@
 #define__is_constant(x)0
 #endif
 
-#define__bswap16_const(x)  x) >> 8) & 0xff) |  
\
-   (((x) << 8) & 0xff00))
-#define__bswap32_const(x)  x) >> 24) & 0xff) | 
\
-   (((x) >> 8) & 0xff00) | (((x) << 8) & 0xff) |   \
-   (((x) << 24) & 0xff00))
-#define__bswap64_const(x)  x) >> 56) & 0xff) | 
\
-   (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff) | \
-   (((x) >> 8) & 0xff00) | \
-   (((x) << 8) & ((__uint64_t)0xff << 32)) |   \
-   (((x) << 24) & ((__uint64_t)0xff << 40)) |  \
-   (((x) << 40) & ((__uint64_t)0xff << 48)) |  \
-   (((x) << 56) & ((__uint64_t)0xff << 56)))
+#define__bswap16_const(x)  __uint16_t)(x) >> 8) & 0xff) |  
\
+   (((__uint16_t)(x) << 8) & 0xff00))
+#define__bswap32_const(x)  __uint32_t)(x) >> 24) & 0xff) | 
\
+   (((__uint32_t)(x) >> 8) & 0xff00) | \
+   (((__uint32_t)(x)<< 8) & 0xff) |\
+   (((__uint32_t)(x) << 24) & 0xff00))
+#define__bswap64_const(x)  __uint64_t)(x) >> 56) & 0xff) | 
\
+   (((__uint64_t)(x) >> 40) & 0xff00) |\
+   (((__uint64_t)(x) >> 24) & 0xff) |  \
+   (((__uint64_t)(x) >> 8) & 0xff00) | \
+   (((__uint64_t)(x) << 8) & ((__uint64_t)0xff << 32)) |   \
+   (((__uint64_t)(x) << 24) & ((__uint64_t)0xff << 40)) |  \
+   (((__uint64_t)(x) << 40) & ((__uint64_t)0xff << 48)) |  \
+   (((__uint64_t)(x) << 56) & ((__uint64_t)0xff << 56)))
 
 static __inline __uint16_t
 __bswap16_var(__uint16_t _x)
___
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: r213867 - head/sys/dev/mii

2010-10-14 Thread Marius Strobl
Author: marius
Date: Thu Oct 14 21:30:13 2010
New Revision: 213867
URL: http://svn.freebsd.org/changeset/base/213867

Log:
  Just like xmphy(4) this driver doesn't use any of the generic subroutines
  so there's no need to fill mii_{ext,}capabilities either.

Modified:
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Oct 14 21:29:51 2010(r213866)
+++ head/sys/dev/mii/brgphy.c   Thu Oct 14 21:30:13 2010(r213867)
@@ -279,10 +279,6 @@ brgphy_attach(device_t dev)
 
brgphy_reset(sc);
 
-   /* Read the PHY's capabilities. */
-   sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
-   if (sc->mii_capabilities & BMSR_EXTSTAT)
-   sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
device_printf(dev, " ");
 
 #defineADD(m, c)   ifmedia_add(&mii->mii_media, (m), (c), NULL)
___
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: r213868 - head/sys/sparc64/sparc64

2010-10-14 Thread Marius Strobl
Author: marius
Date: Thu Oct 14 21:34:53 2010
New Revision: 213868
URL: http://svn.freebsd.org/changeset/base/213868

Log:
  - In the spirit of r212559 add a comment describing what will eventually
lower the PIL.
  - Just as with the AP ensure that the (S)TICK timer(s) are in a known
state when starting BSPs.

Modified:
  head/sys/sparc64/sparc64/mp_machdep.c

Modified: head/sys/sparc64/sparc64/mp_machdep.c
==
--- head/sys/sparc64/sparc64/mp_machdep.c   Thu Oct 14 21:30:13 2010
(r213867)
+++ head/sys/sparc64/sparc64/mp_machdep.c   Thu Oct 14 21:34:53 2010
(r213868)
@@ -433,6 +433,12 @@ cpu_mp_bootstrap(struct pcpu *pc)
 */
cache_enable(pc->pc_impl);
 
+   /*
+* Clear (S)TICK timer(s) (including NPT) and ensure they are stopped.
+*/
+   tick_clear(pc->pc_impl);
+   tick_stop(pc->pc_impl);
+
/* Lock the kernel TSB in the TLB. */
pmap_map_tsb();
 
@@ -445,7 +451,11 @@ cpu_mp_bootstrap(struct pcpu *pc)
/* Initialize global registers. */
cpu_setregs(pc);
 
-   /* Enable interrupts. */
+   /*
+* Enable interrupts.
+* Note that the PIL we be lowered indirectly via sched_throw(NULL)
+* when fake spinlock held by the idle thread eventually is released.
+*/
wrpr(pstate, 0, PSTATE_KERNEL);
 
smp_cpus++;
___
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: r213873 - head/sys/sparc64/sparc64

2010-10-14 Thread Marius Strobl
Author: marius
Date: Thu Oct 14 21:46:53 2010
New Revision: 213873
URL: http://svn.freebsd.org/changeset/base/213873

Log:
  Explicitly lower the PIL to 0 as part of enabling interrupts, similar to
  what is done on other platforms. Unlike as with the sched_throw(NULL)
  called on BSPs during their startup apparently there's nothing which will
  reliably lower it on APs. I'm unsure why this only came up on V215 though,
  breaking these with r207248. My best guess is that these are the only
  supported ones so far fast enough to loose some race.
  
  PR:   151404
  MFC after:3 days

Modified:
  head/sys/sparc64/sparc64/machdep.c

Modified: head/sys/sparc64/sparc64/machdep.c
==
--- head/sys/sparc64/sparc64/machdep.c  Thu Oct 14 21:45:41 2010
(r213872)
+++ head/sys/sparc64/sparc64/machdep.c  Thu Oct 14 21:46:53 2010
(r213873)
@@ -590,6 +590,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
+   wrpr(pil, 0, 0);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*
___
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: r213878 - in head/sys: dev/mii modules/mii

2010-10-14 Thread Marius Strobl
Author: marius
Date: Thu Oct 14 22:01:40 2010
New Revision: 213878
URL: http://svn.freebsd.org/changeset/base/213878

Log:
  Add a NetBSD-compatible mii_attach(), which is intended to eventually
  replace mii_phy_probe() altogether. Compared to the latter the advantages
  of mii_attach() are:
  - intended to be called multiple times in order to attach PHYs in multiple
passes (f.e. in order to only use sub-ranges of the 0 to MII_NPHY - 1
range)
  - being able to pass along the capability mask from the NIC to the PHY
drivers
  - being able to specify at which address (phyloc) to probe for a PHY
(instead of always probing at all addresses from 0 to MII_NPHY - 1)
  - being able to specify which PHY instance (offloc) to attach
  - being able to pass along MIIF_* flags from the NIC to the PHY drivers
(f.e. as required to indicated to the PHY drivers that flow control is
supported by the NIC driver, which actually is the motivation for this
change).
  
  While at it, I used the opportunity to get rid of some hacks in mii(4)
  like miibus_probe() generally doing work besides sheer probing and the
  "EVIL HACK" (which will vanish entirely along with mii_phy_probe()) by
  passing the struct ifnet pointer via an argument of mii_attach() as well
  as to fix some resource leaks in mii(4) in case something fails.
  Commits which will update the PHY drivers to honor the MII flags passed
  down from the NIC drivers and take advantage of mii_attach() to get rid
  of certain types of hacks in NIC and PHY drivers as well as a conversion
  of the remaining uses of mii_phy_probe() will follow shortly.
  
  Reviewed by:  jhb, yongari
  Obtained from:NetBSD (partially)

Modified:
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/mii.h
  head/sys/dev/mii/miivar.h
  head/sys/modules/mii/Makefile

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Thu Oct 14 21:58:51 2010(r213877)
+++ head/sys/dev/mii/mii.c  Thu Oct 14 22:01:40 2010(r213878)
@@ -58,6 +58,8 @@ MODULE_VERSION(miibus, 1);
 #include "miibus_if.h"
 
 static int miibus_print_child(device_t dev, device_t child);
+static int miibus_read_ivar(device_t dev, device_t child, int which,
+uintptr_t *result);
 static int miibus_child_location_str(device_t bus, device_t child, char *buf,
 size_t buflen);
 static int miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
@@ -77,6 +79,7 @@ static device_method_t miibus_methods[] 
 
/* bus interface */
DEVMETHOD(bus_print_child,  miibus_print_child),
+   DEVMETHOD(bus_read_ivar,miibus_read_ivar),
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
DEVMETHOD(bus_child_pnpinfo_str, miibus_child_pnpinfo_str),
DEVMETHOD(bus_child_location_str, miibus_child_location_str),
@@ -100,87 +103,52 @@ driver_t miibus_driver = {
 };
 
 struct miibus_ivars {
+   struct ifnet*ifp;
ifm_change_cb_t ifmedia_upd;
ifm_stat_cb_t   ifmedia_sts;
+   int mii_flags;
 };
 
-/*
- * Helper function used by network interface drivers, attaches PHYs
- * to the network interface driver parent.
- */
 int
 miibus_probe(device_t dev)
 {
-   struct mii_attach_args  ma, *args;
-   struct mii_data *mii;
-   device_tchild = NULL, parent;
-   int bmsr, capmask = 0x;
-
-   mii = device_get_softc(dev);
-   parent = device_get_parent(dev);
-   LIST_INIT(&mii->mii_phys);
-
-   for (ma.mii_phyno = 0; ma.mii_phyno < MII_NPHY; ma.mii_phyno++) {
-   /*
-* Check to see if there is a PHY at this address.  Note,
-* many braindead PHYs report 0/0 in their ID registers,
-* so we test for media in the BMSR.
-*/
-   bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
-   if (bmsr == 0 || bmsr == 0x ||
-   (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
-   /* Assume no PHY at this address. */
-   continue;
-   }
-
-   /*
-* Extract the IDs. Braindead PHYs will be handled by
-* the `ukphy' driver, as we have no ID information to
-* match on.
-*/
-   ma.mii_id1 = MIIBUS_READREG(parent, ma.mii_phyno,
-   MII_PHYIDR1);
-   ma.mii_id2 = MIIBUS_READREG(parent, ma.mii_phyno,
-   MII_PHYIDR2);
-
-   ma.mii_data = mii;
-   ma.mii_capmask = capmask;
-
-   args = malloc(sizeof(struct mii_attach_args),
-   M_DEVBUF, M_NOWAIT);
-   bcopy((char *)&ma, (char *)args, sizeof(ma));
-   child = device_add_child(dev, NULL, -1);
-   device_set_ivars(child, args);
-   }
-
-  

svn commit: r213893 - in head/sys: arm/econa arm/xscale/ixp425 dev/ae dev/age dev/alc dev/ale dev/bfe dev/bge dev/bm dev/cas dev/dc dev/fxp dev/gem dev/hme dev/jme dev/mge dev/mii dev/msk dev/pcn d...

2010-10-15 Thread Marius Strobl
Author: marius
Date: Fri Oct 15 14:52:11 2010
New Revision: 213893
URL: http://svn.freebsd.org/changeset/base/213893

Log:
  Convert the PHY drivers to honor the mii_flags passed down and convert
  the NIC drivers as well as the PHY drivers to take advantage of the
  mii_attach() introduced in r213878 to get rid of certain hacks. For
  the most part these were:
  - Artificially limiting miibus_{read,write}reg methods to certain PHY
addresses; we now let mii_attach() only probe the PHY at the desired
address(es) instead.
  - PHY drivers setting MIIF_* flags based on the NIC driver they hang
off from, partly even based on grabbing and using the softc of the
parent; we now pass these flags down from the NIC to the PHY drivers
via mii_attach(). This got us rid of all such hacks except those of
brgphy() in combination with bce(4) and bge(4), which is way beyond
what can be expressed with simple flags.
  
  While at it, I took the opportunity to change the NIC drivers to pass
  up the error returned by mii_attach() (previously by mii_phy_probe())
  and unify the error message used in this case where and as appropriate
  as mii_attach() actually can fail for a number of reasons, not just
  because of no PHY(s) being present at the expected address(es).
  
  Reviewed by:  jhb, yongari

Modified:
  head/sys/arm/econa/if_ece.c
  head/sys/arm/xscale/ixp425/if_npe.c
  head/sys/dev/ae/if_ae.c
  head/sys/dev/ae/if_aevar.h
  head/sys/dev/age/if_age.c
  head/sys/dev/alc/if_alc.c
  head/sys/dev/ale/if_ale.c
  head/sys/dev/bfe/if_bfe.c
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h
  head/sys/dev/bm/if_bm.c
  head/sys/dev/cas/if_cas.c
  head/sys/dev/cas/if_casvar.h
  head/sys/dev/dc/if_dc.c
  head/sys/dev/dc/pnphy.c
  head/sys/dev/fxp/if_fxp.c
  head/sys/dev/gem/if_gem.c
  head/sys/dev/gem/if_gemvar.h
  head/sys/dev/hme/if_hme.c
  head/sys/dev/jme/if_jme.c
  head/sys/dev/mge/if_mge.c
  head/sys/dev/mge/if_mgevar.h
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/exphy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/inphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/ruephy.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c
  head/sys/dev/msk/if_msk.c
  head/sys/dev/pcn/if_pcn.c
  head/sys/dev/re/if_re.c
  head/sys/dev/sk/if_sk.c
  head/sys/dev/ste/if_ste.c
  head/sys/dev/stge/if_stge.c
  head/sys/dev/tsec/if_tsec.c
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vr/if_vr.c
  head/sys/dev/vr/if_vrreg.h
  head/sys/dev/xl/if_xl.c
  head/sys/mips/cavium/octe/octe.c
  head/sys/mips/rmi/dev/nlge/if_nlge.c
  head/sys/pci/if_rl.c

Modified: head/sys/arm/econa/if_ece.c
==
--- head/sys/arm/econa/if_ece.c Fri Oct 15 14:34:34 2010(r213892)
+++ head/sys/arm/econa/if_ece.c Fri Oct 15 14:52:11 2010(r213893)
@@ -353,10 +353,11 @@ ece_attach(device_t dev)
}
ece_set_mac(sc, eaddr);
sc->ifp = ifp = if_alloc(IFT_ETHER);
-   if (mii_phy_probe(dev, &sc->miibus, ece_ifmedia_upd,
-   ece_ifmedia_sts)) {
-   device_printf(dev, "Cannot find my PHY.\n");
-   err = ENXIO;
+   /* Only one PHY at address 0 in this device. */
+   err = mii_attach(dev, &sc->miibus, ifp, ece_ifmedia_upd,
+   ece_ifmedia_sts, BMSR_DEFCAPMASK, 0, MII_OFFSET_ANY, 0);
+   if (err != 0) {
+   device_printf(dev, "attaching PHYs failed\n");
goto out;
}
ifp->if_softc = sc;
@@ -1904,9 +1905,6 @@ static int
 ece_miibus_readreg(device_t dev, int phy, int reg)
 {
struct ece_softc *sc;
-   /* Only one phy in this device. */
-   if (phy>0)
-   return (0);
sc = device_get_softc(dev);
return (phy_read(sc, phy, reg));
 }

Modified: head/sys/arm/xscale/ixp425/if_npe.c
==
--- head/sys/arm/xscale/ixp425/if_npe.c Fri Oct 15 14:34:34 2010
(r213892)
+++ head/sys/arm/xscale/ixp425/if_npe.c Fri Oct 15 14:52:11 2010
(r213893)
@@ -137,7 +137,6 @@ struct npe_softc {
int rx_freeqid; /* rx free buffers qid */
int tx_qid; /* tx qid */
int tx_doneqid; /* tx completed qid */
-   int sc_phy;

svn commit: r213894 - in head/sys: arm/at91 dev/bce dev/ed dev/et dev/lge dev/nfe dev/nge dev/nve dev/sf dev/sge dev/sis dev/smc dev/tl dev/tx dev/usb/net dev/wb mips/atheros mips/idt

2010-10-15 Thread Marius Strobl
Author: marius
Date: Fri Oct 15 15:00:30 2010
New Revision: 213894
URL: http://svn.freebsd.org/changeset/base/213894

Log:
  Converted the remainder of the NIC drivers to use the mii_attach()
  introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these
  are only straight forward conversions though.
  
  Reviewed by:  yongari

Modified:
  head/sys/arm/at91/if_ate.c
  head/sys/arm/at91/if_macb.c
  head/sys/dev/bce/if_bce.c
  head/sys/dev/ed/if_ed_pccard.c
  head/sys/dev/et/if_et.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/nge/if_nge.c
  head/sys/dev/nve/if_nve.c
  head/sys/dev/sf/if_sf.c
  head/sys/dev/sge/if_sge.c
  head/sys/dev/sis/if_sis.c
  head/sys/dev/smc/if_smc.c
  head/sys/dev/tl/if_tl.c
  head/sys/dev/tx/if_tx.c
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/wb/if_wb.c
  head/sys/mips/atheros/if_arge.c
  head/sys/mips/idt/if_kr.c

Modified: head/sys/arm/at91/if_ate.c
==
--- head/sys/arm/at91/if_ate.c  Fri Oct 15 14:52:11 2010(r213893)
+++ head/sys/arm/at91/if_ate.c  Fri Oct 15 15:00:30 2010(r213894)
@@ -318,9 +318,11 @@ ate_attach(device_t dev)
}
 
sc->ifp = ifp = if_alloc(IFT_ETHER);
-   if (mii_phy_probe(dev, &sc->miibus, ate_ifmedia_upd, ate_ifmedia_sts)) {
+   err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd,
+   ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
device_printf(dev, "Cannot find my PHY.\n");
-   err = ENXIO;
+   if (err != 0) {
+   device_printf(dev, "attaching PHYs failed\n");
goto out;
}
/*

Modified: head/sys/arm/at91/if_macb.c
==
--- head/sys/arm/at91/if_macb.c Fri Oct 15 14:52:11 2010(r213893)
+++ head/sys/arm/at91/if_macb.c Fri Oct 15 15:00:30 2010(r213894)
@@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -1365,9 +1364,10 @@ macb_attach(device_t dev)
write_4(sc, EMAC_NCR, MPE_ENABLE); //enable MPE
 
sc->ifp = ifp = if_alloc(IFT_ETHER);
-   if (mii_phy_probe(dev, &sc->miibus, macb_ifmedia_upd, 
macb_ifmedia_sts)) {
-   device_printf(dev, "Cannot find my PHY.\n");
-   err = ENXIO;
+   err = mii_attach(dev, &sc->miibus, ifp, macb_ifmedia_upd,
+   macb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+   if (err != 0) {
+   device_printf(dev, "attaching PHYs failed\n");
goto out;
}
 

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Fri Oct 15 14:52:11 2010(r213893)
+++ head/sys/dev/bce/if_bce.c   Fri Oct 15 15:00:30 2010(r213894)
@@ -1140,12 +1140,13 @@ bce_attach(device_t dev)
/* Handle any special PHY initialization for SerDes PHYs. */
bce_init_media(sc);
 
-   /* MII child bus by probing the PHY. */
-   if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
-   bce_ifmedia_sts)) {
-   BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n",
-   __FILE__, __LINE__);
-   rc = ENXIO;
+   /* MII child bus by attaching the PHY. */
+   rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
+   bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
+   MII_OFFSET_ANY, 0);
+   if (rc != 0) {
+   BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
+   __LINE__);
goto bce_attach_fail;
}
 

Modified: head/sys/dev/ed/if_ed_pccard.c
==
--- head/sys/dev/ed/if_ed_pccard.c  Fri Oct 15 14:52:11 2010
(r213893)
+++ head/sys/dev/ed/if_ed_pccard.c  Fri Oct 15 15:00:30 2010
(r213894)
@@ -578,25 +578,21 @@ ed_pccard_attach(device_t dev)
goto bad;
if (sc->chip_type == ED_CHIP_TYPE_DL10019 ||
sc->chip_type == ED_CHIP_TYPE_DL10022) {
-   /* Probe for an MII bus, but ignore errors. */
+   /* Try to attach an MII bus, but ignore errors. */
ed_pccard_dl100xx_mii_reset(sc);
-   (void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-   ed_ifmedia_sts);
+   (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+   ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+   MII_OFFSET_ANY, 0);
} else if (sc->chip_type == ED_CHIP_TYPE_AX88190 ||
-   sc->chip_type == ED_CHIP_TYPE_AX88790) {
-   if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
-ed_ifmedia_sts)) != 0) {
-   device_printf(dev, "Missing mii

svn commit: r213896 - head/sys/arm/at91

2010-10-15 Thread Marius Strobl
Author: marius
Date: Fri Oct 15 15:16:36 2010
New Revision: 213896
URL: http://svn.freebsd.org/changeset/base/213896

Log:
  Remove a device_printf() accidentally left in r213894.
  
  Submitted by: jhb

Modified:
  head/sys/arm/at91/if_ate.c

Modified: head/sys/arm/at91/if_ate.c
==
--- head/sys/arm/at91/if_ate.c  Fri Oct 15 15:06:32 2010(r213895)
+++ head/sys/arm/at91/if_ate.c  Fri Oct 15 15:16:36 2010(r213896)
@@ -320,7 +320,6 @@ ate_attach(device_t dev)
sc->ifp = ifp = if_alloc(IFT_ETHER);
err = mii_attach(dev, &sc->miibus, ifp, ate_ifmedia_upd,
ate_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
-   device_printf(dev, "Cannot find my PHY.\n");
if (err != 0) {
device_printf(dev, "attaching PHYs failed\n");
goto out;
___
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: r213900 - in head/sys: dev/mii modules/mii

2010-10-15 Thread Marius Strobl
Author: marius
Date: Fri Oct 15 15:46:58 2010
New Revision: 213900
URL: http://svn.freebsd.org/changeset/base/213900

Log:
  Now that all previous users of mii_phy_probe() have been converted
  in r213893 and r213894 to use mii_attach() instead remove the former
  and along with it the "EVIL HACK".
  
  MFC after:never

Modified:
  head/sys/dev/mii/mii.c
  head/sys/dev/mii/miivar.h
  head/sys/modules/mii/Makefile

Modified: head/sys/dev/mii/mii.c
==
--- head/sys/dev/mii/mii.c  Fri Oct 15 15:37:16 2010(r213899)
+++ head/sys/dev/mii/mii.c  Fri Oct 15 15:46:58 2010(r213900)
@@ -454,21 +454,6 @@ mii_attach(device_t dev, device_t *miibu
return (rv);
 }
 
-int
-mii_phy_probe(device_t dev, device_t *child, ifm_change_cb_t ifmedia_upd,
-ifm_stat_cb_t ifmedia_sts)
-{
-   struct ifnet *ifp;
-
-   /*
-* Note that each NIC's softc must start with an ifnet pointer.
-* XXX: EVIL HACK!
-*/
-   ifp = *(struct ifnet **)device_get_softc(dev);
-   return (mii_attach(dev, child, ifp, ifmedia_upd, ifmedia_sts,
-   BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0));
-}
-
 /*
  * Media changed; notify all PHYs.
  */

Modified: head/sys/dev/mii/miivar.h
==
--- head/sys/dev/mii/miivar.h   Fri Oct 15 15:37:16 2010(r213899)
+++ head/sys/dev/mii/miivar.h   Fri Oct 15 15:46:58 2010(r213900)
@@ -232,7 +232,6 @@ voidmii_down(struct mii_data *);
 intmii_mediachg(struct mii_data *);
 void   mii_tick(struct mii_data *);
 void   mii_pollstat(struct mii_data *);
-intmii_phy_probe(device_t, device_t *, ifm_change_cb_t, ifm_stat_cb_t);
 void   mii_add_media(struct mii_softc *);
 void   mii_phy_add_media(struct mii_softc *);
 

Modified: head/sys/modules/mii/Makefile
==
--- head/sys/modules/mii/Makefile   Fri Oct 15 15:37:16 2010
(r213899)
+++ head/sys/modules/mii/Makefile   Fri Oct 15 15:46:58 2010
(r213900)
@@ -14,7 +14,6 @@ SRCS+=xmphy.c
 
 EXPORT_SYMS=   mii_attach  \
mii_mediachg\
-   mii_phy_probe   \
mii_phy_reset   \
mii_pollstat\
mii_tick
___
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: r213908 - head/sys/dev/dc

2010-10-15 Thread Marius Strobl
Author: marius
Date: Fri Oct 15 23:34:31 2010
New Revision: 213908
URL: http://svn.freebsd.org/changeset/base/213908

Log:
  Convert the PHY drivers to honor the mii_flags passed down and convert
  the NIC drivers as well as the PHY drivers to take advantage of the
  mii_attach() introduced in r213878 to get rid of certain hacks. For
  the most part these were:
  - Artificially limiting miibus_{read,write}reg methods to certain PHY
addresses; we now let mii_attach() only probe the PHY at the desired
address(es) instead.
  - PHY drivers setting MIIF_* flags based on the NIC driver they hang
off from, partly even based on grabbing and using the softc of the
parent; we now pass these flags down from the NIC to the PHY drivers
via mii_attach(). This got us rid of all such hacks except those of
brgphy() in combination with bce(4) and bge(4), which is way beyond
what can be expressed with simple flags.
  
  While at it, I took the opportunity to change the NIC drivers to pass
  up the error returned by mii_attach() (previously by mii_phy_probe())
  and unify the error message used in this case where and as appropriate
  as mii_attach() actually can fail for a number of reasons, not just
  because of no PHY(s) being present at the expected address(es).
  
  This file was missed in r213893.

Modified:
  head/sys/dev/dc/dcphy.c

Modified: head/sys/dev/dc/dcphy.c
==
--- head/sys/dev/dc/dcphy.c Fri Oct 15 21:41:59 2010(r213907)
+++ head/sys/dev/dc/dcphy.c Fri Oct 15 23:34:31 2010(r213908)
@@ -149,6 +149,7 @@ dcphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
+   sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = dcphy_service;
@@ -211,7 +212,6 @@ dcphy_service(struct mii_softc *sc, stru
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
break;
 
-   sc->mii_flags = 0;
mii->mii_media_active = IFM_NONE;
mode = CSR_READ_4(dc_sc, DC_NETCFG);
mode &= ~(DC_NETCFG_FULLDUPLEX | DC_NETCFG_PORTSEL |
___
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: r213952 - stable/8/sys/sparc64/sparc64

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 11:51:55 2010
New Revision: 213952
URL: http://svn.freebsd.org/changeset/base/213952

Log:
  MFC: r213873
  
  Explicitly lower the PIL to 0 as part of enabling interrupts, similar to
  what is done on other platforms. Unlike as with the sched_throw(NULL)
  called on BSPs during their startup apparently there's nothing which will
  reliably lower it on APs. I'm unsure why this only came up on V215 though,
  breaking these with r207248. My best guess is that these are the only
  supported ones so far fast enough to lose some race.
  
  PR:   151404

Modified:
  stable/8/sys/sparc64/sparc64/machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/machdep.c
==
--- stable/8/sys/sparc64/sparc64/machdep.c  Sun Oct 17 11:40:29 2010
(r213951)
+++ stable/8/sys/sparc64/sparc64/machdep.c  Sun Oct 17 11:51:55 2010
(r213952)
@@ -589,6 +589,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
+   wrpr(pil, 0, 0);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*
___
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: r213953 - stable/7/sys/sparc64/sparc64

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 11:51:59 2010
New Revision: 213953
URL: http://svn.freebsd.org/changeset/base/213953

Log:
  MFC: r213873
  
  Explicitly lower the PIL to 0 as part of enabling interrupts, similar to
  what is done on other platforms. Unlike as with the sched_throw(NULL)
  called on BSPs during their startup apparently there's nothing which will
  reliably lower it on APs. I'm unsure why this only came up on V215 though,
  breaking these with r207248. My best guess is that these are the only
  supported ones so far fast enough to lose some race.
  
  PR:   151404

Modified:
  stable/7/sys/sparc64/sparc64/machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/machdep.c
==
--- stable/7/sys/sparc64/sparc64/machdep.c  Sun Oct 17 11:51:55 2010
(r213952)
+++ stable/7/sys/sparc64/sparc64/machdep.c  Sun Oct 17 11:51:59 2010
(r213953)
@@ -579,6 +579,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l
 * enable them.
 */
intr_init2();
+   wrpr(pil, 0, 0);
wrpr(pstate, 0, PSTATE_KERNEL);
 
/*
___
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: r213955 - stable/7/sys/sparc64/sparc64

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:05:39 2010
New Revision: 213955
URL: http://svn.freebsd.org/changeset/base/213955

Log:
  MFC: r213104
  
  minor simplifications and cosmetics

Modified:
  stable/7/sys/sparc64/sparc64/elf_machdep.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/sparc64/elf_machdep.c
==
--- stable/7/sys/sparc64/sparc64/elf_machdep.c  Sun Oct 17 12:05:37 2010
(r213954)
+++ stable/7/sys/sparc64/sparc64/elf_machdep.c  Sun Oct 17 12:05:39 2010
(r213955)
@@ -127,8 +127,8 @@ void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
 size_t *off __unused)
 {
-}
 
+}
 
 /*
  * The following table holds for each relocation type:
@@ -213,7 +213,7 @@ static const int reloc_target_flags[] = 
 };
 
 #if 0
-static const char *reloc_names[] = {
+static const char *const reloc_names[] = {
"NONE", "RELOC_8", "RELOC_16", "RELOC_32", "DISP_8",
"DISP_16", "DISP_32", "WDISP_30", "WDISP_22", "HI22",
"22", "13", "LO10", "GOT10", "GOT13",
@@ -268,10 +268,9 @@ static const long reloc_target_bitmask[]
 
 int
 elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
-int type, elf_lookup_fn lookup)
+int type, elf_lookup_fn lookup __unused)
 {
const Elf_Rela *rela;
-   Elf_Addr value;
Elf_Addr *where;
 
if (type != ELF_RELOC_RELA)
@@ -281,10 +280,8 @@ elf_reloc_local(linker_file_t lf, Elf_Ad
if (ELF64_R_TYPE_ID(rela->r_info) != R_SPARC_RELATIVE)
return (-1);
 
-   value = rela->r_addend + (Elf_Addr)lf->address;
-   where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset);
-
-   *where = value;
+   where = (Elf_Addr *)(relocbase + rela->r_offset);
+   *where = rela->r_addend + relocbase;
 
return (0);
 }
___
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: r213954 - stable/8/sys/sparc64/sparc64

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:05:37 2010
New Revision: 213954
URL: http://svn.freebsd.org/changeset/base/213954

Log:
  MFC: r213104
  
  minor simplifications and cosmetics

Modified:
  stable/8/sys/sparc64/sparc64/elf_machdep.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/sparc64/sparc64/elf_machdep.c
==
--- stable/8/sys/sparc64/sparc64/elf_machdep.c  Sun Oct 17 11:51:59 2010
(r213953)
+++ stable/8/sys/sparc64/sparc64/elf_machdep.c  Sun Oct 17 12:05:37 2010
(r213954)
@@ -128,8 +128,8 @@ void
 elf64_dump_thread(struct thread *td __unused, void *dst __unused,
 size_t *off __unused)
 {
-}
 
+}
 
 /*
  * The following table holds for each relocation type:
@@ -215,7 +215,7 @@ static const int reloc_target_flags[] = 
 };
 
 #if 0
-static const char *reloc_names[] = {
+static const char *const reloc_names[] = {
"NONE", "RELOC_8", "RELOC_16", "RELOC_32", "DISP_8",
"DISP_16", "DISP_32", "WDISP_30", "WDISP_22", "HI22",
"22", "13", "LO10", "GOT10", "GOT13",
@@ -271,10 +271,9 @@ static const long reloc_target_bitmask[]
 
 int
 elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data,
-int type, elf_lookup_fn lookup)
+int type, elf_lookup_fn lookup __unused)
 {
const Elf_Rela *rela;
-   Elf_Addr value;
Elf_Addr *where;
 
if (type != ELF_RELOC_RELA)
@@ -284,10 +283,8 @@ elf_reloc_local(linker_file_t lf, Elf_Ad
if (ELF64_R_TYPE_ID(rela->r_info) != R_SPARC_RELATIVE)
return (-1);
 
-   value = rela->r_addend + (Elf_Addr)lf->address;
-   where = (Elf_Addr *)((Elf_Addr)lf->address + rela->r_offset);
-
-   *where = elf_relocaddr(lf, value);
+   where = (Elf_Addr *)(relocbase + rela->r_offset);
+   *where = elf_relocaddr(lf, rela->r_addend + relocbase);
 
return (0);
 }
@@ -342,9 +339,8 @@ elf_reloc(linker_file_t lf, Elf_Addr rel
if (RELOC_PC_RELATIVE(rtype))
value -= (Elf_Addr)where;
 
-   if (RELOC_BASE_RELATIVE(rtype)) {
+   if (RELOC_BASE_RELATIVE(rtype))
value = elf_relocaddr(lf, value + relocbase);
-   }
 
mask = RELOC_VALUE_BITMASK(rtype);
value >>= RELOC_VALUE_RIGHTSHIFT(rtype);
___
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: r213956 - in stable/8/sys: amd64/include dev/hme dev/le dev/mii i386/include ia64/include mips/include mips/malta powerpc/include sparc64/include sparc64/sbus sun4v/include sys

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:11:42 2010
New Revision: 213956
URL: http://svn.freebsd.org/changeset/base/213956

Log:
  MFC: r204646
  
  The NetBSD Foundation has granted permission to remove clause 3 and 4 from
  the software.
  
  Obtained from:NetBSD

Modified:
  stable/8/sys/amd64/include/_inttypes.h
  stable/8/sys/dev/hme/if_hme_sbus.c
  stable/8/sys/dev/hme/if_hmereg.h
  stable/8/sys/dev/hme/if_hmevar.h
  stable/8/sys/dev/le/am79900var.h
  stable/8/sys/dev/le/am7990var.h
  stable/8/sys/dev/le/if_le_ledma.c
  stable/8/sys/dev/le/lancevar.h
  stable/8/sys/dev/mii/bmtphyreg.h
  stable/8/sys/dev/mii/icsphyreg.h
  stable/8/sys/dev/mii/lxtphyreg.h
  stable/8/sys/dev/mii/mii.c
  stable/8/sys/dev/mii/mii_physubr.c
  stable/8/sys/dev/mii/miidevs
  stable/8/sys/dev/mii/miivar.h
  stable/8/sys/dev/mii/nsphyreg.h
  stable/8/sys/dev/mii/nsphyterreg.h
  stable/8/sys/dev/mii/qsphyreg.h
  stable/8/sys/dev/mii/ukphy_subr.c
  stable/8/sys/i386/include/_inttypes.h
  stable/8/sys/ia64/include/_inttypes.h
  stable/8/sys/mips/include/_inttypes.h
  stable/8/sys/mips/malta/gtreg.h
  stable/8/sys/powerpc/include/_inttypes.h
  stable/8/sys/sparc64/include/_inttypes.h
  stable/8/sys/sparc64/sbus/lsi64854reg.h
  stable/8/sys/sparc64/sbus/lsi64854var.h
  stable/8/sys/sparc64/sbus/ofw_sbus.h
  stable/8/sys/sun4v/include/_inttypes.h
  stable/8/sys/sys/clock.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/include/_inttypes.h
==
--- stable/8/sys/amd64/include/_inttypes.h  Sun Oct 17 12:05:39 2010
(r213955)
+++ stable/8/sys/amd64/include/_inttypes.h  Sun Oct 17 12:11:42 2010
(r213956)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

Modified: stable/8/sys/dev/hme/if_hme_sbus.c
==
--- stable/8/sys/dev/hme/if_hme_sbus.c  Sun Oct 17 12:05:39 2010
(r213955)
+++ stable/8/sys/dev/hme/if_hme_sbus.c  Sun Oct 17 12:11:42 2010
(r213956)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

Modified: stable/8/sys/dev/hme/if_hmereg.h
==
--- stable/8/sys/dev/hme/if_hmereg.hSun Oct 17 12:05:39 2010
(r213955)
+++ stable/8/sys/dev/hme/if_hmereg.hSun Oct 17 12:11:42 2010
(r213956)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * 

svn commit: r213957 - in stable/7/sys: amd64/include dev/hme dev/le dev/mii i386/include ia64/include powerpc/include sparc64/include sparc64/sbus sun4v/include sys

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:11:43 2010
New Revision: 213957
URL: http://svn.freebsd.org/changeset/base/213957

Log:
  MFC: r204646
  
  The NetBSD Foundation has granted permission to remove clause 3 and 4 from
  the software.
  
  Obtained from:NetBSD

Modified:
  stable/7/sys/amd64/include/_inttypes.h
  stable/7/sys/dev/hme/if_hme_sbus.c
  stable/7/sys/dev/hme/if_hmereg.h
  stable/7/sys/dev/hme/if_hmevar.h
  stable/7/sys/dev/le/am79900var.h
  stable/7/sys/dev/le/am7990var.h
  stable/7/sys/dev/le/if_le_ledma.c
  stable/7/sys/dev/le/lancevar.h
  stable/7/sys/dev/mii/bmtphyreg.h
  stable/7/sys/dev/mii/icsphyreg.h
  stable/7/sys/dev/mii/lxtphyreg.h
  stable/7/sys/dev/mii/mii.c
  stable/7/sys/dev/mii/mii_physubr.c
  stable/7/sys/dev/mii/miidevs
  stable/7/sys/dev/mii/miivar.h
  stable/7/sys/dev/mii/nsphyreg.h
  stable/7/sys/dev/mii/nsphyterreg.h
  stable/7/sys/dev/mii/qsphyreg.h
  stable/7/sys/dev/mii/ukphy_subr.c
  stable/7/sys/i386/include/_inttypes.h
  stable/7/sys/ia64/include/_inttypes.h
  stable/7/sys/powerpc/include/_inttypes.h
  stable/7/sys/sparc64/include/_inttypes.h
  stable/7/sys/sparc64/sbus/lsi64854reg.h
  stable/7/sys/sparc64/sbus/lsi64854var.h
  stable/7/sys/sparc64/sbus/ofw_sbus.h
  stable/7/sys/sun4v/include/_inttypes.h
  stable/7/sys/sys/clock.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/amd64/include/_inttypes.h
==
--- stable/7/sys/amd64/include/_inttypes.h  Sun Oct 17 12:11:42 2010
(r213956)
+++ stable/7/sys/amd64/include/_inttypes.h  Sun Oct 17 12:11:43 2010
(r213957)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

Modified: stable/7/sys/dev/hme/if_hme_sbus.c
==
--- stable/7/sys/dev/hme/if_hme_sbus.c  Sun Oct 17 12:11:42 2010
(r213956)
+++ stable/7/sys/dev/hme/if_hme_sbus.c  Sun Oct 17 12:11:43 2010
(r213957)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

Modified: stable/7/sys/dev/hme/if_hmereg.h
==
--- stable/7/sys/dev/hme/if_hmereg.hSun Oct 17 12:11:42 2010
(r213956)
+++ stable/7/sys/dev/hme/if_hmereg.hSun Oct 17 12:11:43 2010
(r213957)
@@ -13,13 +13,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *This product includes software developed by the NetBSD
- *Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED

Modified: stable/7/s

svn commit: r213958 - stable/8/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:16:36 2010
New Revision: 213958
URL: http://svn.freebsd.org/changeset/base/213958

Log:
  MFC: r213188
  
  - Remove clause 3 and 4 from TNF licenses.
  - Remove closes 3 & 4 from Manuel Bouyer's license.
  
  Obtained from:NetBSD

Modified:
  stable/8/sys/dev/mii/acphy.c
  stable/8/sys/dev/mii/bmtphy.c
  stable/8/sys/dev/mii/exphy.c
  stable/8/sys/dev/mii/gentbi.c
  stable/8/sys/dev/mii/icsphy.c
  stable/8/sys/dev/mii/lxtphy.c
  stable/8/sys/dev/mii/mii.h
  stable/8/sys/dev/mii/nsphy.c
  stable/8/sys/dev/mii/nsphyter.c
  stable/8/sys/dev/mii/qsphy.c
  stable/8/sys/dev/mii/tlphy.c
  stable/8/sys/dev/mii/tlphyreg.h
  stable/8/sys/dev/mii/ukphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mii/acphy.c
==
--- stable/8/sys/dev/mii/acphy.cSun Oct 17 12:11:43 2010
(r213957)
+++ stable/8/sys/dev/mii/acphy.cSun Oct 17 12:16:36 2010
(r213958)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: stable/8/sys/dev/mii/bmtphy.c
==
--- stable/8/sys/dev/mii/bmtphy.c   Sun Oct 17 12:11:43 2010
(r213957)
+++ stable/8/sys/dev/mii/bmtphy.c   Sun Oct 17 12:16:36 2010
(r213958)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by the NetBSD
- *  Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: stable/8/sys/dev/mii/exphy.c
==
--- stable/8/sys/dev/mii/exphy.cSun Oct 17 12:11:43 2010
(r213957)
+++ stable/8/

svn commit: r213959 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:16:38 2010
New Revision: 213959
URL: http://svn.freebsd.org/changeset/base/213959

Log:
  MFC: r213188
  
  - Remove clause 3 and 4 from TNF licenses.
  - Remove closes 3 & 4 from Manuel Bouyer's license.
  
  Obtained from:NetBSD

Modified:
  stable/7/sys/dev/mii/acphy.c
  stable/7/sys/dev/mii/bmtphy.c
  stable/7/sys/dev/mii/exphy.c
  stable/7/sys/dev/mii/gentbi.c
  stable/7/sys/dev/mii/icsphy.c
  stable/7/sys/dev/mii/lxtphy.c
  stable/7/sys/dev/mii/mii.h
  stable/7/sys/dev/mii/nsphy.c
  stable/7/sys/dev/mii/nsphyter.c
  stable/7/sys/dev/mii/qsphy.c
  stable/7/sys/dev/mii/tlphy.c
  stable/7/sys/dev/mii/tlphyreg.h
  stable/7/sys/dev/mii/ukphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/acphy.c
==
--- stable/7/sys/dev/mii/acphy.cSun Oct 17 12:16:36 2010
(r213958)
+++ stable/7/sys/dev/mii/acphy.cSun Oct 17 12:16:38 2010
(r213959)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- * This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: stable/7/sys/dev/mii/bmtphy.c
==
--- stable/7/sys/dev/mii/bmtphy.c   Sun Oct 17 12:16:36 2010
(r213958)
+++ stable/7/sys/dev/mii/bmtphy.c   Sun Oct 17 12:16:38 2010
(r213959)
@@ -14,13 +14,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by the NetBSD
- *  Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- *contributors may be used to endorse or promote products derived
- *from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -46,11 +39,6 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *must display the following acknowledgement:
- *  This product includes software developed by Manuel Bouyer.
- * 4. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

Modified: stable/7/sys/dev/mii/exphy.c
==
--- stable/7/sys/dev/mii/exphy.cSun Oct 17 12:16:36 2010
(r213958)
+++ stable/7/sys/dev/mii/exphy.cSun Oct 17 12:16:38 2010
(r213959)
@@ -16,13 +16,6 @@
  * 2. Redis

svn commit: r213960 - in stable/8/sys/dev: dc mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:29:57 2010
New Revision: 213960
URL: http://svn.freebsd.org/changeset/base/213960

Log:
  MFC: r213229
  
  Use the mii_data provided via mii_attach_args and mii_pdata respectively
  instead of reaching out for the softc of the parent.

Modified:
  stable/8/sys/dev/dc/dcphy.c
  stable/8/sys/dev/dc/pnphy.c
  stable/8/sys/dev/mii/acphy.c
  stable/8/sys/dev/mii/amphy.c
  stable/8/sys/dev/mii/atphy.c
  stable/8/sys/dev/mii/axphy.c
  stable/8/sys/dev/mii/bmtphy.c
  stable/8/sys/dev/mii/brgphy.c
  stable/8/sys/dev/mii/ciphy.c
  stable/8/sys/dev/mii/e1000phy.c
  stable/8/sys/dev/mii/exphy.c
  stable/8/sys/dev/mii/gentbi.c
  stable/8/sys/dev/mii/icsphy.c
  stable/8/sys/dev/mii/inphy.c
  stable/8/sys/dev/mii/ip1000phy.c
  stable/8/sys/dev/mii/jmphy.c
  stable/8/sys/dev/mii/lxtphy.c
  stable/8/sys/dev/mii/mii_physubr.c
  stable/8/sys/dev/mii/mlphy.c
  stable/8/sys/dev/mii/nsgphy.c
  stable/8/sys/dev/mii/nsphy.c
  stable/8/sys/dev/mii/nsphyter.c
  stable/8/sys/dev/mii/pnaphy.c
  stable/8/sys/dev/mii/qsphy.c
  stable/8/sys/dev/mii/rgephy.c
  stable/8/sys/dev/mii/rlphy.c
  stable/8/sys/dev/mii/rlswitch.c
  stable/8/sys/dev/mii/ruephy.c
  stable/8/sys/dev/mii/smcphy.c
  stable/8/sys/dev/mii/tdkphy.c
  stable/8/sys/dev/mii/truephy.c
  stable/8/sys/dev/mii/ukphy.c
  stable/8/sys/dev/mii/xmphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/dc/dcphy.c
==
--- stable/8/sys/dev/dc/dcphy.c Sun Oct 17 12:16:38 2010(r213959)
+++ stable/8/sys/dev/dc/dcphy.c Sun Oct 17 12:29:57 2010(r213960)
@@ -146,7 +146,7 @@ dcphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/8/sys/dev/dc/pnphy.c
==
--- stable/8/sys/dev/dc/pnphy.c Sun Oct 17 12:16:38 2010(r213959)
+++ stable/8/sys/dev/dc/pnphy.c Sun Oct 17 12:29:57 2010(r213960)
@@ -129,7 +129,7 @@ pnphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/8/sys/dev/mii/acphy.c
==
--- stable/8/sys/dev/mii/acphy.cSun Oct 17 12:16:38 2010
(r213959)
+++ stable/8/sys/dev/mii/acphy.cSun Oct 17 12:29:57 2010
(r213960)
@@ -129,7 +129,7 @@ acphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/8/sys/dev/mii/amphy.c
==
--- stable/8/sys/dev/mii/amphy.cSun Oct 17 12:16:38 2010
(r213959)
+++ stable/8/sys/dev/mii/amphy.cSun Oct 17 12:29:57 2010
(r213960)
@@ -106,7 +106,7 @@ amphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/8/sys/dev/mii/atphy.c
==
--- stable/8/sys/dev/mii/atphy.cSun Oct 17 12:16:38 2010
(r213959)
+++ stable/8/sys/dev/mii/atphy.cSun Oct 17 12:29:57 2010
(r213960)
@@ -110,7 +110,7 @@ atphy_attach(device_t dev)
sc = &asc->mii_sc;
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/8/sys/dev/mii/axphy.c
==
--- stable/8/sys/dev/mii/axphy.cSun Oct 17 12:16:38 2010
(r213959)
+++ stable/8/sys/dev/mii/axphy.cSun Oct 17 12:29:57 2010
(r21396

svn commit: r213961 - in stable/7/sys/dev: dc mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:30:01 2010
New Revision: 213961
URL: http://svn.freebsd.org/changeset/base/213961

Log:
  MFC: r213229
  
  Use the mii_data provided via mii_attach_args and mii_pdata respectively
  instead of reaching out for the softc of the parent.

Modified:
  stable/7/sys/dev/dc/dcphy.c
  stable/7/sys/dev/dc/pnphy.c
  stable/7/sys/dev/mii/acphy.c
  stable/7/sys/dev/mii/amphy.c
  stable/7/sys/dev/mii/atphy.c
  stable/7/sys/dev/mii/bmtphy.c
  stable/7/sys/dev/mii/brgphy.c
  stable/7/sys/dev/mii/ciphy.c
  stable/7/sys/dev/mii/e1000phy.c
  stable/7/sys/dev/mii/exphy.c
  stable/7/sys/dev/mii/gentbi.c
  stable/7/sys/dev/mii/icsphy.c
  stable/7/sys/dev/mii/inphy.c
  stable/7/sys/dev/mii/ip1000phy.c
  stable/7/sys/dev/mii/jmphy.c
  stable/7/sys/dev/mii/lxtphy.c
  stable/7/sys/dev/mii/mii_physubr.c
  stable/7/sys/dev/mii/mlphy.c
  stable/7/sys/dev/mii/nsgphy.c
  stable/7/sys/dev/mii/nsphy.c
  stable/7/sys/dev/mii/nsphyter.c
  stable/7/sys/dev/mii/pnaphy.c
  stable/7/sys/dev/mii/qsphy.c
  stable/7/sys/dev/mii/rgephy.c
  stable/7/sys/dev/mii/rlphy.c
  stable/7/sys/dev/mii/rlswitch.c
  stable/7/sys/dev/mii/ruephy.c
  stable/7/sys/dev/mii/tdkphy.c
  stable/7/sys/dev/mii/truephy.c
  stable/7/sys/dev/mii/ukphy.c
  stable/7/sys/dev/mii/xmphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/dc/dcphy.c
==
--- stable/7/sys/dev/dc/dcphy.c Sun Oct 17 12:29:57 2010(r213960)
+++ stable/7/sys/dev/dc/dcphy.c Sun Oct 17 12:30:01 2010(r213961)
@@ -146,7 +146,7 @@ dcphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/7/sys/dev/dc/pnphy.c
==
--- stable/7/sys/dev/dc/pnphy.c Sun Oct 17 12:29:57 2010(r213960)
+++ stable/7/sys/dev/dc/pnphy.c Sun Oct 17 12:30:01 2010(r213961)
@@ -129,7 +129,7 @@ pnphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/7/sys/dev/mii/acphy.c
==
--- stable/7/sys/dev/mii/acphy.cSun Oct 17 12:29:57 2010
(r213960)
+++ stable/7/sys/dev/mii/acphy.cSun Oct 17 12:30:01 2010
(r213961)
@@ -129,7 +129,7 @@ acphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/7/sys/dev/mii/amphy.c
==
--- stable/7/sys/dev/mii/amphy.cSun Oct 17 12:29:57 2010
(r213960)
+++ stable/7/sys/dev/mii/amphy.cSun Oct 17 12:30:01 2010
(r213961)
@@ -106,7 +106,7 @@ amphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/7/sys/dev/mii/atphy.c
==
--- stable/7/sys/dev/mii/atphy.cSun Oct 17 12:29:57 2010
(r213960)
+++ stable/7/sys/dev/mii/atphy.cSun Oct 17 12:30:01 2010
(r213961)
@@ -110,7 +110,7 @@ atphy_attach(device_t dev)
sc = &asc->mii_sc;
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
-   mii = device_get_softc(sc->mii_dev);
+   mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
 
sc->mii_inst = mii->mii_instance;

Modified: stable/7/sys/dev/mii/bmtphy.c
==
--- stable/7/sys/dev/mii/bmtphy.c   Sun Oct 17 12:29:57 2010
(r213960)
+++ stable/7/sys/dev/mii/bmtphy.c   Sun Oct 17 12:30:01 2010
(r213961)
@@ -144,7 +144,7 @@ bmtphy_attach(device_t dev)
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(

svn commit: r213962 - stable/8/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:33:15 2010
New Revision: 213962
URL: http://svn.freebsd.org/changeset/base/213962

Log:
  MFC: r213361
  
  Try to adhere to style(9) and be consistent within this file.

Modified:
  stable/8/sys/dev/mii/mii.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/mii/mii.c
==
--- stable/8/sys/dev/mii/mii.c  Sun Oct 17 12:30:01 2010(r213961)
+++ stable/8/sys/dev/mii/mii.c  Sun Oct 17 12:33:15 2010(r213962)
@@ -128,7 +128,7 @@ miibus_probe(device_t dev)
 */
bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
if (bmsr == 0 || bmsr == 0x ||
-   (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+   (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
/* Assume no PHY at this address. */
continue;
}
@@ -154,11 +154,11 @@ miibus_probe(device_t dev)
}
 
if (child == NULL)
-   return(ENXIO);
+   return (ENXIO);
 
device_set_desc(dev, "MII bus");
 
-   return(0);
+   return (0);
 }
 
 int
@@ -180,7 +180,7 @@ miibus_attach(device_t dev)
ivars->ifmedia_sts);
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 int
@@ -193,7 +193,7 @@ miibus_detach(device_t dev)
ifmedia_removeall(&mii->mii_media);
mii->mii_ifp = NULL;
 
-   return(0);
+   return (0);
 }
 
 static int
@@ -214,10 +214,12 @@ static int
 miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
-   MII_OUI(maa->mii_id1, maa->mii_id2),
-   MII_MODEL(maa->mii_id2), MII_REV(maa->mii_id2));
+   MII_OUI(ma->mii_id1, ma->mii_id2),
+   MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
return (0);
 }
 
@@ -225,8 +227,10 @@ static int
 miibus_child_location_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
-   snprintf(buf, buflen, "phyno=%d", maa->mii_phyno);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
+   snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
return (0);
 }
 
@@ -236,7 +240,7 @@ miibus_readreg(device_t dev, int phy, in
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_READREG(parent, phy, reg));
+   return (MIIBUS_READREG(parent, phy, reg));
 }
 
 static int
@@ -245,7 +249,7 @@ miibus_writereg(device_t dev, int phy, i
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_WRITEREG(parent, phy, reg, data));
+   return (MIIBUS_WRITEREG(parent, phy, reg, data));
 }
 
 static void
@@ -266,7 +270,6 @@ miibus_statchg(device_t dev)
 */
ifp = *(struct ifnet **)device_get_softc(parent);
ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
-   return;
 }
 
 static void
@@ -308,13 +311,11 @@ miibus_mediainit(device_t dev)
mii = device_get_softc(dev);
LIST_FOREACH(m, &mii->mii_media.ifm_list, ifm_list) {
media = m->ifm_media;
-   if (media == (IFM_ETHER|IFM_AUTO))
+   if (media == (IFM_ETHER | IFM_AUTO))
break;
}
 
ifmedia_set(&mii->mii_media, media);
-
-   return;
 }
 
 int
@@ -335,7 +336,7 @@ mii_phy_probe(device_t dev, device_t *ch
for (i = 0; i < MII_NPHY; i++) {
bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
 if (bmsr == 0 || bmsr == 0x ||
-(bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+(bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
 /* Assume no PHY at this address. */
 continue;
 } else
@@ -345,12 +346,12 @@ mii_phy_probe(device_t dev, device_t *ch
if (i == MII_NPHY) {
device_delete_child(dev, *child);
*child = NULL;
-   return(ENXIO);
+   return (ENXIO);
}
 
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 /*
@@ -382,7 +383,7 @@ mii_tick(struct mii_data *mii)
struct mii_softc *child;
 
LIST_FOREACH(child, &mii->mii_phys, mii_list)
-   (void) (*child->mii_service)(child, mii, MII_TICK);

svn commit: r213963 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:33:15 2010
New Revision: 213963
URL: http://svn.freebsd.org/changeset/base/213963

Log:
  MFC: r213361
  
  Try to adhere to style(9) and be consistent within this file.

Modified:
  stable/7/sys/dev/mii/mii.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/mii.c
==
--- stable/7/sys/dev/mii/mii.c  Sun Oct 17 12:33:15 2010(r213962)
+++ stable/7/sys/dev/mii/mii.c  Sun Oct 17 12:33:15 2010(r213963)
@@ -128,7 +128,7 @@ miibus_probe(device_t dev)
 */
bmsr = MIIBUS_READREG(parent, ma.mii_phyno, MII_BMSR);
if (bmsr == 0 || bmsr == 0x ||
-   (bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+   (bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
/* Assume no PHY at this address. */
continue;
}
@@ -154,11 +154,11 @@ miibus_probe(device_t dev)
}
 
if (child == NULL)
-   return(ENXIO);
+   return (ENXIO);
 
device_set_desc(dev, "MII bus");
 
-   return(0);
+   return (0);
 }
 
 int
@@ -178,7 +178,7 @@ miibus_attach(device_t dev)
ivars->ifmedia_sts);
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 int
@@ -191,7 +191,7 @@ miibus_detach(device_t dev)
ifmedia_removeall(&mii->mii_media);
mii->mii_ifp = NULL;
 
-   return(0);
+   return (0);
 }
 
 static int
@@ -212,10 +212,12 @@ static int
 miibus_child_pnpinfo_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
snprintf(buf, buflen, "oui=0x%x model=0x%x rev=0x%x",
-   MII_OUI(maa->mii_id1, maa->mii_id2),
-   MII_MODEL(maa->mii_id2), MII_REV(maa->mii_id2));
+   MII_OUI(ma->mii_id1, ma->mii_id2),
+   MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
return (0);
 }
 
@@ -223,8 +225,10 @@ static int
 miibus_child_location_str(device_t bus, device_t child, char *buf,
 size_t buflen)
 {
-   struct mii_attach_args *maa = device_get_ivars(child);
-   snprintf(buf, buflen, "phyno=%d", maa->mii_phyno);
+   struct mii_attach_args *ma;
+
+   ma = device_get_ivars(child);
+   snprintf(buf, buflen, "phyno=%d", ma->mii_phyno);
return (0);
 }
 
@@ -234,7 +238,7 @@ miibus_readreg(device_t dev, int phy, in
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_READREG(parent, phy, reg));
+   return (MIIBUS_READREG(parent, phy, reg));
 }
 
 static int
@@ -243,7 +247,7 @@ miibus_writereg(device_t dev, int phy, i
device_tparent;
 
parent = device_get_parent(dev);
-   return(MIIBUS_WRITEREG(parent, phy, reg, data));
+   return (MIIBUS_WRITEREG(parent, phy, reg, data));
 }
 
 static void
@@ -264,7 +268,6 @@ miibus_statchg(device_t dev)
 */
ifp = *(struct ifnet **)device_get_softc(parent);
ifp->if_baudrate = ifmedia_baudrate(mii->mii_media_active);
-   return;
 }
 
 static void
@@ -306,13 +309,11 @@ miibus_mediainit(device_t dev)
mii = device_get_softc(dev);
LIST_FOREACH(m, &mii->mii_media.ifm_list, ifm_list) {
media = m->ifm_media;
-   if (media == (IFM_ETHER|IFM_AUTO))
+   if (media == (IFM_ETHER | IFM_AUTO))
break;
}
 
ifmedia_set(&mii->mii_media, media);
-
-   return;
 }
 
 int
@@ -333,7 +334,7 @@ mii_phy_probe(device_t dev, device_t *ch
for (i = 0; i < MII_NPHY; i++) {
bmsr = MIIBUS_READREG(dev, i, MII_BMSR);
 if (bmsr == 0 || bmsr == 0x ||
-(bmsr & (BMSR_EXTSTAT|BMSR_MEDIAMASK)) == 0) {
+(bmsr & (BMSR_EXTSTAT | BMSR_MEDIAMASK)) == 0) {
 /* Assume no PHY at this address. */
 continue;
 } else
@@ -343,12 +344,12 @@ mii_phy_probe(device_t dev, device_t *ch
if (i == MII_NPHY) {
device_delete_child(dev, *child);
*child = NULL;
-   return(ENXIO);
+   return (ENXIO);
}
 
bus_generic_attach(dev);
 
-   return(0);
+   return (0);
 }
 
 /*
@@ -380,7 +381,7 @@ mii_tick(struct mii_data *mii)
struct mii_softc *child;
 
LIST_FOREACH(child, &mii->mii_phys, mii_list)
-   (void) (*child->mii_service)(child, mii, MII_TICK);
+   (void)(*child->mii_service)(child, mii, MII_TICK);
 }
 
 /*
@@ -395,7 +396,7 @@ mii_p

svn commit: r213964 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:34:20 2010
New Revision: 213964
URL: http://svn.freebsd.org/changeset/base/213964

Log:
  MFC: r175703
  
  Fix a typo in a comment.

Modified:
  stable/7/sys/dev/mii/amphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/amphy.c
==
--- stable/7/sys/dev/mii/amphy.cSun Oct 17 12:33:15 2010
(r213963)
+++ stable/7/sys/dev/mii/amphy.cSun Oct 17 12:34:20 2010
(r213964)
@@ -216,7 +216,7 @@ amphy_status(struct mii_softc *sc)
 
if (bmcr & BMCR_AUTOEN) {
/*
-* The PAR status bits are only valid of autonegotiation
+* The PAR status bits are only valid if autonegotiation
 * has completed (or it's disabled).
 */
if ((bmsr & BMSR_ACOMP) == 0) {
___
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: r213965 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:43:15 2010
New Revision: 213965
URL: http://svn.freebsd.org/changeset/base/213965

Log:
  MFC: r176773, r178598
  
  Recognize Cicada CS8204 and CS8244 PHYs.

Modified:
  stable/7/sys/dev/mii/ciphy.c
  stable/7/sys/dev/mii/miidevs
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/ciphy.c
==
--- stable/7/sys/dev/mii/ciphy.cSun Oct 17 12:34:20 2010
(r213964)
+++ stable/7/sys/dev/mii/ciphy.cSun Oct 17 12:43:15 2010
(r213965)
@@ -34,7 +34,7 @@
 __FBSDID("$FreeBSD$");
 
 /*
- * Driver for the Cicada CS8201 10/100/1000 copper PHY.
+ * Driver for the Cicada/Vitesse CS/VSC8xxx 10/100/1000 copper PHY.
  */
 
 #include 
@@ -92,6 +92,8 @@ static const struct mii_phydesc ciphys[]
MII_PHY_DESC(CICADA, CS8201A),
MII_PHY_DESC(CICADA, CS8201B),
MII_PHY_DESC(CICADA, VSC8211),
+   MII_PHY_DESC(CICADA, CS8204),
+   MII_PHY_DESC(CICADA, CS8244),
MII_PHY_DESC(VITESSE, VSC8601),
MII_PHY_END
 };
@@ -384,6 +386,7 @@ ciphy_fixup(struct mii_softc *sc)
}
 
switch (model) {
+   case MII_MODEL_CICADA_CS8204:
case MII_MODEL_CICADA_CS8201:
 
/* Turn off "aux mode" (whatever that means) */
@@ -421,6 +424,7 @@ ciphy_fixup(struct mii_softc *sc)
 
break;
case MII_MODEL_CICADA_VSC8211:
+   case MII_MODEL_CICADA_CS8244:
case MII_MODEL_VITESSE_VSC8601:
break;
default:

Modified: stable/7/sys/dev/mii/miidevs
==
--- stable/7/sys/dev/mii/miidevsSun Oct 17 12:34:20 2010
(r213964)
+++ stable/7/sys/dev/mii/miidevsSun Oct 17 12:43:15 2010
(r213965)
@@ -152,9 +152,11 @@ model BROADCOM2 BCM59060x0004 BCM5906 
 
 /* Cicada Semiconductor PHYs (now owned by Vitesse?) */
 model CICADA CS82010x0001 Cicada CS8201 10/100/1000TX PHY
+model CICADA CS82040x0004 Cicada CS8204 10/100/1000TX PHY
 model CICADA VSC8211   0x000b Cicada VSC8211 10/100/1000TX PHY
 model CICADA CS8201A   0x0020 Cicada CS8201 10/100/1000TX PHY
 model CICADA CS8201B   0x0021 Cicada CS8201 10/100/1000TX PHY
+model CICADA CS82440x002c Cicada CS8244 10/100/1000TX PHY
 model VITESSE VSC8601  0x0002 Vitesse VSC8601 10/100/1000TX PHY
 
 /* Davicom Semiconductor PHYs */
___
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: r213966 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 12:47:07 2010
New Revision: 213966
URL: http://svn.freebsd.org/changeset/base/213966

Log:
  MFC: r182751
  
  Recognize 88E1116R phy variation. This part is found on some embedded devices.
  
  Obtained from:Semihalf

Modified:
  stable/7/sys/dev/mii/e1000phy.c
  stable/7/sys/dev/mii/miidevs
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/e1000phy.c
==
--- stable/7/sys/dev/mii/e1000phy.c Sun Oct 17 12:43:15 2010
(r213965)
+++ stable/7/sys/dev/mii/e1000phy.c Sun Oct 17 12:47:07 2010
(r213966)
@@ -109,6 +109,7 @@ static const struct mii_phydesc e1000phy
MII_PHY_DESC(MARVELL, E1149),
MII_PHY_DESC(MARVELL, E),
MII_PHY_DESC(MARVELL, E1116),
+   MII_PHY_DESC(MARVELL, E1116R),
MII_PHY_DESC(MARVELL, E1118),
MII_PHY_DESC(MARVELL, E3016),
MII_PHY_DESC(MARVELL, PHYG65G),

Modified: stable/7/sys/dev/mii/miidevs
==
--- stable/7/sys/dev/mii/miidevsSun Oct 17 12:43:15 2010
(r213965)
+++ stable/7/sys/dev/mii/miidevsSun Oct 17 12:47:07 2010
(r213966)
@@ -237,6 +237,7 @@ model MARVELL E1112 0x0009 Marvell 88E1
 model MARVELL E11490x000b Marvell 88E1149 Gigabit PHY
 model MARVELL E0x000c Marvell 88E Gigabit PHY
 model MARVELL E11160x0021 Marvell 88E1116 Gigabit PHY
+model MARVELL E1116R   0x0024 Marvell 88E1116R Gigabit PHY
 model MARVELL E11180x0022 Marvell 88E1118 Gigabit PHY
 model MARVELL E30160x0026 Marvell 88E3016 10/100 Fast Ethernet PHY
 model MARVELL PHYG65G  0x0027 Marvell PHYG65G Gigabit PHY
___
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: r213967 - stable/7/sys/dev/mii

2010-10-17 Thread Marius Strobl
Author: marius
Date: Sun Oct 17 13:06:18 2010
New Revision: 213967
URL: http://svn.freebsd.org/changeset/base/213967

Log:
  r182037, r182038, r182064
  
  When there's an error, we don't want to free the children, since it
  will be stack garbage.

Modified:
  stable/7/sys/dev/mii/mlphy.c
  stable/7/sys/dev/mii/tlphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/mlphy.c
==
--- stable/7/sys/dev/mii/mlphy.cSun Oct 17 12:47:07 2010
(r213966)
+++ stable/7/sys/dev/mii/mlphy.cSun Oct 17 13:06:18 2010
(r213967)
@@ -194,14 +194,15 @@ mlphy_service(xsc, mii, cmd)
 * See if there's another PHY on this bus with us.
 * If so, we may need it for 10Mbps modes.
 */
-   device_get_children(msc->ml_mii.mii_dev, &devlist, &devs);
-   for (i = 0; i < devs; i++) {
-   if (strcmp(device_get_name(devlist[i]), "mlphy")) {
-   other = device_get_softc(devlist[i]);
-   break;
+   if (device_get_children(msc->ml_mii.mii_dev, &devlist, &devs) == 0) {
+   for (i = 0; i < devs; i++) {
+   if (strcmp(device_get_name(devlist[i]), "mlphy")) {
+   other = device_get_softc(devlist[i]);
+   break;
+   }
}
+   free(devlist, M_TEMP);
}
-   free(devlist, M_TEMP);
 
switch (cmd) {
case MII_POLLSTAT:
@@ -400,6 +401,7 @@ mlphy_status(sc)
int devs, i;
 
/* See if there's another PHY on the bus with us. */
+   devs = 0;
device_get_children(msc->ml_mii.mii_dev, &devlist, &devs);
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "mlphy")) {

Modified: stable/7/sys/dev/mii/tlphy.c
==
--- stable/7/sys/dev/mii/tlphy.cSun Oct 17 12:47:07 2010
(r213966)
+++ stable/7/sys/dev/mii/tlphy.cSun Oct 17 13:06:18 2010
(r213967)
@@ -150,8 +150,8 @@ tlphy_attach(device_t dev)
sc->sc_mii.mii_pdata = mii;
 
capmask = 0x;
-   if (mii->mii_instance) {
-   device_get_children(sc->sc_mii.mii_dev, &devlist, &devs);
+   if (mii->mii_instance &&
+   device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) {
for (i = 0; i < devs; i++) {
if (strcmp(device_get_name(devlist[i]), "tlphy")) {
other = device_get_softc(devlist[i]);
___
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"


  1   2   3   4   5   6   7   8   9   10   >