From owner-svn-src-all@FreeBSD.ORG Wed May 14 19:19:03 2014 Return-Path: Delivered-To: svn-src-all@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 4179A813; Wed, 14 May 2014 19:19:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A42F20C4; Wed, 14 May 2014 19:19:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s4EJJ3U0003542; Wed, 14 May 2014 19:19:03 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s4EJIxOC003489; Wed, 14 May 2014 19:18:59 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201405141918.s4EJIxOC003489@svn.freebsd.org> From: Ian Lepore Date: Wed, 14 May 2014 19:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r266084 - in stable/10/sys: arm/allwinner arm/arm arm/broadcom/bcm2835 arm/conf arm/freescale/imx arm/include arm/lpc arm/mv arm/tegra arm/ti arm/versatile arm/xilinx boot/fdt/dts conf ... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 May 2014 19:19:03 -0000 Author: ian Date: Wed May 14 19:18:58 2014 New Revision: 266084 URL: http://svnweb.freebsd.org/changeset/base/266084 Log: MFC r257738, r259202, r258410, r260288, r260292, r260294, r260320, r260323, r260326, r260327, r260331, r260333, r260340, r260371, r260372, r260373, r260374, r260375 Add common bus_space tag definition shared for most supported ARMv6/v7 SoCs. Correct license statements to reflect the fact that these files were all derived from sys/arm/mv/bus_space.c. In pmap_unmapdev(), remember the size, and use that as an argument to kva_free(), or we'd end up always passing it a size of 0 In pmap_mapdev(), first check whether a static mapping exists, Convert TI static device mapping to use the new arm_devmap_add_entry(), Use the common armv6 fdt_bus_tag defintion for tegra instead of a local copy. Eliminate use of fdt_immr_addr(), it's not needed for tegra Convert lpc from using fdt_immr style to arm_devmap_add_entry() to make static device mappings. Retire machine/fdt.h as a header used by MI code, as its function is now obsolete. This involves the following pieces: - Remove it entirely on PowerPC, where it is not used by MD code either - Remove all references to machine/fdt.h in non-architecture-specific code (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat non-arch-specific). - Fix code relying on header pollution from machine/fdt.h includes - Legacy fdtbus.c (still used on x86 FDT systems) now passes resource requests to its parent (nexus). This allows x86 FDT devices to allocate both memory and IO requests and removes the last notionally MI use of fdtbus_bs_tag. - On those architectures that retain a machine/fdt.h, unused bits like FDT_MAP_IRQ and FDT_INTR_MAX have been removed. Add #include to a few files that used to get it via pollution Enable the mv cesa security/crypto device by providing the required property in the dts source, and adding the right devices to the kernel config. Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs, related to setting up static device mappings. Since it was only used by arm/mv/mv_pci.c, it's now just static functions within that file, plus one public function that gets called only from arm/mv/mv_machdep.c. Switch RPi to using arm_devmap_add_entry() to set up static device mapping. Allow 'no static device mappings' to potentially work. Don't try to find a static mapping before calling pmap_mapdev(), that logic is now part of pmap_mapdev() and doesn't need to be duplicated here. Switch a10 to using arm_devmap_add_entry() to set up static device mapping. Added: stable/10/sys/arm/arm/bus_space-v6.c - copied, changed from r257738, head/sys/arm/arm/bus_space-v6.c Deleted: stable/10/sys/arm/tegra/bus_space.c stable/10/sys/dev/fdt/fdt_pci.c stable/10/sys/powerpc/include/fdt.h Modified: stable/10/sys/arm/allwinner/a10_machdep.c stable/10/sys/arm/arm/bus_space_generic.c stable/10/sys/arm/arm/devmap.c stable/10/sys/arm/arm/machdep.c stable/10/sys/arm/arm/trap.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_fbd.c stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c stable/10/sys/arm/conf/DOCKSTAR stable/10/sys/arm/freescale/imx/imx51_ipuv3.c stable/10/sys/arm/include/fdt.h stable/10/sys/arm/include/intr.h stable/10/sys/arm/include/ofw_machdep.h stable/10/sys/arm/include/psl.h stable/10/sys/arm/lpc/lpc_gpio.c stable/10/sys/arm/lpc/lpc_machdep.c stable/10/sys/arm/lpc/lpc_mmc.c stable/10/sys/arm/lpc/lpcreg.h stable/10/sys/arm/mv/mv_machdep.c stable/10/sys/arm/mv/mv_pci.c stable/10/sys/arm/mv/mvvar.h stable/10/sys/arm/tegra/files.tegra2 stable/10/sys/arm/tegra/tegra2_machdep.c stable/10/sys/arm/ti/ti_machdep.c stable/10/sys/arm/versatile/bus_space.c stable/10/sys/arm/xilinx/zy7_bus_space.c stable/10/sys/boot/fdt/dts/dockstar.dts stable/10/sys/conf/files stable/10/sys/dev/fdt/fdt_common.c stable/10/sys/dev/fdt/fdt_common.h stable/10/sys/dev/fdt/fdtbus.c stable/10/sys/dev/fdt/simplebus.c stable/10/sys/dev/uart/uart_bus_fdt.c stable/10/sys/dev/uart/uart_dev_lpc.c stable/10/sys/mips/include/fdt.h stable/10/sys/x86/include/fdt.h stable/10/sys/x86/include/ofw_machdep.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a10_machdep.c ============================================================================== --- stable/10/sys/arm/allwinner/a10_machdep.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/allwinner/a10_machdep.c Wed May 14 19:18:58 2014 (r266084) @@ -50,21 +50,16 @@ __FBSDID("$FreeBSD$"); #include -/* Start of address space used for bootstrap map */ -#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000 - - vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START); + return (arm_devmap_lastaddr()); } void initarm_early_init(void) { - } void @@ -77,28 +72,21 @@ initarm_late_init(void) { } -#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - /* - * Construct pmap_devmap[] with DT-derived config data. + * Set up static device mappings. + * + * This covers all the on-chip device with 1MB section mappings, which is good + * for performance (uses fewer TLB entries for device access). + * + * XXX It also covers a block of SRAM and some GPU (mali400) stuff that maybe + * shouldn't be device-mapped. The original code mapped a 4MB block, but + * perhaps a 1MB block would be more appropriate. */ int initarm_devmap_init(void) { - int i = 0; - - fdt_devmap[i].pd_va = 0xE1C00000; - fdt_devmap[i].pd_pa = 0x01C00000; - fdt_devmap[i].pd_size = 0x00400000; /* 4 MB */ - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_DEVICE; - - i++; - arm_devmap_register_table(&fdt_devmap[0]); + arm_devmap_add_entry(0x01C00000, 0x00400000); /* 4MB */ return (0); } Copied and modified: stable/10/sys/arm/arm/bus_space-v6.c (from r257738, head/sys/arm/arm/bus_space-v6.c) ============================================================================== --- head/sys/arm/arm/bus_space-v6.c Wed Nov 6 09:41:19 2013 (r257738, copy source) +++ stable/10/sys/arm/arm/bus_space-v6.c Wed May 14 19:18:58 2014 (r266084) @@ -1,7 +1,9 @@ /*- - * Copyright (c) 2012 Damjan Marion + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. * All rights reserved. * + * Developed by Semihalf. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,11 +12,14 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY 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 + * ARE DISCLAIMED. IN NO EVENT SHALL 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) Modified: stable/10/sys/arm/arm/bus_space_generic.c ============================================================================== --- stable/10/sys/arm/arm/bus_space_generic.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/arm/bus_space_generic.c Wed May 14 19:18:58 2014 (r266084) @@ -62,16 +62,12 @@ generic_bs_map(void *t, bus_addr_t bpa, void *va; /* - * Look up the address in the static device mappings. If it's not - * there, establish a new dynamic mapping. - * * We don't even examine the passed-in flags. For ARM, the CACHEABLE * flag doesn't make sense (we create PTE_DEVICE mappings), and the * LINEAR flag is just implied because we use kva_alloc(size). */ - if ((va = arm_devmap_ptov(bpa, size)) == NULL) - if ((va = pmap_mapdev(bpa, size)) == NULL) - return (ENOMEM); + if ((va = pmap_mapdev(bpa, size)) == NULL) + return (ENOMEM); *bshp = (bus_space_handle_t)va; return (0); } @@ -90,12 +86,7 @@ void generic_bs_unmap(void *t, bus_space_handle_t h, bus_size_t size) { - /* - * If the region is static-mapped do nothing, otherwise remove the - * dynamic mapping. - */ - if (arm_devmap_vtop((void*)h, size) == DEVMAP_PADDR_NOTFOUND) - pmap_unmapdev((vm_offset_t)h, size); + pmap_unmapdev((vm_offset_t)h, size); } void Modified: stable/10/sys/arm/arm/devmap.c ============================================================================== --- stable/10/sys/arm/arm/devmap.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/arm/devmap.c Wed May 14 19:18:58 2014 (r266084) @@ -67,11 +67,8 @@ arm_devmap_lastaddr() if (akva_devmap_idx > 0) return (akva_devmap_vaddr); - if (devmap_table == NULL) - panic("arm_devmap_lastaddr(): No devmap table registered."); - lowaddr = ARM_VECTORS_HIGH; - for (pd = devmap_table; pd->pd_size != 0; ++pd) { + for (pd = devmap_table; pd != NULL && pd->pd_size != 0; ++pd) { if (lowaddr > pd->pd_va) lowaddr = pd->pd_va; } @@ -145,22 +142,21 @@ arm_devmap_bootstrap(vm_offset_t l1pt, c { const struct arm_devmap_entry *pd; + devmap_bootstrap_done = true; + /* - * If given a table pointer, use it, else ensure a table was previously - * registered. This happens early in boot, and there's a good chance - * the panic message won't be seen, but there's not much we can do. + * If given a table pointer, use it. Otherwise, if a table was + * previously registered, use it. Otherwise, no work to do. */ if (table != NULL) devmap_table = table; else if (devmap_table == NULL) - panic("arm_devmap_bootstrap(): No devmap table registered"); + return; for (pd = devmap_table; pd->pd_size != 0; ++pd) { pmap_map_chunk(l1pt, pd->pd_va, pd->pd_pa, pd->pd_size, pd->pd_prot,pd->pd_cache); } - - devmap_bootstrap_done = true; } /* @@ -207,13 +203,23 @@ arm_devmap_vtop(void * vpva, vm_size_t s /* * Map a set of physical memory pages into the kernel virtual address space. - * Return a pointer to where it is mapped. This routine is intended to be used - * for mapping device memory, NOT real memory. + * Return a pointer to where it is mapped. + * + * This uses a pre-established static mapping if one exists for the requested + * range, otherwise it allocates kva space and maps the physical pages into it. + * + * This routine is intended to be used for mapping device memory, NOT real + * memory; the mapping type is inherently PTE_DEVICE in pmap_kenter_device(). */ void * pmap_mapdev(vm_offset_t pa, vm_size_t size) { vm_offset_t va, tmpva, offset; + void * rva; + + /* First look in the static mapping table. */ + if ((rva = arm_devmap_ptov(pa, size)) != NULL) + return (rva); offset = pa & PAGE_MASK; pa = trunc_page(pa); @@ -240,7 +246,13 @@ void pmap_unmapdev(vm_offset_t va, vm_size_t size) { vm_offset_t tmpva, offset; - + vm_size_t origsize; + + /* Nothing to do if we find the mapping in the static table. */ + if (arm_devmap_vtop((void*)va, size) != DEVMAP_PADDR_NOTFOUND) + return; + + origsize = size; offset = va & PAGE_MASK; va = trunc_page(va); size = round_page(size + offset); @@ -251,6 +263,6 @@ pmap_unmapdev(vm_offset_t va, vm_size_t tmpva += PAGE_SIZE; } - kva_free(va, size); + kva_free(va, origsize); } Modified: stable/10/sys/arm/arm/machdep.c ============================================================================== --- stable/10/sys/arm/arm/machdep.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/arm/machdep.c Wed May 14 19:18:58 2014 (r266084) @@ -92,6 +92,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: stable/10/sys/arm/arm/trap.c ============================================================================== --- stable/10/sys/arm/arm/trap.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/arm/trap.c Wed May 14 19:18:58 2014 (r266084) @@ -85,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_fbd.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed May 14 19:18:58 2014 (r266084) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c ============================================================================== --- stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Wed May 14 19:18:58 2014 (r266084) @@ -59,14 +59,11 @@ __FBSDID("$FreeBSD$"); #include -/* Start of address space used for bootstrap map */ -#define DEVMAP_BOOTSTRAP_MAP_START 0xE0000000 - vm_offset_t initarm_lastaddr(void) { - return (DEVMAP_BOOTSTRAP_MAP_START); + return (arm_devmap_lastaddr()); } void @@ -99,28 +96,16 @@ initarm_late_init(void) } } -#define FDT_DEVMAP_MAX (2) // FIXME -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - - /* - * Construct pmap_devmap[] with DT-derived config data. + * Set up static device mappings. + * All on-chip peripherals exist in a 16MB range starting at 0x20000000. + * Map the entire range using 1MB section mappings. */ int initarm_devmap_init(void) { - int i = 0; - - fdt_devmap[i].pd_va = 0xf2000000; - fdt_devmap[i].pd_pa = 0x20000000; - fdt_devmap[i].pd_size = 0x01000000; /* 1 MB */ - fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[i].pd_cache = PTE_DEVICE; - i++; - arm_devmap_register_table(&fdt_devmap[0]); + arm_devmap_add_entry(0x20000000, 0x01000000); return (0); } Modified: stable/10/sys/arm/conf/DOCKSTAR ============================================================================== --- stable/10/sys/arm/conf/DOCKSTAR Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/conf/DOCKSTAR Wed May 14 19:18:58 2014 (r266084) @@ -3,73 +3,165 @@ # # $FreeBSD$ # +# 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 DOCKSTAR + include "../mv/kirkwood/std.db88f6xxx" -options SOC_MV_KIRKWOOD +makeoptions FDT_DTS_FILE=dockstar.dts + makeoptions MODULES_OVERRIDE="" -#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols -makeoptions WERROR="-Werror" +options SOC_MV_KIRKWOOD options SCHED_4BSD #4BSD scheduler options INET #InterNETworking options INET6 #IPv6 communications protocols +options SOFTUPDATES +options CD9660 #ISO 9660 filesystem options FFS #Berkeley Fast Filesystem -options NFSCL #New Network Filesystem Client -options NFSLOCKD #Network Lock Manager -options NFS_ROOT #NFS usable as /, requires NFSCL -options BOOTP -options BOOTP_NFSROOT -options BOOTP_NFSV3 -options BOOTP_COMPAT -options BOOTP_WIRED_TO=mge0 - -# Root fs on USB device -#options ROOTDEVNAME=\"ufs:/dev/da0a\" - +options MSDOSFS #MS DOS File System (FAT, FAT32) +options NULLFS #NULL filesystem +options TMPFS #Efficient memory filesystem 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 MUTEX_NOINLINE -options RWLOCK_NOINLINE -options NO_FFS_SNAPSHOT -options NO_SWAPPING +options GEOM_ELI # Disk encryption. +options GEOM_LABEL # Providers labelization. +options GEOM_PART_GPT # GPT partitioning -# Debugging -options ALT_BREAK_TO_DEBUGGER -options DDB -options KDB +# Flattened Device Tree +device fdt +options FDT +options FDT_DTB_STATIC + +# Misc pseudo devices +device bpf #Required for DHCP +device faith #IPv6-to-IPv4 relaying (translation) +device firmware #firmware(9) required for USB wlan +device gif #IPv6 and IPv4 tunneling +device loop #Network loopback +device md #Memory/malloc disk +device pty #BSD-style compatibility pseudo ttys +device random #Entropy device +device tun #Packet tunnel. +device ether #Required for all ethernet devices +device vlan #802.1Q VLAN support +device wlan #802.11 WLAN support -# Pseudo devices -device md -device random -device loop +# cam support for umass and ahci +device scbus +device pass +device da # Serial ports device uart # Networking -device ether device mge # Marvell Gigabit Ethernet controller device mii -device bpf -options HZ=1000 -options DEVICE_POLLING -device vlan +device e1000phy # USB -options USB_DEBUG # enable debug msgs -device usb -device ehci -device umass -device scbus -device pass -device da +options USB_HOST_ALIGN=32 # Align DMA to cacheline +#options USB_DEBUG # Compile in USB debug support +device usb # Basic usb support +device ehci # USB host controller +device umass # Mass storage +device uhid # Human-interface devices +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs +device urtw # Realtek RTL8187B/L USB +device upgt # Conexant/Intersil PrismGT SoftMAC USB +device u3g # USB-based 3G modems (Option, Huawei, Sierra) + +# I2C (TWSI) +device iic +device iicbus + +# Sound +device sound +device snd_uaudio + +#crypto +device cesa # Marvell security engine +device crypto +device cryptodev + +# IPSec +device enc +options IPSEC +options IPSEC_NAT_T +options TCP_SIGNATURE #include support for RFC 2385 + +# IPFW +options IPFIREWALL +options IPFIREWALL_DEFAULT_TO_ACCEPT +options IPFIREWALL_VERBOSE +options IPFIREWALL_VERBOSE_LIMIT=100 +options IPFIREWALL_NAT +options LIBALIAS +options DUMMYNET +options IPDIVERT + +#PF +device pf +device pflog +device pfsync + +# ALTQ, required for PF +options ALTQ # Basic ALTQ support +options ALTQ_CBQ # Class Based Queueing +options ALTQ_RED # Random Early Detection +options ALTQ_RIO # RED In/Out +options ALTQ_HFSC # Hierarchical Packet Scheduler +options ALTQ_CDNR # Traffic conditioner +options ALTQ_PRIQ # Priority Queueing +options ALTQ_NOPCC # Required if the TSC is unusable +#options ALTQ_DEBUG + +# Debugging +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB +options DIAGNOSTIC +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 WITNESS_KDB + +# Enable these options for nfs root configured via BOOTP. +options NFSCL #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +#options NFS_ROOT #NFS usable as /, requires NFSCLIENT +#options BOOTP +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=mge0 + +# If not using BOOTP, use something like one of these... +#options ROOTDEVNAME=\"ufs:/dev/da0a\" +options ROOTDEVNAME=\"ufs:/dev/da0s1a\" +#options ROOTDEVNAME=\"ufs:/dev/da0p10\" +#options ROOTDEVNAME=\"nfs:192.168.0.254/dreamplug\" -# Flattened Device Tree -options FDT -options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=dockstar.dts Modified: stable/10/sys/arm/freescale/imx/imx51_ipuv3.c ============================================================================== --- stable/10/sys/arm/freescale/imx/imx51_ipuv3.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/freescale/imx/imx51_ipuv3.c Wed May 14 19:18:58 2014 (r266084) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/10/sys/arm/include/fdt.h ============================================================================== --- stable/10/sys/arm/include/fdt.h Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/include/fdt.h Wed May 14 19:18:58 2014 (r266084) @@ -51,15 +51,8 @@ */ extern bus_space_tag_t fdtbus_bs_tag; -struct mem_region { - vm_offset_t mr_start; - vm_size_t mr_size; -}; - struct arm_devmap_entry; int fdt_localbus_devmap(phandle_t, struct arm_devmap_entry *, int, int *); -int fdt_pci_devmap(phandle_t, struct arm_devmap_entry *devmap, vm_offset_t, - vm_offset_t); #endif /* _MACHINE_FDT_H_ */ Modified: stable/10/sys/arm/include/intr.h ============================================================================== --- stable/10/sys/arm/include/intr.h Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/include/intr.h Wed May 14 19:18:58 2014 (r266084) @@ -67,8 +67,6 @@ #define NIRQ 32 #endif -#include -#include int arm_get_next_irq(int); void arm_mask_irq(uintptr_t); Modified: stable/10/sys/arm/include/ofw_machdep.h ============================================================================== --- stable/10/sys/arm/include/ofw_machdep.h Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/include/ofw_machdep.h Wed May 14 19:18:58 2014 (r266084) @@ -32,6 +32,13 @@ #ifndef _MACHINE_OFW_MACHDEP_H_ #define _MACHINE_OFW_MACHDEP_H_ +#include + typedef uint32_t cell_t; +struct mem_region { + vm_offset_t mr_start; + vm_size_t mr_size; +}; + #endif /* _MACHINE_OFW_MACHDEP_H_ */ Modified: stable/10/sys/arm/include/psl.h ============================================================================== --- stable/10/sys/arm/include/psl.h Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/include/psl.h Wed May 14 19:18:58 2014 (r266084) @@ -46,7 +46,6 @@ #ifndef _MACHINE_PSL_H_ #define _MACHINE_PSL_H_ -#include /* * These are the different SPL states Modified: stable/10/sys/arm/lpc/lpc_gpio.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_gpio.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/lpc/lpc_gpio.c Wed May 14 19:18:58 2014 (r266084) @@ -502,12 +502,18 @@ lpc_gpio_get_state(device_t dev, int pin void platform_gpio_init() { + bus_space_tag_t bst; + bus_space_handle_t bsh; + + bst = fdtbus_bs_tag; + /* Preset SPI devices CS pins to one */ - bus_space_write_4(fdtbus_bs_tag, - LPC_GPIO_BASE, LPC_GPIO_P3_OUTP_SET, + bus_space_map(bst, LPC_GPIO_PHYS_BASE, LPC_GPIO_SIZE, 0, &bsh); + bus_space_write_4(bst, bsh, LPC_GPIO_P3_OUTP_SET, 1 << (SSD1289_CS_PIN - LPC_GPIO_GPO_00(0)) | 1 << (SSD1289_DC_PIN - LPC_GPIO_GPO_00(0)) | 1 << (ADS7846_CS_PIN - LPC_GPIO_GPO_00(0))); + bus_space_unmap(bst, bsh, LPC_GPIO_SIZE); } static device_method_t lpc_gpio_methods[] = { Modified: stable/10/sys/arm/lpc/lpc_machdep.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_machdep.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/lpc/lpc_machdep.c Wed May 14 19:18:58 2014 (r266084) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -57,21 +58,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include vm_offset_t initarm_lastaddr(void) { - return (fdt_immr_va); + return (arm_devmap_lastaddr()); } void initarm_early_init(void) { - - if (fdt_immr_addr(LPC_DEV_BASE) != 0) - while (1); } void @@ -89,28 +86,16 @@ initarm_late_init(void) { } -#define FDT_DEVMAP_MAX (1 + 2 + 1 + 1) -static struct arm_devmap_entry fdt_devmap[FDT_DEVMAP_MAX] = { - { 0, 0, 0, 0, 0, } -}; - /* - * Construct pmap_devmap[] with DT-derived config data. + * Add a single static device mapping. + * The values used were taken from the ranges property of the SoC node in the + * dts file when this code was converted to arm_devmap_add_entry(). */ int initarm_devmap_init(void) { - /* - * IMMR range. - */ - fdt_devmap[0].pd_va = fdt_immr_va; - fdt_devmap[0].pd_pa = fdt_immr_pa; - fdt_devmap[0].pd_size = fdt_immr_size; - fdt_devmap[0].pd_prot = VM_PROT_READ | VM_PROT_WRITE; - fdt_devmap[0].pd_cache = PTE_NOCACHE; - - arm_devmap_register_table(&fdt_devmap[0]); + arm_devmap_add_entry(LPC_DEV_PHYS_BASE, LPC_DEV_SIZE); return (0); } @@ -131,15 +116,24 @@ bus_dma_get_range_nb(void) void cpu_reset(void) { + bus_space_tag_t bst; + bus_space_handle_t bsh; + + bst = fdtbus_bs_tag; + /* Enable WDT */ - bus_space_write_4(fdtbus_bs_tag, - LPC_CLKPWR_BASE, LPC_CLKPWR_TIMCLK_CTRL, + bus_space_map(bst, LPC_CLKPWR_PHYS_BASE, LPC_CLKPWR_SIZE, 0, &bsh); + bus_space_write_4(bst, bsh, LPC_CLKPWR_TIMCLK_CTRL, LPC_CLKPWR_TIMCLK_CTRL_WATCHDOG); + bus_space_unmap(bst, bsh, LPC_CLKPWR_SIZE); /* Instant assert of RESETOUT_N with pulse length 1ms */ - bus_space_write_4(fdtbus_bs_tag, LPC_WDTIM_BASE, LPC_WDTIM_PULSE, 13000); - bus_space_write_4(fdtbus_bs_tag, LPC_WDTIM_BASE, LPC_WDTIM_MCTRL, 0x70); + bus_space_map(bst, LPC_WDTIM_PHYS_BASE, LPC_WDTIM_SIZE, 0, &bsh); + bus_space_write_4(bst, bsh, LPC_WDTIM_PULSE, 13000); + bus_space_write_4(bst, bsh, LPC_WDTIM_MCTRL, 0x70); + bus_space_unmap(bst, bsh, LPC_WDTIM_SIZE); - for (;;); + for (;;) + continue; } Modified: stable/10/sys/arm/lpc/lpc_mmc.c ============================================================================== --- stable/10/sys/arm/lpc/lpc_mmc.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/lpc/lpc_mmc.c Wed May 14 19:18:58 2014 (r266084) @@ -507,14 +507,14 @@ lpc_mmc_setup_xfer(struct lpc_mmc_softc if (data->flags & MMC_DATA_READ) { sc->lm_xfer_direction = DIRECTION_READ; lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_READ, - LPC_SD_BASE + LPC_SD_FIFO, sc->lm_buffer_phys, + LPC_SD_PHYS_BASE + LPC_SD_FIFO, sc->lm_buffer_phys, data_words, 0); } if (data->flags & MMC_DATA_WRITE) { sc->lm_xfer_direction = DIRECTION_WRITE; lpc_dmac_setup_transfer(sc->lm_dev, LPC_MMC_DMACH_WRITE, - sc->lm_buffer_phys, LPC_SD_BASE + LPC_SD_FIFO, + sc->lm_buffer_phys, LPC_SD_PHYS_BASE + LPC_SD_FIFO, data_words, 0); } Modified: stable/10/sys/arm/lpc/lpcreg.h ============================================================================== --- stable/10/sys/arm/lpc/lpcreg.h Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/lpc/lpcreg.h Wed May 14 19:18:58 2014 (r266084) @@ -32,7 +32,6 @@ #define LPC_DEV_PHYS_BASE 0x40000000 #define LPC_DEV_P5_PHYS_BASE 0x20000000 #define LPC_DEV_P6_PHYS_BASE 0x30000000 -#define LPC_DEV_BASE 0xd0000000 #define LPC_DEV_SIZE 0x10000000 /* @@ -88,7 +87,7 @@ /* * Watchdog timer. (from UM10326: LPC32x0 User manual, page 572) */ -#define LPC_WDTIM_BASE (LPC_DEV_BASE + 0x3c000) +#define LPC_WDTIM_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x3c000) #define LPC_WDTIM_INT 0x00 #define LPC_WDTIM_CTRL 0x04 #define LPC_WDTIM_COUNTER 0x08 @@ -97,11 +96,12 @@ #define LPC_WDTIM_EMR 0x14 #define LPC_WDTIM_PULSE 0x18 #define LPC_WDTIM_RES 0x1c +#define LPC_WDTIM_SIZE 0x20 /* * Clocking and power control. (from UM10326: LPC32x0 User manual, page 58) */ -#define LPC_CLKPWR_BASE (LPC_DEV_BASE + 0x4000) +#define LPC_CLKPWR_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x4000) #define LPC_CLKPWR_PWR_CTRL 0x44 #define LPC_CLKPWR_OSC_CTRL 0x4c #define LPC_CLKPWR_SYSCLK_CTRL 0x50 @@ -189,6 +189,7 @@ #define LPC_CLKPWR_UARTCLK_CTRL 0xe4 #define LPC_CLKPWR_POS0_IRAM_CTRL 0x110 #define LPC_CLKPWR_POS1_IRAM_CTRL 0x114 +#define LPC_CLKPWR_SIZE 0x118 /* Additional UART registers in CLKPWR address space. */ #define LPC_CLKPWR_UART_U3CLK 0xd0 @@ -201,9 +202,9 @@ #define LPC_CLKPWR_UART_IRDACLK 0xe0 /* Additional UART registers */ -#define LPC_UART_BASE (LPC_DEV_BASE + 0x80000) -#define LPC_UART_CONTROL_BASE (LPC_DEV_BASE + 0x54000) -#define LPC_UART5_BASE (LPC_DEV_BASE + 0x90000) +#define LPC_UART_BASE 0x80000 +#define LPC_UART_CONTROL_BASE 0x54000 +#define LPC_UART5_BASE 0x90000 #define LPC_UART_CTRL 0x00 #define LPC_UART_CLKMODE 0x04 #define LPC_UART_CLKMODE_UART3(_n) (((_n) & 0x3) << 4) @@ -211,6 +212,7 @@ #define LPC_UART_CLKMODE_UART5(_n) (((_n) & 0x3) << 8) #define LPC_UART_CLKMODE_UART6(_n) (((_n) & 0x3) << 10) #define LPC_UART_LOOP 0x08 +#define LPC_UART_CONTROL_SIZE 0x0c #define LPC_UART_FIFOSIZE 64 /* @@ -236,7 +238,7 @@ /* * MMC/SD controller. (from UM10326: LPC32x0 User manual, page 436) */ -#define LPC_SD_BASE (LPC_DEV_P5_PHYS_BASE + 0x98000) +#define LPC_SD_PHYS_BASE (LPC_DEV_P5_PHYS_BASE + 0x98000) #define LPC_SD_CLK (13 * 1000 * 1000) // 13Mhz #define LPC_SD_POWER 0x00 #define LPC_SD_POWER_OPENDRAIN (1 << 6) @@ -535,7 +537,7 @@ /* * GPIO (from UM10326: LPC32x0 User manual, page 606) */ -#define LPC_GPIO_BASE (LPC_DEV_BASE + 0x28000) +#define LPC_GPIO_PHYS_BASE (LPC_DEV_PHYS_BASE + 0x28000) #define LPC_GPIO_P0_COUNT 8 #define LPC_GPIO_P1_COUNT 24 #define LPC_GPIO_P2_COUNT 13 @@ -564,6 +566,8 @@ #define LPC_GPIO_P3_OUTP_SET 0x04 #define LPC_GPIO_P3_OUTP_CLR 0x08 #define LPC_GPIO_P3_OUTP_STATE 0x0c +#define LPC_GPIO_SIZE 0x80 + /* Aliases for logical pin numbers: */ #define LPC_GPIO_GPI_00(_n) (0 + _n) #define LPC_GPIO_GPI_15(_n) (10 + _n) Modified: stable/10/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/10/sys/arm/mv/mv_machdep.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/mv/mv_machdep.c Wed May 14 19:18:58 2014 (r266084) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* XXX */ @@ -293,11 +294,11 @@ out: } /* - * Supply a default do-nothing implementation of fdt_pci_devmap() via a weak + * Supply a default do-nothing implementation of mv_pci_devmap() via a weak * alias. Many Marvell platforms don't support a PCI interface, but to support * those that do, we end up with a reference to this function below, in * platform_devmap_init(). If "device pci" appears in the kernel config, the - * real implementation of this function in dev/fdt/fdt_pci.c overrides the weak + * real implementation of this function in arm/mv/mv_pci.c overrides the weak * alias defined here. */ int mv_default_fdt_pci_devmap(phandle_t node, struct arm_devmap_entry *devmap, @@ -309,7 +310,7 @@ mv_default_fdt_pci_devmap(phandle_t node return (0); } -__weak_reference(mv_default_fdt_pci_devmap, fdt_pci_devmap); +__weak_reference(mv_default_fdt_pci_devmap, mv_pci_devmap); /* * XXX: When device entry in devmap has pd_size smaller than section size, @@ -378,7 +379,7 @@ initarm_devmap_init(void) * XXX this should account for PCI and multiple ranges * of a given kind. */ - if (fdt_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE, + if (mv_pci_devmap(child, &fdt_devmap[i], MV_PCI_VA_IO_BASE, MV_PCI_VA_MEM_BASE) != 0) return (ENXIO); i += 2; Modified: stable/10/sys/arm/mv/mv_pci.c ============================================================================== --- stable/10/sys/arm/mv/mv_pci.c Wed May 14 19:11:15 2014 (r266083) +++ stable/10/sys/arm/mv/mv_pci.c Wed May 14 19:18:58 2014 (r266084) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -69,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" #include "pcib_if.h" +#include #include #include @@ -82,6 +84,172 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +/* + * Code and data related to fdt-based PCI configuration. + * + * This stuff used to be in dev/fdt/fdt_pci.c and fdt_common.h, but it was + * always Marvell-specific so that was deleted and the code now lives here. + */ + +struct mv_pci_range { + u_long base_pci; + u_long base_parent; + u_long len; +}; + +#define FDT_RANGES_CELLS ((3 + 3 + 2) * 2) + +static void +mv_pci_range_dump(struct mv_pci_range *range) +{ +#ifdef DEBUG + printf("\n"); + printf(" base_pci = 0x%08lx\n", range->base_pci); + printf(" base_par = 0x%08lx\n", range->base_parent); + printf(" len = 0x%08lx\n", range->len); +#endif +} + +static int +mv_pci_ranges_decode(phandle_t node, struct mv_pci_range *io_space, + struct mv_pci_range *mem_space) +{ + pcell_t ranges[FDT_RANGES_CELLS]; + struct mv_pci_range *pci_space; + pcell_t addr_cells, size_cells, par_addr_cells; + pcell_t *rangesptr; + pcell_t cell0, cell1, cell2; + int tuple_size, tuples, i, rv, offset_cells, len; + + /* + * Retrieve 'ranges' property. + */ + if ((fdt_addrsize_cells(node, &addr_cells, &size_cells)) != 0) + return (EINVAL); + if (addr_cells != 3 || size_cells != 2) + return (ERANGE); + + par_addr_cells = fdt_parent_addr_cells(node); + if (par_addr_cells > 3) + return (ERANGE); + + len = OF_getproplen(node, "ranges"); + if (len > sizeof(ranges)) + return (ENOMEM); + + if (OF_getprop(node, "ranges", ranges, sizeof(ranges)) <= 0) + return (EINVAL); + + tuple_size = sizeof(pcell_t) * (addr_cells + par_addr_cells + + size_cells); + tuples = len / tuple_size; + + /* + * Initialize the ranges so that we don't have to worry about + * having them all defined in the FDT. In particular, it is + * perfectly fine not to want I/O space on PCI busses. + */ + bzero(io_space, sizeof(*io_space)); + bzero(mem_space, sizeof(*mem_space)); + + rangesptr = &ranges[0]; + offset_cells = 0; + for (i = 0; i < tuples; i++) { + cell0 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell1 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + cell2 = fdt_data_get((void *)rangesptr, 1); + rangesptr++; + + if (cell0 & 0x02000000) { + pci_space = mem_space; + } else if (cell0 & 0x01000000) { + pci_space = io_space; + } else { + rv = ERANGE; + goto out; + } + + if (par_addr_cells == 3) { + /* + * This is a PCI subnode 'ranges'. Skip cell0 and + * cell1 of this entry and only use cell2. + */ + offset_cells = 2; + rangesptr += offset_cells; + } + + if (fdt_data_verify((void *)rangesptr, par_addr_cells - + offset_cells)) { + rv = ERANGE; + goto out; + } + pci_space->base_parent = fdt_data_get((void *)rangesptr, + par_addr_cells - offset_cells); + rangesptr += par_addr_cells - offset_cells; + + if (fdt_data_verify((void *)rangesptr, size_cells)) { + rv = ERANGE; + goto out; + } + pci_space->len = fdt_data_get((void *)rangesptr, size_cells); + rangesptr += size_cells; + + pci_space->base_pci = cell2; + } + rv = 0; +out: + return (rv); +} + +static int +mv_pci_ranges(phandle_t node, struct mv_pci_range *io_space, + struct mv_pci_range *mem_space) +{ + int err; + + debugf("Processing PCI node: %x\n", node); + if ((err = mv_pci_ranges_decode(node, io_space, mem_space)) != 0) { + debugf("could not decode parent PCI node 'ranges'\n"); + return (err); + } + + debugf("Post fixup dump:\n"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***