2018-09-07 16:00:13 +01:00
|
|
|
/*
|
2020-01-24 10:10:40 +00:00
|
|
|
* Copyright (c) 2018-2020 Atmosphère-NX
|
2018-09-07 16:00:13 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2020-05-07 06:29:07 +01:00
|
|
|
|
2018-04-09 22:34:23 +01:00
|
|
|
#ifndef FUSEE_NX_BOOT_H
|
|
|
|
#define FUSEE_NX_BOOT_H
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
2019-06-28 16:35:18 +01:00
|
|
|
#define EMUMMC_ENABLED_KEY "enabled"
|
|
|
|
#define EMUMMC_SECTOR_KEY "sector"
|
|
|
|
#define EMUMMC_PATH_KEY "path"
|
|
|
|
#define EMUMMC_NINTENDO_PATH_KEY "nintendo_path"
|
|
|
|
#define EMUMMC_ID_KEY "id"
|
2019-04-07 19:02:01 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bool enabled;
|
2019-06-15 05:20:53 +01:00
|
|
|
uint32_t id;
|
2019-06-09 19:33:44 +01:00
|
|
|
uint64_t sector;
|
2019-06-15 05:20:53 +01:00
|
|
|
char path[0x80];
|
|
|
|
char nintendo_path[0x80];
|
2019-06-09 19:33:44 +01:00
|
|
|
} emummc_config_t;
|
2019-04-07 19:02:01 +01:00
|
|
|
|
2019-01-30 12:14:00 +00:00
|
|
|
#define MAILBOX_NX_BOOTLOADER_BASE_100_620 0x40002E00
|
|
|
|
#define MAILBOX_NX_BOOTLOADER_BASE_700 0x40000000
|
2020-06-12 08:46:21 +01:00
|
|
|
#define MAILBOX_NX_BOOTLOADER_BASE(targetfw) (MAILBOX_NX_BOOTLOADER_BASE_700)
|
2019-01-30 12:14:00 +00:00
|
|
|
#define MAKE_MAILBOX_NX_BOOTLOADER_REG(targetfw, n) MAKE_REG32(MAILBOX_NX_BOOTLOADER_BASE(targetfw) + n)
|
2018-04-10 23:37:58 +01:00
|
|
|
|
2019-01-30 12:14:00 +00:00
|
|
|
#define MAILBOX_NX_BOOTLOADER_BOOT_REASON_BASE(targetfw) (MAILBOX_NX_BOOTLOADER_BASE(targetfw) + 0x10)
|
|
|
|
#define MAILBOX_NX_BOOTLOADER_SETUP_STATE(targetfw) MAKE_MAILBOX_NX_BOOTLOADER_REG(targetfw, 0xF8)
|
|
|
|
#define MAILBOX_NX_BOOTLOADER_IS_SECMON_AWAKE(targetfw) MAKE_MAILBOX_NX_BOOTLOADER_REG(targetfw, 0xFC)
|
2018-04-10 23:37:58 +01:00
|
|
|
|
|
|
|
#define NX_BOOTLOADER_STATE_INIT 0
|
|
|
|
#define NX_BOOTLOADER_STATE_MOVED_BOOTCONFIG 1
|
|
|
|
#define NX_BOOTLOADER_STATE_LOADED_PACKAGE2 2
|
|
|
|
#define NX_BOOTLOADER_STATE_FINISHED 3
|
|
|
|
#define NX_BOOTLOADER_STATE_DRAM_INITIALIZED_4X 2
|
|
|
|
#define NX_BOOTLOADER_STATE_LOADED_PACKAGE2_4X 3
|
|
|
|
#define NX_BOOTLOADER_STATE_FINISHED_4X 4
|
|
|
|
|
2018-08-29 18:28:21 +01:00
|
|
|
typedef struct {
|
|
|
|
uint32_t bootloader_version;
|
|
|
|
uint32_t bootloader_start_block;
|
|
|
|
uint32_t bootloader_start_page;
|
|
|
|
uint32_t bootloader_attribute;
|
|
|
|
uint32_t boot_reason_value;
|
|
|
|
uint32_t boot_reason_state;
|
|
|
|
} boot_reason_t;
|
2018-04-09 22:34:23 +01:00
|
|
|
|
2018-09-15 21:08:58 +01:00
|
|
|
uint32_t nxboot_main(void);
|
|
|
|
void nxboot_finish(uint32_t boot_memaddr);
|
2018-04-09 22:34:23 +01:00
|
|
|
|
2018-05-14 20:17:06 +01:00
|
|
|
#endif
|