source: rtems/c/src/lib/libbsp/powerpc/qoriq/startup/bspstart.c @ b1e8a58

4.11
Last change on this file since b1e8a58 was b1e8a58, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 14, 2012 at 8:57:55 AM

bsps/powerpc: Exception initialization error is fatal

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup QorIQ
5 *
6 * @brief BSP startup.
7 */
8
9/*
10 * Copyright (c) 2010-2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23#include <rtems.h>
24#include <rtems/config.h>
25
26#include <libchip/serial.h>
27
28#include <libcpu/powerpc-utility.h>
29
30#include <bsp.h>
31#include <bsp/vectors.h>
32#include <bsp/bootcard.h>
33#include <bsp/irq-generic.h>
34#include <bsp/u-boot.h>
35#include <bsp/linker-symbols.h>
36#include <bsp/mmu.h>
37#include <bsp/qoriq.h>
38
39LINKER_SYMBOL(bsp_exc_vector_base);
40
41/* Configuration parameters for console driver, ... */
42unsigned int BSP_bus_frequency;
43
44/* Configuration parameter for clock driver, ... */
45uint32_t bsp_clicks_per_usec;
46
47void BSP_panic(char *s)
48{
49  rtems_interrupt_level level;
50
51  rtems_interrupt_disable(level);
52
53  printk("%s PANIC %s\n", rtems_get_version_string(), s);
54
55  while (1) {
56    /* Do nothing */
57  }
58}
59
60void _BSP_Fatal_error(unsigned n)
61{
62  rtems_interrupt_level level;
63
64  rtems_interrupt_disable(level);
65
66  printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);
67
68  while (1) {
69    /* Do nothing */
70  }
71}
72
73void bsp_start(void)
74{
75  unsigned long i = 0;
76
77  ppc_cpu_id_t myCpu;
78  ppc_cpu_revision_t myCpuRevision;
79
80  /*
81   * Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
82   * store the result in global variables so that it can be used latter...
83   */
84  myCpu = get_ppc_cpu_type();
85  myCpuRevision = get_ppc_cpu_revision();
86
87  /* Initialize some device driver parameters */
88  #ifdef HAS_UBOOT
89    BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
90    bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
91  #endif /* HAS_UBOOT */
92
93  /* Initialize some console parameters */
94  for (i = 0; i < Console_Configuration_Count; ++i) {
95    console_tbl *ct = &Console_Configuration_Ports[i];
96
97    ct->ulClock = BSP_bus_frequency;
98
99    #ifdef HAS_UBOOT
100      if (ct->deviceType == SERIAL_NS16550) {
101        ct->pDeviceParams = (void *) bsp_uboot_board_info.bi_baudrate;
102      }
103    #endif
104  }
105
106  /* Disable decrementer */
107  PPC_CLEAR_SPECIAL_PURPOSE_REGISTER_BITS(BOOKE_TCR, BOOKE_TCR_DIE);
108
109  /* Initialize exception handler */
110  ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
111  ppc_exc_initialize(
112    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
113    (uintptr_t) bsp_section_work_begin,
114    rtems_configuration_get_interrupt_stack_size()
115  );
116
117  /* Now it is possible to make the code execute only */
118  qoriq_mmu_change_perm(
119    FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SX,
120    FSL_EIS_MAS3_SX,
121    FSL_EIS_MAS3_SR
122  );
123
124  /* Initalize interrupt support */
125  bsp_interrupt_initialize();
126
127  /* Disable boot page translation */
128  qoriq.lcc.bptr &= ~BPTR_EN;
129}
Note: See TracBrowser for help on using the repository browser.