source: rtems/bsps/powerpc/qemuppc/start/bspstart.c @ 2f61eb21

5
Last change on this file since 2f61eb21 was 54d87f2, checked in by Sebastian Huber <sebastian.huber@…>, on 09/04/18 at 16:28:57

bsps/powerpc: Simplify ppc_exc_initialize()

Remove parameters from ppc_exc_initialize() since all BSPs passed the
same values.

Update #3459.

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 *  This set of routines starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-2008.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.org/license/LICENSE.
13 */
14
15#include <string.h>
16#include <fcntl.h>
17
18#include <rtems/counter.h>
19
20#include <libcpu/bat.h>
21#include <libcpu/spr.h>
22#include <libcpu/powerpc-utility.h>
23
24#include <bsp.h>
25#include <bsp/irq.h>
26#include <bsp/vectors.h>
27#include <bsp/bootcard.h>
28#include <bsp/irq-generic.h>
29
30/*
31 * CPU Bus Frequency
32 */
33unsigned int BSP_bus_frequency;
34
35/* Configuration parameter for clock driver */
36uint32_t bsp_time_base_frequency;
37
38/* Legacy */
39uint32_t bsp_clicks_per_usec;
40
41/*
42 * Memory on this board.
43 */
44extern char RamSize[];
45uint32_t BSP_mem_size = (uint32_t)RamSize;
46
47/* Default decrementer exception handler */
48static int default_decrementer_exception_handler( BSP_Exception_frame *frame, unsigned number)
49{
50  ppc_set_decrementer_register(UINT32_MAX);
51
52  return 0;
53}
54
55uint32_t _CPU_Counter_frequency(void)
56{
57  return bsp_time_base_frequency;
58}
59
60/*
61 *  bsp_start
62 *
63 *  This routine does the bulk of the system initialization.
64 */
65
66void bsp_start( void )
67{
68  rtems_status_code sc = RTEMS_SUCCESSFUL;
69
70  /*
71   * Note we can not get CPU identification dynamically, so
72   * force current_ppc_cpu.
73   */
74  current_ppc_cpu = PPC_PSIM;
75
76  /*
77   *  initialize the device driver parameters
78   * assume we are running with 20MHz bus
79   * this should speed up some tests :-)
80   */
81  BSP_bus_frequency        = 20;
82  bsp_time_base_frequency  = 20000000;
83  bsp_clicks_per_usec      = BSP_bus_frequency;
84
85  BSP_mem_size = (uint32_t )RamSize;
86
87  ppc_exc_initialize();
88
89  /* Install default handler for the decrementer exception */
90  sc = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler);
91  if (sc != RTEMS_SUCCESSFUL) {
92    rtems_panic("cannot install decrementer exception handler");
93  }
94
95  /* Initalize interrupt support */
96  bsp_interrupt_initialize();
97
98#if 0
99  /*
100   * Setup BATs and enable MMU
101   */
102  /* Memory */
103  setdbat(0, 0x0<<24, 0x0<<24, 2<<24, _PAGE_RW);
104  setibat(0, 0x0<<24, 0x0<<24, 2<<24,        0);
105  /* PCI    */
106  setdbat(1, 0x8<<24, 0x8<<24, 1<<24,  IO_PAGE);
107  setdbat(2, 0xc<<24, 0xc<<24, 1<<24,  IO_PAGE);
108
109  _write_MSR(_read_MSR() | MSR_DR | MSR_IR);
110  __asm__ volatile("sync; isync");
111#endif
112}
Note: See TracBrowser for help on using the repository browser.