Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Switch VEXPRESS_A15 kernel to use FDT and GENERIC.c...



details:   https://anonhg.NetBSD.org/src/rev/d9a1348bf3a6
branches:  trunk
changeset: 824353:d9a1348bf3a6
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Jun 02 15:22:47 2017 +0000

description:
Switch VEXPRESS_A15 kernel to use FDT and GENERIC.common. The dtb for this
kernel can be found in the sysutils/dtb-arm-vexpress package as
vexpress-v2p-ca15-tc1.dtb

diffstat:

 sys/arch/arm/vexpress/files.vexpress        |   18 +
 sys/arch/arm/vexpress/vexpress_platform.c   |  170 ++++++++++++++++
 sys/arch/evbarm/conf/VEXPRESS_A15           |  228 +++------------------
 sys/arch/evbarm/conf/files.vexpress         |   32 +--
 sys/arch/evbarm/conf/mk.vexpress            |   39 +---
 sys/arch/evbarm/conf/std.vexpress           |   11 +-
 sys/arch/evbarm/vexpress/if_smsh_axi.c      |  120 -----------
 sys/arch/evbarm/vexpress/platform.h         |   51 -----
 sys/arch/evbarm/vexpress/vexpress_axi.c     |  156 ---------------
 sys/arch/evbarm/vexpress/vexpress_intr.h    |   54 -----
 sys/arch/evbarm/vexpress/vexpress_machdep.c |  284 ----------------------------
 sys/arch/evbarm/vexpress/vexpress_plcom.c   |   97 ---------
 sys/arch/evbarm/vexpress/vexpress_plmmc.c   |   91 --------
 sys/arch/evbarm/vexpress/vexpress_space.c   |  253 ------------------------
 sys/arch/evbarm/vexpress/vexpress_start.S   |   21 +-
 sys/arch/evbarm/vexpress/vexpress_var.h     |   48 ----
 16 files changed, 253 insertions(+), 1420 deletions(-)

diffs (truncated from 1830 to 300 lines):

diff -r e83628e02adb -r d9a1348bf3a6 sys/arch/arm/vexpress/files.vexpress
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/vexpress/files.vexpress      Fri Jun 02 15:22:47 2017 +0000
@@ -0,0 +1,18 @@
+#      $NetBSD: files.vexpress,v 1.1 2017/06/02 15:22:47 jmcneill Exp $
+#
+# Configuration info for ARM Ltd. Versatile Express peripherals
+#
+#
+
+include        "arch/arm/pic/files.pic"
+include        "arch/arm/cortex/files.cortex"
+
+file   arch/arm/arm32/arm32_boot.c
+file   arch/arm/arm32/arm32_kvminit.c
+file   arch/arm/arm32/arm32_reboot.c
+file   arch/arm/arm32/irq_dispatch.S
+file   arch/arm/arm32/armv7_generic_space.c
+file   arch/arm/arm32/armv7_generic_dma.c
+file   arch/arm/arm/bus_space_a4x.S
+
+file   arch/arm/vexpress/vexpress_platform.c
diff -r e83628e02adb -r d9a1348bf3a6 sys/arch/arm/vexpress/vexpress_platform.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/vexpress/vexpress_platform.c Fri Jun 02 15:22:47 2017 +0000
@@ -0,0 +1,170 @@
+/* $NetBSD: vexpress_platform.c,v 1.1 2017/06/02 15:22:47 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "opt_multiprocessor.h"
+#include "opt_fdt_arm.h"
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: vexpress_platform.c,v 1.1 2017/06/02 15:22:47 jmcneill Exp $");
+
+#include <sys/param.h>
+#include <sys/bus.h>
+#include <sys/cpu.h>
+#include <sys/device.h>
+#include <sys/termios.h>
+
+#include <dev/fdt/fdtvar.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/bootconfig.h>
+#include <arm/cpufunc.h>
+
+#include <arm/fdt/arm_fdtvar.h>
+
+#include <arm/cortex/gtmr_var.h>
+
+#include <evbarm/dev/plcomvar.h>
+
+#define        VEXPRESS_REF_FREQ       24000000
+
+#define        VEXPRESS_CORE_VBASE     0xf0000000
+#define        VEXPRESS_CORE_PBASE     0x10000000
+#define        VEXPRESS_CORE_SIZE      0x10000000
+
+#define        DEVMAP_ALIGN(a) ((a) & ~L1_S_OFFSET)
+#define        DEVMAP_SIZE(s)  roundup2((s), L1_S_SIZE)
+#define        DEVMAP_ENTRY(va, pa, sz)                        \
+       {                                               \
+               .pd_va = DEVMAP_ALIGN(va),              \
+               .pd_pa = DEVMAP_ALIGN(pa),              \
+               .pd_size = DEVMAP_SIZE(sz),             \
+               .pd_prot = VM_PROT_READ|VM_PROT_WRITE,  \
+               .pd_cache = PTE_NOCACHE                 \
+       }
+#define        DEVMAP_ENTRY_END        { 0 }
+
+extern struct bus_space armv7_generic_bs_tag;
+extern struct bus_space armv7_generic_a4x_bs_tag;
+extern struct arm32_bus_dma_tag armv7_generic_dma_tag;
+
+#define        SYSREG_BASE             0x1c010000
+#define        SYSREG_SIZE             0x1000
+
+#define        SYS_FLAGS               0x0030
+#define        SYS_FLAGSCLR            0x0034
+#define        SYS_CFGDATA             0x00a0
+#define        SYS_CFGCTRL             0x00a4
+#define         SYS_CFGCTRL_START      __BIT(31)
+#define         SYS_CFGCTRL_WRITE      __BIT(30)
+#define         SYS_CFGCTRL_DCC        __BITS(29,26)
+#define         SYS_CFGCTRL_FUNCTION   __BITS(25,20)
+#define          SYS_CFGCTRL_FUNCTION_SHUTDOWN 8
+#define          SYS_CFGCTRL_FUNCTION_REBOOT   9
+#define         SYS_CFGCTRL_SITE       __BITS(17,16)
+#define         SYS_CFGCTRL_POSITION   __BITS(15,12)
+#define         SYS_CFGCTRL_DEVICE     __BITS(11,0)
+#define        SYS_CFGSTAT             0x00a8
+#define         SYS_CFGSTAT_ERROR      __BIT(1)
+#define         SYS_CFGSTAT_COMPLETE   __BIT(0)
+
+static bus_space_tag_t sysreg_bst = &armv7_generic_bs_tag;
+static bus_space_handle_t sysreg_bsh;
+
+#define        SYSREG_WRITE(o, v)      \
+       bus_space_write_4(sysreg_bst, sysreg_bsh, (o), (v))
+
+
+static const struct pmap_devmap *
+vexpress_platform_devmap(void)
+{
+       static const struct pmap_devmap devmap[] = {
+               DEVMAP_ENTRY(VEXPRESS_CORE_VBASE,
+                            VEXPRESS_CORE_PBASE,
+                            VEXPRESS_CORE_SIZE),
+               DEVMAP_ENTRY_END
+       };      
+
+       return devmap;
+}
+
+static void
+vexpress_platform_bootstrap(void)
+{
+       bus_space_map(sysreg_bst, SYSREG_BASE, SYSREG_SIZE, 0,
+           &sysreg_bsh);
+}
+
+static void
+vexpress_platform_init_attach_args(struct fdt_attach_args *faa)
+{
+       faa->faa_bst = &armv7_generic_bs_tag;
+       faa->faa_a4x_bst = &armv7_generic_a4x_bs_tag;
+       faa->faa_dmat = &armv7_generic_dma_tag;
+}
+
+static void
+vexpress_platform_early_putchar(char c)
+{
+}
+
+static void
+vexpress_platform_device_register(device_t self, void *aux)
+{
+}
+
+static void
+vexpress_platform_reset(void)
+{
+       SYSREG_WRITE(SYS_CFGSTAT, 0);
+       SYSREG_WRITE(SYS_CFGDATA, 0);
+       SYSREG_WRITE(SYS_CFGCTRL,
+           SYS_CFGCTRL_START |
+           SYS_CFGCTRL_WRITE |
+           __SHIFTIN(SYS_CFGCTRL_FUNCTION_REBOOT,
+                     SYS_CFGCTRL_FUNCTION));
+}
+
+static u_int
+vexpress_platform_uart_freq(void)
+{
+       return VEXPRESS_REF_FREQ;
+}
+
+static const struct arm_platform vexpress_platform = {
+       .devmap = vexpress_platform_devmap,
+       .bootstrap = vexpress_platform_bootstrap,
+       .init_attach_args = vexpress_platform_init_attach_args,
+       .early_putchar = vexpress_platform_early_putchar,
+       .device_register = vexpress_platform_device_register,
+       .reset = vexpress_platform_reset,
+       .delay = gtmr_delay,
+       .uart_freq = vexpress_platform_uart_freq,
+};
+
+ARM_PLATFORM(vexpress, "arm,vexpress", &vexpress_platform);
diff -r e83628e02adb -r d9a1348bf3a6 sys/arch/evbarm/conf/VEXPRESS_A15
--- a/sys/arch/evbarm/conf/VEXPRESS_A15 Fri Jun 02 15:09:16 2017 +0000
+++ b/sys/arch/evbarm/conf/VEXPRESS_A15 Fri Jun 02 15:22:47 2017 +0000
@@ -1,215 +1,65 @@
 #
-#      $NetBSD: VEXPRESS_A15,v 1.7 2017/02/19 07:47:00 rin Exp $
+#      $NetBSD: VEXPRESS_A15,v 1.8 2017/06/02 15:22:47 jmcneill Exp $
 #
-#      VEXPRESS_A15 -- Versatile Express A15 kernel
+#      ARM Versatile Express A15
 #
 
 include        "arch/evbarm/conf/std.vexpress"
-
-# estimated number of users
-
-maxusers       32
-
-# Standard system options
+include        "arch/evbarm/conf/GENERIC.common"
 
-options        RTC_OFFSET=0    # hardware clock is this many mins. west of GMT
-#options       NTP             # NTP phase/frequency locked loop
-
-# CPU options
-options        CPU_CORTEX
 options        CPU_CORTEXA15
+options        SOC_TEGRA124
 #options       MULTIPROCESSOR
 
-options        PMAPCOUNTERS
-options        BUSDMA_COUNTERS
-#options       UVMHIST
-#options       USB_DEBUG
-#options       USBHIST_SIZE=100000
-#options       UVMHIST_PRINT,KERNHIST_DELAY=0
-options        __HAVE_MM_MD_DIRECT_MAPPED_PHYS
-options        PMAP_NEED_ALLOC_POOLPAGE
-
-# Specify the memory size in megabytes (optional).
-#options       MEMSIZE=512
-
-# File systems
-file-system    FFS             # UFS
-#file-system   LFS             # log-structured file system
-file-system    MFS             # memory file system
-file-system    NFS             # Network file system
-#file-system   ADOSFS          # AmigaDOS-compatible file system
-#file-system   EXT2FS          # second extended file system (linux)
-#file-system   CD9660          # ISO 9660 + Rock Ridge file system
-file-system    MSDOSFS         # MS-DOS file system
-#file-system   FDESC           # /dev/fd
-file-system    KERNFS          # /kern
-#file-system   NULLFS          # loopback file system
-file-system    PROCFS          # /proc
-#file-system   PUFFS           # Userspace file systems (e.g. ntfs-3g & sshfs)
-#file-system   UMAPFS          # NULLFS + uid and gid remapping
-#file-system   UNION           # union file system
-file-system    TMPFS           # memory file system
-file-system    PTYFS           # /dev/pts/N support
-
-# File system options
-#options       QUOTA           # legacy UFS quotas
-#options       QUOTA2          # new, in-filesystem UFS quotas
-#options       DISKLABEL_EI    # disklabel Endian Independent support
-#options       FFS_EI          # FFS Endian Independent support
-#options       NFSSERVER
-options        WAPBL           # File system journaling support
-#options       FFS_NO_SNAPSHOT # No FFS snapshot support
-
-# Networking options
-
-#options       GATEWAY         # packet forwarding
-options        INET            # IP + ICMP + TCP + UDP
-options        INET6           # IPV6
-#options       IPSEC           # IP security
-#options       IPSEC_DEBUG     # debug for IP security
-#options       MROUTING        # IP multicast routing
-#options       PIM             # Protocol Independent Multicast
-#options       NETATALK        # AppleTalk networking
-#options       PPP_BSDCOMP     # BSD-Compress compression support for PPP
-#options       PPP_DEFLATE     # Deflate compression support for PPP
-#options       PPP_FILTER      # Active filter support for PPP (requires bpf)
-#options       TCP_DEBUG       # Record last TCP_NDEBUG packets with SO_DEBUG
+pseudo-device  openfirm        # /dev/openfirm
 
-options        NFS_BOOT_BOOTP
-options        NFS_BOOT_DHCP
-#options       NFS_BOOT_BOOTSTATIC
-#options       NFS_BOOTSTATIC_MYIP="\"192.168.1.4\""
-#options       NFS_BOOTSTATIC_GWIP="\"192.168.1.1\""
-#options       NFS_BOOTSTATIC_MASK="\"255.255.255.0\""
-#options       NFS_BOOTSTATIC_SERVADDR="\"192.168.1.1\""
-#options       NFS_BOOTSTATIC_SERVER="\"192.168.1.1:/nfs/sdp2430\""
-
-options        NFS_BOOT_RWSIZE=1024
-
-# Compatibility options
-
-options        COMPAT_NETBSD32 # allow running arm (e.g. non-earm) binaries
-#options       COMPAT_43       # 4.3BSD compatibility.
-#options       COMPAT_09       # NetBSD 0.9,
-#options       COMPAT_10       # NetBSD 1.0,
-#options       COMPAT_11       # NetBSD 1.1,



Home | Main Index | Thread Index | Old Index