1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-23 10:52:13 +00:00

exosphere: Fix virtual mapping of MC_SECURITY_CFG3.

Allow DRAM magic test value to be written on < 4.0.0.
This commit is contained in:
hexkyz 2018-11-14 21:12:36 +00:00
parent e5e9968d22
commit 7c61e935ee
4 changed files with 13 additions and 12 deletions

View file

@ -49,7 +49,6 @@ static bool g_has_booted_up = false;
void setup_dram_magic_numbers(void) { void setup_dram_magic_numbers(void) {
/* These DRAM writes test and set values for the GPU UCODE carveout. */ /* These DRAM writes test and set values for the GPU UCODE carveout. */
unsigned int target_fw = exosphere_get_target_firmware(); unsigned int target_fw = exosphere_get_target_firmware();
if (EXOSPHERE_TARGET_FIRMWARE_400 <= target_fw) {
(*(volatile uint32_t *)(0x8005FFFC)) = 0xC0EDBBCC; /* Access test value. */ (*(volatile uint32_t *)(0x8005FFFC)) = 0xC0EDBBCC; /* Access test value. */
flush_dcache_range((void *)0x8005FFFC, (void *)0x80060000); flush_dcache_range((void *)0x8005FFFC, (void *)0x80060000);
if (EXOSPHERE_TARGET_FIRMWARE_600 <= target_fw) { if (EXOSPHERE_TARGET_FIRMWARE_600 <= target_fw) {
@ -58,7 +57,6 @@ void setup_dram_magic_numbers(void) {
(*(volatile uint32_t *)(0x8005FF08)) = 0x00000210; /* Tegra210 code. */ (*(volatile uint32_t *)(0x8005FF08)) = 0x00000210; /* Tegra210 code. */
flush_dcache_range((void *)0x8005FF00, (void *)0x8005FF0C); flush_dcache_range((void *)0x8005FF00, (void *)0x8005FF0C);
} }
}
__dsb_sy(); __dsb_sy();
} }
@ -82,7 +80,7 @@ void bootup_misc_mmio(void) {
se_generate_random_key(KEYSLOT_SWITCH_SRKGENKEY, KEYSLOT_SWITCH_RNGKEY); se_generate_random_key(KEYSLOT_SWITCH_SRKGENKEY, KEYSLOT_SWITCH_RNGKEY);
se_generate_srk(KEYSLOT_SWITCH_SRKGENKEY); se_generate_srk(KEYSLOT_SWITCH_SRKGENKEY);
if (!g_has_booted_up && EXOSPHERE_TARGET_FIRMWARE_600 > exosphere_get_target_firmware() && exosphere_get_target_firmware() >= EXOSPHERE_TARGET_FIRMWARE_400) { if (!g_has_booted_up && (EXOSPHERE_TARGET_FIRMWARE_600 > exosphere_get_target_firmware())) {
setup_dram_magic_numbers(); setup_dram_magic_numbers();
} }

View file

@ -493,6 +493,9 @@ static inline uintptr_t get_mc_base(void) {
#define MC_ERR_APB_ASID_UPDATE_STATUS 0x9d0 #define MC_ERR_APB_ASID_UPDATE_STATUS 0x9d0
#define MC_DA_CONFIG0 0x9dc #define MC_DA_CONFIG0 0x9dc
/* Virtual aliases */
#define VIRT_MC_SECURITY_CFG3 MAKE_MC_REG(MC_SECURITY_CFG3)
/* Memory Controller clients */ /* Memory Controller clients */
#define CLIENT_ACCESS_NUM_CLIENTS 32 #define CLIENT_ACCESS_NUM_CLIENTS 32
typedef enum { typedef enum {

View file

@ -199,7 +199,7 @@ void warmboot_init(void) {
invalidate_icache_all(); invalidate_icache_all();
/* On warmboot (not cpu_on) only */ /* On warmboot (not cpu_on) only */
if (MC_SECURITY_CFG3 == 0) { if (VIRT_MC_SECURITY_CFG3 == 0) {
init_dma_controllers(g_exosphere_target_firmware_for_init); init_dma_controllers(g_exosphere_target_firmware_for_init);
} }

View file

@ -54,7 +54,7 @@ void __attribute__((noreturn)) warmboot_main(void) {
identity_unmap_iram_cd_tzram(); identity_unmap_iram_cd_tzram();
/* On warmboot (not cpu_on) only */ /* On warmboot (not cpu_on) only */
if (MC_SECURITY_CFG3 == 0) { if (VIRT_MC_SECURITY_CFG3 == 0) {
if (!configitem_is_retail()) { if (!configitem_is_retail()) {
/* TODO: uart_log("OHAYO"); */ /* TODO: uart_log("OHAYO"); */
} }