The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/mips/idt/idt_machdep.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (C) 2007 by Oleksandr Tymoshenko. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   16  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
   17  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   19  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   21  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   22  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   23  * THE POSSIBILITY OF SUCH DAMAGE.
   24  *
   25  * $Id: $
   26  * 
   27  */
   28 
   29 #include <sys/cdefs.h>
   30 __FBSDID("$FreeBSD: releng/9.0/sys/mips/idt/idt_machdep.c 216320 2010-12-09 07:47:40Z gonzo $");
   31 
   32 #include "opt_ddb.h"
   33 
   34 #include <sys/param.h>
   35 #include <sys/conf.h>
   36 #include <sys/kernel.h>
   37 #include <sys/systm.h>
   38 #include <sys/imgact.h>
   39 #include <sys/bio.h>
   40 #include <sys/buf.h>
   41 #include <sys/bus.h>
   42 #include <sys/cpu.h>
   43 #include <sys/cons.h>
   44 #include <sys/exec.h>
   45 #include <sys/ucontext.h>
   46 #include <sys/proc.h>
   47 #include <sys/kdb.h>
   48 #include <sys/ptrace.h>
   49 #include <sys/reboot.h>
   50 #include <sys/signalvar.h>
   51 #include <sys/sysent.h>
   52 #include <sys/sysproto.h>
   53 #include <sys/user.h>
   54 
   55 #include <vm/vm.h>
   56 #include <vm/vm_object.h>
   57 #include <vm/vm_page.h>
   58 #include <vm/vm_pager.h>
   59 
   60 #include <machine/cache.h>
   61 #include <machine/clock.h>
   62 #include <machine/cpu.h>
   63 #include <machine/cpuinfo.h>
   64 #include <machine/cpufunc.h>
   65 #include <machine/cpuregs.h>
   66 #include <machine/hwfunc.h>
   67 #include <machine/intr_machdep.h>
   68 #include <machine/locore.h>
   69 #include <machine/md_var.h>
   70 #include <machine/pte.h>
   71 #include <machine/sigframe.h>
   72 #include <machine/trap.h>
   73 #include <machine/vmparam.h>
   74 
   75 extern int      *edata;
   76 extern int      *end;
   77 
   78 void
   79 platform_cpu_init()
   80 {
   81         /* Nothing special */
   82 }
   83 
   84 void
   85 platform_halt(void)
   86 {
   87 
   88 }
   89 
   90 
   91 void
   92 platform_identify(void)
   93 {
   94 
   95 }
   96 
   97 void
   98 platform_reset(void)
   99 {
  100         volatile unsigned int * p = (void *)0xb8008000;
  101         /* 
  102          * TODO: we should take care of TLB stuff here. Otherwise
  103          * board does not boots properly next time
  104          */
  105 
  106         /* Write 0x8000_0001 to the Reset register */
  107         *p = 0x80000001;
  108 
  109         __asm __volatile("li    $25, 0xbfc00000");
  110         __asm __volatile("j     $25");
  111 }
  112 
  113 void
  114 platform_trap_enter(void)
  115 {
  116 
  117 }
  118 
  119 void
  120 platform_trap_exit(void)
  121 {
  122 
  123 }
  124 
  125 void
  126 platform_start(__register_t a0, __register_t a1,
  127     __register_t a2 __unused, __register_t a3 __unused)
  128 {
  129         uint64_t platform_counter_freq;
  130         vm_offset_t kernend;
  131         int argc = a0;
  132         char **argv = (char **)a1;
  133         int i, mem;
  134 
  135 
  136         /* clear the BSS and SBSS segments */
  137         kernend = (vm_offset_t)&end;
  138         memset(&edata, 0, kernend - (vm_offset_t)(&edata));
  139 
  140         mips_postboot_fixup();
  141 
  142         /* Initialize pcpu stuff */
  143         mips_pcpu0_init();
  144 
  145         /*
  146          * Looking for mem=XXM argument
  147          */
  148         mem = 0; /* Just something to start with */
  149         for (i=0; i < argc; i++) {
  150                 if (strncmp(argv[i], "mem=", 4) == 0) {
  151                         mem = strtol(argv[i] + 4, NULL, 0);
  152                         break;
  153                 }
  154         }
  155 
  156         bootverbose = 1;
  157         if (mem > 0)
  158                 realmem = btoc(mem << 20);
  159         else
  160                 realmem = btoc(32 << 20);
  161 
  162         for (i = 0; i < 10; i++) {
  163                 phys_avail[i] = 0;
  164         }
  165 
  166         /* phys_avail regions are in bytes */
  167         phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
  168         phys_avail[1] = ctob(realmem);
  169 
  170         dump_avail[0] = phys_avail[0];
  171         dump_avail[1] = phys_avail[1];
  172 
  173         physmem = realmem;
  174 
  175         /* 
  176          * ns8250 uart code uses DELAY so ticker should be inititalized 
  177          * before cninit. And tick_init_params refers to hz, so * init_param1 
  178          * should be called first.
  179          */
  180         init_param1();
  181         /* TODO: parse argc,argv */
  182         platform_counter_freq = 330000000UL;
  183         mips_timer_init_params(platform_counter_freq, 1);
  184         cninit();
  185         /* Panic here, after cninit */ 
  186         if (mem == 0)
  187                 panic("No mem=XX parameter in arguments");
  188 
  189         printf("cmd line: ");
  190         for (i=0; i < argc; i++)
  191                 printf("%s ", argv[i]);
  192         printf("\n");
  193 
  194         init_param2(physmem);
  195         mips_cpu_init();
  196         pmap_bootstrap();
  197         mips_proc0_init();
  198         mutex_init();
  199         kdb_init();
  200 #ifdef KDB
  201         if (boothowto & RB_KDB)
  202                 kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
  203 #endif
  204 }

Cache object: 4b824a8e7ddc83bec857e023ad09d1b0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.