source: rtems/cpukit/score/cpu/powerpc/rtems/new-exceptions/cpu.h @ 282048a

4.104.114.95
Last change on this file since 282048a was 282048a, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/07 at 22:22:01

2007-12-03 Joel Sherrill <joel.sherrill@…>

  • rtems/new-exceptions/cpu.h, rtems/old-exceptions/cpu.h: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred.
  • Property mode set to 100644
File size: 10.1 KB
Line 
1/*  cpu.h
2 *
3 *  This include file contains information pertaining to the PowerPC
4 *  processor.
5 *
6 *  Modified for MPC8260 Andy Dachs <a.dachs@sstl.co.uk>
7 *  Surrey Satellite Technology Limited (SSTL), 2001
8 *
9 *  Author:     Andrew Bray <andy@i-cubed.co.uk>
10 *
11 *  COPYRIGHT (c) 1995 by i-cubed ltd.
12 *
13 *  To anyone who acknowledges that this file is provided "AS IS"
14 *  without any express or implied warranty:
15 *      permission to use, copy, modify, and distribute this file
16 *      for any purpose is hereby granted without fee, provided that
17 *      the above copyright notice and this notice appears in all
18 *      copies, and that the name of i-cubed limited not be used in
19 *      advertising or publicity pertaining to distribution of the
20 *      software without specific, written prior permission.
21 *      i-cubed limited makes no representations about the suitability
22 *      of this software for any purpose.
23 *
24 *  Derived from c/src/exec/cpu/no_cpu/cpu.h:
25 *
26 *  COPYRIGHT (c) 1989-2007.
27 *  On-Line Applications Research Corporation (OAR).
28 *
29 *  The license and distribution terms for this file may be found in
30 *  the file LICENSE in this distribution or at
31 *  http://www.rtems.com/license/LICENSE.
32 *
33 *  $Id$
34 */
35
36#ifndef _RTEMS_NEW_EXCEPTIONS_CPU_H
37#define _RTEMS_NEW_EXCEPTIONS_CPU_H
38
39#ifndef _RTEMS_SCORE_CPU_H
40#error "You should include <rtems/score/cpu.h>"
41#endif
42
43#include <rtems/powerpc/registers.h>
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49/* conditional compilation parameters */
50
51/*
52 *  Does RTEMS manage a dedicated interrupt stack in software?
53 *
54 *  If TRUE, then a stack is allocated in _ISR_Handler_initialization.
55 *  If FALSE, nothing is done.
56 *
57 *  If the CPU supports a dedicated interrupt stack in hardware,
58 *  then it is generally the responsibility of the BSP to allocate it
59 *  and set it up.
60 *
61 *  If the CPU does not support a dedicated interrupt stack, then
62 *  the porter has two options: (1) execute interrupts on the
63 *  stack of the interrupted task, and (2) have RTEMS manage a dedicated
64 *  interrupt stack.
65 *
66 *  If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
67 *
68 *  Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
69 *  CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE.  It is
70 *  possible that both are FALSE for a particular CPU.  Although it
71 *  is unclear what that would imply about the interrupt processing
72 *  procedure on that CPU.
73 */
74
75#define CPU_HAS_SOFTWARE_INTERRUPT_STACK TRUE
76
77/*
78 *  Does this CPU have hardware support for a dedicated interrupt stack?
79 *
80 *  If TRUE, then it must be installed during initialization.
81 *  If FALSE, then no installation is performed.
82 *
83 *  If this is TRUE, CPU_ALLOCATE_INTERRUPT_STACK should also be TRUE.
84 *
85 *  Only one of CPU_HAS_SOFTWARE_INTERRUPT_STACK and
86 *  CPU_HAS_HARDWARE_INTERRUPT_STACK should be set to TRUE.  It is
87 *  possible that both are FALSE for a particular CPU.  Although it
88 *  is unclear what that would imply about the interrupt processing
89 *  procedure on that CPU.
90 */
91
92#define CPU_HAS_HARDWARE_INTERRUPT_STACK FALSE
93
94/*
95 *  Does RTEMS allocate a dedicated interrupt stack in the Interrupt Manager?
96 *
97 *  If TRUE, then the memory is allocated during initialization.
98 *  If FALSE, then the memory is allocated during initialization.
99 *
100 *  This should be TRUE is CPU_HAS_SOFTWARE_INTERRUPT_STACK is TRUE.
101 */
102
103#define CPU_ALLOCATE_INTERRUPT_STACK FALSE
104
105/*
106 *  Does the RTEMS invoke the user's ISR with the vector number and
107 *  a pointer to the saved interrupt frame (1) or just the vector
108 *  number (0)?
109 */
110
111#define CPU_ISR_PASSES_FRAME_POINTER 0
112
113/*
114 *  Should the saving of the floating point registers be deferred
115 *  until a context switch is made to another different floating point
116 *  task?
117 *
118 *  If TRUE, then the floating point context will not be stored until
119 *  necessary.  It will remain in the floating point registers and not
120 *  disturned until another floating point task is switched to.
121 *
122 *  If FALSE, then the floating point context is saved when a floating
123 *  point task is switched out and restored when the next floating point
124 *  task is restored.  The state of the floating point registers between
125 *  those two operations is not specified.
126 *
127 *  If the floating point context does NOT have to be saved as part of
128 *  interrupt dispatching, then it should be safe to set this to TRUE.
129 *
130 *  Setting this flag to TRUE results in using a different algorithm
131 *  for deciding when to save and restore the floating point context.
132 *  The deferred FP switch algorithm minimizes the number of times
133 *  the FP context is saved and restored.  The FP context is not saved
134 *  until a context switch is made to another, different FP task.
135 *  Thus in a system with only one FP task, the FP context will never
136 *  be saved or restored.
137 *
138 *  Note, however that compilers may use floating point registers/
139 *  instructions for optimization or they may save/restore FP registers
140 *  on the stack. You must not use deferred switching in these cases
141 *  and on the PowerPC attempting to do so will raise a "FP unavailable"
142 *  exception.
143 */
144/*
145 *  ACB Note:  This could make debugging tricky..
146 */
147
148/* conservative setting (FALSE); probably doesn't affect performance too much */
149#define CPU_USE_DEFERRED_FP_SWITCH       FALSE
150
151/*
152 *  Processor defined structures required for cpukit/score.
153 */
154
155#ifndef ASM
156 
157/*
158 *  The following table contains the information required to configure
159 *  the PowerPC processor specific parameters.
160 */
161
162typedef struct {
163  uint32_t     interrupt_stack_size;
164}   rtems_cpu_table;
165
166/*
167 *  This variable is optional.  It is used on CPUs on which it is difficult
168 *  to generate an "uninitialized" FP context.  It is filled in by
169 *  _CPU_Initialize and copied into the task's FP context area during
170 *  _CPU_Context_Initialize.
171 */
172
173/* EXTERN Context_Control_fp  _CPU_Null_fp_context; */
174
175/*
176 *  On some CPUs, RTEMS supports a software managed interrupt stack.
177 *  This stack is allocated by the Interrupt Manager and the switch
178 *  is performed in _ISR_Handler.  These variables contain pointers
179 *  to the lowest and highest addresses in the chunk of memory allocated
180 *  for the interrupt stack.  Since it is unknown whether the stack
181 *  grows up or down (in general), this give the CPU dependent
182 *  code the option of picking the version it wants to use.
183 *
184 *  NOTE: These two variables are required if the macro
185 *        CPU_HAS_SOFTWARE_INTERRUPT_STACK is defined as TRUE.
186 */
187
188SCORE_EXTERN void               *_CPU_Interrupt_stack_low;
189SCORE_EXTERN void               *_CPU_Interrupt_stack_high;
190
191#endif /* ndef ASM */
192
193/*
194 *  This defines the number of levels and the mask used to pick those
195 *  bits out of a thread mode.
196 */
197
198#define CPU_MODES_INTERRUPT_LEVEL  0x00000001 /* interrupt level in mode */
199#define CPU_MODES_INTERRUPT_MASK   0x00000001 /* interrupt level in mode */
200
201/*
202 *  With some compilation systems, it is difficult if not impossible to
203 *  call a high-level language routine from assembly language.  This
204 *  is especially true of commercial Ada compilers and name mangling
205 *  C++ ones.  This variable can be optionally defined by the CPU porter
206 *  and contains the address of the routine _Thread_Dispatch.  This
207 *  can make it easier to invoke that routine at the end of the interrupt
208 *  sequence (if a dispatch is necessary).
209 */
210
211/* EXTERN void           (*_CPU_Thread_dispatch_pointer)(); */
212
213/*
214 *  Nothing prevents the porter from declaring more CPU specific variables.
215 */
216
217#ifndef ASM
218 
219SCORE_EXTERN struct {
220  uint32_t   *Disable_level;
221  void *Stack;
222  volatile boolean *Switch_necessary;
223  boolean *Signal;
224
225} _CPU_IRQ_info CPU_STRUCTURE_ALIGNMENT;
226
227#endif /* ndef ASM */
228
229/*
230 *  The size of the floating point context area.  On some CPUs this
231 *  will not be a "sizeof" because the format of the floating point
232 *  area is not defined -- only the size is.  This is usually on
233 *  CPUs with a "floating point save context" instruction.
234 */
235
236#define CPU_CONTEXT_FP_SIZE sizeof( Context_Control_fp )
237
238/*
239 * (Optional) # of bytes for libmisc/stackchk to check
240 * If not specifed, then it defaults to something reasonable
241 * for most architectures.
242 */
243
244#define CPU_STACK_CHECK_SIZE    (128)
245
246/*
247 *  Amount of extra stack (above minimum stack size) required by
248 *  MPCI receive server thread.  Remember that in a multiprocessor
249 *  system this thread must exist and be able to process all directives.
250 */
251
252#define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0
253
254/*
255 *  This defines the number of entries in the ISR_Vector_table managed
256 *  by RTEMS.
257 */
258
259#define CPU_INTERRUPT_NUMBER_OF_VECTORS     (PPC_INTERRUPT_MAX)
260#define CPU_INTERRUPT_MAXIMUM_VECTOR_NUMBER (PPC_INTERRUPT_MAX - 1)
261
262/*
263 *  This is defined if the port has a special way to report the ISR nesting
264 *  level.  Most ports maintain the variable _ISR_Nest_level. Note that
265 *  this is not an option - RTEMS/score _relies_ on _ISR_Nest_level
266 *  being maintained (e.g. watchdog queues).
267 */
268
269#define CPU_PROVIDES_ISR_IS_IN_PROGRESS FALSE
270
271/*
272 *  ISR handler macros
273 */
274
275#define _CPU_Initialize_vectors()
276
277/*
278 *  Disable all interrupts for an RTEMS critical section.  The previous
279 *  level is returned in _isr_cookie.
280 */
281
282#ifndef ASM
283 
284static inline uint32_t   _CPU_ISR_Get_level( void )
285{
286  register unsigned int msr;
287  _CPU_MSR_GET(msr);
288  if (msr & MSR_EE) return 0;
289  else  return 1;
290}
291
292static inline void _CPU_ISR_Set_level( uint32_t   level )
293{
294  register unsigned int msr;
295  _CPU_MSR_GET(msr);
296  if (!(level & CPU_MODES_INTERRUPT_MASK)) {
297    msr |= MSR_EE;
298  }
299  else {
300    msr &= ~MSR_EE;
301  }
302  _CPU_MSR_SET(msr);
303}
304 
305void BSP_panic(char *);
306
307/* Fatal Error manager macros */
308
309/*
310 *  This routine copies _error into a known place -- typically a stack
311 *  location or a register, optionally disables interrupts, and
312 *  halts/stops the CPU.
313 */
314
315void _BSP_Fatal_error(unsigned int);
316
317#define _CPU_Fatal_halt( _error ) \
318  _BSP_Fatal_error(_error)
319
320/* end of Fatal Error manager macros */
321
322/*
323 *  Until all new-exception processing BSPs have fixed
324 *  PR288, we let the good BSPs pass
325 *
326 *  PPC_BSP_HAS_FIXED_PR288
327 *
328 *  in SPRG0 and let _CPU_Initialize assert this.
329 */
330
331#define PPC_BSP_HAS_FIXED_PR288 0x600dbabe
332
333#endif /* ASM */
334
335#ifdef __cplusplus
336}
337#endif
338
339#endif
Note: See TracBrowser for help on using the repository browser.