mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 13:52:21 +00:00
Fusee use CAR reboot for fatal errors
This commit is contained in:
parent
4ec7d0fc82
commit
83d9d874e6
6 changed files with 34 additions and 24 deletions
|
@ -60,7 +60,7 @@ void check_and_display_panic(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
display_color_screen(color);
|
display_color_screen(color);
|
||||||
wait_for_button_and_pmc_reboot();
|
wait_for_button_and_reboot();
|
||||||
} else {
|
} else {
|
||||||
g_panic_code = 0;
|
g_panic_code = 0;
|
||||||
APBDEV_PMC_SCRATCH200_0 = 0;
|
APBDEV_PMC_SCRATCH200_0 = 0;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "pmc.h"
|
#include "pmc.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
#include "car.h"
|
||||||
|
|
||||||
#include "lib/printk.h"
|
#include "lib/printk.h"
|
||||||
#include "hwinit/btn.h"
|
#include "hwinit/btn.h"
|
||||||
|
@ -33,16 +34,21 @@ __attribute__((noreturn)) void pmc_reboot(uint32_t scratch0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((noreturn)) void wait_for_button_and_pmc_reboot(void) {
|
__attribute__((noreturn)) void car_reboot(void) {
|
||||||
|
/* Reset the processor. */
|
||||||
|
car_get_regs()->rst_dev_l |= 1<<2;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
/* Wait for reboot. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noreturn)) void wait_for_button_and_reboot(void) {
|
||||||
uint32_t button;
|
uint32_t button;
|
||||||
while (true) {
|
while (true) {
|
||||||
button = btn_read();
|
button = btn_read();
|
||||||
if (button & BTN_POWER) {
|
if (button & BTN_POWER) {
|
||||||
/* Reboot into RCM. */
|
car_reboot();
|
||||||
pmc_reboot(BIT(1) | 0);
|
|
||||||
} else if (button & (BTN_VOL_UP | BTN_VOL_DOWN)) {
|
|
||||||
/* Reboot normally. */
|
|
||||||
pmc_reboot(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,10 +63,8 @@ __attribute__((noreturn)) void fatal_error(const char *fmt, ...) {
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vprintk(fmt, args);
|
vprintk(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
printk("\nHanging...\n");
|
printk("\nPress POWER to reboot\n");
|
||||||
while(true);
|
wait_for_button_and_reboot();
|
||||||
//printk("\nPress POWER to reboot into RCM, VOL+/VOL- to reboot normally.\n");
|
|
||||||
//wait_for_button_and_pmc_reboot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((noinline)) bool overlaps(uint64_t as, uint64_t ae, uint64_t bs, uint64_t be)
|
__attribute__((noinline)) bool overlaps(uint64_t as, uint64_t ae, uint64_t bs, uint64_t be)
|
||||||
|
|
|
@ -103,7 +103,8 @@ static inline bool check_32bit_address_range_in_program(uintptr_t addr, size_t s
|
||||||
|
|
||||||
__attribute__((noreturn)) void watchdog_reboot(void);
|
__attribute__((noreturn)) void watchdog_reboot(void);
|
||||||
__attribute__((noreturn)) void pmc_reboot(uint32_t scratch0);
|
__attribute__((noreturn)) void pmc_reboot(uint32_t scratch0);
|
||||||
__attribute__((noreturn)) void wait_for_button_and_pmc_reboot(void);
|
__attribute__((noreturn)) void car_reboot(void);
|
||||||
|
__attribute__((noreturn)) void wait_for_button_and_reboot(void);
|
||||||
|
|
||||||
__attribute__((noreturn)) void generic_panic(void);
|
__attribute__((noreturn)) void generic_panic(void);
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ void check_and_display_panic(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
display_color_screen(color);
|
display_color_screen(color);
|
||||||
wait_for_button_and_pmc_reboot();
|
wait_for_button_and_reboot();
|
||||||
} else {
|
} else {
|
||||||
g_panic_code = 0;
|
g_panic_code = 0;
|
||||||
APBDEV_PMC_SCRATCH200_0 = 0;
|
APBDEV_PMC_SCRATCH200_0 = 0;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "se.h"
|
#include "se.h"
|
||||||
#include "fuse.h"
|
#include "fuse.h"
|
||||||
#include "pmc.h"
|
#include "pmc.h"
|
||||||
|
#include "car.h"
|
||||||
#include "timers.h"
|
#include "timers.h"
|
||||||
#include "hwinit/btn.h"
|
#include "hwinit/btn.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
@ -33,16 +34,21 @@ __attribute__((noreturn)) void pmc_reboot(uint32_t scratch0) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((noreturn)) void wait_for_button_and_pmc_reboot(void) {
|
__attribute__((noreturn)) void car_reboot(void) {
|
||||||
|
/* Reset the processor. */
|
||||||
|
car_get_regs()->rst_dev_l |= 1<<2;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
/* Wait for reboot. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__attribute__((noreturn)) void wait_for_button_and_reboot(void) {
|
||||||
uint32_t button;
|
uint32_t button;
|
||||||
while (true) {
|
while (true) {
|
||||||
button = btn_read();
|
button = btn_read();
|
||||||
if (button & BTN_POWER) {
|
if (button & BTN_POWER) {
|
||||||
/* Reboot into RCM. */
|
car_reboot();
|
||||||
pmc_reboot(BIT(1) | 0);
|
|
||||||
} else if (button & (BTN_VOL_UP | BTN_VOL_DOWN)) {
|
|
||||||
/* Reboot normally. */
|
|
||||||
pmc_reboot(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,10 +63,8 @@ __attribute__((noreturn)) void fatal_error(const char *fmt, ...) {
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
printf("Hanging...\n");
|
printf("\n Press POWER to reboot.\n");
|
||||||
while(true);
|
wait_for_button_and_reboot();
|
||||||
//printf("\n Press POWER to reboot into RCM, VOL+/VOL- to reboot normally.\n");
|
|
||||||
//wait_for_button_and_pmc_reboot();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((noinline)) bool overlaps(uint64_t as, uint64_t ae, uint64_t bs, uint64_t be)
|
__attribute__((noinline)) bool overlaps(uint64_t as, uint64_t ae, uint64_t bs, uint64_t be)
|
||||||
|
|
|
@ -106,7 +106,8 @@ void hexdump(const void* data, size_t size, uintptr_t addrbase);
|
||||||
|
|
||||||
__attribute__((noreturn)) void watchdog_reboot(void);
|
__attribute__((noreturn)) void watchdog_reboot(void);
|
||||||
__attribute__((noreturn)) void pmc_reboot(uint32_t scratch0);
|
__attribute__((noreturn)) void pmc_reboot(uint32_t scratch0);
|
||||||
__attribute__((noreturn)) void wait_for_button_and_pmc_reboot(void);
|
__attribute__((noreturn)) void car_reboot(void);
|
||||||
|
__attribute__((noreturn)) void wait_for_button_and_reboot(void);
|
||||||
|
|
||||||
__attribute__((noreturn)) void generic_panic(void);
|
__attribute__((noreturn)) void generic_panic(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue