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

4.11
Last change on this file since dd8df59 was dd8df59, checked in by Sebastian Huber <sebastian.huber@…>, on Nov 14, 2012 at 12:59:27 PM

bsps: Interrupt initialization error is fatal

  • Property mode set to 100644
File size: 3.0 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  rtems_status_code sc = RTEMS_SUCCESSFUL;
76  unsigned long i = 0;
77
78  ppc_cpu_id_t myCpu;
79  ppc_cpu_revision_t myCpuRevision;
80
81  /*
82   * Get CPU identification dynamically. Note that the get_ppc_cpu_type() function
83   * store the result in global variables so that it can be used latter...
84   */
85  myCpu = get_ppc_cpu_type();
86  myCpuRevision = get_ppc_cpu_revision();
87
88  /* Initialize some device driver parameters */
89  #ifdef HAS_UBOOT
90    BSP_bus_frequency = bsp_uboot_board_info.bi_busfreq;
91    bsp_clicks_per_usec = bsp_uboot_board_info.bi_busfreq / 8000000;
92  #endif /* HAS_UBOOT */
93
94  /* Initialize some console parameters */
95  for (i = 0; i < Console_Configuration_Count; ++i) {
96    console_tbl *ct = &Console_Configuration_Ports[i];
97
98    ct->ulClock = BSP_bus_frequency;
99
100    #ifdef HAS_UBOOT
101      if (ct->deviceType == SERIAL_NS16550) {
102        ct->pDeviceParams = (void *) bsp_uboot_board_info.bi_baudrate;
103      }
104    #endif
105  }
106
107  /* Disable decrementer */
108  PPC_CLEAR_SPECIAL_PURPOSE_REGISTER_BITS(BOOKE_TCR, BOOKE_TCR_DIE);
109
110  /* Initialize exception handler */
111  ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
112  sc = ppc_exc_initialize(
113    PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
114    (uintptr_t) bsp_section_work_begin,
115    rtems_configuration_get_interrupt_stack_size()
116  );
117  if (sc != RTEMS_SUCCESSFUL) {
118    BSP_panic("cannot initialize exceptions");
119  }
120
121  /* Now it is possible to make the code execute only */
122  qoriq_mmu_change_perm(
123    FSL_EIS_MAS3_SR | FSL_EIS_MAS3_SX,
124    FSL_EIS_MAS3_SX,
125    FSL_EIS_MAS3_SR
126  );
127
128  /* Initalize interrupt support */
129  bsp_interrupt_initialize();
130
131  /* Disable boot page translation */
132  qoriq.lcc.bptr &= ~BPTR_EN;
133}
Note: See TracBrowser for help on using the repository browser.