summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author yz70s <yz70s@users.noreply.github.com>2019-04-24 20:13:54 +0200
committer yz70s <yz70s@users.noreply.github.com>2019-04-24 20:16:57 +0200
commita73650ea2ae21e894b137cf9ae8355af3b4c5e52 (patch)
tree74b2abee2f7d7aadaf02d2ff36615ec9b3d2866d
parentacc073745a45615d0c4593f0305a3c5f87aeee96 (diff)
xbox_pci.cpp: add simple interfaces for lpc bus devices (nw)
-rw-r--r--src/mame/includes/xbox_pci.h17
-rw-r--r--src/mame/machine/xbox_pci.cpp141
2 files changed, 109 insertions, 49 deletions
diff --git a/src/mame/includes/xbox_pci.h b/src/mame/includes/xbox_pci.h
index c098d9148fb..16606d1fcb5 100644
--- a/src/mame/includes/xbox_pci.h
+++ b/src/mame/includes/xbox_pci.h
@@ -58,7 +58,18 @@ DECLARE_DEVICE_TYPE(NV2A_RAM, nv2a_ram_device)
* LPC Bus
*/
-class mcpx_isalpc_device : public pci_device {
+class lpcbus_host_interface {
+public:
+ virtual void set_virtual_line(int line, int state) = 0;
+};
+
+class lpcbus_device_interface {
+public:
+ virtual void map_extra(address_space *memory_space, address_space *io_space) = 0;
+ virtual void set_host(int index, lpcbus_host_interface *host) = 0;
+};
+
+class mcpx_isalpc_device : public pci_device, public lpcbus_host_interface {
public:
mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id);
mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -69,6 +80,8 @@ public:
uint32_t acknowledge();
void debug_generate_irq(int irq, int state);
+ virtual void set_virtual_line(int line, int state) override;
+
DECLARE_READ32_MEMBER(acpi_r);
DECLARE_WRITE32_MEMBER(acpi_w);
DECLARE_WRITE8_MEMBER(boot_state_w);
@@ -100,6 +113,8 @@ private:
required_device<pic8259_device> pic8259_1;
required_device<pic8259_device> pic8259_2;
required_device<pit8254_device> pit8254;
+
+ lpcbus_device_interface *lpcdevices[16];
};
DECLARE_DEVICE_TYPE(MCPX_ISALPC, mcpx_isalpc_device)
diff --git a/src/mame/machine/xbox_pci.cpp b/src/mame/machine/xbox_pci.cpp
index b70b01dab1e..c45b3fe53ff 100644
--- a/src/mame/machine/xbox_pci.cpp
+++ b/src/mame/machine/xbox_pci.cpp
@@ -102,6 +102,9 @@ void mcpx_isalpc_device::map_extra(uint64_t memory_window_start, uint64_t memory
uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space)
{
io_space->install_device(0, 0xffff, *this, &mcpx_isalpc_device::internal_io_map);
+ for (int a = 0; a < 16; a++)
+ if (lpcdevices[a] != nullptr)
+ lpcdevices[a]->map_extra(memory_space, io_space);
}
mcpx_isalpc_device::mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subsystem_id)
@@ -127,6 +130,30 @@ void mcpx_isalpc_device::device_start()
m_boot_state_hook.resolve_safe();
add_map(0x00000100, M_IO, FUNC(mcpx_isalpc_device::lpc_io));
bank_infos[0].adr = 0x8000;
+ for (int a = 0; a < 16; a++)
+ lpcdevices[a] = nullptr;
+ for (device_t &d : subdevices())
+ {
+ const char *t = d.basetag();
+ int l = strlen(t);
+
+ if (l == 1)
+ {
+ int address = strtol(t + l, nullptr, 16);
+
+ address = address & 15;
+ if (lpcdevices[address] == nullptr)
+ {
+ lpcbus_device_interface *i = dynamic_cast<lpcbus_device_interface *>(&d);
+ lpcdevices[address] = i;
+ if (i)
+ i->set_host(address, this);
+ }
+ else
+ logerror("Duplicate address for LPC bus device with tag %s\n", t);
+ break;
+ }
+ }
}
void mcpx_isalpc_device::device_reset()
@@ -164,13 +191,21 @@ void mcpx_isalpc_device::device_add_mconfig(machine_config &config)
READ32_MEMBER(mcpx_isalpc_device::acpi_r)
{
- logerror("Acpi read from %04X mask %08X\n", bank_infos[0].adr + offset, mem_mask);
+ logerror("Acpi read from %04X mask %08X\n", bank_infos[0].adr + offset * 4, mem_mask);
return 0;
}
WRITE32_MEMBER(mcpx_isalpc_device::acpi_w)
{
- logerror("Acpi write %08X to %04X mask %08X\n", data, bank_infos[0].adr + offset, mem_mask);
+ // Seen using word registers at the following offsets
+ // 0x00 0x02 0x04 0x08 0x20 0x22 0x28 0xa0 0xa2 0xc0-0xd8
+ if ((offset == 0xb) && ACCESSING_BITS_16_23)
+ {
+ // SMI Command Port
+ // write to byte 0x2e must generate a SMI interrupt
+ logerror("Generate software SMI with value %02X\n", (data >> 16) & 0xff);
+ }
+ logerror("Acpi write %08X to %04X mask %08X\n", data, bank_infos[0].adr + offset * 4, mem_mask);
}
WRITE8_MEMBER(mcpx_isalpc_device::boot_state_w)
@@ -233,54 +268,64 @@ uint32_t mcpx_isalpc_device::acknowledge()
void mcpx_isalpc_device::debug_generate_irq(int irq, int state)
{
- switch (irq)
+ set_virtual_line(irq, state);
+}
+
+void mcpx_isalpc_device::set_virtual_line(int line, int state)
+{
+ if (line < 16)
{
- case 0:
- pic8259_1->ir0_w(state);
- break;
- case 1:
- pic8259_1->ir1_w(state);
- break;
- case 3:
- pic8259_1->ir3_w(state);
- break;
- case 4:
- pic8259_1->ir4_w(state);
- break;
- case 5:
- pic8259_1->ir5_w(state);
- break;
- case 6:
- pic8259_1->ir6_w(state);
- break;
- case 7:
- pic8259_1->ir7_w(state);
- break;
- case 8:
- pic8259_2->ir0_w(state);
- break;
- case 9:
- pic8259_2->ir1_w(state);
- break;
- case 10:
- pic8259_2->ir2_w(state);
- break;
- case 11:
- pic8259_2->ir3_w(state);
- break;
- case 12:
- pic8259_2->ir4_w(state);
- break;
- case 13:
- pic8259_2->ir5_w(state);
- break;
- case 14:
- pic8259_2->ir6_w(state);
- break;
- case 15:
- pic8259_2->ir7_w(state);
- break;
+ switch (line)
+ {
+ case 0:
+ pic8259_1->ir0_w(state);
+ break;
+ case 1:
+ pic8259_1->ir1_w(state);
+ break;
+ case 3:
+ pic8259_1->ir3_w(state);
+ break;
+ case 4:
+ pic8259_1->ir4_w(state);
+ break;
+ case 5:
+ pic8259_1->ir5_w(state);
+ break;
+ case 6:
+ pic8259_1->ir6_w(state);
+ break;
+ case 7:
+ pic8259_1->ir7_w(state);
+ break;
+ case 8:
+ pic8259_2->ir0_w(state);
+ break;
+ case 9:
+ pic8259_2->ir1_w(state);
+ break;
+ case 10:
+ pic8259_2->ir2_w(state);
+ break;
+ case 11:
+ pic8259_2->ir3_w(state);
+ break;
+ case 12:
+ pic8259_2->ir4_w(state);
+ break;
+ case 13:
+ pic8259_2->ir5_w(state);
+ break;
+ case 14:
+ pic8259_2->ir6_w(state);
+ break;
+ case 15:
+ pic8259_2->ir7_w(state);
+ break;
+ }
+ return;
}
+ //line = line - 16;
}
/*