2018-02-21 18:57:51 +00:00
|
|
|
#ifndef EXOSPHERE_BOOTCONFIG_H
|
|
|
|
#define EXOSPHERE_BOOTCONFIG_H
|
|
|
|
|
2018-02-24 20:46:57 +00:00
|
|
|
#include <stdbool.h>
|
2018-02-21 18:57:51 +00:00
|
|
|
#include <stdint.h>
|
2018-03-01 10:06:55 +00:00
|
|
|
#include "memory_map.h"
|
2018-02-21 18:57:51 +00:00
|
|
|
|
|
|
|
/* This provides management for Switch BootConfig. */
|
|
|
|
|
2018-03-01 10:06:55 +00:00
|
|
|
#define LOADED_BOOTCONFIG (get_loaded_bootconfig())
|
|
|
|
|
2018-02-21 18:57:51 +00:00
|
|
|
typedef struct {
|
2018-02-28 04:28:34 +00:00
|
|
|
uint8_t data[0x200];
|
|
|
|
} bootconfig_unsigned_config_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t _0x0[8];
|
|
|
|
uint8_t package2_config;
|
|
|
|
uint8_t _0x9[7];
|
|
|
|
uint8_t hardware_info[0x10];
|
|
|
|
uint8_t disable_program_verification;
|
|
|
|
uint8_t _0x21[0xDF];
|
|
|
|
} bootconfig_signed_config_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
bootconfig_unsigned_config_t unsigned_config;
|
2018-02-21 18:57:51 +00:00
|
|
|
uint8_t signature[0x100];
|
2018-02-28 04:28:34 +00:00
|
|
|
bootconfig_signed_config_t signed_config;
|
2018-03-01 10:06:55 +00:00
|
|
|
uint8_t unused_space[0x240]; /* remaining space in the evt page */
|
2018-02-21 18:57:51 +00:00
|
|
|
} bootconfig_t;
|
|
|
|
|
2018-03-01 10:06:55 +00:00
|
|
|
static inline bootconfig_t *get_loaded_bootconfig(void) {
|
|
|
|
/* this is also get_exception_entry_stack_address(2) */
|
|
|
|
return (bootconfig_t *)(TZRAM_GET_SEGMENT_ADDRESS(TZRAM_SEGEMENT_ID_SECMON_EVT) + 0x180);
|
|
|
|
}
|
|
|
|
|
2018-02-21 19:52:39 +00:00
|
|
|
void bootconfig_load_and_verify(const bootconfig_t *bootconfig);
|
2018-02-21 18:57:51 +00:00
|
|
|
void bootconfig_clear(void);
|
|
|
|
|
2018-02-21 19:52:39 +00:00
|
|
|
/* Actual configuration getters. */
|
2018-02-23 03:58:39 +00:00
|
|
|
bool bootconfig_is_package2_plaintext(void);
|
|
|
|
bool bootconfig_is_package2_unsigned(void);
|
2018-02-24 15:25:38 +00:00
|
|
|
bool bootconfig_disable_program_verification(void);
|
2018-02-25 09:21:52 +00:00
|
|
|
bool bootconfig_is_debug_mode(void);
|
|
|
|
|
2018-03-02 23:04:16 +00:00
|
|
|
bool bootconfig_should_set_scr_el3_bit(void);
|
|
|
|
|
2018-02-25 09:21:52 +00:00
|
|
|
uint64_t bootconfig_get_memory_arrangement(void);
|
|
|
|
uint64_t bootconfig_get_kernel_memory_configuration(void);
|
2018-02-21 19:52:39 +00:00
|
|
|
|
2018-03-01 10:06:55 +00:00
|
|
|
#endif
|