source: rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.5 KB
Line 
1#include <rtems.h>
2#include <bsp.h>
3#include <bsp/bootcard.h>
4#include <bsp/uart.h>
5#include <rtems/bspIo.h>
6#include <rtems/error.h>
7#include <libcpu/stackTrace.h>
8#include <rtems/score/thread.h>
9#include <rtems/score/thread.inl>
10
11static void
12rebootQuestion(void)
13{
14  printk("Press a key to reboot\n");
15  BSP_poll_char_via_serial();
16  bsp_reset();
17}
18
19void BSP_panic(char *s)
20{
21  printk("%s PANIC %s\n",_RTEMS_version, s);
22  rebootQuestion();
23}
24
25#define THESRC _Internal_errors_What_happened.the_source
26#define ISITNL _Internal_errors_What_happened.is_internal
27#define THEERR _Internal_errors_What_happened.the_error
28
29char *score_status_text(rtems_status_code sc)
30{
31  switch (sc) {
32    case INTERNAL_ERROR_NO_CONFIGURATION_TABLE:
33      return "INTERNAL_ERROR_NO_CONFIGURATION_TABLE";
34    case INTERNAL_ERROR_NO_CPU_TABLE:
35      return "INTERNAL_ERROR_NO_CPU_TABLE";
36    case INTERNAL_ERROR_TOO_LITTLE_WORKSPACE:
37      return "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE";
38    case INTERNAL_ERROR_WORKSPACE_ALLOCATION:
39      return "INTERNAL_ERROR_WORKSPACE_ALLOCATION";
40    case INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL:
41      return "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL";
42    case INTERNAL_ERROR_THREAD_EXITTED:
43      return "INTERNAL_ERROR_THREAD_EXITTED";
44    case INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION:
45      return "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION";
46    case INTERNAL_ERROR_INVALID_NODE:
47      return "INTERNAL_ERROR_INVALID_NODE";
48    case INTERNAL_ERROR_NO_MPCI:
49      return "INTERNAL_ERROR_NO_MPCI";
50    case INTERNAL_ERROR_BAD_PACKET:
51      return "INTERNAL_ERROR_BAD_PACKET";
52    case INTERNAL_ERROR_OUT_OF_PACKETS:
53      return "INTERNAL_ERROR_OUT_OF_PACKETS";
54    case INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS:
55      return "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS";
56    case INTERNAL_ERROR_OUT_OF_PROXIES:
57      return "INTERNAL_ERROR_OUT_OF_PROXIES";
58    case INTERNAL_ERROR_INVALID_GLOBAL_ID:
59      return "INTERNAL_ERROR_INVALID_GLOBAL_ID";
60    case INTERNAL_ERROR_BAD_STACK_HOOK:
61      return "INTERNAL_ERROR_BAD_STACK_HOOK";
62    case INTERNAL_ERROR_BAD_ATTRIBUTES:
63      return "INTERNAL_ERROR_BAD_ATTRIBUTES";
64    case 18: /* not in header (yet) :-( */
65      return "INTERNAL_ERROR_CALLED_FROM_WRONG_ENVIRONMENT";
66    default:
67      break;
68  }
69  return 0;
70}
71
72void _BSP_Fatal_error(unsigned int v)
73{
74  unsigned long flags;
75  const char *err = 0;
76
77  rtems_interrupt_disable(flags);
78  printk("%s\n",_RTEMS_version);
79  printk("FATAL ERROR:\n");
80  printk("Internal error: %s\n", ISITNL? "Yes":"No");
81  printk("Environment:");
82  switch (THESRC) {
83    case INTERNAL_ERROR_CORE:
84      printk(" RTEMS Core\n");
85      err = score_status_text(THEERR);
86    break;
87
88      case INTERNAL_ERROR_RTEMS_API:
89      printk(" RTEMS API\n");
90      err = rtems_status_text(THEERR);
91    break;
92
93      case INTERNAL_ERROR_POSIX_API:
94      printk(" POSIX API (errno)\n");
95      /* could use strerror but I'd rather avoid using this here */
96    break;
97
98    default:
99      printk("  UNKNOWN (0x%x)\n",THESRC);
100  break;
101  }
102  if ( _Thread_Dispatch_in_critical_section() )
103    printk(
104      "  Error occurred in a Thread Dispatching DISABLED context (level %i)\n",
105      _Thread_Dispatch_get_disable_level());
106  else
107    printk("enabled\n");
108
109  if ( _ISR_Nest_level ) {
110    printk(
111      "  Error occurred from ISR context (ISR nest level %i)\n",
112      _ISR_Nest_level
113    );
114  }
115
116  printk("Error %d",THEERR);
117  if (err) {
118    printk(": %s",err);
119  }
120  printk("\n");
121  printk("Stack Trace:\n");
122  CPU_print_stack();
123
124  rebootQuestion();
125}
Note: See TracBrowser for help on using the repository browser.