1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 13:52:21 +00:00

fusee: Disable AHB redirection when necessary.

fusee: Add 3.0.0/3.0.1/3.0.2 warmboot fix.
This commit is contained in:
hexkyz 2018-08-30 19:49:33 +01:00
parent 611e85e6ee
commit 3cf37330ca
3 changed files with 23 additions and 1 deletions

View file

@ -47,6 +47,12 @@ void unmount_sd(void)
sdmmc_device_finish(&g_sd_device); sdmmc_device_finish(&g_sd_device);
g_sd_mounted = false; g_sd_mounted = false;
} }
/* Disable AHB redirection if necessary. */
if (g_ahb_redirect_enabled) {
mc_disable_ahb_redirect();
g_ahb_redirect_enabled = false;
}
} }
uint32_t get_file_size(const char *filename) uint32_t get_file_size(const char *filename)

View file

@ -362,6 +362,15 @@ void nxboot_main(void) {
printf("[NXBOOT]: Moving BootConfig...\n"); printf("[NXBOOT]: Moving BootConfig...\n");
nxboot_move_bootconfig(); nxboot_move_bootconfig();
/* Set 3.0.0/3.0.1/3.0.2 warmboot security check. */
if (MAILBOX_EXOSPHERE_CONFIGURATION->target_firmware == EXOSPHERE_TARGET_FIRMWARE_300) {
const package1loader_header_t *package1loader_header = (const package1loader_header_t *)package1loader;
if (!strcmp(package1loader_header->build_timestamp, "20170519101410"))
pmc->secure_scratch32 = 0xE3; /* Warmboot 3.0.0 security check.*/
else if (!strcmp(package1loader_header->build_timestamp, "20170710161758"))
pmc->secure_scratch32 = 0x104; /* Warmboot 3.0.1/3.0.2 security check. */
}
/* Clean up. */ /* Clean up. */
free(package1loader); free(package1loader);
if (loader_ctx->tsecfw_path[0] != '\0') { if (loader_ctx->tsecfw_path[0] != '\0') {
@ -424,7 +433,7 @@ void nxboot_main(void) {
display_end(); display_end();
/* Boot CPU0. */ /* Boot CPU0. */
cluster_boot_cpu0((uint64_t)(uintptr_t)exosphere_memaddr); cluster_boot_cpu0((uint32_t)exosphere_memaddr);
/* Wait for Exosphère to wake up. */ /* Wait for Exosphère to wake up. */
while (MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE == 0) { while (MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE == 0) {

View file

@ -48,6 +48,7 @@ static int mmc_partition_initialize(device_partition_t *devpart) {
devpart->crypto_work_buffer_num_sectors = 0; devpart->crypto_work_buffer_num_sectors = 0;
} }
/* Enable AHB redirection if necessary. */
if (!g_ahb_redirect_enabled) { if (!g_ahb_redirect_enabled) {
mc_enable_ahb_redirect(); mc_enable_ahb_redirect();
g_ahb_redirect_enabled = true; g_ahb_redirect_enabled = true;
@ -78,6 +79,12 @@ static int mmc_partition_initialize(device_partition_t *devpart) {
static void mmc_partition_finalize(device_partition_t *devpart) { static void mmc_partition_finalize(device_partition_t *devpart) {
free(devpart->crypto_work_buffer); free(devpart->crypto_work_buffer);
/* Disable AHB redirection if necessary. */
if (g_ahb_redirect_enabled) {
mc_disable_ahb_redirect();
g_ahb_redirect_enabled = false;
}
} }
static int mmc_partition_read(device_partition_t *devpart, void *dst, uint64_t sector, uint64_t num_sectors) { static int mmc_partition_read(device_partition_t *devpart, void *dst, uint64_t sector, uint64_t num_sectors) {