mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
atpci.cpp: update usage of device finders and remove hardcoded cpu tags in chipset devices (nw)
This commit is contained in:
parent
4f5a836c89
commit
94341777f5
@ -38,7 +38,7 @@ i82371sb_device::i82371sb_device(const machine_config &mconfig, const char *tag,
|
||||
, m_apmc(0)
|
||||
, m_apms(0)
|
||||
, m_base(0)
|
||||
, m_maincpu(*this, ":maincpu")
|
||||
, m_cpu(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -250,7 +250,7 @@ void i82371sb_device::remap(int space_id, offs_t start, offs_t end)
|
||||
|
||||
void i82371sb_device::device_start()
|
||||
{
|
||||
address_space& spaceio = ((device_memory_interface *)m_maincpu.target())->memory().space(AS_IO);
|
||||
address_space& spaceio = m_cpu->space(AS_IO);
|
||||
|
||||
southbridge_device::device_start();
|
||||
m_ide_io_ports_enabled = false;
|
||||
|
@ -24,6 +24,9 @@ public:
|
||||
// construction/destruction
|
||||
i82371sb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
template <typename T>
|
||||
void set_cpu(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
auto smi() { return m_smi_callback.bind(); }
|
||||
auto boot_state_hook() { return m_boot_state_hook.bind(); }
|
||||
|
||||
@ -61,7 +64,7 @@ private:
|
||||
int m_apmc;
|
||||
int m_apms;
|
||||
uint32_t m_base;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_cpu;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -21,11 +21,9 @@ DEFINE_DEVICE_TYPE(I82439TX_LEGACY, i82439tx_device, "i82439tx_legacy", "Intel 8
|
||||
i82439tx_device::i82439tx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
northbridge_device(mconfig, I82439TX_LEGACY, tag, owner, clock),
|
||||
pci_device_interface(mconfig, *this),
|
||||
m_cpu_tag(nullptr),
|
||||
m_region_tag(nullptr),
|
||||
m_space(nullptr),
|
||||
m_rom(nullptr),
|
||||
m_cpu(*this, finder_base::DUMMY_TAG)
|
||||
m_rom(nullptr)
|
||||
{
|
||||
m_smram.smiact_n = 1;
|
||||
}
|
||||
@ -443,7 +441,7 @@ void i82439tx_device::device_start()
|
||||
{
|
||||
northbridge_device::device_start();
|
||||
// get address space we are working on
|
||||
m_space = &((device_memory_interface *)m_cpu.target())->memory().space(AS_PROGRAM);
|
||||
m_space = &m_cpu->space(AS_PROGRAM);
|
||||
|
||||
// get rom region
|
||||
m_rom = machine().root_device().memregion(m_region_tag)->base();
|
||||
|
@ -24,7 +24,6 @@ public:
|
||||
// construction/destruction
|
||||
i82439tx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
void set_cpu(const char *tag) { m_cpu_tag = tag; m_cpu.set_tag(m_cpu_tag); }
|
||||
void set_region(const char *tag) { m_region_tag = tag; }
|
||||
|
||||
virtual uint32_t pci_read(pci_bus_device *pcibus, int function, int offset, uint32_t mem_mask) override;
|
||||
@ -41,14 +40,11 @@ protected:
|
||||
void update_smram_mappings();
|
||||
|
||||
private:
|
||||
const char *m_cpu_tag;
|
||||
const char *m_region_tag;
|
||||
|
||||
address_space *m_space;
|
||||
uint8_t *m_rom;
|
||||
|
||||
required_device<cpu_device> m_cpu;
|
||||
|
||||
uint32_t m_regs[8*256];
|
||||
uint32_t m_bios_ram[0x40000 / 4];
|
||||
|
||||
|
@ -13,9 +13,9 @@
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
northbridge_device::northbridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
|
||||
northbridge_device::northbridge_device(const machine_config& mconfig, device_type type, const char* tag, device_t* owner, uint32_t clock)
|
||||
: device_t(mconfig, type, tag, owner, clock),
|
||||
m_maincpu(*this, ":maincpu"),
|
||||
m_cpu(*this, finder_base::DUMMY_TAG),
|
||||
m_ram(*this, ":" RAM_TAG)
|
||||
{
|
||||
}
|
||||
@ -26,7 +26,7 @@ northbridge_device::northbridge_device(const machine_config &mconfig, device_typ
|
||||
|
||||
void northbridge_device::device_start()
|
||||
{
|
||||
address_space& space = ((device_memory_interface *)m_maincpu.target())->memory().space(AS_PROGRAM);
|
||||
address_space &space = m_cpu->space(AS_PROGRAM);
|
||||
|
||||
machine().root_device().membank("bank10")->set_base(m_ram->pointer());
|
||||
|
||||
|
@ -16,6 +16,10 @@
|
||||
|
||||
class northbridge_device : public device_t
|
||||
{
|
||||
public:
|
||||
template <typename T>
|
||||
void set_cpu(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
protected:
|
||||
// construction/destruction
|
||||
northbridge_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
@ -24,7 +28,7 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_cpu;
|
||||
required_device<ram_device> m_ram;
|
||||
};
|
||||
|
||||
|
@ -29,9 +29,9 @@ protected:
|
||||
|
||||
DECLARE_WRITE8_MEMBER(boot_state_w);
|
||||
|
||||
static void tx_config(device_t *device);
|
||||
static void sb_config(device_t *device);
|
||||
static void superio_config(device_t *device);
|
||||
void tx_config(device_t *device);
|
||||
void sb_config(device_t *device);
|
||||
void superio_config(device_t *device);
|
||||
|
||||
void at586_io(address_map &map);
|
||||
void at586_map(address_map &map);
|
||||
@ -48,15 +48,16 @@ WRITE8_MEMBER(at586_state::boot_state_w)
|
||||
|
||||
void at586_state::tx_config(device_t *device)
|
||||
{
|
||||
downcast<i82439tx_device *>(device)->set_cpu(":maincpu");
|
||||
downcast<i82439tx_device *>(device)->set_cpu(m_maincpu);
|
||||
downcast<i82439tx_device *>(device)->set_region("isa");
|
||||
}
|
||||
|
||||
void at586_state::sb_config(device_t *device)
|
||||
{
|
||||
i82371sb_device &sb = *downcast<i82371sb_device *>(device);
|
||||
sb.set_cpu(m_maincpu);
|
||||
sb.boot_state_hook().set(":", FUNC(at586_state::boot_state_w));
|
||||
sb.smi().set_inputline(":maincpu", INPUT_LINE_SMI);
|
||||
sb.smi().set_inputline(m_maincpu, INPUT_LINE_SMI);
|
||||
}
|
||||
|
||||
|
||||
@ -64,8 +65,8 @@ void at586_state::superio_config(device_t *device)
|
||||
{
|
||||
fdc37c93x_device &fdc = *downcast<fdc37c93x_device *>(device);
|
||||
fdc.set_sysopt_pin(1);
|
||||
fdc.gp20_reset().set_inputline(":maincpu", INPUT_LINE_RESET);
|
||||
fdc.gp25_gatea20().set_inputline(":maincpu", INPUT_LINE_A20);
|
||||
fdc.gp20_reset().set_inputline(m_maincpu, INPUT_LINE_RESET);
|
||||
fdc.gp25_gatea20().set_inputline(m_maincpu, INPUT_LINE_A20);
|
||||
fdc.irq1().set(":pcibus:7:i82371sb:pic8259_master", FUNC(pic8259_device::ir1_w));
|
||||
}
|
||||
|
||||
@ -115,7 +116,7 @@ void at586_state::at586(machine_config &config)
|
||||
RAM(config, RAM_TAG).set_default_size("4M").set_extra_options("1M,2M,8M,16M,32M,64M,128M,256M");
|
||||
|
||||
PCI_BUS(config, "pcibus", 0).set_busnum(0);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", tx_config);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", [this](device_t *device) { tx_config(device); });
|
||||
PCI_CONNECTOR(config, "pcibus:1", pci_devices, "i82371ab", true);
|
||||
|
||||
// FIXME: determine ISA bus clock
|
||||
@ -139,8 +140,8 @@ void at586_state::at586x3(machine_config &config)
|
||||
RAM(config, RAM_TAG).set_default_size("4M").set_extra_options("1M,2M,8M,16M,32M,64M,128M,256M");
|
||||
|
||||
PCI_BUS(config, "pcibus", 0).set_busnum(0);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", tx_config);
|
||||
PCI_CONNECTOR(config, "pcibus:1", pci_devices, "i82371sb", true).set_option_machine_config("i82371sb", sb_config);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", [this](device_t *device) { tx_config(device); });
|
||||
PCI_CONNECTOR(config, "pcibus:1", pci_devices, "i82371sb", true).set_option_machine_config("i82371sb", [this](device_t *device) { sb_config(device); });
|
||||
|
||||
// FIXME: determine ISA bus clock
|
||||
ISA16_SLOT(config, "isa1", 0, "pcibus:1:i82371sb:isabus", pc_isa16_cards, "svga_et4k", false);
|
||||
@ -167,10 +168,10 @@ void at586_state::at586m55(machine_config &config)
|
||||
RAM(config, RAM_TAG).set_default_size("4M").set_extra_options("1M,2M,8M,16M,32M,64M,128M,256M");
|
||||
|
||||
PCI_BUS(config, "pcibus", 0).set_busnum(0);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", tx_config);
|
||||
PCI_CONNECTOR(config, "pcibus:7", pci_devices, "i82371sb", true).set_option_machine_config("i82371sb", sb_config);
|
||||
PCI_CONNECTOR(config, "pcibus:0", pci_devices, "i82439tx", true).set_option_machine_config("i82439tx", [this](device_t *device) { tx_config(device); });
|
||||
PCI_CONNECTOR(config, "pcibus:7", pci_devices, "i82371sb", true).set_option_machine_config("i82371sb", [this](device_t *device) { sb_config(device); });
|
||||
|
||||
ISA16_SLOT(config, "board4", 0, "pcibus:7:i82371sb:isabus", isa_internal_devices, "fdc37c93x", true).set_option_machine_config("fdc37c93x", superio_config);
|
||||
ISA16_SLOT(config, "board4", 0, "pcibus:7:i82371sb:isabus", isa_internal_devices, "fdc37c93x", true).set_option_machine_config("fdc37c93x", [this](device_t *device) { superio_config(device); });
|
||||
ISA16_SLOT(config, "isa1", 0, "pcibus:7:i82371sb:isabus", pc_isa16_cards, "svga_et4k", false);
|
||||
ISA16_SLOT(config, "isa2", 0, "pcibus:7:i82371sb:isabus", pc_isa16_cards, nullptr, false);
|
||||
ISA16_SLOT(config, "isa3", 0, "pcibus:7:i82371sb:isabus", pc_isa16_cards, nullptr, false);
|
||||
|
Loading…
Reference in New Issue
Block a user