source: rtems/bsps/powerpc/gen5200/include/bsp.h @ 511dc4b

5
Last change on this file since 511dc4b was 511dc4b, checked in by Sebastian Huber <sebastian.huber@…>, on 06/19/18 at 07:09:51

Rework initialization and interrupt stack support

Statically initialize the interrupt stack area
(_Configuration_Interrupt_stack_area_begin,
_Configuration_Interrupt_stack_area_end, and
_Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the
interrupt stack area in a special section ".rtemsstack.interrupt". Let
BSPs define the optimal placement of this section in their linker
command files (e.g. in a fast on-chip memory).

This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and
CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the
low level initialization code has all information available via global
symbols.

This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define
superfluous, since the interrupt stacks are allocated by confdefs.h for
all architectures. There is no need for BSP-specific linker command
file magic (except the section placement), see previous ARM linker
command file as a bad example.

Remove _CPU_Install_interrupt_stack(). Initialize the hardware
interrupt stack in _CPU_Initialize() if necessary (e.g.
m68k_install_interrupt_stack()).

The optional _CPU_Interrupt_stack_setup() is still useful to customize
the registration of the interrupt stack area in the per-CPU information.

The initialization stack can reuse the interrupt stack, since

  • interrupts are disabled during the sequential system initialization, and
  • the boot_card() function does not return.

This stack resuse saves memory.

Changes per architecture:

arm:

  • Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases.
  • Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp.

bfin:

  • Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value.

lm32, m32c, mips, nios2, riscv, sh, v850:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

m68k:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.

powerpc:

  • Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack.
  • Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA).

sparc:

  • Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM.

Update #3459.

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/*===============================================================*\
2| Project: RTEMS generic MPC5200 BSP                              |
3+-----------------------------------------------------------------+
4| Partially based on the code references which are named below.   |
5| Adaptions, modifications, enhancements and any recent parts of  |
6| the code are:                                                   |
7|                    Copyright (c) 2005                           |
8|                    Embedded Brains GmbH                         |
9|                    Obere Lagerstr. 30                           |
10|                    D-82178 Puchheim                             |
11|                    Germany                                      |
12|                    rtems@embedded-brains.de                     |
13+-----------------------------------------------------------------+
14| The license and distribution terms for this file may be         |
15| found in the file LICENSE in this distribution or at            |
16|                                                                 |
17| http://www.rtems.org/license/LICENSE.                           |
18|                                                                 |
19+-----------------------------------------------------------------+
20| this file contains board specific definitions                   |
21\*===============================================================*/
22
23#ifndef LIBBSP_POWERPC_GEN5200_BSP_H
24#define LIBBSP_POWERPC_GEN5200_BSP_H
25
26#include <bspopts.h>
27
28#include <libcpu/powerpc-utility.h>
29
30/*
31 * Some symbols defined in the linker command file.
32 */
33
34LINKER_SYMBOL(bsp_ram_start);
35LINKER_SYMBOL(bsp_ram_end);
36LINKER_SYMBOL(bsp_ram_size);
37
38LINKER_SYMBOL(bsp_rom_start);
39LINKER_SYMBOL(bsp_rom_end);
40LINKER_SYMBOL(bsp_rom_size);
41
42LINKER_SYMBOL(bsp_dpram_start);
43LINKER_SYMBOL(bsp_dpram_end);
44LINKER_SYMBOL(bsp_dpram_size);
45
46LINKER_SYMBOL(bsp_section_text_start);
47LINKER_SYMBOL(bsp_section_text_end);
48LINKER_SYMBOL(bsp_section_text_size);
49
50LINKER_SYMBOL(bsp_section_data_start);
51LINKER_SYMBOL(bsp_section_data_end);
52LINKER_SYMBOL(bsp_section_data_size);
53
54LINKER_SYMBOL(bsp_section_bss_start);
55LINKER_SYMBOL(bsp_section_bss_end);
56LINKER_SYMBOL(bsp_section_bss_size);
57
58LINKER_SYMBOL(bsp_work_area_start);
59
60LINKER_SYMBOL(MBAR);
61
62/* Provide legacy defines */
63
64#ifdef MPC5200_BOARD_PM520_ZE30
65#define PM520_ZE30
66#endif
67
68#ifdef MPC5200_BOARD_PM520_CR825
69#define PM520_CR825
70#endif
71
72#ifdef MPC5200_BOARD_ICECUBE
73#define icecube
74#endif
75
76#ifdef MPC5200_BOARD_BRS5L
77#define BRS5L
78#endif
79
80/*
81 * distinguish board characteristics
82 */
83/*
84 * for PM520 mdule on a ZE30 carrier
85 */
86#if defined(MPC5200_BOARD_PM520_ZE30)
87#define PM520
88#endif
89/*
90 * for PM520 mdule on a CR825 carrier
91 */
92#if defined(MPC5200_BOARD_PM520_CR825)
93#define PM520
94#endif
95
96#if !defined(HAS_UBOOT)
97  /* we need the low level initialization in start.S*/
98  #define NEED_LOW_LEVEL_INIT
99#endif
100
101#if defined(MPC5200_BOARD_BRS5L)
102/*
103 * IMD Custom Board BRS5L
104 */
105
106#define HAS_NVRAM_93CXX
107
108#elif defined(MPC5200_BOARD_BRS6L)
109  #define MPC5200_BRS6L_FPGA_BEGIN 0x800000
110  #define MPC5200_BRS6L_FPGA_SIZE (64 * 1024)
111  #define MPC5200_BRS6L_FPGA_END \
112    (MPC5200_BRS6L_FPGA_BEGIN + MPC5200_BRS6L_FPGA_SIZE)
113
114  #define MPC5200_BRS6L_MRAM_BEGIN 0xff000000
115  #define MPC5200_BRS6L_MRAM_SIZE (4 * 1024 * 1024)
116  #define MPC5200_BRS6L_MRAM_END \
117    (MPC5200_BRS6L_MRAM_BEGIN + MPC5200_BRS6L_MRAM_SIZE)
118#elif defined (PM520)
119
120/* Nothing special */
121
122#elif defined (MPC5200_BOARD_ICECUBE)
123/*
124 *  Codename: IceCube
125 *  Compatible Boards:
126 *     Freescape MPC5200LITE
127 *     Embedded Planet EP5200
128 */
129
130#elif defined (MPC5200_BOARD_DP2)
131
132/* Nothing special */
133
134#else
135#error "board type not defined"
136#endif
137
138#ifndef ASM
139
140#include <rtems.h>
141#include <bsp/i2cdrv.h>
142#include <bsp/irq.h>
143#include <bsp/vectors.h>
144#include <bsp/u-boot.h>
145#include <bsp/default-initial-extension.h>
146
147#ifdef __cplusplus
148extern "C" {
149#endif
150
151/*
152 * Network driver configuration
153 */
154struct rtems_bsdnet_ifconfig;
155extern int rtems_mpc5200_fec_driver_attach_detach (struct rtems_bsdnet_ifconfig *config, int attaching);
156#define RTEMS_BSP_NETWORK_DRIVER_NAME   "eth1"
157#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_mpc5200_fec_driver_attach_detach
158
159/* miscellaneous stuff assumed to exist */
160
161/*
162 * We need to decide how much memory will be non-cacheable. This
163 * will mainly be memory that will be used in DMA (network and serial
164 * buffers).
165 */
166/*
167#define NOCACHE_MEM_SIZE 512*1024
168*/
169
170/*
171 *  Device Driver Table Entries
172 */
173
174#ifdef HAS_NVRAM_93CXX
175#define NVRAM_DRIVER_TABLE_ENTRY \
176  { nvram_driver_initialize, nvram_driver_open, nvram_driver_close, \
177    nvram_driver_read, nvram_driver_write, NULL }
178#endif
179
180/*
181 * indicate, that BSP has IDE driver
182 */
183#define RTEMS_BSP_HAS_IDE_DRIVER
184
185/* functions */
186
187/* #define SHOW_MORE_INIT_SETTINGS 1 */
188
189/* ata modes */
190/* #undef ATA_USE_INT */
191#define ATA_USE_INT
192
193/* clock settings */
194#if defined(HAS_UBOOT)
195#define IPB_CLOCK (bsp_uboot_board_info.bi_ipbfreq)
196#define XLB_CLOCK (bsp_uboot_board_info.bi_busfreq)
197#define G2_CLOCK  (bsp_uboot_board_info.bi_intfreq)
198#elif defined(MPC5200_BOARD_BRS5L) || defined(MPC5200_BOARD_BRS6L)
199#define IPB_CLOCK 66000000   /* 66 MHz */
200#define XLB_CLOCK 132000000  /* 132 MHz */
201#define G2_CLOCK  396000000  /* 396 MHz */
202#else
203#define IPB_CLOCK 33000000   /* 33 MHz */
204#define XLB_CLOCK 66000000   /* 66 MHz */
205#define G2_CLOCK  231000000  /* 231 MHz */
206#endif
207
208#if defined(HAS_UBOOT)
209#define GEN5200_CONSOLE_BAUD (bsp_uboot_board_info.bi_baudrate)
210#else
211#define GEN5200_CONSOLE_BAUD 115200
212#endif
213
214/*
215 *  Convert decrement value to tenths of microsecnds (used by
216 *  shared timer driver).
217 *
218 *    + CPU has a XLB_CLOCK bus,
219 *    + There are 4 bus cycles per click
220 *    + We return value in 1/10 microsecond units.
221 *   Modified following equation to integer equation to remove
222 *   floating point math.
223 *   (int) ((float)(_value) / ((XLB_CLOCK/1000000 * 0.1) / 4.0))
224 */
225
226#define BSP_Convert_decrementer( _value ) \
227  (int) (((_value) * 4000) / (XLB_CLOCK/10000))
228
229/* slicetimer settings */
230#define USE_SLICETIMER_0     TRUE
231#define USE_SLICETIMER_1     FALSE
232
233void *bsp_idle_thread( uintptr_t ignored );
234#define BSP_IDLE_TASK_BODY bsp_idle_thread
235
236/* BSP specific IRQ Benchmarking support */
237void BSP_IRQ_Benchmarking_Reset(void);
238void BSP_IRQ_Benchmarking_Report(void);
239
240#if defined(HAS_UBOOT)
241  /* Routine to obtain U-Boot environment variables */
242  const char *bsp_uboot_getenv(
243    const char *name
244  );
245#endif
246
247void cpu_init(void);
248
249int mpc5200_eth_mii_read(
250  int phyAddr,
251  void *arg,
252  unsigned regAddr,
253  uint32_t *retVal
254);
255
256#ifdef __cplusplus
257}
258#endif
259
260#endif /* ASM */
261
262#endif /* GEN5200 */
Note: See TracBrowser for help on using the repository browser.