1 | /* |
---|
2 | * HP PA-RISC Dependent Source |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1994 by Division Incorporated |
---|
5 | * |
---|
6 | * To anyone who acknowledges that this file is provided "AS IS" |
---|
7 | * without any express or implied warranty: |
---|
8 | * permission to use, copy, modify, and distribute this file |
---|
9 | * for any purpose is hereby granted without fee, provided that |
---|
10 | * the above copyright notice and this notice appears in all |
---|
11 | * copies, and that the name of Division Incorporated not be |
---|
12 | * used in advertising or publicity pertaining to distribution |
---|
13 | * of the software without specific, written prior permission. |
---|
14 | * Division Incorporated makes no representations about the |
---|
15 | * suitability of this software for any purpose. |
---|
16 | * |
---|
17 | * $Id$ |
---|
18 | */ |
---|
19 | |
---|
20 | #include <rtems/system.h> |
---|
21 | #include <rtems/score/isr.h> |
---|
22 | void hppa_cpu_halt(unsigned32 the_error); |
---|
23 | |
---|
24 | |
---|
25 | /*PAGE |
---|
26 | * |
---|
27 | * _CPU_ISR_install_raw_handler |
---|
28 | */ |
---|
29 | |
---|
30 | void _CPU_ISR_install_raw_handler( |
---|
31 | unsigned32 vector, |
---|
32 | proc_ptr new_handler, |
---|
33 | proc_ptr *old_handler |
---|
34 | ) |
---|
35 | { |
---|
36 | /* |
---|
37 | * This is unsupported. For HPPA this function is handled by BSP |
---|
38 | */ |
---|
39 | |
---|
40 | _CPU_Fatal_halt( 0xdeaddead ); |
---|
41 | } |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | /* |
---|
46 | * This is the default handler which is called if |
---|
47 | * _CPU_ISR_install_vector() has not been called for the |
---|
48 | * specified vector. It simply forwards onto the spurious |
---|
49 | * handler defined in the cpu-table. |
---|
50 | */ |
---|
51 | |
---|
52 | static ISR_Handler |
---|
53 | hppa_interrupt_report_spurious(ISR_Vector_number vector, |
---|
54 | void* rtems_isr_frame) /* HPPA extension */ |
---|
55 | { |
---|
56 | |
---|
57 | /* |
---|
58 | * If the CPU table defines a spurious_handler, then |
---|
59 | * call it. If the handler returns halt. |
---|
60 | */ |
---|
61 | if ( _CPU_Table.spurious_handler ) |
---|
62 | _CPU_Table.spurious_handler(vector, rtems_isr_frame); |
---|
63 | |
---|
64 | hppa_cpu_halt(vector); |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | /*PAGE |
---|
69 | * |
---|
70 | * _CPU_ISR_Get_level |
---|
71 | */ |
---|
72 | |
---|
73 | unsigned32 _CPU_ISR_Get_level(void) |
---|
74 | { |
---|
75 | int level; |
---|
76 | HPPA_ASM_SSM(0, level); /* change no bits; just get copy */ |
---|
77 | if (level & HPPA_PSW_I) |
---|
78 | return 0; |
---|
79 | return 1; |
---|
80 | } |
---|
81 | |
---|
82 | /*PAGE |
---|
83 | * |
---|
84 | * _CPU_ISR_install_vector |
---|
85 | * |
---|
86 | * This kernel routine installs the RTEMS handler for the |
---|
87 | * specified vector. The handler is a C callable routine. |
---|
88 | * |
---|
89 | * Input parameters: |
---|
90 | * vector - interrupt vector number |
---|
91 | * old_handler - former ISR for this vector number |
---|
92 | * new_handler - replacement ISR for this vector number |
---|
93 | * |
---|
94 | * Output parameters: NONE |
---|
95 | * |
---|
96 | */ |
---|
97 | |
---|
98 | void _CPU_ISR_install_vector( |
---|
99 | unsigned32 vector, |
---|
100 | proc_ptr new_handler, |
---|
101 | proc_ptr *old_handler |
---|
102 | ) |
---|
103 | { |
---|
104 | *old_handler = _ISR_Vector_table[vector]; |
---|
105 | |
---|
106 | _ISR_Vector_table[vector] = new_handler; |
---|
107 | } |
---|
108 | |
---|
109 | /* _CPU_Initialize |
---|
110 | * |
---|
111 | * This routine performs processor dependent initialization. |
---|
112 | * |
---|
113 | * INPUT PARAMETERS: |
---|
114 | * cpu_table - CPU table to initialize |
---|
115 | * thread_dispatch - address of disptaching routine |
---|
116 | * |
---|
117 | */ |
---|
118 | |
---|
119 | void _CPU_Initialize( |
---|
120 | rtems_cpu_table *cpu_table, |
---|
121 | void (*thread_dispatch) /* ignored on this CPU */ |
---|
122 | ) |
---|
123 | { |
---|
124 | register unsigned8 *fp_context; |
---|
125 | int i; |
---|
126 | proc_ptr old_handler; |
---|
127 | |
---|
128 | /* |
---|
129 | * XXX; need to setup fpsr smarter perhaps |
---|
130 | */ |
---|
131 | |
---|
132 | fp_context = (unsigned8*) &_CPU_Null_fp_context; |
---|
133 | for (i=0 ; i<sizeof(Context_Control_fp); i++) |
---|
134 | *fp_context++ = 0; |
---|
135 | |
---|
136 | /* |
---|
137 | * Set _CPU_Default_gr27 here so it will hopefully be the correct |
---|
138 | * global data pointer for the entire system. |
---|
139 | */ |
---|
140 | |
---|
141 | asm volatile( "stw %%r27,%0" : "=m" (_CPU_Default_gr27): ); |
---|
142 | |
---|
143 | /* |
---|
144 | * Init the 2nd level interrupt handlers |
---|
145 | */ |
---|
146 | |
---|
147 | for (i=0; i < CPU_INTERRUPT_NUMBER_OF_VECTORS; i++) |
---|
148 | _CPU_ISR_install_vector(i, |
---|
149 | hppa_interrupt_report_spurious, |
---|
150 | &old_handler); |
---|
151 | |
---|
152 | _CPU_Table = *cpu_table; |
---|
153 | |
---|
154 | } |
---|
155 | |
---|
156 | |
---|
157 | /* |
---|
158 | * Halt the system. |
---|
159 | * Called by the _CPU_Fatal_halt macro |
---|
160 | * |
---|
161 | * XXX |
---|
162 | * Later on, this will allow us to return to the prom. |
---|
163 | * For now, we just ignore 'type_of_halt' |
---|
164 | * |
---|
165 | * XXX |
---|
166 | * NOTE: for gcc, this function must be at the bottom |
---|
167 | * of the file, that is because if it is at the top |
---|
168 | * of the file, gcc will inline it's calls. Since |
---|
169 | * the function uses the HPPA_ASM_LABEL() macro, when |
---|
170 | * gcc inlines it, you get two definitions of the same |
---|
171 | * label name, which is an assembly error. |
---|
172 | */ |
---|
173 | |
---|
174 | |
---|
175 | void |
---|
176 | hppa_cpu_halt(unsigned32 the_error) |
---|
177 | { |
---|
178 | unsigned32 isrlevel; |
---|
179 | |
---|
180 | _CPU_ISR_Disable(isrlevel); |
---|
181 | |
---|
182 | /* |
---|
183 | * XXXXX NOTE: This label is only needed that that when |
---|
184 | * the simulator stops, it shows the label name specified |
---|
185 | */ |
---|
186 | HPPA_ASM_LABEL("_hppa_cpu_halt"); |
---|
187 | HPPA_ASM_BREAK(0, 0); |
---|
188 | } |
---|
189 | |
---|