Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2013 23:22:36 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r254628 - in projects/bhyve_npt_pmap: contrib/libcxxrt contrib/wpa/src/drivers sys/amd64/conf sys/arm/allwinner sys/arm/allwinner/a20 sys/arm/arm sys/arm/conf sys/boot/fdt/dts sys/cam s...
Message-ID:  <201308212322.r7LNMaIY068274@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Wed Aug 21 23:22:36 2013
New Revision: 254628
URL: http://svnweb.freebsd.org/changeset/base/254628

Log:
  IFC @254063

Added:
  projects/bhyve_npt_pmap/sys/arm/allwinner/a20/
     - copied from r254063, head/sys/arm/allwinner/a20/
  projects/bhyve_npt_pmap/sys/arm/conf/CUBIEBOARD2
     - copied unchanged from r254063, head/sys/arm/conf/CUBIEBOARD2
  projects/bhyve_npt_pmap/sys/boot/fdt/dts/cubieboard2.dts
     - copied unchanged from r254063, head/sys/boot/fdt/dts/cubieboard2.dts
Modified:
  projects/bhyve_npt_pmap/contrib/libcxxrt/unwind-itanium.h
  projects/bhyve_npt_pmap/contrib/wpa/src/drivers/driver_wired.c
  projects/bhyve_npt_pmap/sys/amd64/conf/GENERIC
  projects/bhyve_npt_pmap/sys/arm/allwinner/common.c
  projects/bhyve_npt_pmap/sys/arm/allwinner/files.a10
  projects/bhyve_npt_pmap/sys/arm/allwinner/timer.c
  projects/bhyve_npt_pmap/sys/arm/arm/busdma_machdep-v6.c
  projects/bhyve_npt_pmap/sys/cam/cam_periph.c
  projects/bhyve_npt_pmap/sys/cam/cam_xpt.c
  projects/bhyve_npt_pmap/sys/cam/cam_xpt_periph.h
  projects/bhyve_npt_pmap/sys/cam/scsi/scsi_da.c
  projects/bhyve_npt_pmap/sys/i386/conf/GENERIC
  projects/bhyve_npt_pmap/sys/ia64/conf/GENERIC
  projects/bhyve_npt_pmap/sys/kern/kern_poll.c
  projects/bhyve_npt_pmap/sys/powerpc/conf/GENERIC
  projects/bhyve_npt_pmap/sys/sparc64/conf/GENERIC
Directory Properties:
  projects/bhyve_npt_pmap/   (props changed)
  projects/bhyve_npt_pmap/contrib/libcxxrt/   (props changed)
  projects/bhyve_npt_pmap/contrib/wpa/   (props changed)
  projects/bhyve_npt_pmap/sys/   (props changed)
  projects/bhyve_npt_pmap/sys/boot/   (props changed)

Modified: projects/bhyve_npt_pmap/contrib/libcxxrt/unwind-itanium.h
==============================================================================
--- projects/bhyve_npt_pmap/contrib/libcxxrt/unwind-itanium.h	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/contrib/libcxxrt/unwind-itanium.h	Wed Aug 21 23:22:36 2013	(r254628)
@@ -80,7 +80,7 @@ struct _Unwind_Exception
     _Unwind_Exception_Cleanup_Fn exception_cleanup;
     unsigned long private_1;
     unsigned long private_2;
-  } __attribute__((__aligned__));
+  };
 
 extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *);
 extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *,

Modified: projects/bhyve_npt_pmap/contrib/wpa/src/drivers/driver_wired.c
==============================================================================
--- projects/bhyve_npt_pmap/contrib/wpa/src/drivers/driver_wired.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/contrib/wpa/src/drivers/driver_wired.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -473,7 +473,8 @@ static int wpa_driver_wired_get_ifstatus
 		return -1;
 	}
 	close(s);
-	*status = ifmr.ifm_status & (IFM_ACTIVE|IFM_AVALID);
+	*status = (ifmr.ifm_status & (IFM_ACTIVE|IFM_AVALID)) == 
+	    (IFM_ACTIVE|IFM_AVALID);
 
 	return 0;
 }

Modified: projects/bhyve_npt_pmap/sys/amd64/conf/GENERIC
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/conf/GENERIC	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/amd64/conf/GENERIC	Wed Aug 21 23:22:36 2013	(r254628)
@@ -75,7 +75,7 @@ options 	INCLUDE_CONFIG_FILE     # Inclu
 # Debugging support.  Always need this:
 options 	KDB			# Enable kernel debugger support.
 # For minimum debugger support (stable branch) use:
-#options 	KDB_TRACE		# Print a stack trace for a panic.
+options 	KDB_TRACE		# Print a stack trace for a panic.
 # For full debugger support use this instead:
 options 	DDB			# Support DDB.
 options 	GDB			# Support remote GDB.

Modified: projects/bhyve_npt_pmap/sys/arm/allwinner/common.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/arm/allwinner/common.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/arm/allwinner/common.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -47,10 +47,16 @@ static int
 fdt_aintc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
     int *pol)
 {
-	if (!fdt_is_compatible(node, "allwinner,sun4i-ic"))
+	int offset;
+
+	if (fdt_is_compatible(node, "allwinner,sun4i-ic"))
+		offset = 0;
+	else if (fdt_is_compatible(node, "arm,gic"))
+		offset = 32;
+	else
 		return (ENXIO);
 
-	*interrupt = fdt32_to_cpu(intr[0]);
+	*interrupt = fdt32_to_cpu(intr[0]) + offset;
 	*trig = INTR_TRIGGER_CONFORM;
 	*pol = INTR_POLARITY_CONFORM;
 

Modified: projects/bhyve_npt_pmap/sys/arm/allwinner/files.a10
==============================================================================
--- projects/bhyve_npt_pmap/sys/arm/allwinner/files.a10	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/arm/allwinner/files.a10	Wed Aug 21 23:22:36 2013	(r254628)
@@ -9,6 +9,7 @@ arm/arm/cpufunc_asm_arm11.S		standard
 arm/arm/cpufunc_asm_armv7.S		standard
 arm/arm/irq_dispatch.S			standard
 
+arm/allwinner/a20/a20_cpu_cfg.c 	standard
 arm/allwinner/a10_clk.c			standard
 arm/allwinner/a10_gpio.c		optional	gpio
 arm/allwinner/a10_ehci.c		optional	ehci

Modified: projects/bhyve_npt_pmap/sys/arm/allwinner/timer.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/arm/allwinner/timer.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/arm/allwinner/timer.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -52,6 +52,8 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/kdb.h>
 
+#include "a20/a20_cpu_cfg.h"
+
 /**
  * Timer registers addr
  *
@@ -84,6 +86,7 @@ struct a10_timer_softc {
 	uint32_t 	sc_period;
 	uint32_t 	timer0_freq;
 	struct eventtimer et;
+	uint8_t 	sc_timer_type;	/* 0 for A10, 1 for A20 */
 };
 
 int a10_timer_get_timerfreq(struct a10_timer_softc *);
@@ -126,6 +129,10 @@ timer_read_counter64(void)
 {
 	uint32_t lo, hi;
 
+	/* In case of A20 get appropriate counter info */
+	if (a10_timer_sc->sc_timer_type)
+		return (a20_read_counter64());
+
 	/* Latch counter, wait for it to be ready to read. */
 	timer_write_4(a10_timer_sc, CNT64_CTRL_REG, CNT64_RL_EN);
 	while (timer_read_4(a10_timer_sc, CNT64_CTRL_REG) & CNT64_RL_EN)
@@ -140,11 +147,18 @@ timer_read_counter64(void)
 static int
 a10_timer_probe(device_t dev)
 {
+	struct a10_timer_softc *sc;
 
-	if (!ofw_bus_is_compatible(dev, "allwinner,sun4i-timer"))
+	sc = device_get_softc(dev);
+
+	if (ofw_bus_is_compatible(dev, "allwinner,sun4i-timer"))
+		sc->sc_timer_type = 0;
+	else if (ofw_bus_is_compatible(dev, "allwinner,sun7i-timer"))
+		sc->sc_timer_type = 1;
+	else
 		return (ENXIO);
 
-	device_set_desc(dev, "Allwinner A10 timer");
+	device_set_desc(dev, "Allwinner A10/A20 timer");
 	return (BUS_PROBE_DEFAULT);
 }
 

Modified: projects/bhyve_npt_pmap/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/arm/arm/busdma_machdep-v6.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/arm/arm/busdma_machdep-v6.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -67,8 +67,6 @@ __FBSDID("$FreeBSD$");
 #define BUS_DMA_COULD_BOUNCE	BUS_DMA_BUS3
 #define BUS_DMA_MIN_ALLOC_COMP	BUS_DMA_BUS4
 
-#define FIX_DMAP_BUS_DMASYNC_POSTREAD
-
 struct bounce_zone;
 
 struct bus_dma_tag {
@@ -179,7 +177,7 @@ static bus_addr_t add_bounce_page(bus_dm
 				  vm_offset_t vaddr, bus_addr_t addr,
 				  bus_size_t size);
 static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
-int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
+int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent);
 static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
     void *buf, bus_size_t buflen, int flags);
 static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
@@ -269,7 +267,7 @@ _bus_dma_inrange(struct arm32_dma_range 
  * to check for a match, if there is no filter callback then assume a match.
  */
 int
-run_filter(bus_dma_tag_t dmat, bus_addr_t paddr)
+run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t size, int coherent)
 {
 	int retval;
 
@@ -277,7 +275,9 @@ run_filter(bus_dma_tag_t dmat, bus_addr_
 
 	do {
 		if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr)
-		 || ((paddr & (dmat->alignment - 1)) != 0))
+		 || ((paddr & (dmat->alignment - 1)) != 0) ||
+		 (!coherent && (size & arm_dcache_align_mask)) ||
+		 (!coherent && (paddr & arm_dcache_align_mask)))
 		 && (dmat->filter == NULL
 		  || (*dmat->filter)(dmat->filterarg, paddr) != 0))
 			retval = 1;
@@ -426,8 +426,7 @@ bus_dma_tag_create(bus_dma_tag_t parent,
 	 || newtag->alignment > 1)
 		newtag->flags |= BUS_DMA_COULD_BOUNCE;
 
-	if (((newtag->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
-	    (flags & BUS_DMA_ALLOCNOW) != 0) {
+	if ((flags & BUS_DMA_ALLOCNOW) != 0) {
 		struct bounce_zone *bz;
 
 		/* Must bounce */
@@ -503,6 +502,41 @@ out:
 	return (error);
 }
 
+static int allocate_bz_and_pages(bus_dma_tag_t dmat, bus_dmamap_t mapp)
+{
+        struct bounce_zone *bz;
+	int maxpages;
+	int error;
+		
+	if (dmat->bounce_zone == NULL)
+		if ((error = alloc_bounce_zone(dmat)) != 0)
+			return (error);
+	bz = dmat->bounce_zone;
+	/* Initialize the new map */
+	STAILQ_INIT(&(mapp->bpages));
+
+	/*
+	 * Attempt to add pages to our pool on a per-instance
+	 * basis up to a sane limit.
+	 */
+	maxpages = MAX_BPAGES;
+	if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0
+	    || (bz->map_count > 0 && bz->total_bpages < maxpages)) {
+		int pages;
+		
+		pages = MAX(atop(dmat->maxsize), 1);
+		pages = MIN(maxpages - bz->total_bpages, pages);
+		pages = MAX(pages, 1);
+		if (alloc_bounce_pages(dmat, pages) < pages)
+			return (ENOMEM);
+		
+		if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0)
+			dmat->flags |= BUS_DMA_MIN_ALLOC_COMP;
+	}
+	bz->map_count++;
+	return (0);
+}
+
 /*
  * Allocate a handle for mapping from kva/uva/physical
  * address space into bus device space.
@@ -511,9 +545,7 @@ int
 bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
 {
 	int mapsize;
-	int error;
-
-	error = 0;
+	int error = 0;
 
 	mapsize = sizeof(**mapp) + (sizeof(struct sync_list) * dmat->nsegments);
 	*mapp = (bus_dmamap_t)malloc(mapsize, M_DEVBUF, M_NOWAIT | M_ZERO);
@@ -540,52 +572,12 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
 	 * exclusion region, a data alignment that is stricter than 1, and/or
 	 * an active address boundary.
 	 */
-	if (dmat->flags & BUS_DMA_COULD_BOUNCE) {
-
-		/* Must bounce */
-		struct bounce_zone *bz;
-		int maxpages;
-
-		if (dmat->bounce_zone == NULL) {
-			if ((error = alloc_bounce_zone(dmat)) != 0) {
-				free(*mapp, M_DEVBUF);
-				*mapp = NULL;
-				return (error);
-			}
-		}
-		bz = dmat->bounce_zone;
-
-		/* Initialize the new map */
-		STAILQ_INIT(&((*mapp)->bpages));
-
-		/*
-		 * Attempt to add pages to our pool on a per-instance
-		 * basis up to a sane limit.
-		 */
-		maxpages = MAX_BPAGES;
-		if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0
-		 || (bz->map_count > 0 && bz->total_bpages < maxpages)) {
-			int pages;
-
-			pages = MAX(atop(dmat->maxsize), 1);
-			pages = MIN(maxpages - bz->total_bpages, pages);
-			pages = MAX(pages, 1);
-			if (alloc_bounce_pages(dmat, pages) < pages)
-				error = ENOMEM;
-
-			if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) {
-				if (error == 0)
-					dmat->flags |= BUS_DMA_MIN_ALLOC_COMP;
-			} else {
-				error = 0;
-			}
-		}
-		bz->map_count++;
+	error = allocate_bz_and_pages(dmat, *mapp);
+	if (error != 0) {
+		free(*mapp, M_DEVBUF);
+		*mapp = NULL;
+		return (error);
 	}
-	if (error == 0)
-		dmat->map_count++;
-	CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
-	    __func__, dmat, dmat->flags, error);
 	return (error);
 }
 
@@ -624,6 +616,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 	vm_memattr_t memattr;
 	int mflags;
 	int mapsize;
+	int error;
 
 	if (flags & BUS_DMA_NOWAIT)
 		mflags = M_NOWAIT;
@@ -641,6 +634,13 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 	}
 
 	(*mapp)->sync_count = 0;
+	/* We may need bounce pages, even for allocated memory */
+	error = allocate_bz_and_pages(dmat, *mapp);
+	if (error != 0) {
+		free(*mapp, M_DEVBUF);
+		*mapp = NULL;
+		return (error);
+	}
 
 	if (dmat->segments == NULL) {
 		dmat->segments = (bus_dma_segment_t *)malloc(
@@ -666,10 +666,6 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
 		ba = standard_allocator;
 		(*mapp)->flags = 0;
 	}
-#ifdef notyet
-	/* All buffers we allocate are cache-aligned. */
-	map->flags |= DMAMAP_CACHE_ALIGNED;
-#endif
 
 	/*
 	 * Try to find a bufzone in the allocator that holds a cache of buffers
@@ -770,7 +766,8 @@ _bus_dmamap_count_phys(bus_dma_tag_t dma
 		curaddr = buf;
 		while (buflen != 0) {
 			sgsize = MIN(buflen, dmat->maxsegsz);
-			if (run_filter(dmat, curaddr) != 0) {
+			if (run_filter(dmat, curaddr, sgsize, 
+			    map->flags & DMAMAP_COHERENT) != 0) {
 				sgsize = MIN(sgsize, PAGE_SIZE);
 				map->pagesneeded++;
 			}
@@ -806,7 +803,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
 				paddr = pmap_kextract(vaddr);
 			else
 				paddr = pmap_extract(map->pmap, vaddr);
-			if (run_filter(dmat, paddr) != 0) {
+			if (run_filter(dmat, paddr,
+			    min(vendaddr - vaddr, 
+			    (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK))),
+			    map->flags & DMAMAP_COHERENT) != 0) {
 				map->pagesneeded++;
 			}
 			vaddr += (PAGE_SIZE - ((vm_offset_t)vaddr & PAGE_MASK));
@@ -922,7 +922,8 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat
 	if (segs == NULL)
 		segs = dmat->segments;
 
-	if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
+	if (((map->flags & DMAMAP_COHERENT) == 0) ||
+	    (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
 		_bus_dmamap_count_phys(dmat, map, buf, buflen, flags);
 		if (map->pagesneeded != 0) {
 			error = _bus_dmamap_reserve_pages(dmat, map, flags);
@@ -934,8 +935,10 @@ _bus_dmamap_load_phys(bus_dma_tag_t dmat
 	while (buflen > 0) {
 		curaddr = buf;
 		sgsize = MIN(buflen, dmat->maxsegsz);
-		if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
-		    map->pagesneeded != 0 && run_filter(dmat, curaddr)) {
+		if ((((map->flags & DMAMAP_COHERENT) == 0) ||
+		    ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) &&
+		    map->pagesneeded != 0 && run_filter(dmat, curaddr,
+		    sgsize, map->flags & DMAMAP_COHERENT)) {
 			sgsize = MIN(sgsize, PAGE_SIZE);
 			curaddr = add_bounce_page(dmat, map, 0, curaddr,
 						  sgsize);
@@ -982,7 +985,8 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 
 	map->pmap = pmap;
 
-	if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
+	if (!(map->flags & DMAMAP_COHERENT) ||
+	    (dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
 		_bus_dmamap_count_pages(dmat, map, buf, buflen, flags);
 		if (map->pagesneeded != 0) {
 			error = _bus_dmamap_reserve_pages(dmat, map, flags);
@@ -1012,8 +1016,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
 		if (buflen < sgsize)
 			sgsize = buflen;
 
-		if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
-		    map->pagesneeded != 0 && run_filter(dmat, curaddr)) {
+		if ((((map->flags & DMAMAP_COHERENT) == 0) ||
+		    ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0)) &&
+		    map->pagesneeded != 0 && run_filter(dmat, curaddr,
+		    sgsize, map->flags & DMAMAP_COHERENT)) {
 			curaddr = add_bounce_page(dmat, map, vaddr, curaddr,
 						  sgsize);
 		} else {
@@ -1156,12 +1162,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
 {
 	struct bounce_page *bpage;
 	struct sync_list *sl, *end;
-	bus_size_t len, unalign;
-	vm_offset_t buf, ebuf;
-#ifdef FIX_DMAP_BUS_DMASYNC_POSTREAD
-	vm_offset_t bbuf;
-	char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align];
-#endif
 	/*
 	 * If the buffer was from user space, it is possible that this is not
 	 * the same vm map, especially on a POST operation.  It's not clear that
@@ -1252,45 +1252,9 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
 
 		case BUS_DMASYNC_PREREAD:
 			while (sl != end) {
-					/* write back the unaligned portions */
-				vm_paddr_t physaddr = sl->busaddr, ephysaddr;
-				buf = sl->vaddr;
-				len = sl->datacount;
-				ebuf = buf + len;	/* end of buffer */
-				ephysaddr = physaddr + len;
-				unalign = buf & arm_dcache_align_mask;
-				if (unalign) {
-						/* wbinv leading fragment */
-					buf &= ~arm_dcache_align_mask;
-					physaddr &= ~arm_dcache_align_mask;
-					cpu_dcache_wbinv_range(buf,
-							arm_dcache_align);
-					l2cache_wbinv_range(buf, physaddr,
-					    arm_dcache_align);
-					buf += arm_dcache_align;
-					physaddr += arm_dcache_align;
-					/* number byte in buffer wbinv */
-					unalign = arm_dcache_align - unalign;
-					if (len > unalign)
-						len -= unalign;
-					else
-						len = 0;
-				}
-				unalign = ebuf & arm_dcache_align_mask;
-				if (ebuf > buf && unalign) {
-						/* wbinv trailing fragment */
-					len -= unalign;
-					ebuf -= unalign;
-					ephysaddr -= unalign;
-					cpu_dcache_wbinv_range(ebuf,
-							arm_dcache_align);
-					l2cache_wbinv_range(ebuf, ephysaddr,
-					    arm_dcache_align);
-				}
-				if (ebuf > buf) {
-					cpu_dcache_inv_range(buf, len);
-					l2cache_inv_range(buf, physaddr, len);
-				}
+				cpu_dcache_inv_range(sl->vaddr, sl->datacount);
+				l2cache_inv_range(sl->vaddr, sl->busaddr, 
+				    sl->datacount);
 				sl++;
 			}
 			break;
@@ -1304,60 +1268,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
 			}
 			break;
 
-#ifdef FIX_DMAP_BUS_DMASYNC_POSTREAD
-		case BUS_DMASYNC_POSTREAD:
-			while (sl != end) {
-					/* write back the unaligned portions */
-				vm_paddr_t physaddr;
-				register_t s = 0;
-
-				buf = sl->vaddr;
-				len = sl->datacount;
-				physaddr = sl->busaddr;
-				bbuf = buf & ~arm_dcache_align_mask;
-				ebuf = buf + len;
-				physaddr = physaddr & ~arm_dcache_align_mask;
-
-
-				if ((buf & arm_dcache_align_mask) ||
-				    (ebuf & arm_dcache_align_mask)) {
-					s = intr_disable();
-					unalign = buf & arm_dcache_align_mask;
-					if (unalign) {
-						memcpy(_tmp_cl, (void *)bbuf, unalign);
-						len += unalign; /* inv entire cache line */
-					}
-
-					unalign = ebuf & arm_dcache_align_mask;
-					if (unalign) {
-						unalign = arm_dcache_align - unalign;
-						memcpy(_tmp_clend, (void *)ebuf, unalign);
-						len += unalign; /* inv entire cache line */
-					}
-				}
-
-				/* inv are cache length aligned */
-				cpu_dcache_inv_range(bbuf, len);
-				l2cache_inv_range(bbuf, physaddr, len);
-
-				if ((buf & arm_dcache_align_mask) ||
-				    (ebuf & arm_dcache_align_mask)) {
-					unalign = (vm_offset_t)buf & arm_dcache_align_mask;
-					if (unalign)
-						memcpy((void *)bbuf, _tmp_cl, unalign);
-
-					unalign = ebuf & arm_dcache_align_mask;
-					if (unalign)
-						memcpy((void *)ebuf, _tmp_clend,
-						    arm_dcache_align - unalign);
-
-					intr_restore(s);
-				}
-				sl++;
-			}
-				break;
-#endif /* FIX_DMAP_BUS_DMASYNC_POSTREAD */
-
 		default:
 			break;
 		}

Copied: projects/bhyve_npt_pmap/sys/arm/conf/CUBIEBOARD2 (from r254063, head/sys/arm/conf/CUBIEBOARD2)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/bhyve_npt_pmap/sys/arm/conf/CUBIEBOARD2	Wed Aug 21 23:22:36 2013	(r254628, copy of r254063, head/sys/arm/conf/CUBIEBOARD2)
@@ -0,0 +1,133 @@
+# CUBIEBOARD2 -- Custom configuration for the CUBIEBOARD2 ARM development
+# platform, check out http://www.cubieboard.org
+#
+# For more information on this file, please read the handbook section on
+# Kernel Configuration Files:
+#
+#    http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+
+ident		CUBIEBOARD2
+
+include 	"../allwinner/a20/std.a20"
+
+makeoptions	MODULES_OVERRIDE=""
+makeoptions	WITHOUT_MODULES="ahc"
+
+options 	HZ=100
+options 	SCHED_4BSD		#4BSD scheduler
+options 	INET			#InterNETworking
+options 	INET6			#IPv6 communications protocols
+options 	FFS			#Berkeley Fast Filesystem
+options 	SOFTUPDATES		#Enable FFS soft updates support
+options 	UFS_ACL 		#Support for access control lists
+options 	UFS_DIRHASH		#Improve performance on big directories
+options 	MSDOSFS 		#MSDOS Filesystem
+options 	CD9660			#ISO 9660 Filesystem
+options 	PROCFS			#Process filesystem (requires PSEUDOFS)
+options 	PSEUDOFS		#Pseudo-filesystem framework
+options 	COMPAT_43		#Compatible with BSD 4.3 [KEEP THIS!]
+options 	SCSI_DELAY=5000		#Delay (in ms) before probing SCSI
+options 	KTRACE			#ktrace(1) support
+options 	SYSVSHM 		#SYSV-style shared memory
+options 	SYSVMSG 		#SYSV-style message queues
+options 	SYSVSEM 		#SYSV-style semaphores
+options 	_KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions
+options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
+options 	PREEMPTION
+options 	FREEBSD_BOOT_LOADER
+
+# Debugging
+makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
+options 	BREAK_TO_DEBUGGER
+#options 	VERBOSE_SYSINIT		#Enable verbose sysinit messages
+options 	KDB
+options 	DDB			#Enable the kernel debugger
+options 	INVARIANTS		#Enable calls of extra sanity checking
+options 	INVARIANT_SUPPORT	#Extra sanity checks of internal structures, required by INVARIANTS
+options 	WITNESS 		#Enable checks to detect deadlocks and cycles
+options 	WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
+#options 	DIAGNOSTIC
+
+# NFS support
+#options 	NFSCL
+#options 	NFSSERVER		#Network Filesystem Server
+#options 	NFSCLIENT		#Network Filesystem Client
+
+# Uncomment this for NFS root
+#options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
+#options 	BOOTP_NFSROOT
+#options 	BOOTP_COMPAT
+#options 	BOOTP
+#options 	BOOTP_NFSV3
+#options 	BOOTP_WIRED_TO=cpsw0
+
+# MMC/SD/SDIO card slot support
+#device 	mmc			# mmc/sd bus
+#device 	mmcsd			# mmc/sd flash cards
+
+# Boot device is 2nd slice on MMC/SD card
+options 	ROOTDEVNAME=\"ufs:/dev/da0s2\"
+
+# ATA controllers
+#device 	ahci		# AHCI-compatible SATA controllers
+#device 	ata		# Legacy ATA/SATA controllers
+#options	ATA_STATIC_ID	# Static device numbering
+
+# Console and misc
+device		uart
+device		uart_ns8250
+device		pty
+device		snp
+device		md
+device		random			# Entropy device
+
+# I2C support
+#device 	iicbus
+#device 	iic
+
+# GPIO
+device		gpio
+
+device		scbus			# SCSI bus (required for SCSI)
+device		da			# Direct Access (disks)
+device		pass
+
+# USB support
+device		usb
+options 	USB_DEBUG
+#options 	USB_REQ_DEBUG
+#options 	USB_VERBOSE
+#device 	uhci
+#device 	ohci
+device		ehci
+
+device		umass
+
+# Ethernet
+device		loop
+device		ether
+device		mii
+device		smscphy
+#device 	cpsw
+device		bpf
+
+# USB ethernet support, requires miibus
+device		miibus
+
+# Flattened Device Tree
+options 	FDT
+options 	FDT_DTB_STATIC
+makeoptions	FDT_DTS_FILE=cubieboard2.dts
+

Copied: projects/bhyve_npt_pmap/sys/boot/fdt/dts/cubieboard2.dts (from r254063, head/sys/boot/fdt/dts/cubieboard2.dts)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/bhyve_npt_pmap/sys/boot/fdt/dts/cubieboard2.dts	Wed Aug 21 23:22:36 2013	(r254628, copy of r254063, head/sys/boot/fdt/dts/cubieboard2.dts)
@@ -0,0 +1,141 @@
+/*-
+ * Copyright (c) 2013 Ganbold Tsagaankhuu <ganbold@gmail.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * $FreeBSD$
+ */
+
+/dts-v1/;
+
+/ {
+	model = "Cubietech Cubieboard2";
+	compatible = "cubietech,a20-cubieboard", "allwinner,sun7i-a20";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	interrupt-parent = <&GIC>;
+
+	memory {
+		device_type = "memory";
+		reg = < 0x40000000 0x20000000 >;	/* 512MB RAM */
+	};
+
+	aliases {
+		soc = &SOC;
+		UART0 = &UART0;
+	};
+
+	SOC: a20 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "simple-bus";
+		ranges;
+		bus-frequency = <0>;
+
+		GIC: interrupt-controller@01c81000 {
+			compatible = "arm,gic";
+			reg = 	<0x01c81000 0x1000>,	/* Distributor Registers */
+				<0x01c82000 0x0100>;	/* CPU Interface Registers */
+			interrupt-controller;
+			#interrupt-cells = <1>;
+		};
+
+		cpu-cfg@01c20000 {
+			compatible = "allwinner,sun7i-cpu-cfg";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			reg = < 0x01c25c00 0x400 >;
+		};
+
+		ccm@01c20000 {
+			compatible = "allwinner,sun4i-ccm";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			reg = < 0x01c20000 0x400 >;
+		};
+
+		timer@01c20c00 {
+			compatible = "allwinner,sun7i-timer";
+			reg = <0x01c20c00 0x90>;
+			interrupts = < 22 >;
+			interrupt-parent = <&GIC>;
+			clock-frequency = < 24000000 >;
+		};
+
+		watchdog@01c20c90 {
+			compatible = "allwinner,sun4i-wdt";
+			reg = <0x01c20c90 0x10>;
+		};
+
+		GPIO: gpio@01c20800 {
+			#gpio-cells = <3>;
+			compatible = "allwinner,sun4i-gpio";
+			gpio-controller;
+			reg =<  0x01c20800 0x400 >;
+			interrupts = < 28 >;
+			interrupt-parent = <&GIC>;
+		};
+
+		usb1: usb@01c14000 {
+			compatible = "allwinner,usb-ehci", "usb-ehci";
+			reg = <0x01c14000 0x1000>;
+			interrupts = < 39 >;
+			interrupt-parent = <&GIC>;
+		};
+
+		usb2: usb@01c1c000 {
+			compatible = "allwinner,usb-ehci", "usb-ehci";
+			reg = <0x01c1c000 0x1000>;
+			interrupts = < 40 >;
+			interrupt-parent = <&GIC>;
+		};
+
+		sata@01c18000 {
+			compatible = "allwinner,ahci";
+			reg = <0x01c18000 0x1000>;
+			interrupts = <56>;
+			interrupt-parent = <&GIC>;
+		};
+
+		UART0: serial@01c28000 {
+			status = "okay";
+			compatible = "ns16550";
+			reg = <0x01c28000 0x400>;
+			reg-shift = <2>;
+			interrupts = <1>;
+			interrupt-parent = <&GIC>;
+			current-speed = <115200>;
+			clock-frequency = < 24000000 >;
+			busy-detect = <1>;
+			broken-txfifo = <1>;
+		};
+	};
+
+	chosen {
+		bootargs = "-v";
+		stdin = "UART0";
+		stdout = "UART0";
+	};
+};
+

Modified: projects/bhyve_npt_pmap/sys/cam/cam_periph.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/cam/cam_periph.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/cam/cam_periph.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -258,7 +258,7 @@ failure:
 		break;
 	case 3:
 		CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));
-		xpt_remove_periph(periph, /*topology_lock_held*/ 0);
+		xpt_remove_periph(periph);
 		/* FALLTHROUGH */
 	case 2:
 		xpt_lock_buses();
@@ -645,7 +645,7 @@ camperiphfree(struct cam_periph *periph)
 	TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links);
 	(*p_drv)->generation++;
 
-	xpt_remove_periph(periph, /*topology_lock_held*/ 1);
+	xpt_remove_periph(periph);
 
 	xpt_unlock_buses();
 	CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n"));

Modified: projects/bhyve_npt_pmap/sys/cam/cam_xpt.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/cam/cam_xpt.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/cam/cam_xpt.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -96,7 +96,6 @@ typedef enum {
 
 struct xpt_softc {
 	xpt_flags		flags;
-	u_int32_t		xpt_generation;
 
 	/* number of high powered commands that can go through right now */
 	STAILQ_HEAD(highpowerlist, cam_ed)	highpowerq;
@@ -608,24 +607,11 @@ xptdoioctl(struct cdev *dev, u_long cmd,
 		struct periph_driver **p_drv;
 		char   *name;
 		u_int unit;
-		u_int cur_generation;
 		int base_periph_found;
-		int splbreaknum;
 
 		ccb = (union ccb *)addr;
 		unit = ccb->cgdl.unit_number;
 		name = ccb->cgdl.periph_name;
-		/*
-		 * Every 100 devices, we want to drop our lock protection to
-		 * give the software interrupt handler a chance to run.
-		 * Most systems won't run into this check, but this should
-		 * avoid starvation in the software interrupt handler in
-		 * large systems.
-		 */
-		splbreaknum = 100;
-
-		ccb = (union ccb *)addr;
-
 		base_periph_found = 0;
 
 		/*
@@ -639,8 +625,6 @@ xptdoioctl(struct cdev *dev, u_long cmd,
 
 		/* Keep the list from changing while we traverse it */
 		xpt_lock_buses();
-ptstartover:
-		cur_generation = xsoftc.xpt_generation;
 
 		/* first find our driver in the list of drivers */
 		for (p_drv = periph_drivers; *p_drv != NULL; p_drv++)
@@ -667,15 +651,8 @@ ptstartover:
 		for (periph = TAILQ_FIRST(&(*p_drv)->units); periph != NULL;
 		     periph = TAILQ_NEXT(periph, unit_links)) {
 
-			if (periph->unit_number == unit) {
+			if (periph->unit_number == unit)
 				break;
-			} else if (--splbreaknum == 0) {
-				xpt_unlock_buses();
-				xpt_lock_buses();
-				splbreaknum = 100;
-				if (cur_generation != xsoftc.xpt_generation)
-				       goto ptstartover;
-			}
 		}
 		/*
 		 * If we found the peripheral driver that the user passed
@@ -1015,15 +992,11 @@ xpt_add_periph(struct cam_periph *periph
 		SLIST_INSERT_HEAD(periph_head, periph, periph_links);
 	}
 
-	xpt_lock_buses();
-	xsoftc.xpt_generation++;
-	xpt_unlock_buses();
-
 	return (status);
 }
 
 void
-xpt_remove_periph(struct cam_periph *periph, int topology_lock_held)
+xpt_remove_periph(struct cam_periph *periph)
 {
 	struct cam_ed *device;
 
@@ -1043,14 +1016,6 @@ xpt_remove_periph(struct cam_periph *per
 
 		SLIST_REMOVE(periph_head, periph, cam_periph, periph_links);
 	}
-
-	if (topology_lock_held == 0)
-		xpt_lock_buses();
-
-	xsoftc.xpt_generation++;
-
-	if (topology_lock_held == 0)
-		xpt_unlock_buses();
 }
 
 

Modified: projects/bhyve_npt_pmap/sys/cam/cam_xpt_periph.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/cam/cam_xpt_periph.h	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/cam/cam_xpt_periph.h	Wed Aug 21 23:22:36 2013	(r254628)
@@ -42,8 +42,7 @@ void		xpt_polled_action(union ccb *ccb);
 void		xpt_release_ccb(union ccb *released_ccb);
 void		xpt_schedule(struct cam_periph *perph, u_int32_t new_priority);
 int32_t		xpt_add_periph(struct cam_periph *periph);
-void		xpt_remove_periph(struct cam_periph *periph,
-				  int topology_lock_held);
+void		xpt_remove_periph(struct cam_periph *periph);
 void		xpt_announce_periph(struct cam_periph *periph,
 				    char *announce_string);
 void		xpt_announce_quirks(struct cam_periph *periph,

Modified: projects/bhyve_npt_pmap/sys/cam/scsi/scsi_da.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/cam/scsi/scsi_da.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/cam/scsi/scsi_da.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -2820,6 +2820,7 @@ cmd6workaround(union ccb *ccb)
 			xpt_print(ccb->ccb_h.path,
 			    "SYNCHRONIZE CACHE(10) not supported.\n");
 		softc->quirks |= DA_Q_NO_SYNC_CACHE;
+		softc->disk->d_flags &= ~DISKFLAG_CANFLUSHCACHE;
 		return (0);
 	}
 

Modified: projects/bhyve_npt_pmap/sys/i386/conf/GENERIC
==============================================================================
--- projects/bhyve_npt_pmap/sys/i386/conf/GENERIC	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/i386/conf/GENERIC	Wed Aug 21 23:22:36 2013	(r254628)
@@ -75,7 +75,7 @@ options 	INCLUDE_CONFIG_FILE     # Inclu
 # Debugging support.  Always need this:
 options 	KDB			# Enable kernel debugger support.
 # For minimum debugger support (stable branch) use:
-#options 	KDB_TRACE		# Print a stack trace for a panic.
+options 	KDB_TRACE		# Print a stack trace for a panic.
 # For full debugger support use this instead:
 options 	DDB			# Support DDB.
 options 	GDB			# Support remote GDB.

Modified: projects/bhyve_npt_pmap/sys/ia64/conf/GENERIC
==============================================================================
--- projects/bhyve_npt_pmap/sys/ia64/conf/GENERIC	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/ia64/conf/GENERIC	Wed Aug 21 23:22:36 2013	(r254628)
@@ -66,7 +66,7 @@ options 	_KPOSIX_PRIORITY_SCHEDULING	# P
 # Debugging support.  Always need this:
 options 	KDB		# Enable kernel debugger support.
 # For minimum debugger support (stable branch) use:
-#options 	KDB_TRACE	# Print a stack trace for a panic.
+options 	KDB_TRACE	# Print a stack trace for a panic.
 # For full debugger support use this instead:
 options 	DDB		# Support DDB
 options 	GDB		# Support remote GDB

Modified: projects/bhyve_npt_pmap/sys/kern/kern_poll.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/kern/kern_poll.c	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/kern/kern_poll.c	Wed Aug 21 23:22:36 2013	(r254628)
@@ -169,7 +169,7 @@ static int user_frac_sysctl(SYSCTL_HANDL
 	error = sysctl_handle_int(oidp, &val, 0, req);
 	if (error || !req->newptr )
 		return (error);
-	if (val < 0 || val > 99)
+	if (val > 99)
 		return (EINVAL);
 
 	mtx_lock(&poll_mtx);

Modified: projects/bhyve_npt_pmap/sys/powerpc/conf/GENERIC
==============================================================================
--- projects/bhyve_npt_pmap/sys/powerpc/conf/GENERIC	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/powerpc/conf/GENERIC	Wed Aug 21 23:22:36 2013	(r254628)
@@ -77,7 +77,7 @@ options 	INCLUDE_CONFIG_FILE     # Inclu
 # Debugging support.  Always need this:
 options 	KDB			# Enable kernel debugger support.
 # For minimum debugger support (stable branch) use:
-#options 	KDB_TRACE		# Print a stack trace for a panic.
+options 	KDB_TRACE		# Print a stack trace for a panic.
 # For full debugger support use this instead:
 options 	DDB			#Support DDB
 #options 	DEADLKRES		#Enable the deadlock resolver

Modified: projects/bhyve_npt_pmap/sys/sparc64/conf/GENERIC
==============================================================================
--- projects/bhyve_npt_pmap/sys/sparc64/conf/GENERIC	Wed Aug 21 23:04:48 2013	(r254627)
+++ projects/bhyve_npt_pmap/sys/sparc64/conf/GENERIC	Wed Aug 21 23:22:36 2013	(r254628)
@@ -69,7 +69,7 @@ options 	INCLUDE_CONFIG_FILE	# Include t
 # Debugging support.  Always need this:
 options 	KDB			# Enable kernel debugger support.
 # For minimum debugger support (stable branch) use:
-#options 	KDB_TRACE		# Print a stack trace for a panic.
+options 	KDB_TRACE		# Print a stack trace for a panic.
 # For full debugger support use this instead:
 options 	DDB			# Support DDB.
 options 	GDB			# Support remote GDB.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308212322.r7LNMaIY068274>