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/rt305x/rt305x_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) 2010-2011 by Aleksandr Rybalko. All rights reserved.
    3  * Copyright (C) 2007 by Oleksandr Tymoshenko. All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   17  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
   18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
   19  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   20  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
   22  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
   23  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
   24  * THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  */
   27 
   28 #include <sys/cdefs.h>
   29 __FBSDID("$FreeBSD: releng/10.1/sys/mips/rt305x/rt305x_machdep.c 247297 2013-02-26 01:00:11Z attilio $");
   30 
   31 #include "opt_ddb.h"
   32 
   33 #include <sys/param.h>
   34 #include <sys/conf.h>
   35 #include <sys/kernel.h>
   36 #include <sys/systm.h>
   37 #include <sys/imgact.h>
   38 #include <sys/bio.h>
   39 #include <sys/buf.h>
   40 #include <sys/bus.h>
   41 #include <sys/cpu.h>
   42 #include <sys/cons.h>
   43 #include <sys/exec.h>
   44 #include <sys/ucontext.h>
   45 #include <sys/proc.h>
   46 #include <sys/kdb.h>
   47 #include <sys/ptrace.h>
   48 #include <sys/reboot.h>
   49 #include <sys/signalvar.h>
   50 #include <sys/sysent.h>
   51 #include <sys/sysproto.h>
   52 #include <sys/user.h>
   53 
   54 #include <vm/vm.h>
   55 #include <vm/vm_object.h>
   56 #include <vm/vm_page.h>
   57 
   58 #include <machine/cache.h>
   59 #include <machine/clock.h>
   60 #include <machine/cpu.h>
   61 #include <machine/cpuinfo.h>
   62 #include <machine/cpufunc.h>
   63 #include <machine/cpuregs.h>
   64 #include <machine/hwfunc.h>
   65 #include <machine/intr_machdep.h>
   66 #include <machine/locore.h>
   67 #include <machine/md_var.h>
   68 #include <machine/pte.h>
   69 #include <machine/sigframe.h>
   70 #include <machine/trap.h>
   71 #include <machine/vmparam.h>
   72 
   73 #include <mips/rt305x/rt305xreg.h>
   74 
   75 extern int      *edata;
   76 extern int      *end;
   77 static char     boot1_env[0x1000];
   78 
   79 
   80 void
   81 platform_cpu_init()
   82 {
   83         /* Nothing special */
   84 }
   85 
   86 static void
   87 mips_init(void)
   88 {
   89         int i;
   90 
   91         printf("entry: mips_init()\n");
   92 
   93         bootverbose = 1;
   94         realmem = btoc(32 << 20);
   95 
   96         for (i = 0; i < 10; i++) {
   97                 phys_avail[i] = 0;
   98         }
   99 
  100         /* phys_avail regions are in bytes */
  101         dump_avail[0] = phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
  102         dump_avail[1] = phys_avail[1] = ctob(realmem);
  103 
  104         physmem = realmem;
  105 
  106         init_param1();
  107         init_param2(physmem);
  108         mips_cpu_init();
  109         pmap_bootstrap();
  110         mips_proc0_init();
  111         mutex_init();
  112         kdb_init();
  113 #ifdef KDB
  114         if (boothowto & RB_KDB)
  115                 kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
  116 #endif
  117 }
  118 
  119 void
  120 platform_reset(void)
  121 {
  122 
  123         __asm __volatile("li    $25, 0xbf000000");
  124         __asm __volatile("j     $25");
  125 }
  126 
  127 void
  128 platform_start(__register_t a0 __unused, __register_t a1 __unused, 
  129     __register_t a2 __unused, __register_t a3 __unused)
  130 {
  131         vm_offset_t kernend;
  132         uint64_t platform_counter_freq = PLATFORM_COUNTER_FREQ;
  133         int i;
  134         int argc = a0;
  135         char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1);
  136         char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2);
  137 
  138         /* clear the BSS and SBSS segments */
  139         kernend = (vm_offset_t)&end;
  140         memset(&edata, 0, kernend - (vm_offset_t)(&edata));
  141 
  142         mips_postboot_fixup();
  143 
  144         /* Initialize pcpu stuff */
  145         mips_pcpu0_init();
  146 
  147         /* initialize console so that we have printf */
  148         boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */
  149         boothowto |= (RB_VERBOSE);
  150         cninit();
  151 
  152         init_static_kenv(boot1_env, sizeof(boot1_env));
  153 
  154         printf("U-Boot args (from %d args):\n", argc - 1);
  155 
  156         if (argc == 1)
  157                 printf("\tNone\n");
  158 
  159         for (i = 1; i < argc; i++) {
  160                 char *n = "argv  ", *arg;
  161 
  162                 if (i > 99)
  163                         break;
  164 
  165                 if (argv[i])
  166                 {
  167                         arg = (char *)(intptr_t)MIPS_PHYS_TO_KSEG0(argv[i]);
  168                         printf("\targv[%d] = %s\n", i, arg);
  169                         sprintf(n, "argv%d", i);
  170                         setenv(n, arg);
  171                 }
  172         }
  173 
  174         printf("Environment:\n");
  175 
  176         for (i = 0; envp[i] ; i++) {
  177                 char *n, *arg;
  178 
  179                 arg = (char *)(intptr_t)MIPS_PHYS_TO_KSEG0(envp[i]);
  180                 printf("\t%s\n", arg);
  181                 n = strsep(&arg, "=");
  182                 if (arg == NULL)
  183                         setenv(n, "1");
  184                 else
  185                         setenv(n, arg);
  186         }
  187 
  188 
  189         mips_init();
  190         mips_timer_init_params(platform_counter_freq, 2);
  191 }

Cache object: a2af20710616a25237c6ee552da40cd7


[ 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.