exo: change config to its own static page

This is necessary to support both pre-7.0.0 and 7.0.0...
This commit is contained in:
Michael Scire
2019-01-30 13:53:16 -08:00
parent 7bdb2ae897
commit 3d6405be85
4 changed files with 14 additions and 25 deletions

View File

@@ -22,12 +22,7 @@
#include "mmu.h"
#include "memory_map.h"
#define MAILBOX_BASE (MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_NXBOOTLOADER_MAILBOX))
/* TODO: Should this be at a non-static location? */
#define MAILBOX_EXOSPHERE_CONFIG (*((volatile exosphere_config_t *)(MAILBOX_BASE + 0xE40ULL)))
static exosphere_config_t g_exosphere_cfg = {MAGIC_EXOSPHERE_BOOTCONFIG, ATMOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG, EXOSPHERE_FLAGS_DEFAULT};
static exosphere_config_t g_exosphere_cfg = {MAGIC_EXOSPHERE_CONFIG, ATMOSPHERE_TARGET_FIRMWARE_DEFAULT_FOR_DEBUG, EXOSPHERE_FLAGS_DEFAULT};
static bool g_has_loaded_config = false;
#define EXOSPHERE_CHECK_FLAG(flag) ((g_exosphere_cfg.flags & flag) != 0)
@@ -42,11 +37,8 @@ unsigned int exosphere_load_config(void) {
const unsigned int magic = MAILBOX_EXOSPHERE_CONFIG.magic;
if (magic == MAGIC_EXOSPHERE_BOOTCONFIG) {
if (magic == MAGIC_EXOSPHERE_CONFIG) {
g_exosphere_cfg = MAILBOX_EXOSPHERE_CONFIG;
} else if (magic == MAGIC_EXOSPHERE_BOOTCONFIG_0) {
g_exosphere_cfg = MAILBOX_EXOSPHERE_CONFIG;
g_exosphere_cfg.flags = EXOSPHERE_FLAGS_DEFAULT;
}
return g_exosphere_cfg.target_firmware;