summaryrefslogtreecommitdiff
path: root/firmware/servicereq.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/servicereq.c')
-rw-r--r--firmware/servicereq.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/firmware/servicereq.c b/firmware/servicereq.c
index 8f8f8a3..a05d37a 100644
--- a/firmware/servicereq.c
+++ b/firmware/servicereq.c
@@ -5616,12 +5616,22 @@ end:
return;
}
+void read_rom_hack(void)
+{
+ // Read a byte of the ROM at an address that autoincrements every read
+ // and save it to the scratch register above the post code.
+ // Will wrap around at 0x10000 bytes.
+ static u16 wrappedromaddress = 0;
+ u32 oldpostcode = read32(0xe0003024) & 0xff;
+ write32(0xe0003024, ((u32)read8(wrappedromaddress++) << 8) | oldpostcode);
+}
+
void smu_service_request(unsigned int e3)
{
static ddiphy_t ddiphy = {{0}};
static u32 bapm = 0;
- int requestid;
+ u32 requestid;
requestid = e3;
requestid &= 0x1fffe;
@@ -5715,6 +5725,9 @@ void smu_service_request(unsigned int e3)
case SMC_MSG_DISABLE_BAPM:
set_bapm(OFF, &bapm, &bapm);
break;
+ case SMC_MSG_READ_ROM_HACK:
+ read_rom_hack();
+ break;
default:
break;
}