From a3601f224c372483bedf4bb51f6fbf84ac06b221 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Wed, 8 Jan 2020 19:33:38 +0100 Subject: [PATCH] Fix NVRAM->Heathrow connection. --- devices/heathrow.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/devices/heathrow.cpp b/devices/heathrow.cpp index 15e9eaa..b8f40bf 100644 --- a/devices/heathrow.cpp +++ b/devices/heathrow.cpp @@ -67,9 +67,9 @@ uint32_t HeathrowIC::read(uint32_t offset, int size) cout << this->name << ": reading from offset " << hex << offset << endl; - unsigned sub_dev = (offset >> 12) & 0x3F; + unsigned sub_addr = (offset >> 12) & 0x7F; - switch(sub_dev) { + switch(sub_addr) { case 0: res = mio_ctrl_read(offset, size); break; @@ -83,11 +83,12 @@ uint32_t HeathrowIC::read(uint32_t offset, int size) case 0x17: res = this->viacuda->read((offset - 0x16000) >> 9); break; - case 0x60: - case 0x70: - res = this->nvram->read_byte((offset - 0x60000) >> 4); default: - cout << "unmapped I/O space: " << sub_dev << endl; + if (sub_addr >= 0x60) { + res = this->nvram->read_byte((offset - 0x60000) >> 4); + } else { + cout << "unmapped I/O space: " << hex << offset << endl; + } } return res; @@ -97,9 +98,9 @@ void HeathrowIC::write(uint32_t offset, uint32_t value, int size) { cout << this->name << ": writing to offset " << hex << offset << endl; - unsigned sub_dev = (offset >> 12) & 0x3F; + unsigned sub_addr = (offset >> 12) & 0x7F; - switch(sub_dev) { + switch(sub_addr) { case 0: mio_ctrl_write(offset, value, size); break; @@ -114,7 +115,11 @@ void HeathrowIC::write(uint32_t offset, uint32_t value, int size) this->viacuda->write((offset - 0x16000) >> 9, value); break; default: - cout << "unmapped I/O space: " << sub_dev << endl; + if (sub_addr >= 0x60) { + this->nvram->write_byte((offset - 0x60000) >> 4, value); + } else { + cout << "unmapped I/O space: " << hex << offset << endl; + } } }