1 /*=============================================================================
2 Copyright (C) 2016-2017 Authors of rpi-open-firmware
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
16 VideoCoreIV second level exception handlers.
18 =============================================================================*/
20 #include <lib/runtime.h>
22 #include <exception.h>
26 static const char* g_ExceptionNames
[] = { VC4_EXC_NAMES
};
28 static const char* exception_name(uint32_t n
) {
29 if (n
>= (sizeof(g_ExceptionNames
)/4))
31 return g_ExceptionNames
[n
];
34 #define REGISTER_FORMAT_STRING(prefix) \
35 prefix " r0: 0x%08x r1: 0x%08x r2: 0x%08x r3: 0x%08x\n" \
36 prefix " r4: 0x%08x r5: 0x%08x r6: 0x%08x r7: 0x%08x\n" \
37 prefix " r8: 0x%08x r9: 0x%08x r10: 0x%08x r11: 0x%08x\n" \
38 prefix " r12: 0x%08x r13: 0x%08x r14: 0x%08x r15: 0x%08x\n" \
39 prefix " pc: 0x%08x lr: 0x%08x sr: 0x%08x\n"
41 static void print_vpu_state(vc4_saved_state_t
* pcb
) {
42 printf("VPU registers:\n");
45 REGISTER_FORMAT_STRING(" "),
67 printf("Exception info (IC0):\n");
70 " src0: 0x%08x src1: 0x%08x vaddr: 0x%08x\n"
71 " C: 0x%08x S: 0x%08x\n",
79 printf("Exception info (IC1):\n");
82 " src0: 0x%08x src1: 0x%08x vaddr: 0x%08x\n"
83 " C: 0x%08x S: 0x%08x\n",
92 void sleh_fatal(vc4_saved_state_t
* pcb
, uint32_t n
) {
93 printf("Fatal VPU Exception: %s\n", exception_name(n
));
97 printf("We are hanging here ...\n");
102 extern void arm_monitor_interrupt();
104 void sleh_irq(vc4_saved_state_t
* pcb
, uint32_t tp
) {
105 uint32_t status
= IC0_S
;
106 uint32_t source
= status
& 0xFF;
108 printf("VPU Received interrupt from source %d\n", source
);
110 if (source
== INTERRUPT_ARM
) {
111 arm_monitor_interrupt();
113 print_vpu_state(pcb
);
114 panic("unknown interrupt source!");
This page took 0.084559 seconds and 5 git commands to generate.