source: rtems/cpukit/score/include/rtems/score/interr.h @ 8a6de83

4.115
Last change on this file since 8a6de83 was 8a6de83, checked in by Sebastian Huber <sebastian.huber@…>, on 02/17/14 at 09:10:27

score: Move _SMP_Request_other_cores_to_shutdown()

Move _SMP_Request_other_cores_to_shutdown() invocation from
rtems_shutdown_executive() to _Internal_error_Occurred() to allow a
proper shutdown on SMP configurations even in the error case.

  • Property mode set to 100644
File size: 6.2 KB
Line 
1/**
2 *  @file  rtems/score/interr.h
3 *
4 *  @brief Constants and Prototypes Related to the Internal Error Handler
5 *
6 *  This include file contains constants and prototypes related
7 *  to the Internal Error Handler.
8 */
9
10/*
11 *  COPYRIGHT (c) 1989-2009.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#ifndef _RTEMS_SCORE_INTERR_H
20#define _RTEMS_SCORE_INTERR_H
21
22#include <stdbool.h>
23#include <stdint.h>
24
25#include <rtems/system.h>
26
27/**
28 *  @defgroup ScoreIntErr Internal Error Handler
29 *
30 *  @ingroup Score
31 *
32 *  This handler encapsulates functionality which provides the foundation
33 *  Semaphore services used in all of the APIs supported by RTEMS.
34 */
35/**@{*/
36
37#ifdef __cplusplus
38extern "C" {
39#endif
40
41/**
42 *  @brief This type lists the possible sources from which an error
43 *  can be reported.
44 */
45typedef enum {
46  INTERNAL_ERROR_CORE,
47  INTERNAL_ERROR_RTEMS_API,
48  INTERNAL_ERROR_POSIX_API,
49
50  /**
51   * @brief Fatal source for the block device cache.
52   *
53   * @see rtems_bdbuf_fatal_code.
54   */
55  RTEMS_FATAL_SOURCE_BDBUF,
56
57  /**
58   * @brief Fatal source for application specific errors.
59   *
60   * The fatal code is application specific.
61   */
62  RTEMS_FATAL_SOURCE_APPLICATION,
63
64  /**
65   * @brief Fatal source of exit().
66   *
67   * The fatal code is the exit() status code.
68   */
69  RTEMS_FATAL_SOURCE_EXIT,
70
71  /**
72   * @brief Fatal source for generic BSP errors.
73   *
74   * The fatal codes are defined in <bsp/generic-fatal.h>.  Examples are
75   * interrupt and exception initialization.
76   *
77   * @see bsp_generic_fatal_code and bsp_generic_fatal().
78   */
79  RTEMS_FATAL_SOURCE_BSP_GENERIC,
80
81  /**
82   * @brief Fatal source for BSP specific errors.
83   *
84   * The fatal code is BSP specific.
85   */
86  RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
87
88  /**
89   * @brief Fatal source of assert().
90   *
91   * The fatal code is the pointer value of the assert context.
92   *
93   * @see rtems_assert_context.
94   */
95  RTEMS_FATAL_SOURCE_ASSERT,
96
97  /**
98   * @brief Fatal source of the stack checker.
99   *
100   * The fatal code is the object name of the executing task.
101   */
102  RTEMS_FATAL_SOURCE_STACK_CHECKER,
103
104  /**
105   * @brief Fatal source of the exceptions.
106   *
107   * The fatal code is the pointer value of the exception frame pointer.
108   *
109   * @see rtems_exception_frame and rtems_exception_frame_print().
110   */
111  RTEMS_FATAL_SOURCE_EXCEPTION,
112
113  /**
114   * @brief The last available fatal source.
115   *
116   * This enum value ensures that the enum type needs at least 32-bits for
117   * architectures with short enums.
118   */
119  RTEMS_FATAL_SOURCE_LAST = 0xffffffff
120} Internal_errors_Source;
121
122/**
123 *  A list of errors which are generated internally by the executive core.
124 */
125typedef enum {
126  INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
127  INTERNAL_ERROR_NO_CPU_TABLE,
128  INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
129  INTERNAL_ERROR_WORKSPACE_ALLOCATION,
130  INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
131  INTERNAL_ERROR_THREAD_EXITTED,
132  INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
133  INTERNAL_ERROR_INVALID_NODE,
134  INTERNAL_ERROR_NO_MPCI,
135  INTERNAL_ERROR_BAD_PACKET,
136  INTERNAL_ERROR_OUT_OF_PACKETS,
137  INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
138  INTERNAL_ERROR_OUT_OF_PROXIES,
139  INTERNAL_ERROR_INVALID_GLOBAL_ID,
140  INTERNAL_ERROR_BAD_STACK_HOOK,
141  INTERNAL_ERROR_BAD_ATTRIBUTES,
142  INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY,
143  INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL,
144  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE,
145  INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0,
146  INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP,
147  INTERNAL_ERROR_GXX_KEY_ADD_FAILED,
148  INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
149  INTERNAL_ERROR_NO_MEMORY_FOR_HEAP,
150  INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR
151} Internal_errors_Core_list;
152
153typedef uint32_t Internal_errors_t;
154
155/**
156 *  This type holds the fatal error information.
157 */
158typedef struct {
159  /** This is the source of the error. */
160  Internal_errors_Source  the_source;
161  /** This indicates if the error is internal of external. */
162  bool                    is_internal;
163  /** This is the error code. */
164  Internal_errors_t       the_error;
165} Internal_errors_Information;
166
167/**
168 *  When a fatal error occurs, the error information is stored here.
169 */
170extern Internal_errors_Information _Internal_errors_What_happened;
171
172/**
173 * @brief Initiates system termination.
174 *
175 * This routine is invoked when the application or the executive itself
176 * determines that a fatal error has occurred or a final system state is
177 * reached (for example after exit()).
178 *
179 * The first action is to disable interrupts.
180 *
181 * The second action of this function is to call the fatal handler of the user
182 * extensions.  For the initial extensions the following conditions are
183 * required
184 * - a valid stack pointer and enough stack space,
185 * - a valid code memory, and
186 * - valid read-only data.
187 *
188 * For the initial extensions the read-write data (including BSS segment) is
189 * not required on single processor configurations.  On SMP configurations
190 * however the read-write data must be initialized since this function must
191 * determine the state of the other processors and request them to shut-down if
192 * necessary.
193 *
194 * Non-initial extensions require in addition valid read-write data.  The BSP
195 * may install an initial extension that performs a system reset.  In this case
196 * the non-initial extensions will be not called.
197 *
198 * Once all fatal handler executed the error information will be stored to
199 * _Internal_errors_What_happened and the system state is set to
200 * SYSTEM_STATE_TERMINATED.
201 *
202 * The final step is to call the CPU specific _CPU_Fatal_halt().
203 *
204 * @param[in] the_source The fatal source indicating the subsystem the fatal
205 * condition originated in.
206 * @param[in] is_internal Indicates if the fatal condition was generated
207 * internally to the executive.
208 * @param[in] the_error The fatal error code.  This value must be interpreted
209 * with respect to the source.
210 *
211 * @see rtems_fatal_error_occurred() and rtems_fatal().
212 */
213void _Internal_error_Occurred(
214  Internal_errors_Source  the_source,
215  bool                    is_internal,
216  Internal_errors_t       the_error
217) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
218
219#ifdef __cplusplus
220}
221#endif
222
223/**@}*/
224
225#endif
226/* end of include file */
Note: See TracBrowser for help on using the repository browser.