fusee_cpp: fix mariko mtc (mariko now gets as far as erista)

This commit is contained in:
Michael Scire 2021-09-03 12:43:07 -07:00 committed by SciresM
parent 5950ff5b5e
commit 968ced677e
5 changed files with 595 additions and 895 deletions

View file

@ -23,6 +23,7 @@ SECTIONS
KEEP(*(.text._ZN3ams4util15GetMicroSecondsEv)) KEEP(*(.text._ZN3ams4util15GetMicroSecondsEv))
KEEP(*(.text._ZN3ams4util16WaitMicroSecondsEi)) KEEP(*(.text._ZN3ams4util16WaitMicroSecondsEi))
KEEP(*(.text._ZN3ams6nxboot14ShowFatalErrorEPKcz)) KEEP(*(.text._ZN3ams6nxboot14ShowFatalErrorEPKcz))
KEEP(*(.text._ZN3ams6nxboot10UncompressEPvjPKvj))
KEEP(*(.text.memcpy)) KEEP(*(.text.memcpy))
KEEP(*(.text.memset)) KEEP(*(.text.memset))
KEEP(*(.text.memcmp)) KEEP(*(.text.memcmp))

View file

@ -208,8 +208,7 @@ namespace ams::nxboot {
if (soc_type == fuse::SocType_Mariko) { if (soc_type == fuse::SocType_Mariko) {
package1 += 0x170; package1 += 0x170;
const u8 iv[0x10] = {}; se::DecryptAes128Cbc(package1 + 0x20, 0x40000 - (0x20 + 0x170), pkg1::AesKeySlot_MarikoBek, package1 + 0x20, 0x40000 - (0x20 + 0x170), package1 + 0x10, se::AesBlockSize);
se::DecryptAes128Cbc(package1 + 0x20, 0x40000 - (0x20 + 0x170), pkg1::AesKeySlot_MarikoBek, package1 + 0x20, 0x40000 - (0x20 + 0x170), iv, sizeof(iv));
hw::InvalidateDataCache(package1 + 0x20, 0x40000 - (0x20 + 0x170)); hw::InvalidateDataCache(package1 + 0x20, 0x40000 - (0x20 + 0x170));

View file

@ -956,7 +956,7 @@ namespace ams::nxboot {
} }
void PllDisable(u32 dst_clk_src) { void PllDisable(u32 dst_clk_src) {
switch (dst_clk_src) { switch (reg::GetField(dst_clk_src, CLK_RST_REG_BITS_MASK(CLK_SOURCE_EMC_EMC_2X_CLK_SRC))) {
case PLLM_OUT0: case PLLM_OUT0:
case PLLM_UD: case PLLM_UD:
reg::ClearBits(CLKRST + CLK_RST_CONTROLLER_PLLMB_BASE, 0x40000000); reg::ClearBits(CLKRST + CLK_RST_CONTROLLER_PLLMB_BASE, 0x40000000);
@ -2707,6 +2707,8 @@ namespace ams::nxboot {
g_did_first_training = true; g_did_first_training = true;
} }
reg::Write(EMC + EMC_TRAINING_QUSE_CTRL_MISC, (dst_timing->burst_regs.emc_training_read_ctrl_misc & 0xFFFF0000) | 0x00001000);
/* Do training, if we need to. */ /* Do training, if we need to. */
const u32 needed_training = dst_timing->needs_training; const u32 needed_training = dst_timing->needs_training;
if (needed_training && !dst_timing->trained) { if (needed_training && !dst_timing->trained) {

File diff suppressed because it is too large Load diff

View file

@ -76,11 +76,13 @@ def main(argc, argv):
f.write('%s\n' % " */") f.write('%s\n' % " */")
f.write('\n') f.write('\n')
for board in compressed_params[soc].keys(): for board in compressed_params[soc].keys():
data_1600 = compressed_params[soc][board][-1] if soc == 'mariko' else params[soc][board][-1] data_1600 = params[soc][board][-1]
data_204 = compressed_params[soc][board][0] if soc == 'mariko' else params[soc][board][3] data_204 = params[soc][board][0] if soc == 'mariko' else params[soc][board][3]
assert up('<I', params[soc][board][-1][0x40:0x44])[0] == 1600000 assert up('<I', data_1600[0x40:0x44])[0] == 1600000
assert up('<I', params[soc][board][0 if soc == 'mariko' else 3][0x40:0x44])[0] == 204000 assert up('<I', data_204[0x40:0x44])[0] == 204000
data = data_204 + data_1600 data = data_204 + data_1600
if soc == 'mariko':
data = lz4_compress(data)
f.write('%s\n' % ('constexpr const u8 %s[0x%03X] = {' % (board, len(data)))) f.write('%s\n' % ('constexpr const u8 %s[0x%03X] = {' % (board, len(data))))
while data: while data:
block = data[:0x10] block = data[:0x10]