summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author yz70s <yz70s@users.noreply.github.com>2020-01-13 00:28:36 +0100
committer yz70s <yz70s@users.noreply.github.com>2020-01-13 00:37:59 +0100
commitfc0e6b38095fc246bb5f9e6abb862a11e2f12354 (patch)
treec7ef9181d71816a9abc5e15651a9e518bb27fe43
parent08d576e1818193346df12ffa26a3ce2fe8747f7c (diff)
naomi: let the dimm board see the encrypted des data from the gdrom (nw)
Now it only has to reset/reboot the naomi below itself.
-rw-r--r--src/mame/machine/315-6154.cpp16
-rw-r--r--src/mame/machine/315-6154.h1
-rw-r--r--src/mame/machine/naomigd.cpp20
-rw-r--r--src/mame/machine/naomigd.h3
4 files changed, 38 insertions, 2 deletions
diff --git a/src/mame/machine/315-6154.cpp b/src/mame/machine/315-6154.cpp
index a086c4a009f..940c1b8c144 100644
--- a/src/mame/machine/315-6154.cpp
+++ b/src/mame/machine/315-6154.cpp
@@ -76,7 +76,21 @@ WRITE32_MEMBER(sega_315_6154_device::registers_w)
else if (offset == 0x38 / 4)
{
if (m_registers[0x38 / 4] & 0x01000000)
- logerror("got dma transfer request from 0x%08x to 0x%08x size 0x%08x bytes\n", m_registers[0x30 / 4], m_registers[0x34 / 4], (m_registers[0x38 / 4] & 0xffffff) << 2);
+ {
+ uint32_t s, d, l;
+
+ s = m_registers[0x30 / 4];
+ d = m_registers[0x34 / 4];
+ l = m_registers[0x38 / 4] & 0xffffff;
+ logerror("got dma transfer request from 0x%08x to 0x%08x size 0x%08x bytes\n", s, d, l << 2);
+ while (l != 0)
+ {
+ m_memory->write_dword(d, m_memory->read_dword(s));
+ s += 4;
+ d += 4;
+ l--;
+ }
+ }
m_registers[0x38 / 4] &= ~0x01000000;
}
}
diff --git a/src/mame/machine/315-6154.h b/src/mame/machine/315-6154.h
index a143dd34219..815fb767b72 100644
--- a/src/mame/machine/315-6154.h
+++ b/src/mame/machine/315-6154.h
@@ -12,6 +12,7 @@ class sega_315_6154_device : public device_t, public device_memory_interface
public:
// construction/destruction
sega_315_6154_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ address_space *memory() { return m_memory; }
DECLARE_READ32_MEMBER(registers_r);
DECLARE_WRITE32_MEMBER(registers_w);
diff --git a/src/mame/machine/naomigd.cpp b/src/mame/machine/naomigd.cpp
index a576765bab2..e102f58f9ea 100644
--- a/src/mame/machine/naomigd.cpp
+++ b/src/mame/machine/naomigd.cpp
@@ -416,6 +416,7 @@ naomi_gdrom_board::naomi_gdrom_board(const machine_config &mconfig, const char *
dimm_parameterl(0xffff),
dimm_parameterh(0xffff),
dimm_status(0xffff),
+ dimm_control(0),
sh4_unknown(0),
dimm_des_key(0)
{
@@ -461,10 +462,10 @@ void naomi_gdrom_board::pci_map(address_map& map)
map(0x0000001c, 0x0000001f).rw(FUNC(naomi_gdrom_board::sh4_parameterl_r), FUNC(naomi_gdrom_board::sh4_parameterl_w));
map(0x00000020, 0x00000023).rw(FUNC(naomi_gdrom_board::sh4_parameterh_r), FUNC(naomi_gdrom_board::sh4_parameterh_w));
map(0x00000024, 0x00000027).rw(FUNC(naomi_gdrom_board::sh4_status_r), FUNC(naomi_gdrom_board::sh4_status_w));
+ map(0x00000028, 0x0000002b).rw(FUNC(naomi_gdrom_board::sh4_control_r), FUNC(naomi_gdrom_board::sh4_control_w));
map(0x0000002c, 0x0000002f).lr32([]() { return 0x0c; }, "Constant 0x0c"); // 0x0a or 0x0e possible too
map(0x00000030, 0x00000033).rw(FUNC(naomi_gdrom_board::sh4_des_keyl_r), FUNC(naomi_gdrom_board::sh4_des_keyl_w));
map(0x00000034, 0x00000037).rw(FUNC(naomi_gdrom_board::sh4_des_keyh_r), FUNC(naomi_gdrom_board::sh4_des_keyh_w));
- map(0x10000000, 0x10000003).ram(); // temporary for testing
map(0x70000000, 0x70ffffff).ram().share("sh4sdram");
map(0x78000000, 0x783fffff).ram().share("6154sdram");
map(0xc00001c0, 0xc00001df).rw(FUNC(naomi_gdrom_board::ide_cs0_r), FUNC(naomi_gdrom_board::ide_cs0_w));
@@ -603,6 +604,20 @@ READ32_MEMBER(naomi_gdrom_board::sh4_status_r)
return dimm_status;
}
+WRITE32_MEMBER(naomi_gdrom_board::sh4_control_w)
+{
+ dimm_control = data;
+ if (dimm_control & 2)
+ m_315_6154->memory()->unmap_readwrite(0x10000000, 0x10000000 + dimm_data_size - 1);
+ else
+ m_315_6154->memory()->install_ram(0x10000000, 0x10000000 + dimm_data_size - 1, dimm_des_data);
+}
+
+READ32_MEMBER(naomi_gdrom_board::sh4_control_r)
+{
+ return dimm_control;
+}
+
WRITE32_MEMBER(naomi_gdrom_board::sh4_des_keyl_w)
{
dimm_des_key = (dimm_des_key & 0xffffffff00000000) | (uint64_t)data;
@@ -921,6 +936,7 @@ void naomi_gdrom_board::device_start()
save_item(NAME(dimm_parameterl));
save_item(NAME(dimm_parameterh));
save_item(NAME(dimm_status));
+ save_item(NAME(dimm_control));
save_item(NAME(sh4_unknown));
save_item(NAME(dimm_des_key));
}
@@ -930,6 +946,8 @@ void naomi_gdrom_board::device_reset()
naomi_board::device_reset();
dimm_cur_address = 0;
+ if (work_mode != 0)
+ m_315_6154->memory()->install_ram(0x10000000, 0x10000000 + dimm_data_size - 1, dimm_des_data);
}
void naomi_gdrom_board::board_setup_address(uint32_t address, bool is_dma)
diff --git a/src/mame/machine/naomigd.h b/src/mame/machine/naomigd.h
index 1c3ea693bad..0a44efe256f 100644
--- a/src/mame/machine/naomigd.h
+++ b/src/mame/machine/naomigd.h
@@ -75,6 +75,8 @@ public:
DECLARE_READ32_MEMBER(sh4_parameterh_r);
DECLARE_WRITE32_MEMBER(sh4_status_w); // 14000024
DECLARE_READ32_MEMBER(sh4_status_r);
+ DECLARE_WRITE32_MEMBER(sh4_control_w); // 14000028
+ DECLARE_READ32_MEMBER(sh4_control_r);
DECLARE_WRITE32_MEMBER(sh4_des_keyl_w); // 14000030
DECLARE_READ32_MEMBER(sh4_des_keyl_r);
DECLARE_WRITE32_MEMBER(sh4_des_keyh_w); // 14000034
@@ -123,6 +125,7 @@ private:
uint32_t dimm_parameterl;
uint32_t dimm_parameterh;
uint32_t dimm_status;
+ uint32_t dimm_control;
uint32_t sh4_unknown;
uint64_t dimm_des_key;