make vfs & filesystems use failable copying
[minix3.git] / kernel / arch / earm / arch_reset.c
blob7d5a872de50ca48405f97b4a99c8131df257255a
1 #include "kernel/kernel.h"
3 #include <unistd.h>
4 #include <ctype.h>
5 #include <string.h>
6 #include <machine/cpu.h>
7 #include <assert.h>
8 #include <signal.h>
9 #include <machine/vm.h>
10 #include <io.h>
12 #include <minix/board.h>
13 #include <sys/reboot.h>
15 #include <minix/u64.h>
17 #include "archconst.h"
18 #include "arch_proto.h"
19 #include "bsp_reset.h"
20 #include "bsp_serial.h"
21 #include "kernel/proc.h"
22 #include "kernel/debug.h"
23 #include "direct_utils.h"
24 #include <machine/multiboot.h>
26 void
27 halt_cpu(void)
29 asm volatile("dsb");
30 asm volatile("cpsie i");
31 asm volatile("wfi");
32 asm volatile("cpsid i");
35 void
36 reset(void)
38 bsp_reset(); /* should not exit */
39 direct_print("Reset not supported.");
40 while (1);
43 void
44 poweroff(void)
46 bsp_poweroff();
47 /* fallback option: hang */
48 direct_print("Unable to power-off this device.");
49 while (1);
52 __dead void
53 arch_shutdown(int how)
56 if((how & RB_POWERDOWN) == RB_POWERDOWN) {
57 /* Power off if possible, hang otherwise */
58 poweroff();
59 NOT_REACHABLE;
62 if(how & RB_HALT) {
63 /* Hang */
64 for (; ; ) halt_cpu();
65 NOT_REACHABLE;
68 /* Reset the system */
69 reset();
70 NOT_REACHABLE;
72 while (1);
75 #ifdef DEBUG_SERIAL
76 void
77 ser_putc(char c)
79 bsp_ser_putc(c);
82 #endif