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/beri/beri_machdep.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2006 Wojciech A. Koszek <wkoszek@FreeBSD.org>
    3  * Copyright (c) 2012 Robert N. M. Watson
    4  * All rights reserved.
    5  *
    6  * This software was developed by SRI International and the University of
    7  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
    8  * ("CTSRD"), as part of the DARPA CRASH research programme.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  */
   31 #include <sys/cdefs.h>
   32 __FBSDID("$FreeBSD: releng/10.0/sys/mips/beri/beri_machdep.c 247297 2013-02-26 01:00:11Z attilio $");
   33 
   34 #include "opt_ddb.h"
   35 #include "opt_platform.h"
   36 
   37 #include <sys/param.h>
   38 #include <sys/conf.h>
   39 #include <sys/kernel.h>
   40 #include <sys/systm.h>
   41 #include <sys/imgact.h>
   42 #include <sys/bio.h>
   43 #include <sys/buf.h>
   44 #include <sys/bus.h>
   45 #include <sys/cpu.h>
   46 #include <sys/cons.h>
   47 #include <sys/exec.h>
   48 #include <sys/linker.h>
   49 #include <sys/ucontext.h>
   50 #include <sys/proc.h>
   51 #include <sys/kdb.h>
   52 #include <sys/ptrace.h>
   53 #include <sys/reboot.h>
   54 #include <sys/signalvar.h>
   55 #include <sys/sysent.h>
   56 #include <sys/sysproto.h>
   57 #include <sys/user.h>
   58 
   59 #ifdef FDT
   60 #include <dev/fdt/fdt_common.h>
   61 #include <dev/ofw/openfirm.h>
   62 #endif
   63 
   64 #include <vm/vm.h>
   65 #include <vm/vm_object.h>
   66 #include <vm/vm_page.h>
   67 
   68 #include <machine/clock.h>
   69 #include <machine/cpu.h>
   70 #include <machine/cpuregs.h>
   71 #include <machine/hwfunc.h>
   72 #include <machine/md_var.h>
   73 #include <machine/metadata.h>
   74 #include <machine/pmap.h>
   75 #include <machine/trap.h>
   76 
   77 extern int      *edata;
   78 extern int      *end;
   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         for (i = 0; i < 10; i++) {
   92                 phys_avail[i] = 0;
   93         }
   94 
   95         /* phys_avail regions are in bytes */
   96         phys_avail[0] = MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
   97         phys_avail[1] = ctob(realmem);
   98 
   99         dump_avail[0] = phys_avail[0];
  100         dump_avail[1] = phys_avail[1];
  101 
  102         physmem = realmem;
  103 
  104         init_param1();
  105         init_param2(physmem);
  106         mips_cpu_init();
  107         pmap_bootstrap();
  108         mips_proc0_init();
  109         mutex_init();
  110         kdb_init();
  111 #ifdef KDB
  112         if (boothowto & RB_KDB)
  113                 kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
  114 #endif
  115 }
  116 
  117 /*
  118  * Perform a board-level soft-reset.
  119  *
  120  * XXXRW: BERI doesn't yet have a board-level soft-reset.
  121  */
  122 void
  123 platform_reset(void)
  124 {
  125 
  126         panic("%s: not yet", __func__);
  127 }
  128 
  129 void
  130 platform_start(__register_t a0, __register_t a1,  __register_t a2, 
  131     __register_t a3)
  132 {
  133         vm_offset_t kernend;
  134         uint64_t platform_counter_freq;
  135         int argc = a0;
  136         char **argv = (char **)a1;
  137         char **envp = (char **)a2;
  138         unsigned int memsize = a3;
  139 #ifdef FDT
  140         vm_offset_t dtbp;
  141         void *kmdp;
  142 #endif
  143         int i;
  144 
  145         /* clear the BSS and SBSS segments */
  146         kernend = (vm_offset_t)&end;
  147         memset(&edata, 0, kernend - (vm_offset_t)(&edata));
  148 
  149         mips_postboot_fixup();
  150 
  151         mips_pcpu0_init();
  152 
  153 #ifdef FDT
  154         /*
  155          * Find the dtb passed in by the boot loader (currently fictional).
  156          */
  157         kmdp = preload_search_by_type("elf kernel");
  158         if (kmdp != NULL)
  159                 dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
  160         else
  161                 dtbp = (vm_offset_t)NULL;
  162 
  163 #if defined(FDT_DTB_STATIC)
  164         /*
  165          * In case the device tree blob was not retrieved (from metadata) try
  166          * to use the statically embedded one.
  167          */
  168         if (dtbp == (vm_offset_t)NULL)
  169                 dtbp = (vm_offset_t)&fdt_static_dtb;
  170 #else
  171 #error  "Non-static FDT not yet supported on BERI"
  172 #endif
  173 
  174         if (OF_install(OFW_FDT, 0) == FALSE)
  175                 while (1);
  176         if (OF_init(&fdt_static_dtb) != 0)
  177                 while (1);
  178 #endif
  179 
  180         /*
  181          * XXXRW: We have no way to compare wallclock time to cycle rate on
  182          * BERI, so for now assume we run at the MALTA default (100MHz).
  183          */
  184         platform_counter_freq = MIPS_DEFAULT_HZ;
  185         mips_timer_early_init(platform_counter_freq);
  186 
  187         cninit();
  188         printf("entry: platform_start()\n");
  189 
  190         bootverbose = 1;
  191         if (bootverbose) {
  192                 printf("cmd line: ");
  193                 for (i = 0; i < argc; i++)
  194                         printf("%s ", argv[i]);
  195                 printf("\n");
  196 
  197                 printf("envp:\n");
  198                 for (i = 0; envp[i]; i += 2)
  199                         printf("\t%s = %s\n", envp[i], envp[i+1]);
  200 
  201                 printf("memsize = %08x\n", memsize);
  202         }
  203 
  204         realmem = btoc(memsize);
  205         mips_init();
  206 
  207         mips_timer_init_params(platform_counter_freq, 0);
  208 }

Cache object: 3ea87c1a54673eb3b7be3106a03d92cd


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