summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2014-11-10 19:46:48 +0100
committer Olivier Galibert <galibert@pobox.com>2014-11-10 19:46:18 +0100
commit31eda228fe96394b8ba0a2731477711e84b828c2 (patch)
tree7277cd73dffdd79b253885a2646bc23e225891f5
parent0a3d96d6f029144aad4ec2c885f260b3af3a2eae (diff)
pci: Add remapping notifiers [O. Galibert]
-rw-r--r--src/emu/machine/i6300esb.c11
-rw-r--r--src/emu/machine/pci.c24
-rw-r--r--src/emu/machine/pci.h6
3 files changed, 40 insertions, 1 deletions
diff --git a/src/emu/machine/i6300esb.c b/src/emu/machine/i6300esb.c
index 1057774c739..5b594f115ee 100644
--- a/src/emu/machine/i6300esb.c
+++ b/src/emu/machine/i6300esb.c
@@ -71,7 +71,7 @@ void i6300esb_lpc_device::reset_all_mappings()
lpc_if_sound_range = 0x00;
fwh_dec_en1 = 0xff;
gen1_dec = 0x0000;
- lpc_en = 0x2000;
+ lpc_en = 0x0000;
fwh_sel1 = 0x00112233;
}
@@ -85,6 +85,7 @@ WRITE32_MEMBER(i6300esb_lpc_device::gpio_base_w)
COMBINE_DATA(&gpio_base);
gpio_base &= 0x0000ffc0;
logerror("%s: gpio_base = %08x\n", tag(), gpio_base);
+ remap_cb();
}
READ8_MEMBER (i6300esb_lpc_device::gpio_cntl_r)
@@ -96,6 +97,7 @@ WRITE8_MEMBER (i6300esb_lpc_device::gpio_cntl_w)
{
COMBINE_DATA(&gpio_cntl);
logerror("%s: gpio_cntl = %02x\n", tag(), gpio_cntl);
+ remap_cb();
}
READ8_MEMBER (i6300esb_lpc_device::lpc_if_com_range_r)
@@ -107,6 +109,7 @@ WRITE8_MEMBER (i6300esb_lpc_device::lpc_if_com_range_w)
{
COMBINE_DATA(&lpc_if_com_range);
logerror("%s: lpc_if_com_range = %02x\n", tag(), lpc_if_com_range);
+ remap_cb();
}
READ8_MEMBER (i6300esb_lpc_device::lpc_if_fdd_lpt_range_r)
@@ -118,6 +121,7 @@ WRITE8_MEMBER (i6300esb_lpc_device::lpc_if_fdd_lpt_range_w)
{
COMBINE_DATA(&lpc_if_fdd_lpt_range);
logerror("%s: lpc_if_fdd_lpt_range = %02x\n", tag(), lpc_if_fdd_lpt_range);
+ remap_cb();
}
READ8_MEMBER (i6300esb_lpc_device::lpc_if_sound_range_r)
@@ -129,6 +133,7 @@ WRITE8_MEMBER (i6300esb_lpc_device::lpc_if_sound_range_w)
{
COMBINE_DATA(&lpc_if_sound_range);
logerror("%s: lpc_if_sound_range = %02x\n", tag(), lpc_if_sound_range);
+ remap_cb();
}
READ8_MEMBER (i6300esb_lpc_device::fwh_dec_en1_r)
@@ -140,6 +145,7 @@ WRITE8_MEMBER (i6300esb_lpc_device::fwh_dec_en1_w)
{
fwh_dec_en1 = data | 0x80;
logerror("%s: fwh_dec_en1 = %02x\n", tag(), fwh_dec_en1);
+ remap_cb();
}
READ16_MEMBER (i6300esb_lpc_device::gen1_dec_r)
@@ -151,6 +157,7 @@ WRITE16_MEMBER(i6300esb_lpc_device::gen1_dec_w)
{
COMBINE_DATA(&gen1_dec);
logerror("%s: gen1_dec = %04x\n", tag(), gen1_dec);
+ remap_cb();
}
READ16_MEMBER (i6300esb_lpc_device::lpc_en_r)
@@ -162,6 +169,7 @@ WRITE16_MEMBER(i6300esb_lpc_device::lpc_en_w)
{
COMBINE_DATA(&lpc_en);
logerror("%s: lpc_en = %04x\n", tag(), lpc_en);
+ remap_cb();
}
READ32_MEMBER (i6300esb_lpc_device::fwh_sel1_r)
@@ -173,6 +181,7 @@ WRITE32_MEMBER(i6300esb_lpc_device::fwh_sel1_w)
{
COMBINE_DATA(&fwh_sel1);
logerror("%s: fwh_sel1 = %08x\n", tag(), fwh_sel1);
+ remap_cb();
}
READ32_MEMBER (i6300esb_lpc_device::unk_fc_r)
diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c
index 9f12520cbd7..1736d0c6584 100644
--- a/src/emu/machine/pci.c
+++ b/src/emu/machine/pci.c
@@ -91,6 +91,11 @@ void pci_device::scan_sub_devices(pci_device **devices, dynamic_array<pci_device
{
}
+void pci_device::set_remap_cb(mapper_cb _remap_cb)
+{
+ remap_cb = _remap_cb;
+}
+
void pci_device::reset_all_mappings()
{
}
@@ -163,6 +168,14 @@ device_t *pci_bridge_device::bus_root()
return this;
}
+void pci_bridge_device::set_remap_cb(mapper_cb _remap_cb)
+{
+ remap_cb = _remap_cb;
+ for(int i=0; i != all_devices.count(); i++)
+ if(all_devices[i] != this)
+ all_devices[i]->set_remap_cb(_remap_cb);
+}
+
void pci_bridge_device::device_start()
{
pci_device::device_start();
@@ -179,10 +192,15 @@ void pci_bridge_device::device_start()
int fct = t[l-1] - '0';
sub_devices[(id << 3) | fct] = downcast<pci_device *>(d);
}
+
+ mapper_cb cf_cb(FUNC(pci_bridge_device::regenerate_config_mapping), this);
+
for(int i=0; i<32*8; i++)
if(sub_devices[i]) {
all_devices.append(sub_devices[i]);
if(sub_devices[i] != this) {
+ sub_devices[i]->remap_config_cb = cf_cb;
+ sub_devices[i]->set_remap_cb(remap_cb);
pci_bridge_device *bridge = dynamic_cast<pci_bridge_device *>(sub_devices[i]);
if(bridge)
all_bridges.append(bridge);
@@ -262,10 +280,16 @@ device_t *pci_host_device::bus_root()
void pci_host_device::device_start()
{
+ remap_cb = mapper_cb(FUNC(pci_host_device::regenerate_mapping), this);
+
pci_bridge_device::device_start();
memory_window_start = memory_window_end = memory_offset = 0;
io_window_start = io_window_end = io_offset = 0;
+
+ for(int i=0; i != all_devices.count(); i++)
+ if(all_devices[i] != this)
+ all_devices[i]->reset_all_mappings();
}
void pci_host_device::device_reset()
diff --git a/src/emu/machine/pci.h b/src/emu/machine/pci.h
index 3f5b6d93e58..dd18c38e0e9 100644
--- a/src/emu/machine/pci.h
+++ b/src/emu/machine/pci.h
@@ -24,10 +24,15 @@
class pci_device : public device_t {
public:
+ typedef delegate<void ()> mapper_cb;
+
+ mapper_cb remap_cb, remap_config_cb;
+
pci_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
void set_ids(UINT32 main_id, UINT8 revision, UINT32 pclass, UINT32 subsystem_id);
+ virtual void set_remap_cb(mapper_cb _remap_cb);
virtual void reset_all_mappings();
virtual void map_device(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space,
UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space);
@@ -87,6 +92,7 @@ public:
pci_bridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
pci_bridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ virtual void set_remap_cb(mapper_cb _remap_cb);
virtual void map_device(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space,
UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space);
virtual void reset_all_mappings();