From owner-p4-projects@FreeBSD.ORG Sun Jan 19 19:56:10 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B175C928; Sun, 19 Jan 2014 19:56:10 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74527926 for ; Sun, 19 Jan 2014 19:56:10 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 44D321806 for ; Sun, 19 Jan 2014 19:56:10 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id s0JJuA1U066244 for ; Sun, 19 Jan 2014 19:56:10 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.7/Submit) id s0JJuA8Z066241 for perforce@freebsd.org; Sun, 19 Jan 2014 19:56:10 GMT (envelope-from jhb@freebsd.org) Date: Sun, 19 Jan 2014 19:56:10 GMT Message-Id: <201401191956.s0JJuA8Z066241@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1190165 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jan 2014 19:56:10 -0000 http://p4web.freebsd.org/@@1190165?ac=10 Change 1190165 by jhb@jhb_pippin on 2014/01/19 19:55:43 Update usage and some confusing language in the manpage for the 'device as selector' changes. Affected files ... .. //depot/projects/pci/usr.sbin/pciconf/pciconf.8#4 edit .. //depot/projects/pci/usr.sbin/pciconf/pciconf.c#4 edit Differences ... ==== //depot/projects/pci/usr.sbin/pciconf/pciconf.8#4 (text+ko) ==== @@ -67,13 +67,13 @@ .Ed .Pp The first column gives the -device name, unit number, and selector . -If there is no device configured in the kernel for the +driver name, unit number, and selector . +If there is no driver attached to the .Tn PCI -device in question, the device name will be +device in question, the driver name will be .Dq none . -Unit numbers for unconfigured devices start at zero and are incremented for -each unconfigured device that is encountered. +Unit numbers for detached devices start at zero and are incremented for +each detached device that is encountered. The selector is in a form which may directly be used for the other forms of the command. The second column is the class code, with the class byte printed as two ==== //depot/projects/pci/usr.sbin/pciconf/pciconf.c#4 (text+ko) ==== @@ -87,10 +87,10 @@ usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pciconf -l [-bcevV] [selector]", - " pciconf -a selector", - " pciconf -r [-b | -h] selector addr[:addr2]", - " pciconf -w [-b | -h] selector addr value"); + "usage: pciconf -l [-bcevV] [device]", + " pciconf -a device", + " pciconf -r [-b | -h] device addr[:addr2]", + " pciconf -w [-b | -h] device addr value"); exit (1); } @@ -734,8 +734,8 @@ { /* - * No device names contain colons and raw selectors always - * contain at least one colon. + * No device names contain colons and selectors always contain + * at least one colon. */ if (strchr(str, ':') == NULL) return (getdevice(str)); From owner-p4-projects@FreeBSD.ORG Mon Jan 20 23:11:19 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 72E55BCD; Mon, 20 Jan 2014 23:11:19 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A508BCB for ; Mon, 20 Jan 2014 23:11:19 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EDE6115CF for ; Mon, 20 Jan 2014 23:11:18 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KNBIgo096924 for ; Mon, 20 Jan 2014 23:11:18 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.7/Submit) id s0KNBIY6096921 for perforce@freebsd.org; Mon, 20 Jan 2014 23:11:18 GMT (envelope-from jhb@freebsd.org) Date: Mon, 20 Jan 2014 23:11:18 GMT Message-Id: <201401202311.s0KNBIY6096921@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1190201 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 23:11:19 -0000 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 -__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 #include @@ -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 -__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 #include @@ -34,7 +34,37 @@ #include #include #include +#include +#include +#include + +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 -__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 #include @@ -38,9 +38,39 @@ #include #include #include +#include +#include +#include + +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 -__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 #include @@ -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 -__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 #include @@ -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 -__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 #include @@ -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 -__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 -__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 #include @@ -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) <<< From owner-p4-projects@FreeBSD.ORG Mon Jan 20 23:14:23 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 449D9FDB; Mon, 20 Jan 2014 23:14:23 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03918FD3 for ; Mon, 20 Jan 2014 23:14:23 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CA58C15FE for ; Mon, 20 Jan 2014 23:14:22 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id s0KNEM8I098797 for ; Mon, 20 Jan 2014 23:14:22 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.7/Submit) id s0KNEMLu098794 for perforce@freebsd.org; Mon, 20 Jan 2014 23:14:22 GMT (envelope-from jhb@freebsd.org) Date: Mon, 20 Jan 2014 23:14:22 GMT Message-Id: <201401202314.s0KNEMLu098794@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1190203 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 23:14:23 -0000 http://p4web.freebsd.org/@@1190203?ac=10 Change 1190203 by jhb@jhb_pippin on 2014/01/20 23:13:37 Diff reduction. Affected files ... .. //depot/projects/pci/sys/x86/pci/pci_bus.c#6 edit Differences ... ==== //depot/projects/pci/sys/x86/pci/pci_bus.c#6 (text+ko) ==== @@ -629,7 +629,6 @@ } #endif - static device_method_t legacy_pcib_methods[] = { /* Device interface */ DEVMETHOD(device_identify, legacy_pcib_identify), From owner-p4-projects@FreeBSD.ORG Tue Jan 21 16:03:03 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 794BAF63; Tue, 21 Jan 2014 16:03:03 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 39DA5F61 for ; Tue, 21 Jan 2014 16:03:03 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 249F81CF3 for ; Tue, 21 Jan 2014 16:03:03 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id s0LG32bg087750 for ; Tue, 21 Jan 2014 16:03:02 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.7/Submit) id s0LG32T5087747 for perforce@freebsd.org; Tue, 21 Jan 2014 16:03:02 GMT (envelope-from jhb@freebsd.org) Date: Tue, 21 Jan 2014 16:03:02 GMT Message-Id: <201401211603.s0LG32T5087747@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1190240 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 16:03:03 -0000 http://p4web.freebsd.org/@@1190240?ac=10 Change 1190240 by jhb@jhb_jhbbsd on 2014/01/21 16:02:07 A todo. Affected files ... .. //depot/projects/pci/usr.sbin/pciconf/err.c#2 edit Differences ... ==== //depot/projects/pci/usr.sbin/pciconf/err.c#2 (text+ko) ==== @@ -45,6 +45,8 @@ const char *desc; }; +/* XXX: Need to handle PCI-PCI bridge secondary status register. */ + /* Error indicators in the PCI status register (PCIR_STATUS). */ static struct bit_table pci_status[] = { { PCIM_STATUS_MDPERR, "Master Data Parity Error" }, From owner-p4-projects@FreeBSD.ORG Tue Jan 21 18:09:25 2014 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3ADB5A92; Tue, 21 Jan 2014 18:09:25 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF52DA90 for ; Tue, 21 Jan 2014 18:09:24 +0000 (UTC) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:1900:2254:2068::682:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D7E421837 for ; Tue, 21 Jan 2014 18:09:24 +0000 (UTC) Received: from skunkworks.freebsd.org ([127.0.1.74]) by skunkworks.freebsd.org (8.14.7/8.14.7) with ESMTP id s0LI9OgO010220 for ; Tue, 21 Jan 2014 18:09:24 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.7/8.14.7/Submit) id s0LI9OjL010215 for perforce@freebsd.org; Tue, 21 Jan 2014 18:09:24 GMT (envelope-from jhb@freebsd.org) Date: Tue, 21 Jan 2014 18:09:24 GMT Message-Id: <201401211809.s0LI9OjL010215@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin Subject: PERFORCE change 1190242 for review To: Perforce Change Reviews Precedence: bulk X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.17 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jan 2014 18:09:25 -0000 http://p4web.freebsd.org/@@1190242?ac=10 Change 1190242 by jhb@jhb_jhbbsd on 2014/01/21 18:08:58 IFC @1190241 Affected files ... .. //depot/projects/pci/sys/amd64/vmm/io/iommu.c#2 integrate .. //depot/projects/pci/sys/amd64/vmm/io/ppt.c#6 integrate .. //depot/projects/pci/sys/amd64/vmm/io/ppt.h#4 integrate .. //depot/projects/pci/sys/amd64/vmm/vmm.c#9 integrate .. //depot/projects/pci/sys/boot/i386/libi386/comconsole.c#5 integrate .. //depot/projects/pci/sys/boot/pc98/libpc98/comconsole.c#5 integrate .. //depot/projects/pci/sys/dev/vt/hw/fb/vt_fb.c#3 integrate .. //depot/projects/pci/sys/kern/vfs_bio.c#14 integrate .. //depot/projects/pci/sys/vm/vm_pageout.c#12 integrate .. //depot/projects/pci/sys/x86/include/legacyvar.h#4 integrate .. //depot/projects/pci/sys/x86/pci/pci_bus.c#7 integrate .. //depot/projects/pci/sys/x86/pci/qpi.c#7 integrate .. //depot/projects/pci/sys/x86/x86/mptable_pci.c#19 integrate Differences ... ==== //depot/projects/pci/sys/amd64/vmm/io/iommu.c#2 (text+ko) ==== @@ -23,16 +23,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/amd64/vmm/io/iommu.c 245678 2013-01-20 03:42:49Z neel $ + * $FreeBSD: head/sys/amd64/vmm/io/iommu.c 260972 2014-01-21 03:01:34Z neel $ */ #include -__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/iommu.c 245678 2013-01-20 03:42:49Z neel $"); +__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/iommu.c 260972 2014-01-21 03:01:34Z neel $"); #include #include #include #include +#include #include #include @@ -43,7 +44,13 @@ #include "vmm_mem.h" #include "iommu.h" -static boolean_t iommu_avail; +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, iommu, CTLFLAG_RW, 0, "bhyve iommu parameters"); + +static int iommu_avail; +SYSCTL_INT(_hw_vmm_iommu, OID_AUTO, initialized, CTLFLAG_RD, &iommu_avail, + 0, "bhyve iommu initialized?"); + static struct iommu_ops *ops; static void *host_domain; @@ -160,7 +167,7 @@ if (error) return; - iommu_avail = TRUE; + iommu_avail = 1; /* * Create a domain for the devices owned by the host ==== //depot/projects/pci/sys/amd64/vmm/io/ppt.c#6 (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/io/ppt.c 259482 2013-12-16 19:59:31Z neel $ + * $FreeBSD: head/sys/amd64/vmm/io/ppt.c 260972 2014-01-21 03:01:34Z neel $ */ #include -__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/ppt.c 259482 2013-12-16 19:59:31Z neel $"); +__FBSDID("$FreeBSD: head/sys/amd64/vmm/io/ppt.c 260972 2014-01-21 03:01:34Z neel $"); #include #include @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -100,7 +101,12 @@ } msix; } pptdevs[64]; +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, ppt, CTLFLAG_RW, 0, "bhyve passthru devices"); + static int num_pptdevs; +SYSCTL_INT(_hw_vmm_ppt, OID_AUTO, devices, CTLFLAG_RD, &num_pptdevs, 0, + "number of pci passthru devices"); static int ppt_probe(device_t dev) @@ -282,7 +288,14 @@ } int -ppt_num_devices(struct vm *vm) +ppt_avail_devices(void) +{ + + return (num_pptdevs); +} + +int +ppt_assigned_devices(struct vm *vm) { int i, num; ==== //depot/projects/pci/sys/amd64/vmm/io/ppt.h#4 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/amd64/vmm/io/ppt.h 259482 2013-12-16 19:59:31Z neel $ + * $FreeBSD: head/sys/amd64/vmm/io/ppt.h 260972 2014-01-21 03:01:34Z neel $ */ #ifndef _IO_PPT_H_ @@ -36,10 +36,16 @@ uint64_t addr, uint64_t msg, int numvec); int ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func, int idx, uint64_t addr, uint64_t msg, uint32_t vector_control); -int ppt_num_devices(struct vm *vm); +int ppt_assigned_devices(struct vm *vm); boolean_t ppt_is_mmio(struct vm *vm, vm_paddr_t gpa); /* + * Returns the number of devices sequestered by the ppt driver for assignment + * to virtual machines. + */ +int ppt_avail_devices(void); + +/* * The following functions should never be called directly. * Use 'vm_assign_pptdev()' and 'vm_unassign_pptdev()' instead. */ ==== //depot/projects/pci/sys/amd64/vmm/vmm.c#9 (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/vmm.c 260619 2014-01-14 01:55:58Z neel $ + * $FreeBSD: head/sys/amd64/vmm/vmm.c 260972 2014-01-21 03:01:34Z neel $ */ #include -__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 260619 2014-01-14 01:55:58Z neel $"); +__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 260972 2014-01-21 03:01:34Z neel $"); #include #include @@ -266,7 +266,8 @@ switch (what) { case MOD_LOAD: vmmdev_init(); - iommu_init(); + if (ppt_avail_devices() > 0) + iommu_init(); error = vmm_init(); if (error == 0) vmm_initialized = 1; @@ -604,7 +605,7 @@ if (error) return (error); - if (ppt_num_devices(vm) == 0) { + if (ppt_assigned_devices(vm) == 0) { vm_iommu_unmap(vm); vm_gpa_unwire(vm); } @@ -624,7 +625,7 @@ * * We need to do this before the first pci passthru device is attached. */ - if (ppt_num_devices(vm) == 0) { + if (ppt_assigned_devices(vm) == 0) { KASSERT(vm->iommu == NULL, ("vm_assign_pptdev: iommu must be NULL")); maxaddr = vmm_mem_maxaddr(); ==== //depot/projects/pci/sys/boot/i386/libi386/comconsole.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 245848 2013-01-23 18:34:21Z jhb $"); +__FBSDID("$FreeBSD: head/sys/boot/i386/libi386/comconsole.c 260949 2014-01-20 23:27:05Z mav $"); #include #include @@ -181,8 +181,7 @@ return (CMD_ERROR); } - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_curspeed != speed) + if (comc_curspeed != speed) comc_setup(speed, comc_port); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -200,8 +199,7 @@ return (CMD_ERROR); } - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_port != port) + if (comc_port != port) comc_setup(comc_curspeed, port); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -309,6 +307,8 @@ unsetenv("hw.uart.console"); comc_curspeed = speed; comc_port = port; + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) + return; outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); ==== //depot/projects/pci/sys/boot/pc98/libpc98/comconsole.c#5 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/boot/pc98/libpc98/comconsole.c 251223 2013-06-01 12:27:48Z nyan $"); +__FBSDID("$FreeBSD: head/sys/boot/pc98/libpc98/comconsole.c 260949 2014-01-20 23:27:05Z mav $"); #include #include @@ -181,8 +181,7 @@ return (CMD_ERROR); } - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_curspeed != speed) + if (comc_curspeed != speed) comc_setup(speed, comc_port); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -200,8 +199,7 @@ return (CMD_ERROR); } - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_port != port) + if (comc_port != port) comc_setup(comc_curspeed, port); env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); @@ -309,6 +307,8 @@ unsetenv("hw.uart.console"); comc_curspeed = speed; comc_port = port; + if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) + return; outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); ==== //depot/projects/pci/sys/dev/vt/hw/fb/vt_fb.c#3 (text+ko) ==== @@ -26,11 +26,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/dev/vt/hw/fb/vt_fb.c 259777 2013-12-23 18:09:10Z ray $ + * $FreeBSD: head/sys/dev/vt/hw/fb/vt_fb.c 260953 2014-01-20 23:36:16Z ray $ */ #include -__FBSDID("$FreeBSD: head/sys/dev/vt/hw/fb/vt_fb.c 259777 2013-12-23 18:09:10Z ray $"); +__FBSDID("$FreeBSD: head/sys/dev/vt/hw/fb/vt_fb.c 260953 2014-01-20 23:36:16Z ray $"); #include #include @@ -69,8 +69,9 @@ return (info->fb_ioctl(info->fb_cdev, cmd, data, 0, td)); } -static int vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, - vm_paddr_t *paddr, int prot, vm_memattr_t *memattr) +static int +vt_fb_mmap(struct vt_device *vd, vm_ooffset_t offset, vm_paddr_t *paddr, + int prot, vm_memattr_t *memattr) { struct fb_info *info; ==== //depot/projects/pci/sys/kern/vfs_bio.c#14 (text+ko) ==== @@ -43,7 +43,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 259952 2013-12-27 17:04:51Z kib $"); +__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 260974 2014-01-21 03:24:52Z jhb $"); #include #include @@ -715,7 +715,7 @@ } /* - * Ideal allocation size for the transient bio submap if 10% + * Ideal allocation size for the transient bio submap is 10% * of the maximal space buffer map. This roughly corresponds * to the amount of the buffer mapped for typical UFS load. * ==== //depot/projects/pci/sys/vm/vm_pageout.c#12 (text+ko) ==== @@ -73,7 +73,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/vm/vm_pageout.c 260859 2014-01-18 20:02:59Z alc $"); +__FBSDID("$FreeBSD: head/sys/vm/vm_pageout.c 260975 2014-01-21 03:27:47Z jhb $"); #include "opt_vm.h" #include @@ -1121,7 +1121,7 @@ } else if ((m->flags & PG_WINATCFLS) == 0 && pass < 2) { /* * Dirty pages need to be paged out, but flushing - * a page is extremely expensive verses freeing + * a page is extremely expensive versus freeing * a clean page. Rather then artificially limiting * the number of pages we can flush, we instead give * dirty pages extra priority on the inactive queue @@ -1183,7 +1183,7 @@ * to be freed and dirty pages to be moved to the end * of the queue. Since dirty pages are also moved to * the end of the queue once-cleaned, this gives - * way too large a weighting to defering the freeing + * way too large a weighting to deferring the freeing * of dirty pages. * * We can't wait forever for the vnode lock, we might ==== //depot/projects/pci/sys/x86/include/legacyvar.h#4 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: head/sys/x86/include/legacyvar.h 233707 2012-03-30 19:10:14Z jhb $ + * $FreeBSD: head/sys/x86/include/legacyvar.h 260973 2014-01-21 03:14:19Z jhb $ */ #ifndef _X86_LEGACYVAR_H_ @@ -61,6 +61,9 @@ struct resource *r, u_long start, u_long end); int legacy_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *r); +int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, + int maxcount, int *irqs); +int legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq); int legacy_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data); ==== //depot/projects/pci/sys/x86/pci/pci_bus.c#7 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/x86/pci/pci_bus.c 234153 2012-04-11 21:00:33Z jhb $"); +__FBSDID("$FreeBSD: head/sys/x86/pci/pci_bus.c 260973 2014-01-21 03:14:19Z jhb $"); #include "opt_cpu.h" @@ -92,7 +92,7 @@ /* Pass MSI requests up to the nexus. */ -static int +int legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, int *irqs) { @@ -103,7 +103,7 @@ irqs)); } -static int +int legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq) { device_t bus; ==== //depot/projects/pci/sys/x86/pci/qpi.c#7 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/x86/pci/qpi.c 227843 2011-11-22 21:28:20Z marius $"); +__FBSDID("$FreeBSD: head/sys/x86/pci/qpi.c 260973 2014-01-21 03:14:19Z jhb $"); #include #include @@ -253,26 +253,6 @@ #endif static int -qpi_pcib_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, - int *irqs) -{ - device_t bus; - - bus = device_get_parent(pcib); - return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount, - irqs)); -} - -static int -qpi_pcib_alloc_msix(device_t pcib, device_t dev, int *irq) -{ - device_t bus; - - bus = device_get_parent(pcib); - return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq)); -} - -static int qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr, uint32_t *data) { @@ -309,9 +289,9 @@ DEVMETHOD(pcib_maxslots, pcib_maxslots), DEVMETHOD(pcib_read_config, legacy_pcib_read_config), DEVMETHOD(pcib_write_config, legacy_pcib_write_config), - DEVMETHOD(pcib_alloc_msi, qpi_pcib_alloc_msi), + DEVMETHOD(pcib_alloc_msi, legacy_pcib_alloc_msi), DEVMETHOD(pcib_release_msi, pcib_release_msi), - DEVMETHOD(pcib_alloc_msix, qpi_pcib_alloc_msix), + DEVMETHOD(pcib_alloc_msix, legacy_pcib_alloc_msix), DEVMETHOD(pcib_release_msix, pcib_release_msix), DEVMETHOD(pcib_map_msi, qpi_pcib_map_msi), ==== //depot/projects/pci/sys/x86/x86/mptable_pci.c#19 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: head/sys/x86/x86/mptable_pci.c 233707 2012-03-30 19:10:14Z jhb $"); +__FBSDID("$FreeBSD: head/sys/x86/x86/mptable_pci.c 260973 2014-01-21 03:14:19Z jhb $"); #include #include @@ -76,27 +76,6 @@ return (bus_generic_attach(dev)); } -/* Pass MSI requests up to the nexus. */ -static int -mptable_hostb_alloc_msi(device_t pcib, device_t dev, int count, int maxcount, - int *irqs) -{ - device_t bus; - - bus = device_get_parent(pcib); - return (PCIB_ALLOC_MSI(device_get_parent(bus), dev, count, maxcount, - irqs)); -} - -static int -mptable_hostb_alloc_msix(device_t pcib, device_t dev, int *irq) -{ - device_t bus; - - bus = device_get_parent(pcib); - return (PCIB_ALLOC_MSIX(device_get_parent(bus), dev, irq)); -} - #ifdef NEW_PCIB static int mptable_is_isa_range(u_long start, u_long end) @@ -213,9 +192,9 @@ DEVMETHOD(pcib_read_config, legacy_pcib_read_config), DEVMETHOD(pcib_write_config, legacy_pcib_write_config), DEVMETHOD(pcib_route_interrupt, mptable_pci_route_interrupt), - DEVMETHOD(pcib_alloc_msi, mptable_hostb_alloc_msi), + DEVMETHOD(pcib_alloc_msi, legacy_pcib_alloc_msi), DEVMETHOD(pcib_release_msi, pcib_release_msi), - DEVMETHOD(pcib_alloc_msix, mptable_hostb_alloc_msix), + DEVMETHOD(pcib_alloc_msix, legacy_pcib_alloc_msix), DEVMETHOD(pcib_release_msix, pcib_release_msix), DEVMETHOD(pcib_map_msi, legacy_pcib_map_msi),