Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm use initarm_common()



details:   https://anonhg.NetBSD.org/src/rev/1c1e841c5d4a
branches:  trunk
changeset: 326272:1c1e841c5d4a
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Fri Jan 24 02:06:03 2014 +0000

description:
use initarm_common()

diffstat:

 sys/arch/evbarm/conf/files.netwalker          |    6 +-
 sys/arch/evbarm/netwalker/netwalker_machdep.c |  729 +------------------------
 2 files changed, 43 insertions(+), 692 deletions(-)

diffs (truncated from 874 to 300 lines):

diff -r adb87d98dcca -r 1c1e841c5d4a sys/arch/evbarm/conf/files.netwalker
--- a/sys/arch/evbarm/conf/files.netwalker      Fri Jan 24 01:10:22 2014 +0000
+++ b/sys/arch/evbarm/conf/files.netwalker      Fri Jan 24 02:06:03 2014 +0000
@@ -1,8 +1,12 @@
-#      $NetBSD: files.netwalker,v 1.3 2012/04/17 10:19:57 bsh Exp $
+#      $NetBSD: files.netwalker,v 1.4 2014/01/24 02:06:03 hkenken Exp $
 #
 # Sharp Netwalker
 #
 
+file   arch/arm/arm32/arm32_boot.c
+file   arch/arm/arm32/arm32_kvminit.c
+file   arch/arm/arm32/arm32_reboot.c
+
 file   arch/evbarm/netwalker/netwalker_machdep.c
 
 # Kernel boot arguments
diff -r adb87d98dcca -r 1c1e841c5d4a sys/arch/evbarm/netwalker/netwalker_machdep.c
--- a/sys/arch/evbarm/netwalker/netwalker_machdep.c     Fri Jan 24 01:10:22 2014 +0000
+++ b/sys/arch/evbarm/netwalker/netwalker_machdep.c     Fri Jan 24 02:06:03 2014 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $   */
+/*     $NetBSD: netwalker_machdep.c,v 1.13 2014/01/24 02:06:03 hkenken Exp $   */
 
 /*
- * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation. 
+ * Copyright (c) 2002, 2003, 2005, 2010  Genetec Corporation.
  * All rights reserved.
  * Written by Hiroyuki Bessho for Genetec Corporation.
  *
@@ -102,12 +102,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.12 2014/01/23 12:23:20 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_machdep.c,v 1.13 2014/01/24 02:06:03 hkenken Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
-#include "opt_ipkdb.h"
-#include "opt_pmap_debug.h"
 #include "opt_md.h"
 #include "opt_com.h"
 #include "imxuart.h"
@@ -118,35 +116,16 @@
 
 #include <sys/param.h>
 #include <sys/device.h>
-#include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/exec.h>
-#include <sys/proc.h>
-#include <sys/msgbuf.h>
-#include <sys/reboot.h>
 #include <sys/termios.h>
-#include <sys/ksyms.h>
 #include <sys/bus.h>
-#include <sys/cpu.h>
-#include <sys/conf.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-#include <dev/md.h>
 
 #include <machine/db_machdep.h>
-#include <ddb/db_sym.h>
-#include <ddb/db_extern.h>
 #ifdef KGDB
 #include <sys/kgdb.h>
 #endif
 
 #include <machine/bootconfig.h>
-#include <arm/locore.h>
-#include <arm/undefined.h>
 
-#include <arm/arm32/pte.h>
 #include <arm/arm32/machdep.h>
 
 #include <arm/imx/imx51reg.h>
@@ -174,39 +153,14 @@
 #define KERNEL_VM_SIZE         0x0C000000
 
 BootConfig bootconfig;         /* Boot config storage */
+static char bootargs[MAX_BOOT_STRING];
 char *boot_args = NULL;
-char *boot_file = NULL;
-
-vm_offset_t physical_start;
-vm_offset_t physical_freestart;
-vm_offset_t physical_freeend;
-vm_offset_t physical_end;
-u_int free_pages;
-vm_offset_t pagetables_start;
-
-/*int debug_flags;*/
-#ifndef PMAP_STATIC_L1S
-int max_processes = 64;                        /* Default number */
-#endif /* !PMAP_STATIC_L1S */
-
-vm_offset_t msgbufphys;
 
 extern char KERNEL_BASE_phys[];
 extern char KERNEL_BASE_virt[];
-extern char etext[], __data_start[], _edata[], __bss_start[], __bss_end__[];
-extern char _end[];
+
 extern int cpu_do_powersave;
 
-#define KERNEL_PT_SYS          0       /* Page table for mapping proc0 zero page */
-#define KERNEL_PT_KERNEL       1       /* Page table for mapping kernel */
-#define        KERNEL_PT_KERNEL_NUM    4
-#define KERNEL_PT_VMDATA       (KERNEL_PT_KERNEL+KERNEL_PT_KERNEL_NUM)
-                                       /* Page tables for mapping kernel VM */
-#define        KERNEL_PT_VMDATA_NUM    4       /* start with 16MB of KVM */
-#define NUM_KERNEL_PTS         (KERNEL_PT_VMDATA + KERNEL_PT_VMDATA_NUM)
-
-pv_addr_t kernel_pt_table[NUM_KERNEL_PTS];
-
 /*
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.
@@ -222,22 +176,13 @@
 /* Prototypes */
 
 void consinit(void);
-#if 0
-void   process_kernel_args(char *);
-#endif
 
 #ifdef KGDB
 void   kgdb_port_init(void);
 #endif
-void   change_clock(uint32_t v);
 
 static void init_clocks(void);
 static void setup_ioports(void);
-#ifdef DEBUG_IOPORTS
-void dump_registers(void);
-#endif
-
-bs_protos(bs_notimpl);
 
 #ifndef CONSPEED
 #define CONSPEED B115200       /* What RedBoot uses */
@@ -250,76 +195,6 @@
 int comcnmode = CONMODE;
 
 /*
- * void cpu_reboot(int howto, char *bootstr)
- *
- * Reboots the system
- *
- * Deal with any syncing, unmounting, dumping and shutdown hooks,
- * then reset the CPU.
- */
-void
-cpu_reboot(int howto, char *bootstr)
-{
-#ifdef DIAGNOSTIC
-       /* info */
-       printf("boot: howto=%08x curproc=%p\n", howto, curproc);
-#endif
-
-       /*
-        * If we are still cold then hit the air brakes
-        * and crash to earth fast
-        */
-       if (cold) {
-               doshutdownhooks();
-               pmf_system_shutdown(boothowto);
-               printf("The operating system has halted.\n");
-               printf("Please press any key to reboot.\n\n");
-               cngetc();
-               printf("rebooting...\n");
-               cpu_reset();
-               /*NOTREACHED*/
-       }
-
-       /* Disable console buffering */
-/*     cnpollc(1);*/
-
-       /*
-        * If RB_NOSYNC was not specified sync the discs.
-        * Note: Unless cold is set to 1 here, syslogd will die during the
-        * unmount.  It looks like syslogd is getting woken up only to find
-        * that it cannot page part of the binary in as the filesystem has
-        * been unmounted.
-        */
-       if (!(howto & RB_NOSYNC))
-               bootsync();
-
-       /* Say NO to interrupts */
-       splhigh();
-
-       /* Do a dump if requested. */
-       if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP)
-               dumpsys();
-
-       /* Run any shutdown hooks */
-       doshutdownhooks();
-
-       pmf_system_shutdown(boothowto);
-
-       /* Make sure IRQ's are disabled */
-       IRQdisable;
-
-       if (howto & RB_HALT) {
-               printf("The operating system has halted.\n");
-               printf("Please press any key to reboot.\n\n");
-               cngetc();
-       }
-
-       printf("rebooting...\n");
-       cpu_reset();
-       /*NOTREACHED*/
-}
-
-/*
  * Static device mappings. These peripheral registers are mapped at
  * fixed virtual addresses very early in netwalker_start() so that we
  * can use them while booting the kernel, and stay at the same address
@@ -366,34 +241,24 @@
 u_int
 initarm(void *arg)
 {
-       int loop;
-       int loop1;
-       vaddr_t l1pagetable;
-
-#ifdef RBFLAGS
-       boothowto |= RBFLAGS;
-#endif
-
-       disable_interrupts(I32_bit|F32_bit);
-       /* XXX move to netwalker_start.S */
-
-       /* Register devmap for devices we mapped in start */
-       pmap_devmap_register(netwalker_devmap);
-
-       setup_ioports();
-
-       consinit();
-
-#ifdef DEBUG_IOPORTS
-       dump_registers();
-#endif
-
        /*
         * Heads up ... Setup the CPU / MMU / TLB functions
         */
        if (set_cpufuncs())
                panic("cpu not recognized!");
 
+       /* map some peripheral registers */
+       pmap_devmap_bootstrap((vaddr_t)armreg_ttbr_read() & -L1_TABLE_SIZE,
+           netwalker_devmap);
+
+       cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT);
+
+       /* Register devmap for devices we mapped in start */
+       pmap_devmap_register(netwalker_devmap);
+       setup_ioports();
+
+       consinit();
+
 #ifdef NO_POWERSAVE
        cpu_do_powersave=0;
 #endif
@@ -405,8 +270,16 @@
 #endif
 
        /* Talk to the user */
-       printf("\nNetBSD/evbarm (netwalker) booting ...\n");
+       printf("\nNetBSD/evbarm (" ___STRING(EVBARM_BOARDTYPE) ") booting ...\n");
+
+       bootargs[0] = '\0';
 
+#if defined(VERBOSE_INIT_ARM) || 1
+       printf("initarm: Configuring system");
+       printf(", CLIDR=%010o CTR=%#x",
+           armreg_clidr_read(), armreg_ctr_read());
+       printf("\n");
+#endif
        /*
         * Ok we have the following memory map
         *
@@ -421,14 +294,6 @@
         * by pmap etc.
         */
 
-#if 0
-       /*
-        * Examine the boot args string for options we need to know about
-        * now.
-        */
-       process_kernel_args((char *)nwbootinfo.bt_args);
-#endif
-
 #ifdef VERBOSE_INIT_ARM



Home | Main Index | Thread Index | Old Index