Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arc/arc Moved from /cvsroot/syssrc/sys/arch/pica/pi...



details:   https://anonhg.NetBSD.org/src/rev/6799f79990b0
branches:  trunk
changeset: 481106:6799f79990b0
user:      soda <soda%NetBSD.org@localhost>
date:      Sun Jan 23 20:09:12 2000 +0000

description:
Moved from /cvsroot/syssrc/sys/arch/pica/pica/machdep.c,v

diffstat:

 sys/arch/arc/arc/machdep.c |  823 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 823 insertions(+), 0 deletions(-)

diffs (truncated from 827 to 300 lines):

diff -r c69ac5ef4e11 -r 6799f79990b0 sys/arch/arc/arc/machdep.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arc/arc/machdep.c        Sun Jan 23 20:09:12 2000 +0000
@@ -0,0 +1,823 @@
+/*     $NetBSD: machdep.c,v 1.27 2000/01/23 20:09:13 soda Exp $        */
+
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department, The Mach Operating System project at
+ * Carnegie-Mellon University and Ralph Campbell.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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)
+ * 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.
+ *
+ *     from: @(#)machdep.c     8.3 (Berkeley) 1/12/94
+ */
+
+/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
+
+#include "fs_mfs.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/signalvar.h>
+#include <sys/kernel.h>
+#include <sys/map.h>
+#include <sys/proc.h>
+#include <sys/buf.h>
+#include <sys/reboot.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/msgbuf.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/tty.h>
+#include <sys/user.h>
+#include <sys/exec.h>
+#include <vm/vm.h>
+#include <sys/sysctl.h>
+#include <sys/mount.h>
+#include <sys/syscallargs.h>
+#include <sys/kcore.h>
+
+#include <vm/vm_kern.h>
+#include <ufs/mfs/mfs_extern.h>                /* mfs_initminiroot() */
+
+#include <machine/cpu.h>
+#include <machine/reg.h>
+#include <machine/pio.h>
+#include <machine/pte.h>
+#include <machine/autoconf.h>
+#include <mips/locore.h>               /* wbflush() */
+#include <mips/cpuregs.h>
+#include <mips/psl.h>
+#ifdef DDB
+#include <mips/db_machdep.h>
+#endif
+
+#include <sys/exec_ecoff.h>
+
+#include <dev/cons.h>
+
+#include <pica/pica/pica.h>
+#include <pica/pica/picatype.h>
+
+#include <asc.h>
+
+#if NASC > 0
+#include <pica/dev/ascreg.h>
+#endif
+
+extern struct consdev *cn_tab;
+
+/* the following is used externally (sysctl_hw) */
+char   machine[] = MACHINE;    /* from <machine/param.h> */
+char   cpu_model[30];
+
+vm_map_t buffer_map;
+
+int    maxmem;                 /* max memory per process */
+int    physmem;                /* max supported memory, changes to actual */
+int    memcfg;                 /* memory config register */
+int    brdcfg;                 /* motherboard config register */
+int    cpucfg;                 /* Value of processor config register */
+int    cputype;                /* Mother board type */
+int    ncpu = 1;               /* At least one cpu in the system */
+int    isa_io_base;            /* Base address of ISA io port space */
+int    isa_mem_base;           /* Base address of ISA memory space */
+
+phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
+int mem_cluster_cnt;
+
+/*
+ * Interrupt-blocking functions defined in locore. These names aren't used
+ * directly except here and in interrupt handlers.
+ */
+
+/* Block out one hardware interrupt-enable bit. */
+extern int     Mach_spl0 __P((void)), Mach_spl1 __P((void));
+extern int     Mach_spl2 __P((void)), Mach_spl3 __P((void));
+
+/* Block out nested interrupt-enable bits. */
+extern int     cpu_spl0 __P((void)), cpu_spl1 __P((void));
+extern int     cpu_spl2 __P((void)), cpu_spl3 __P((void));
+extern int     splhigh __P((void));
+
+/*
+ * Instead, we declare the standard splXXX names as function pointers,
+ * and initialie them to point to the above functions to match
+ * the way a specific motherboard is  wired up.
+ */
+int    (*Mach_splbio) __P((void)) = splhigh;
+int    (*Mach_splnet)__P((void)) = splhigh;
+int    (*Mach_spltty)__P((void)) = splhigh;
+int    (*Mach_splimp)__P((void)) = splhigh;
+int    (*Mach_splclock)__P((void)) = splhigh;
+int    (*Mach_splstatclock)__P((void)) = splhigh;
+
+/* initialize bss, etc. from kernel start, before main() is called. */
+extern void
+mach_init __P((int argc, char *argv[], u_int code));
+
+
+/*
+ * Pica video-console output (for output before console is autoconfigured)
+ */
+static void  vid_scroll __P((void));
+void vid_print_string __P((const char *str));
+void vid_putchar __P((dev_t dev, char c));
+extern int atoi __P((const char *cp));
+
+#ifdef DEBUG
+/* stacktrace code violates prototypes to get callee's registers */
+extern void stacktrace __P((void)); /*XXX*/
+#endif
+
+
+
+/*
+ * safepri is a safe priority for sleep to set for a spin-wait
+ * during autoconfiguration or after a panic.
+ */
+int    safepri = PSL_LOWIPL;
+
+extern void mips_vector_init  __P((void));
+
+
+/*
+ * Do all the stuff that locore normally does before calling main().
+ * Process arguments passed to us by the BIOS.
+ * Reset mapping and set up mapping to hardware and init "wired" reg.
+ * Return the first page address following the system.
+ */
+void
+mach_init(argc, argv, code)
+       int argc;
+       char *argv[];
+       u_int code;
+{
+       register char *cp;
+       register int i;
+       struct tlb tlb;
+       u_long first, last;
+       caddr_t kernend, v;
+       vm_size_t size;
+       extern char edata[], end[];
+
+       /* clear the BSS segment in NetBSD code */
+       kernend = (caddr_t)pica_round_page(end);
+       bzero(edata, kernend - edata);
+
+       /*
+        * Set the VM page size.
+        */
+       vm_set_page_size();
+
+       /*
+        * Copy exception-dispatch code down to exception vector.
+        * Initialize locore-function vector.
+        * Clear out the I and D caches.
+        *
+        * XXX this may clobber PTEs needed by the BIOS.
+        */
+       mips_vector_init();
+
+#ifdef DDB
+       /*
+        * Initialize machine-dependent DDB commands, in case of early panic.
+        */
+       db_machine_init();
+#endif
+
+       /* check what model platform we are running on */
+       cputype = ACER_PICA_61; /* FIXME find systemtype */
+
+       /*
+        * Get config register now as mapped from BIOS since we are
+        * going to demap these addresses later. We want as may TLB
+        * entries as possible to do something useful :-).
+        */
+
+       switch (cputype) {
+       case ACER_PICA_61:      /* ALI PICA 61 */
+               memcfg = in32(PICA_MEMORY_SIZE_REG);
+               brdcfg = in32(PICA_CONFIG_REG);
+               isa_io_base = PICA_V_ISA_IO;
+               isa_mem_base = PICA_V_ISA_MEM;
+               break;
+       default:
+               memcfg = -1;
+               break;
+       }
+
+       /* look at argv[0] and compute bootdev */
+       makebootdev(argv[0]);
+
+       /*
+        * Look at arguments passed to us and compute boothowto.
+        */
+       boothowto = RB_SINGLE;
+#ifdef KADB
+       boothowto |= RB_KDB;
+#endif
+       if (argc > 1) {
+               for (i = 1; i < argc; i++) {
+                       if(strncmp("OSLOADOPTIONS=",argv[i],14) == 0) {
+                               for (cp = argv[i]+14; *cp; cp++) {
+                                       switch (*cp) {
+                                       case 'a': /* autoboot */
+                                               boothowto &= ~RB_SINGLE;
+                                               break;
+
+                                       case 'd': /* use compiled in default root */
+                                               boothowto |= RB_DFLTROOT;
+                                               break;
+
+                                       case 'm': /* mini root present in memory */
+                                               boothowto |= RB_MINIROOT;
+                                               break;
+
+                                       case 'n': /* ask for names */
+                                               boothowto |= RB_ASKNAME;
+                                               break;
+
+                                       case 'N': /* don't ask for names */
+                                               boothowto &= ~RB_ASKNAME;
+                                               break;
+                                       }
+
+                               }
+                       }
+               }
+       }
+
+#ifdef MFS
+       /*
+        * Check to see if a mini-root was loaded into memory. It resides
+        * at the start of the next page just after the end of BSS.
+        */
+       if (boothowto & RB_MINIROOT) {
+               boothowto |= RB_DFLTROOT;
+               kernend += round_page(mfs_initminiroot(kernend));
+       }
+#endif
+
+       /*
+        * Init the mapping for u page(s) for proc0, pm_tlbpid 1.
+        * This also initializes nullproc for switch_exit().



Home | Main Index | Thread Index | Old Index