diff options
Diffstat (limited to 'src/devices')
-rw-r--r-- | src/devices/bus/pci/geforce.cpp (renamed from src/devices/video/geforce.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/pci/geforce.h (renamed from src/devices/video/geforce.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/pci/mga2064w.cpp (renamed from src/devices/video/mga2064w.cpp) | 2 | ||||
-rw-r--r-- | src/devices/bus/pci/mga2064w.h (renamed from src/devices/video/mga2064w.h) | 4 | ||||
-rw-r--r-- | src/devices/bus/pci/pci_slot.cpp | 83 | ||||
-rw-r--r-- | src/devices/bus/pci/pci_slot.h | 76 | ||||
-rw-r--r-- | src/devices/bus/pci/riva128.cpp (renamed from src/devices/video/riva128.cpp) | 4 | ||||
-rw-r--r-- | src/devices/bus/pci/riva128.h (renamed from src/devices/video/riva128.h) | 4 | ||||
-rw-r--r-- | src/devices/bus/pci/rivatnt.cpp (renamed from src/devices/video/rivatnt.cpp) | 0 | ||||
-rw-r--r-- | src/devices/bus/pci/rivatnt.h (renamed from src/devices/video/rivatnt.h) | 0 | ||||
-rw-r--r-- | src/devices/bus/pci/sw1000xg.cpp | 42 | ||||
-rw-r--r-- | src/devices/bus/pci/sw1000xg.h | 28 | ||||
-rw-r--r-- | src/devices/bus/pci/virge_pci.cpp (renamed from src/devices/video/virge_pci.cpp) | 2 | ||||
-rw-r--r-- | src/devices/bus/pci/virge_pci.h (renamed from src/devices/video/virge_pci.h) | 4 | ||||
-rw-r--r-- | src/devices/machine/i82371sb.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/i82371sb.h | 5 | ||||
-rw-r--r-- | src/devices/machine/pci.cpp | 29 | ||||
-rw-r--r-- | src/devices/machine/pci.h | 1 |
18 files changed, 267 insertions, 21 deletions
diff --git a/src/devices/video/geforce.cpp b/src/devices/bus/pci/geforce.cpp index d420d881547..d420d881547 100644 --- a/src/devices/video/geforce.cpp +++ b/src/devices/bus/pci/geforce.cpp diff --git a/src/devices/video/geforce.h b/src/devices/bus/pci/geforce.h index d219516976a..d219516976a 100644 --- a/src/devices/video/geforce.h +++ b/src/devices/bus/pci/geforce.h diff --git a/src/devices/video/mga2064w.cpp b/src/devices/bus/pci/mga2064w.cpp index 1afbbbb4a8f..ce64c216ba0 100644 --- a/src/devices/video/mga2064w.cpp +++ b/src/devices/bus/pci/mga2064w.cpp @@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(MGA2064W, mga2064w_device, "mga2064w", "Matrox Millennium \"IS-STORM / MGA-2064W\"") mga2064w_device::mga2064w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : pci_device(mconfig, MGA2064W, tag, owner, clock) + : pci_card_device(mconfig, MGA2064W, tag, owner, clock) , device_memory_interface(mconfig, *this) , m_svga(*this, "svga") , m_vga_rom(*this, "vga_rom") diff --git a/src/devices/video/mga2064w.h b/src/devices/bus/pci/mga2064w.h index 762af85d1eb..f86b8c65d92 100644 --- a/src/devices/video/mga2064w.h +++ b/src/devices/bus/pci/mga2064w.h @@ -5,10 +5,10 @@ #pragma once -#include "machine/pci.h" +#include "pci_slot.h" #include "video/pc_vga_matrox.h" -class mga2064w_device : public pci_device, public device_memory_interface { +class mga2064w_device : public pci_card_device, public device_memory_interface { public: mga2064w_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/bus/pci/pci_slot.cpp b/src/devices/bus/pci/pci_slot.cpp new file mode 100644 index 00000000000..5496ee35b2e --- /dev/null +++ b/src/devices/bus/pci/pci_slot.cpp @@ -0,0 +1,83 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Generic PCI card port + +#include "emu.h" +#include "pci_slot.h" +#include "virge_pci.h" +#include "riva128.h" +#include "rivatnt.h" +#include "geforce.h" +#include "mga2064w.h" +#include "sw1000xg.h" + +DEFINE_DEVICE_TYPE(PCI_SLOT, pci_slot_device, "pci_slot", "PCI extension motherboard port") + +pci_slot_device::pci_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, PCI_SLOT, tag, owner, clock), + device_single_card_slot_interface<pci_card_interface>(mconfig, *this), + m_irq_cb(*this) +{ +} + +pci_slot_device::~pci_slot_device() +{ +} + +void pci_slot_device::device_start() +{ +} + +u8 pci_slot_device::get_slot() const +{ + return m_slot; +} + +pci_card_device *pci_slot_device::get_card() const +{ + return dynamic_cast<pci_card_device *>(get_card_device()); +} + +pci_card_interface::pci_card_interface(const machine_config &mconfig, device_t &device) : + device_interface(device, "pci_card"), + m_pci_slot(nullptr) +{ +} + +void pci_card_interface::interface_pre_start() +{ + m_pci_slot = downcast<pci_slot_device *>(device().owner()); +} + +void pci_card_interface::irq_w(offs_t line, u8 state) +{ +} + +pci_card_device::pci_card_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + pci_device(mconfig, type, tag, owner, clock), + pci_card_interface(mconfig, *this) +{ +} + +pci_card_device::~pci_card_device() +{ +} + +void pci_cards(device_slot_interface &device) +{ + device.option_add("virge", VIRGE_PCI); + device.option_add("virgedx", VIRGEDX_PCI); + device.option_add("riva128", RIVA128); + device.option_add("riva128zx", RIVA128ZX); + device.option_add("rivatnt", RIVATNT); + device.option_add("rivatnt2", RIVATNT2); + device.option_add("rivatnt2_ultra", RIVATNT2_ULTRA); + device.option_add("vanta", VANTA); + device.option_add("rivatnt2_m64", RIVATNT2_M64); + device.option_add("geforce256", GEFORCE256); + device.option_add("geforce256_ddr", GEFORCE256_DDR); + device.option_add("quadro", QUADRO); + device.option_add("mga2064w", MGA2064W); + device.option_add("sw1000xg", SW1000XG); +} diff --git a/src/devices/bus/pci/pci_slot.h b/src/devices/bus/pci/pci_slot.h new file mode 100644 index 00000000000..4ac7943887c --- /dev/null +++ b/src/devices/bus/pci/pci_slot.h @@ -0,0 +1,76 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +// Generic PCI card port + +#ifndef MAME_BUS_PCI_PCI_SLOT_H +#define MAME_BUS_PCI_PCI_SLOT_H + +#include "machine/pci.h" + +class pci_card_interface; + +class pci_slot_device: public device_t, public device_single_card_slot_interface<pci_card_interface> +{ +public: + friend class pci_card_interface; + + template <typename T> + pci_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&opts, u8 slot, u8 irqa, u8 irqb, u8 irqc, u8 irqd, const char *dflt) + : pci_slot_device(mconfig, tag, owner, (uint32_t)0) + { + option_reset(); + opts(*this); + set_default_option(dflt); + set_fixed(false); + m_slot = slot; + m_irq[0] = irqa; + m_irq[1] = irqb; + m_irq[2] = irqc; + m_irq[3] = irqd; + } + + pci_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); + + virtual ~pci_slot_device(); + + auto irq_cb() { return m_irq_cb.bind(); } + + u8 get_slot() const; + class pci_card_device *get_card() const; + + void irq_w(offs_t line, u8 state); + +protected: + virtual void device_start() override; + +private: + devcb_write8 m_irq_cb; + std::array<u8, 4> m_irq; + u8 m_slot; +}; + +class pci_card_interface : public device_interface +{ +public: + void irq_w(offs_t line, u8 state); + +protected: + pci_slot_device *m_pci_slot; + + pci_card_interface(const machine_config &mconfig, device_t &device); + virtual void interface_pre_start() override; +}; + +class pci_card_device : public pci_device, public pci_card_interface +{ +public: + pci_card_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + virtual ~pci_card_device(); +}; + +DECLARE_DEVICE_TYPE(PCI_SLOT, pci_slot_device) + +void pci_cards(device_slot_interface &device); + +#endif diff --git a/src/devices/video/riva128.cpp b/src/devices/bus/pci/riva128.cpp index f36885fd76c..0fef064e4e8 100644 --- a/src/devices/video/riva128.cpp +++ b/src/devices/bus/pci/riva128.cpp @@ -7,7 +7,7 @@ nVidia NV3/NV3T Riva 128 TODO: - Windows 98 punts device detection by attempting to modify the (supposedly) PMC ID. -\- Maybe the card is supposed to send an INTA trap on the write attempt? +- Maybe the card is supposed to send an INTA trap on the write attempt? References: - https://envytools.readthedocs.io/en/latest/hw/mmio.html?highlight=mmio#nv3-g80-mmio-map @@ -32,7 +32,7 @@ DEFINE_DEVICE_TYPE(RIVA128, riva128_device, "riva128", "SGS-Thompson/nVidi DEFINE_DEVICE_TYPE(RIVA128ZX, riva128zx_device, "riva128zx", "SGS-Thompson/nVidia Riva 128 ZX (NV3T)") riva128_device::riva128_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : pci_device(mconfig, type, tag, owner, clock) + : pci_card_device(mconfig, type, tag, owner, clock) , m_svga(*this, "svga") , m_vga_rom(*this, "vga_rom") { diff --git a/src/devices/video/riva128.h b/src/devices/bus/pci/riva128.h index ce03de39a68..b464cdbd464 100644 --- a/src/devices/video/riva128.h +++ b/src/devices/bus/pci/riva128.h @@ -6,10 +6,10 @@ #pragma once -#include "machine/pci.h" +#include "pci_slot.h" #include "video/pc_vga_nvidia.h" -class riva128_device : public pci_device +class riva128_device : public pci_card_device { public: riva128_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/devices/video/rivatnt.cpp b/src/devices/bus/pci/rivatnt.cpp index 2b24f969d5a..2b24f969d5a 100644 --- a/src/devices/video/rivatnt.cpp +++ b/src/devices/bus/pci/rivatnt.cpp diff --git a/src/devices/video/rivatnt.h b/src/devices/bus/pci/rivatnt.h index c7fb1bab99f..c7fb1bab99f 100644 --- a/src/devices/video/rivatnt.h +++ b/src/devices/bus/pci/rivatnt.h diff --git a/src/devices/bus/pci/sw1000xg.cpp b/src/devices/bus/pci/sw1000xg.cpp new file mode 100644 index 00000000000..ea724d14aec --- /dev/null +++ b/src/devices/bus/pci/sw1000xg.cpp @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "emu.h" +#include "sw1000xg.h" + +DEFINE_DEVICE_TYPE(SW1000XG, sw1000xg_device, "sw1000xg", "Yamaha SW1000XG") + +sw1000xg_device::sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : pci_card_device(mconfig, SW1000XG, tag, owner, clock) +{ + set_ids(0x10731000, 0x00, 0x040100, 0x10731000); +} + +void sw1000xg_device::device_start() +{ + pci_device::device_start(); + add_map(0x40000, M_MEM, FUNC(sw1000xg_device::map)); + intr_pin = 0x01; +} + +void sw1000xg_device::device_reset() +{ +} + +void sw1000xg_device::map(address_map &map) +{ + map(0x00000, 0x3ffff).rw(FUNC(sw1000xg_device::read), FUNC(sw1000xg_device::write)); +} + +u32 sw1000xg_device::read(offs_t offset, u32 mem_mask) +{ + logerror("ym read %05x %08x\n", offset*4, mem_mask); + return 0; +} + +void sw1000xg_device::write(offs_t offset, u32 data, u32 mem_mask) +{ + logerror("ym write %05x, %08x %08x\n", offset*4, data, mem_mask); +} + + diff --git a/src/devices/bus/pci/sw1000xg.h b/src/devices/bus/pci/sw1000xg.h new file mode 100644 index 00000000000..a09944ace0f --- /dev/null +++ b/src/devices/bus/pci/sw1000xg.h @@ -0,0 +1,28 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#ifndef MAME_SOUND_SW1000XG_H +#define MAME_SOUND_SW1000XG_H + +#pragma once + +#include "pci_slot.h" + +class sw1000xg_device : public pci_card_device { +public: + sw1000xg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + +private: + void map(address_map &map); + + u32 read(offs_t offset, u32 mem_mask); + void write(offs_t offset, u32 data, u32 mem_mask); +}; + +DECLARE_DEVICE_TYPE(SW1000XG, sw1000xg_device) + +#endif diff --git a/src/devices/video/virge_pci.cpp b/src/devices/bus/pci/virge_pci.cpp index cd5ea859a85..b38090603f3 100644 --- a/src/devices/video/virge_pci.cpp +++ b/src/devices/bus/pci/virge_pci.cpp @@ -13,7 +13,7 @@ virge_pci_device::virge_pci_device(const machine_config &mconfig, const char *ta } virge_pci_device::virge_pci_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : pci_device(mconfig, type, tag, owner, clock), + : pci_card_device(mconfig, type, tag, owner, clock), m_vga(*this, "vga"), m_bios(*this, "bios"), m_screen(*this, finder_base::DUMMY_TAG) diff --git a/src/devices/video/virge_pci.h b/src/devices/bus/pci/virge_pci.h index 51c902c871e..5533a2db14e 100644 --- a/src/devices/video/virge_pci.h +++ b/src/devices/bus/pci/virge_pci.h @@ -10,10 +10,10 @@ #pragma once -#include "machine/pci.h" +#include "pci_slot.h" #include "video/s3virge.h" -class virge_pci_device : public pci_device +class virge_pci_device : public pci_card_device { public: template <typename T> diff --git a/src/devices/machine/i82371sb.cpp b/src/devices/machine/i82371sb.cpp index 241a8ea8368..a1d1ed2c983 100644 --- a/src/devices/machine/i82371sb.cpp +++ b/src/devices/machine/i82371sb.cpp @@ -765,6 +765,10 @@ void i82371sb_isa_device::redirect_irq(int irq, int state) } } +void i82371sb_isa_device::pci_irq_w(offs_t line, u8 state) +{ +} + void i82371sb_isa_device::pc_pirqa_w(int state) { int irq = pirqrc[0] & 15; diff --git a/src/devices/machine/i82371sb.h b/src/devices/machine/i82371sb.h index e03dcf16ba8..c3b86ed7e5f 100644 --- a/src/devices/machine/i82371sb.h +++ b/src/devices/machine/i82371sb.h @@ -40,8 +40,9 @@ public: auto stpclk() { return m_stpclk_callback.bind(); } auto boot_state_hook() { return m_boot_state_hook.bind(); } - template <typename T> - void set_cpu_tag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); } + template <typename T> void set_cpu_tag(T &&tag) { m_maincpu.set_tag(std::forward<T>(tag)); } + + void pci_irq_w(offs_t line, u8 state); void pc_pirqa_w(int state); void pc_pirqb_w(int state); diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index 10433028f2a..c9d723c7dab 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -7,6 +7,7 @@ */ #include "emu.h" #include "pci.h" +#include "bus/pci/pci_slot.h" DEFINE_DEVICE_TYPE(PCI_ROOT, pci_root_device, "pci_root", "PCI virtual root") DEFINE_DEVICE_TYPE(PCI_BRIDGE, pci_bridge_device, "pci_bridge", "PCI-PCI Bridge") @@ -108,7 +109,7 @@ void pci_device::set_ids(uint32_t _main_id, uint8_t _revision, uint32_t _pclass, void pci_device::device_start() { - command = 0x0080; + command = 0x0000; command_mask = 0x01bf; status = 0x0000; @@ -509,13 +510,25 @@ void pci_bridge_device::device_start() for (device_t &d : bus_root()->subdevices()) { - const char *t = d.tag(); - int l = strlen(t); - if(l <= 4 || t[l-5] != ':' || t[l-2] != '.') - continue; - int id = strtol(t+l-4, nullptr, 16); - int fct = t[l-1] - '0'; - sub_devices[(id << 3) | fct] = downcast<pci_device *>(&d); + if(d.type() == PCI_SLOT) { + pci_slot_device &slot = downcast<pci_slot_device &>(d); + pci_device *card = slot.get_card(); + if(card) { + int id = slot.get_slot(); + sub_devices[id << 3] = card; + } + + } else { + const char *t = d.tag(); + int l = strlen(t); + if(l <= 4 || t[l-5] != ':' || t[l-2] != '.') { + logerror("Device %s unhandled\n", t); + continue; + } + int id = strtol(t+l-4, nullptr, 16); + int fct = t[l-1] - '0'; + sub_devices[(id << 3) | fct] = downcast<pci_device *>(&d); + } } mapper_cb cf_cb(&pci_bridge_device::regenerate_config_mapping, this); diff --git a/src/devices/machine/pci.h b/src/devices/machine/pci.h index 1bb75f52f67..0e0211411bf 100644 --- a/src/devices/machine/pci.h +++ b/src/devices/machine/pci.h @@ -5,7 +5,6 @@ #pragma once - class pci_device : public device_t { public: typedef delegate<void ()> mapper_cb; |