Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2014 23:11:18 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 1190201 for review
Message-ID:  <201401202311.s0KNBIY6096921@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1190201?ac=10

Change 1190201 by jhb@jhb_pippin on 2014/01/20 23:10:51

	IFC @1190198

Affected files ...

.. //depot/projects/pci/sys/amd64/conf/VT#1 branch
.. //depot/projects/pci/sys/amd64/vmm/intel/vmx.c#10 integrate
.. //depot/projects/pci/sys/arm/at91/at91_smc.c#1 branch
.. //depot/projects/pci/sys/arm/at91/at91_smc.h#1 branch
.. //depot/projects/pci/sys/arm/at91/board_hl201.c#3 integrate
.. //depot/projects/pci/sys/arm/at91/board_sam9260ek.c#2 integrate
.. //depot/projects/pci/sys/arm/at91/files.at91#4 integrate
.. //depot/projects/pci/sys/arm/at91/uart_dev_at91usart.c#6 integrate
.. //depot/projects/pci/sys/arm/conf/ATMEL#5 integrate
.. //depot/projects/pci/sys/arm/conf/HL201#6 integrate
.. //depot/projects/pci/sys/arm/conf/NOTES#3 integrate
.. //depot/projects/pci/sys/arm/conf/SAM9260EK#4 integrate
.. //depot/projects/pci/sys/arm/s3c2xx0/uart_dev_s3c2410.c#4 integrate
.. //depot/projects/pci/sys/arm/sa11x0/uart_dev_sa1110.c#4 integrate
.. //depot/projects/pci/sys/arm/xilinx/uart_dev_cdnc.c#2 integrate
.. //depot/projects/pci/sys/dev/aha/aha.c#5 integrate
.. //depot/projects/pci/sys/dev/nand/nfc_at91.c#2 integrate
.. //depot/projects/pci/sys/dev/nand/nfc_at91.h#1 branch
.. //depot/projects/pci/sys/dev/pci/pci.c#50 integrate
.. //depot/projects/pci/sys/dev/pci/pci_user.c#8 integrate
.. //depot/projects/pci/sys/dev/pci/pcivar.h#16 integrate
.. //depot/projects/pci/sys/dev/uart/uart_core.c#7 integrate
.. //depot/projects/pci/sys/dev/uart/uart_cpu.h#4 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_imx.c#3 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_lpc.c#3 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_ns8250.c#9 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_ns8250.h#2 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_pl011.c#4 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_quicc.c#4 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_sab82532.c#4 integrate
.. //depot/projects/pci/sys/dev/uart/uart_dev_z8530.c#4 integrate
.. //depot/projects/pci/sys/dev/uart/uart_if.m#3 integrate
.. //depot/projects/pci/sys/dev/usb/net/uhso.c#10 integrate
.. //depot/projects/pci/sys/geom/multipath/g_multipath.c#8 integrate
.. //depot/projects/pci/sys/i386/conf/VT#1 branch
.. //depot/projects/pci/sys/ia64/conf/GENERIC#10 integrate
.. //depot/projects/pci/sys/ia64/ia64/pmap.c#14 integrate
.. //depot/projects/pci/sys/kern/subr_witness.c#9 integrate
.. //depot/projects/pci/sys/mips/adm5120/uart_dev_adm5120.c#4 integrate
.. //depot/projects/pci/sys/mips/atheros/uart_dev_ar933x.c#2 integrate
.. //depot/projects/pci/sys/mips/cavium/uart_dev_oct16550.c#4 integrate
.. //depot/projects/pci/sys/mips/rt305x/uart_dev_rt305x.c#4 integrate
.. //depot/projects/pci/sys/net/ieee8023ad_lacp.c#10 integrate
.. //depot/projects/pci/sys/net/if.c#12 integrate
.. //depot/projects/pci/sys/net/if_arcsubr.c#7 integrate
.. //depot/projects/pci/sys/net/if_dl.h#3 integrate
.. //depot/projects/pci/sys/net/if_ethersubr.c#12 integrate
.. //depot/projects/pci/sys/net/if_fddisubr.c#7 integrate
.. //depot/projects/pci/sys/net/if_iso88025subr.c#8 integrate
.. //depot/projects/pci/sys/net/if_lagg.c#14 integrate
.. //depot/projects/pci/sys/netinet/ip_carp.c#11 integrate
.. //depot/projects/pci/sys/netinet/tcp_syncache.c#10 integrate
.. //depot/projects/pci/sys/netinet6/in6.c#15 integrate
.. //depot/projects/pci/sys/netinet6/in6_var.h#9 integrate
.. //depot/projects/pci/sys/netinet6/nd6.c#14 integrate
.. //depot/projects/pci/sys/netinet6/nd6.h#6 integrate
.. //depot/projects/pci/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c#7 integrate
.. //depot/projects/pci/sys/powerpc/powermac/macio.c#7 integrate
.. //depot/projects/pci/sys/powerpc/powermac/maciovar.h#5 integrate
.. //depot/projects/pci/sys/powerpc/powermac/pmu.c#5 integrate
.. //depot/projects/pci/sys/sys/pciio.h#4 integrate
.. //depot/projects/pci/sys/vm/vnode_pager.c#9 integrate
.. //depot/projects/pci/sys/x86/x86/nexus.c#15 integrate
.. //depot/projects/pci/usr.sbin/pciconf/pciconf.8#5 integrate
.. //depot/projects/pci/usr.sbin/pciconf/pciconf.c#5 integrate

Differences ...

==== //depot/projects/pci/sys/amd64/vmm/intel/vmx.c#10 (text+ko) ====

@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 260836 2014-01-18 02:20:10Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 260863 2014-01-18 21:47:12Z neel $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 260836 2014-01-18 02:20:10Z neel $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 260863 2014-01-18 21:47:12Z neel $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -147,21 +147,6 @@
 	   &vmx_initialized, 0, "Intel VMX initialized");
 
 /*
- * Virtual NMI blocking conditions.
- *
- * Some processor implementations also require NMI to be blocked if
- * the STI_BLOCKING bit is set. It is possible to detect this at runtime
- * based on the (exit_reason,exit_qual) tuple being set to 
- * (EXIT_REASON_INVAL_VMCS, EXIT_QUAL_NMI_WHILE_STI_BLOCKING).
- *
- * We take the easy way out and also include STI_BLOCKING as one of the
- * gating items for vNMI injection.
- */
-static uint64_t nmi_blocking_bits = VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING |
-				    VMCS_INTERRUPTIBILITY_NMI_BLOCKING |
-				    VMCS_INTERRUPTIBILITY_STI_BLOCKING;
-
-/*
  * Optional capabilities
  */
 static int cap_halt_exit;
@@ -1020,117 +1005,145 @@
 vmx_set_int_window_exiting(struct vmx *vmx, int vcpu)
 {
 
-	vmx->cap[vcpu].proc_ctls |= PROCBASED_INT_WINDOW_EXITING;
-	vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+	if ((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) == 0) {
+		vmx->cap[vcpu].proc_ctls |= PROCBASED_INT_WINDOW_EXITING;
+		vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+		VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting");
+	}
 }
 
 static void __inline
 vmx_clear_int_window_exiting(struct vmx *vmx, int vcpu)
 {
 
+	KASSERT((vmx->cap[vcpu].proc_ctls & PROCBASED_INT_WINDOW_EXITING) != 0,
+	    ("intr_window_exiting not set: %#x", vmx->cap[vcpu].proc_ctls));
 	vmx->cap[vcpu].proc_ctls &= ~PROCBASED_INT_WINDOW_EXITING;
 	vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+	VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting");
 }
 
 static void __inline
 vmx_set_nmi_window_exiting(struct vmx *vmx, int vcpu)
 {
 
-	vmx->cap[vcpu].proc_ctls |= PROCBASED_NMI_WINDOW_EXITING;
-	vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+	if ((vmx->cap[vcpu].proc_ctls & PROCBASED_NMI_WINDOW_EXITING) == 0) {
+		vmx->cap[vcpu].proc_ctls |= PROCBASED_NMI_WINDOW_EXITING;
+		vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+		VCPU_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting");
+	}
 }
 
 static void __inline
 vmx_clear_nmi_window_exiting(struct vmx *vmx, int vcpu)
 {
 
+	KASSERT((vmx->cap[vcpu].proc_ctls & PROCBASED_NMI_WINDOW_EXITING) != 0,
+	    ("nmi_window_exiting not set %#x", vmx->cap[vcpu].proc_ctls));
 	vmx->cap[vcpu].proc_ctls &= ~PROCBASED_NMI_WINDOW_EXITING;
 	vmcs_write(VMCS_PRI_PROC_BASED_CTLS, vmx->cap[vcpu].proc_ctls);
+	VCPU_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting");
 }
 
-static int
+#define	NMI_BLOCKING	(VMCS_INTERRUPTIBILITY_NMI_BLOCKING |		\
+			 VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)
+#define	HWINTR_BLOCKING	(VMCS_INTERRUPTIBILITY_STI_BLOCKING |		\
+			 VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING)
+
+static void
 vmx_inject_nmi(struct vmx *vmx, int vcpu)
 {
-	uint64_t info, interruptibility;
+	uint32_t gi, info;
 
-	/* Bail out if no NMI requested */
-	if (!vm_nmi_pending(vmx->vm, vcpu))
-		return (0);
+	gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
+	KASSERT((gi & NMI_BLOCKING) == 0, ("vmx_inject_nmi: invalid guest "
+	    "interruptibility-state %#x", gi));
 
-	interruptibility = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
-	if (interruptibility & nmi_blocking_bits)
-		goto nmiblocked;
+	info = vmcs_read(VMCS_ENTRY_INTR_INFO);
+	KASSERT((info & VMCS_INTR_VALID) == 0, ("vmx_inject_nmi: invalid "
+	    "VM-entry interruption information %#x", info));
 
 	/*
 	 * Inject the virtual NMI. The vector must be the NMI IDT entry
 	 * or the VMCS entry check will fail.
 	 */
-	info = VMCS_INTR_T_NMI | VMCS_INTR_VALID;
-	info |= IDT_NMI;
+	info = IDT_NMI | VMCS_INTR_T_NMI | VMCS_INTR_VALID;
 	vmcs_write(VMCS_ENTRY_INTR_INFO, info);
 
 	VCPU_CTR0(vmx->vm, vcpu, "Injecting vNMI");
 
 	/* Clear the request */
 	vm_nmi_clear(vmx->vm, vcpu);
-	return (1);
-
-nmiblocked:
-	/*
-	 * Set the NMI Window Exiting execution control so we can inject
-	 * the virtual NMI as soon as blocking condition goes away.
-	 */
-	vmx_set_nmi_window_exiting(vmx, vcpu);
-
-	VCPU_CTR0(vmx->vm, vcpu, "Enabling NMI window exiting");
-	return (1);
 }
 
 static void
 vmx_inject_interrupts(struct vmx *vmx, int vcpu, struct vlapic *vlapic)
 {
-	int vector;
-	uint64_t info, rflags, interruptibility;
+	int vector, need_nmi_exiting;
+	uint64_t rflags;
+	uint32_t gi, info;
+
+	if (vm_nmi_pending(vmx->vm, vcpu)) {
+		/*
+		 * If there are no conditions blocking NMI injection then
+		 * inject it directly here otherwise enable "NMI window
+		 * exiting" to inject it as soon as we can.
+		 *
+		 * We also check for STI_BLOCKING because some implementations
+		 * don't allow NMI injection in this case. If we are running
+		 * on a processor that doesn't have this restriction it will
+		 * immediately exit and the NMI will be injected in the
+		 * "NMI window exiting" handler.
+		 */
+		need_nmi_exiting = 1;
+		gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
+		if ((gi & (HWINTR_BLOCKING | NMI_BLOCKING)) == 0) {
+			info = vmcs_read(VMCS_ENTRY_INTR_INFO);
+			if ((info & VMCS_INTR_VALID) == 0) {
+				vmx_inject_nmi(vmx, vcpu);
+				need_nmi_exiting = 0;
+			} else {
+				VCPU_CTR1(vmx->vm, vcpu, "Cannot inject NMI "
+				    "due to VM-entry intr info %#x", info);
+			}
+		} else {
+			VCPU_CTR1(vmx->vm, vcpu, "Cannot inject NMI due to "
+			    "Guest Interruptibility-state %#x", gi);
+		}
+
+		if (need_nmi_exiting)
+			vmx_set_nmi_window_exiting(vmx, vcpu);
+	}
 
-	const int HWINTR_BLOCKED = VMCS_INTERRUPTIBILITY_STI_BLOCKING |
-				   VMCS_INTERRUPTIBILITY_MOVSS_BLOCKING;
+	if (virtual_interrupt_delivery) {
+		vmx_inject_pir(vlapic);
+		return;
+	}
 
 	/*
-	 * If there is already an interrupt pending then just return.
-	 *
-	 * This could happen if an interrupt was injected on a prior
-	 * VM entry but the actual entry into guest mode was aborted
-	 * because of a pending AST.
+	 * If there is already an interrupt pending then just return. This
+	 * could happen for multiple reasons:
+	 * - A vectoring VM-entry was aborted due to astpending or rendezvous.
+	 * - A VM-exit happened during event injection.
+	 * - A NMI was injected above or after "NMI window exiting" VM-exit.
 	 */
 	info = vmcs_read(VMCS_ENTRY_INTR_INFO);
 	if (info & VMCS_INTR_VALID)
 		return;
 
-	/*
-	 * NMI injection has priority so deal with those first
-	 */
-	if (vmx_inject_nmi(vmx, vcpu))
-		return;
-
-	if (virtual_interrupt_delivery) {
-		vmx_inject_pir(vlapic);
-		return;
-	}
-
 	/* Ask the local apic for a vector to inject */
 	if (!vlapic_pending_intr(vlapic, &vector))
 		return;
 
-	if (vector < 32 || vector > 255)
-		panic("vmx_inject_interrupts: invalid vector %d\n", vector);
+	KASSERT(vector >= 32 && vector <= 255, ("invalid vector %d", vector));
 
 	/* Check RFLAGS.IF and the interruptibility state of the guest */
 	rflags = vmcs_read(VMCS_GUEST_RFLAGS);
 	if ((rflags & PSL_I) == 0)
 		goto cantinject;
 
-	interruptibility = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
-	if (interruptibility & HWINTR_BLOCKED)
+	gi = vmcs_read(VMCS_GUEST_INTERRUPTIBILITY);
+	if (gi & HWINTR_BLOCKING)
 		goto cantinject;
 
 	/* Inject the interrupt */
@@ -1151,8 +1164,6 @@
 	 * the interrupt as soon as blocking condition goes away.
 	 */
 	vmx_set_int_window_exiting(vmx, vcpu);
-
-	VCPU_CTR0(vmx->vm, vcpu, "Enabling interrupt window exiting");
 }
 
 /*
@@ -1587,7 +1598,6 @@
 	case EXIT_REASON_INTR_WINDOW:
 		vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INTR_WINDOW, 1);
 		vmx_clear_int_window_exiting(vmx, vcpu);
-		VCPU_CTR0(vmx->vm, vcpu, "Disabling interrupt window exiting");
 		return (1);
 	case EXIT_REASON_EXT_INTR:
 		/*
@@ -1613,9 +1623,10 @@
 		return (1);
 	case EXIT_REASON_NMI_WINDOW:
 		/* Exit to allow the pending virtual NMI to be injected */
+		if (vm_nmi_pending(vmx->vm, vcpu))
+			vmx_inject_nmi(vmx, vcpu);
+		vmx_clear_nmi_window_exiting(vmx, vcpu);
 		vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NMI_WINDOW, 1);
-		vmx_clear_nmi_window_exiting(vmx, vcpu);
-		VCPU_CTR0(vmx->vm, vcpu, "Disabling NMI window exiting");
 		return (1);
 	case EXIT_REASON_INOUT:
 		vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INOUT, 1);

==== //depot/projects/pci/sys/arm/at91/board_hl201.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/at91/board_hl201.c 238189 2012-07-07 05:02:39Z imp $");
+__FBSDID("$FreeBSD: head/sys/arm/at91/board_hl201.c 260886 2014-01-19 17:59:34Z imp $");
 #include <sys/param.h>
 #include <sys/systm.h>
 
@@ -34,7 +34,37 @@
 #include <arm/at91/at91sam9g20reg.h>
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91_pio_sam9g20.h>
+#include <arm/at91/at91_smc.h>
+#include <arm/at91/at91_gpio.h>
+#include <dev/nand/nfc_at91.h>
+
+static struct at91_smc_init nand_smc = {
+	.ncs_rd_setup		= 0,
+	.nrd_setup		= 2,
+	.ncs_wr_setup		= 0,
+	.nwe_setup		= 2,
 
+	.ncs_rd_pulse		= 4,
+	.nrd_pulse		= 4,
+	.ncs_wr_pulse		= 4,
+	.nwe_pulse		= 4,
+
+	.nrd_cycle		= 7,
+	.nwe_cycle		= 7,
+
+	.mode			= SMC_MODE_READ | SMC_MODE_WRITE | SMC_MODE_EXNW_DISABLED,
+	.tdf_cycles		= 3,
+};
+
+static struct at91_nand_params nand_param = {
+	.ale			= 1u << 21,
+	.cle			= 1u << 22,
+	.width			= 8,
+	.rnb_pin		= AT91_PIN_PC13,	/* Note: These pins not confirmed */
+	.nce_pin		= AT91_PIN_PC14,
+	.cs			= 3,
+};
+
 BOARD_INIT long
 board_init(void)
 {
@@ -64,6 +94,27 @@
 	at91_pio_use_periph_b(AT91SAM9G20_PIOA_BASE, AT91C_PIO_PA24, 0);	/* ETX3 */
 	at91_pio_use_periph_b(AT91SAM9G20_PIOA_BASE, AT91C_PIO_PA22, 0);	/* ETXER */
 
+	/* Setup Static Memory Controller */
+	at91_smc_setup(0, 3, &nand_smc);
+	at91_enable_nand(&nand_param);
+
+	/*
+	 * This assumes
+	 *  - RNB is on pin PC13
+	 *  - CE is on pin PC14
+	 *
+	 * Nothing actually uses RNB right now.
+	 *
+	 * For CE, this currently asserts it during board setup and leaves it
+	 * that way forever.
+	 *
+	 * All this can go away when the gpio pin-renumbering happens...
+	 */
+	at91_pio_use_gpio(AT91SAM9G20_PIOC_BASE, AT91C_PIO_PC13 | AT91C_PIO_PC14);
+	at91_pio_gpio_input(AT91SAM9G20_PIOC_BASE, AT91C_PIO_PC13);	/* RNB */
+	at91_pio_gpio_output(AT91SAM9G20_PIOC_BASE, AT91C_PIO_PC14, 0);	/* nCS */
+	at91_pio_gpio_clear(AT91SAM9G20_PIOC_BASE, AT91C_PIO_PC14);	/* Assert nCS */
+
 	return (at91_ramsize());
 }
 

==== //depot/projects/pci/sys/arm/at91/board_sam9260ek.c#2 (text+ko) ====

@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/at91/board_sam9260ek.c 238821 2012-07-27 05:33:55Z imp $");
+__FBSDID("$FreeBSD: head/sys/arm/at91/board_sam9260ek.c 260886 2014-01-19 17:59:34Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -38,9 +38,39 @@
 #include <arm/at91/at91_piovar.h>
 #include <arm/at91/at91board.h>
 #include <arm/at91/at91sam9260reg.h>
+#include <arm/at91/at91_smc.h>
+#include <arm/at91/at91_gpio.h>
+#include <dev/nand/nfc_at91.h>
+
+static struct at91_smc_init nand_smc = {
+	.ncs_rd_setup		= 0,
+	.nrd_setup		= 1,
+	.ncs_wr_setup		= 0,
+	.nwe_setup		= 1,
+
+	.ncs_rd_pulse		= 3,
+	.nrd_pulse		= 3,
+	.ncs_wr_pulse		= 3,
+	.nwe_pulse		= 3,
+
+	.nrd_cycle		= 5,
+	.nwe_cycle		= 5,
+
+	.mode			= SMC_MODE_READ | SMC_MODE_WRITE | SMC_MODE_EXNW_DISABLED,
+	.tdf_cycles		= 2,
+};
+
+static struct at91_nand_params nand_param = {
+	.ale			= 1u << 21,
+	.cle			= 1u << 22,
+	.width			= 8,
+	.rnb_pin		= AT91_PIN_PC13,
+	.nce_pin		= AT91_PIN_PC14,
+	.cs			= 3,
+};
 
-BOARD_INIT long
-board_init(void)
+static void
+bi_dbgu(void)
 {
 
 	/*
@@ -50,6 +80,11 @@
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB14, 0);
 	/* DTXD */
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB15, 1);
+}
+
+static void
+bi_emac()
+{
 
 	/*
 	 * EMAC
@@ -91,7 +126,11 @@
 	at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA28, 0);
 	/* ECOL */
 	at91_pio_use_periph_b(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA29, 0);
+}
 
+static void
+bi_mmc(void)
+{
 
 	/*
 	 * MMC, wired to socket B.
@@ -114,11 +153,11 @@
 	 * don't support the dataflash.  But if you did, you'd have to
 	 * use CS0 and CS1.
 	 */
+}
 
-	/*
-	 * SPI1 is wired to a audio CODEC that we don't support, so
-	 * give it a pass.
-	 */
+static void
+bi_iic(void)
+{
 
 	/*
 	 * TWI.  Only one child on the iic bus, which we take care of
@@ -128,7 +167,12 @@
 	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA23, 1);
 	/* TWCK */
 	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA24, 1);
+}
 
+static void
+bi_usart0(void)
+{
+
 	/*
 	 * USART0
 	 */
@@ -148,7 +192,11 @@
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB26, 1);
 	/* CTS0 */
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB27, 0);
+}
 
+static void
+bi_usart1(void)
+{
 	/*
 	 * USART1
 	 */
@@ -160,9 +208,54 @@
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB6, 1);
 	/* RXD1 */
 	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB7, 0);
+}
+
+static void
+bi_nand(void)
+{
+	/* Samsung 256MB SLC Flash */
 
+	/* Setup Static Memory Controller */
+	at91_smc_setup(0, 3, &nand_smc);
+	at91_enable_nand(&nand_param);
+
+	/*
+	 * This assumes
+	 *  - RNB is on pin PC13
+	 *  - CE is on pin PC14
+	 *
+	 * Nothing actually uses RNB right now.
+	 *
+	 * For CE, this currently asserts it during board setup and leaves it
+	 * that way forever.
+	 *
+	 * All this can go away when the gpio pin-renumbering happens...
+	 */
+	at91_pio_use_gpio(AT91SAM9260_PIOC_BASE, AT91C_PIO_PC13 | AT91C_PIO_PC14);
+	at91_pio_gpio_input(AT91SAM9260_PIOC_BASE, AT91C_PIO_PC13);	/* RNB */
+	at91_pio_gpio_output(AT91SAM9260_PIOC_BASE, AT91C_PIO_PC14, 0);	/* nCS */
+	at91_pio_gpio_clear(AT91SAM9260_PIOC_BASE, AT91C_PIO_PC14);	/* Assert nCS */
+}
+
+BOARD_INIT long
+board_init(void)
+{
+	bi_dbgu();
+	bi_emac();
+	bi_mmc();
+
+	/*
+	 * SPI1 is wired to a audio CODEC that we don't support, so
+	 * give it a pass.
+	 */
+
+	bi_iic();
+	bi_usart0();
+	bi_usart1();
 	/* USART2 - USART5 aren't wired up, except via PIO pins, ignore them. */
 
+	bi_nand();
+
 	return (at91_ramsize());
 }
 

==== //depot/projects/pci/sys/arm/at91/files.at91#4 (text) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/arm/at91/files.at91 258828 2013-12-02 03:52:40Z ian $
+# $FreeBSD: head/sys/arm/at91/files.at91 260884 2014-01-19 17:45:13Z imp $
 arm/arm/cpufunc_asm_arm9.S	standard
 arm/arm/irq_dispatch.S		standard
 arm/at91/at91_machdep.c		standard
@@ -12,6 +12,7 @@
 arm/at91/at91_reset.S		optional	at91sam9
 arm/at91/at91_rst.c		optional	at91sam9
 arm/at91/at91_rtc.c		optional	at91_rtc
+arm/at91/at91_smc.c		standard
 arm/at91/at91_spi.c		optional	at91_spi		\
 	dependency	"spibus_if.h"
 arm/at91/at91_ssc.c		optional	at91_ssc

==== //depot/projects/pci/sys/arm/at91/uart_dev_at91usart.c#6 (text) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/at91/uart_dev_at91usart.c 259685 2013-12-21 16:23:31Z imp $");
+__FBSDID("$FreeBSD: head/sys/arm/at91/uart_dev_at91usart.c 260886 2014-01-19 17:59:34Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -219,20 +219,6 @@
 	return (0);
 }
 
-static void
-at91_usart_grab(struct uart_bas *bas)
-{
-
-	WR4(bas, USART_IDR, USART_CSR_RXRDY);
-}
-
-static void
-at91_usart_ungrab(struct uart_bas *bas)
-{
-
-	WR4(bas, USART_IER, USART_CSR_RXRDY);
-}
-
 static struct uart_ops at91_usart_ops = {
 	.probe = at91_usart_probe,
 	.init = at91_usart_init,
@@ -240,8 +226,6 @@
 	.putc = at91_usart_putc,
 	.rxready = at91_usart_rxready,
 	.getc = at91_usart_getc,
-	.grab = at91_usart_grab,
-	.ungrab = at91_usart_ungrab,
 };
 
 static int
@@ -331,6 +315,8 @@
 static int at91_usart_bus_receive(struct uart_softc *);
 static int at91_usart_bus_setsig(struct uart_softc *, int);
 static int at91_usart_bus_transmit(struct uart_softc *);
+static void at91_usart_bus_grab(struct uart_softc *);
+static void at91_usart_bus_ungrab(struct uart_softc *);
 
 static kobj_method_t at91_usart_methods[] = {
 	KOBJMETHOD(uart_probe,		at91_usart_bus_probe),
@@ -343,6 +329,8 @@
 	KOBJMETHOD(uart_receive,	at91_usart_bus_receive),
 	KOBJMETHOD(uart_setsig,		at91_usart_bus_setsig),
 	KOBJMETHOD(uart_transmit,	at91_usart_bus_transmit),
+	KOBJMETHOD(uart_grab,		at91_usart_bus_grab),
+	KOBJMETHOD(uart_ungrab,		at91_usart_bus_ungrab),
 
 	KOBJMETHOD_END
 };
@@ -815,6 +803,25 @@
 	return (EINVAL);
 }
 
+
+static void
+at91_usart_bus_grab(struct uart_softc *sc)
+{
+
+	uart_lock(sc->sc_hwmtx);
+	WR4(&sc->sc_bas, USART_IDR, USART_CSR_RXRDY);
+	uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+at91_usart_bus_ungrab(struct uart_softc *sc)
+{
+
+	uart_lock(sc->sc_hwmtx);
+	WR4(&sc->sc_bas, USART_IER, USART_CSR_RXRDY);
+	uart_unlock(sc->sc_hwmtx);
+}
+
 struct uart_class at91_usart_class = {
 	"at91_usart",
 	at91_usart_methods,

==== //depot/projects/pci/sys/arm/conf/ATMEL#5 (text+ko) ====

@@ -2,7 +2,7 @@
 # configuration.  This kernel will not (presently) boot.  Do not copy
 # it to create your own custom config file.
 #
-# $FreeBSD: head/sys/arm/conf/ATMEL 260440 2014-01-08 03:40:18Z ian $
+# $FreeBSD: head/sys/arm/conf/ATMEL 260887 2014-01-19 18:09:00Z imp $
 
 ident		ATMEL
 
@@ -175,3 +175,6 @@
 device		at91_rtc
 device		at91_ssc
 #device		at91_tc		# missing?
+
+# NAND Flash - Reference design has Samsung 256MB but others possible
+device		nand			# NAND interface on CS3

==== //depot/projects/pci/sys/arm/conf/HL201#6 (text+ko) ====

@@ -15,7 +15,7 @@
 # If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
-# $FreeBSD: head/sys/arm/conf/HL201 260440 2014-01-08 03:40:18Z ian $
+# $FreeBSD: head/sys/arm/conf/HL201 260887 2014-01-19 18:09:00Z imp $
 
 ident		HL201
 
@@ -37,7 +37,8 @@
 #options 	UFS_ACL			#Support for access control lists
 #options 	UFS_DIRHASH		#Improve performance on big directories
 #options 	MD_ROOT			#MD is a potential root device
-#options 	MD_ROOT_SIZE=4096	# 3MB ram disk
+#options 	MD_ROOT_SIZE=4096	# 4MB ram disk
+options 	NANDFS			# NAND file system
 #options 	ROOTDEVNAME=\"ufs:/dev/mmcsd0s1a\"
 options 	NFSCL			#New Network Filesystem Client
 #options 	NFSD			#New Network Filesystem Server
@@ -131,3 +132,5 @@
 #device		wlan_amrr	# AMRR transmit rate control algorithm
 options 	ROOTDEVNAME=\"ufs:da0s1a\"
 
+# NAND Flash - my board as 128MB Samsung part
+device		nand			# NAND interface on CS3

==== //depot/projects/pci/sys/arm/conf/NOTES#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/arm/conf/NOTES 245999 2013-01-27 20:10:29Z ian $
+# $FreeBSD: head/sys/arm/conf/NOTES 260921 2014-01-20 19:57:30Z imp $
 
 machine	arm
 
@@ -60,6 +60,7 @@
 device		at91_board_sam9x25ek
 device		at91_board_tsc4370
 device		at91rm9200
+device		nand
 device		board_ln2410sbc
 
 nooptions	SMP

==== //depot/projects/pci/sys/arm/conf/SAM9260EK#4 (text+ko) ====

@@ -1,4 +1,4 @@
-# Kernel configuration for Ethernut 5 boards
+# Kernel configuration for Atmel SAM9260-EK eval board
 #
 # For more information on this file, please read the config(5) manual page,
 # and/or the handbook section on Kernel Configuration Files:
@@ -15,7 +15,7 @@
 # If you are in doubt as to the purpose or necessity of a line, check first
 # in NOTES.
 #
-# $FreeBSD: head/sys/arm/conf/SAM9260EK 260440 2014-01-08 03:40:18Z ian $
+# $FreeBSD: head/sys/arm/conf/SAM9260EK 260887 2014-01-19 18:09:00Z imp $
 
 ident		SAM9260EK
 
@@ -37,6 +37,7 @@
 options 	UFS_DIRHASH		# Improve performance on big directories
 #options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
 #options 	MD_ROOT			# MD is a potential root device
+options 	NANDFS			# NAND file system
 options 	NFSCL			# New Network Filesystem Client
 #options 	NFSD			# New Network Filesystem Server
 options 	NFSLOCKD		# Network Lock Manager
@@ -165,3 +166,6 @@
 
 # watchdog
 device		at91_wdt	# Atmel AT91 Watchdog Timer
+
+# NAND Flash - Reference design has Samsung 256MB but others possible
+device		nand			# NAND interface on CS3

==== //depot/projects/pci/sys/arm/s3c2xx0/uart_dev_s3c2410.c#4 (text+ko) ====

@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/s3c2xx0/uart_dev_s3c2410.c 248965 2013-04-01 00:44:20Z ian $");
+__FBSDID("$FreeBSD: head/sys/arm/s3c2xx0/uart_dev_s3c2410.c 260889 2014-01-19 19:36:11Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -203,7 +203,6 @@
 
 	return sscom_getc(bas->bst, bas->bsh);
 }
-
 static int s3c2410_bus_probe(struct uart_softc *sc);
 static int s3c2410_bus_attach(struct uart_softc *sc);
 static int s3c2410_bus_flush(struct uart_softc *, int);
@@ -214,6 +213,8 @@
 static int s3c2410_bus_receive(struct uart_softc *);
 static int s3c2410_bus_setsig(struct uart_softc *, int);
 static int s3c2410_bus_transmit(struct uart_softc *);
+static void s3c2410_bus_grab(struct uart_softc *);
+static void s3c2410_bus_ungrab(struct uart_softc *);
 
 static kobj_method_t s3c2410_methods[] = {
 	KOBJMETHOD(uart_probe,		s3c2410_bus_probe),
@@ -226,6 +227,8 @@
 	KOBJMETHOD(uart_receive,	s3c2410_bus_receive),
 	KOBJMETHOD(uart_setsig,		s3c2410_bus_setsig),
 	KOBJMETHOD(uart_transmit,	s3c2410_bus_transmit),
+	KOBJMETHOD(uart_grab,		s3c2410_bus_grab),
+	KOBJMETHOD(uart_ungrab,		s3c2410_bus_ungrab),
 	
 	{0, 0 }
 };
@@ -373,6 +376,25 @@
 	return (EINVAL);
 }
 
+
+static void
+s3c2410_bus_grab(struct uart_softc *sc)
+{
+	uintptr_t irq;
+
+	irq = rman_get_start(sc->sc_ires);
+	arm_mask_irq(get_sub_irq(irq, RX_OFF));
+}
+
+static void
+s3c2410_bus_ungrab(struct uart_softc *sc)
+{
+	uintptr_t irq;
+
+	irq = rman_get_start(sc->sc_ires);
+	arm_unmask_irq(get_sub_irq(irq, RX_OFF));
+}
+
 struct uart_class uart_s3c2410_class = {
 	"s3c2410 class",
 	s3c2410_methods,

==== //depot/projects/pci/sys/arm/sa11x0/uart_dev_sa1110.c#4 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/sa11x0/uart_dev_sa1110.c 248965 2013-04-01 00:44:20Z ian $");
+__FBSDID("$FreeBSD: head/sys/arm/sa11x0/uart_dev_sa1110.c 260889 2014-01-19 19:36:11Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -137,6 +137,8 @@
 static int sa1110_bus_receive(struct uart_softc *);
 static int sa1110_bus_setsig(struct uart_softc *, int);
 static int sa1110_bus_transmit(struct uart_softc *);
+static void sa1110_bus_grab(struct uart_softc *);
+static void sa1110_bus_ungrab(struct uart_softc *);
 
 static kobj_method_t sa1110_methods[] = {
 	KOBJMETHOD(uart_probe,		sa1110_bus_probe),
@@ -149,6 +151,8 @@
 	KOBJMETHOD(uart_receive,	sa1110_bus_receive),
 	KOBJMETHOD(uart_setsig,		sa1110_bus_setsig),
 	KOBJMETHOD(uart_transmit,	sa1110_bus_transmit),
+	KOBJMETHOD(uart_grab,		sa1110_bus_grab),
+	KOBJMETHOD(uart_ungrab,		sa1110_bus_ungrab),
 	
 	{0, 0 }
 };
@@ -164,10 +168,10 @@
 static int
 sa1110_bus_attach(struct uart_softc *sc)
 {
-	 bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
+	bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
 
-	 sc->sc_hwiflow = 0;
-	 uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
+	sc->sc_hwiflow = 0;
+	uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
 	return (0);
 }
 static int
@@ -273,6 +277,26 @@
 	return (EINVAL);
 }
 
+static void
+sa1110_bus_grab(struct uart_softc *sc)
+{
+
+	/* Turn off Rx interrupts */
+	uart_lock(sc->sc_hwmtx);
+	uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_TXE | CR3_TIE);
+	uart_unlock(sc->sc_hwmtx);
+}
+
+static void
+sa1110_bus_ungrab(struct uart_softc *sc)
+{
+
+	/* Turn on Rx interrupts */
+	uart_lock(sc->sc_hwmtx);
+	uart_setreg(&sc->sc_bas, SACOM_CR3, CR3_RXE | CR3_TXE | CR3_RIE | CR3_TIE);
+	uart_unlock(sc->sc_hwmtx);
+}
+
 struct uart_class uart_sa1110_class = {
 	"sa1110",
 	sa1110_methods,

==== //depot/projects/pci/sys/arm/xilinx/uart_dev_cdnc.c#2 (text+ko) ====

@@ -36,7 +36,7 @@
 
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/arm/xilinx/uart_dev_cdnc.c 249997 2013-04-27 22:38:29Z wkoszek $");
+__FBSDID("$FreeBSD: head/sys/arm/xilinx/uart_dev_cdnc.c 260889 2014-01-19 19:36:11Z imp $");
 
 #include "opt_global.h"
 
@@ -398,6 +398,8 @@
 static int cdnc_uart_bus_receive(struct uart_softc *);
 static int cdnc_uart_bus_setsig(struct uart_softc *, int);
 static int cdnc_uart_bus_transmit(struct uart_softc *);
+static void cdnc_uart_bus_grab(struct uart_softc *);
+static void cdnc_uart_bus_ungrab(struct uart_softc *);
 
 static kobj_method_t cdnc_uart_bus_methods[] = {
 	KOBJMETHOD(uart_probe,		cdnc_uart_bus_probe),
@@ -410,6 +412,8 @@
 	KOBJMETHOD(uart_receive,	cdnc_uart_bus_receive),
 	KOBJMETHOD(uart_setsig,		cdnc_uart_bus_setsig),
 	KOBJMETHOD(uart_transmit,	cdnc_uart_bus_transmit),
+	KOBJMETHOD(uart_grab,		cdnc_uart_bus_grab),
+	KOBJMETHOD(uart_ungrab,		cdnc_uart_bus_ungrab),
 	
 	KOBJMETHOD_END
 };
@@ -675,6 +679,27 @@
 	return (error);
 }
 
+static void
+cdnc_uart_bus_grab(struct uart_softc *sc)
+{
+
+	/* Enable interrupts. */
+	WR4(&sc->sc_bas, CDNC_UART_IEN_REG,
+	    CDNC_UART_INT_TXOVR | CDNC_UART_INT_RXOVR |
+	    CDNC_UART_INT_DMSI);
+}
+
+static void
+cdnc_uart_bus_ungrab(struct uart_softc *sc)
+{
+
+	/* Enable interrupts. */
+	WR4(&sc->sc_bas, CDNC_UART_IEN_REG,
+	    CDNC_UART_INT_RXTRIG | CDNC_UART_INT_RXTMOUT |
+	    CDNC_UART_INT_TXOVR | CDNC_UART_INT_RXOVR |
+	    CDNC_UART_INT_DMSI);
+}
+
 struct uart_class uart_cdnc_class = {
 	"cdnc_uart",
 	cdnc_uart_bus_methods,

==== //depot/projects/pci/sys/dev/aha/aha.c#5 (text+ko) ====

@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/dev/aha/aha.c 256887 2013-10-22 12:42:49Z mav $");
+__FBSDID("$FreeBSD: head/sys/dev/aha/aha.c 260893 2014-01-19 20:32:20Z imp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -207,9 +207,9 @@
 	case 7:
 		bus_dmamap_unload(aha->ccb_dmat, aha->ccb_dmamap);
 	case 6:
-		bus_dmamap_destroy(aha->ccb_dmat, aha->ccb_dmamap);
 		bus_dmamem_free(aha->ccb_dmat, aha->aha_ccb_array,

>>> TRUNCATED FOR MAIL (1000 lines) <<<



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