mirror of
https://github.com/holub/mame
synced 2025-10-06 17:08:28 +03:00
xbox_pci.cpp: add simple interfaces for lpc bus devices (nw)
This commit is contained in:
parent
acc073745a
commit
a73650ea2a
@ -58,7 +58,18 @@ DECLARE_DEVICE_TYPE(NV2A_RAM, nv2a_ram_device)
|
|||||||
* LPC Bus
|
* 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:
|
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, uint32_t subsystem_id);
|
||||||
mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
mcpx_isalpc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||||
@ -69,6 +80,8 @@ public:
|
|||||||
uint32_t acknowledge();
|
uint32_t acknowledge();
|
||||||
void debug_generate_irq(int irq, int state);
|
void debug_generate_irq(int irq, int state);
|
||||||
|
|
||||||
|
virtual void set_virtual_line(int line, int state) override;
|
||||||
|
|
||||||
DECLARE_READ32_MEMBER(acpi_r);
|
DECLARE_READ32_MEMBER(acpi_r);
|
||||||
DECLARE_WRITE32_MEMBER(acpi_w);
|
DECLARE_WRITE32_MEMBER(acpi_w);
|
||||||
DECLARE_WRITE8_MEMBER(boot_state_w);
|
DECLARE_WRITE8_MEMBER(boot_state_w);
|
||||||
@ -100,6 +113,8 @@ private:
|
|||||||
required_device<pic8259_device> pic8259_1;
|
required_device<pic8259_device> pic8259_1;
|
||||||
required_device<pic8259_device> pic8259_2;
|
required_device<pic8259_device> pic8259_2;
|
||||||
required_device<pit8254_device> pit8254;
|
required_device<pit8254_device> pit8254;
|
||||||
|
|
||||||
|
lpcbus_device_interface *lpcdevices[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
DECLARE_DEVICE_TYPE(MCPX_ISALPC, mcpx_isalpc_device)
|
DECLARE_DEVICE_TYPE(MCPX_ISALPC, mcpx_isalpc_device)
|
||||||
|
@ -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)
|
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);
|
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)
|
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();
|
m_boot_state_hook.resolve_safe();
|
||||||
add_map(0x00000100, M_IO, FUNC(mcpx_isalpc_device::lpc_io));
|
add_map(0x00000100, M_IO, FUNC(mcpx_isalpc_device::lpc_io));
|
||||||
bank_infos[0].adr = 0x8000;
|
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()
|
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)
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE32_MEMBER(mcpx_isalpc_device::acpi_w)
|
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)
|
WRITE8_MEMBER(mcpx_isalpc_device::boot_state_w)
|
||||||
@ -233,7 +268,14 @@ uint32_t mcpx_isalpc_device::acknowledge()
|
|||||||
|
|
||||||
void mcpx_isalpc_device::debug_generate_irq(int irq, int state)
|
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)
|
||||||
|
{
|
||||||
|
switch (line)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
pic8259_1->ir0_w(state);
|
pic8259_1->ir0_w(state);
|
||||||
@ -281,6 +323,9 @@ void mcpx_isalpc_device::debug_generate_irq(int irq, int state)
|
|||||||
pic8259_2->ir7_w(state);
|
pic8259_2->ir7_w(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//line = line - 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user