summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2014-11-03 17:00:25 +0100
committer Olivier Galibert <galibert@pobox.com>2014-11-05 13:28:48 +0100
commitf975ef079a135fe3bdc19c0a70cd41178ffff5d8 (patch)
tree02e852ce8692fbf66121a2225af04d033c3f3947
parent749dbb5f4a9faac3758c7d1eca09038e76007c03 (diff)
Experiments in PCI land [O. Galibert]
-rw-r--r--src/emu/bus/bus.mak26
-rw-r--r--src/emu/bus/lpci/cirrus.c (renamed from src/emu/bus/pci/cirrus.c)0
-rw-r--r--src/emu/bus/lpci/cirrus.h (renamed from src/emu/bus/pci/cirrus.h)2
-rw-r--r--src/emu/bus/lpci/i82371ab.c (renamed from src/emu/bus/pci/i82371ab.c)0
-rw-r--r--src/emu/bus/lpci/i82371ab.h (renamed from src/emu/bus/pci/i82371ab.h)0
-rw-r--r--src/emu/bus/lpci/i82371sb.c (renamed from src/emu/bus/pci/i82371sb.c)0
-rw-r--r--src/emu/bus/lpci/i82371sb.h (renamed from src/emu/bus/pci/i82371sb.h)0
-rw-r--r--src/emu/bus/lpci/i82439tx.c (renamed from src/emu/bus/pci/i82439tx.c)0
-rw-r--r--src/emu/bus/lpci/i82439tx.h (renamed from src/emu/bus/pci/i82439tx.h)0
-rw-r--r--src/emu/bus/lpci/mpc105.c (renamed from src/emu/bus/pci/mpc105.c)0
-rw-r--r--src/emu/bus/lpci/mpc105.h (renamed from src/emu/bus/pci/mpc105.h)0
-rw-r--r--src/emu/bus/lpci/northbridge.c (renamed from src/emu/bus/pci/northbridge.c)0
-rw-r--r--src/emu/bus/lpci/northbridge.h (renamed from src/emu/bus/pci/northbridge.h)0
-rw-r--r--src/emu/bus/lpci/pci.c (renamed from src/emu/bus/pci/pci.c)0
-rw-r--r--src/emu/bus/lpci/pci.h (renamed from src/emu/bus/pci/pci.h)0
-rw-r--r--src/emu/bus/lpci/southbridge.c (renamed from src/emu/bus/pci/southbridge.c)0
-rw-r--r--src/emu/bus/lpci/southbridge.h (renamed from src/emu/bus/pci/southbridge.h)0
-rw-r--r--src/emu/machine/i6300esb.c119
-rw-r--r--src/emu/machine/i6300esb.h60
-rw-r--r--src/emu/machine/i82541.c30
-rw-r--r--src/emu/machine/i82541.h27
-rw-r--r--src/emu/machine/i82875p.c71
-rw-r--r--src/emu/machine/i82875p.h52
-rw-r--r--src/emu/machine/lpci.c289
-rw-r--r--src/emu/machine/lpci.h81
-rw-r--r--src/emu/machine/machine.mak16
-rw-r--r--src/emu/machine/pci-apic.c18
-rw-r--r--src/emu/machine/pci-apic.h20
-rw-r--r--src/emu/machine/pci-sata.c44
-rw-r--r--src/emu/machine/pci-sata.h28
-rw-r--r--src/emu/machine/pci-smbus.c22
-rw-r--r--src/emu/machine/pci-smbus.h23
-rw-r--r--src/emu/machine/pci-usb.c42
-rw-r--r--src/emu/machine/pci-usb.h39
-rw-r--r--src/emu/machine/pci.c502
-rw-r--r--src/emu/machine/pci.h181
-rw-r--r--src/emu/sound/pci-ac97.c34
-rw-r--r--src/emu/sound/pci-ac97.h26
-rw-r--r--src/emu/sound/sb0400.c22
-rw-r--r--src/emu/sound/sb0400.h25
-rw-r--r--src/emu/sound/sound.mak30
-rw-r--r--src/emu/video/gf6800gt.c30
-rw-r--r--src/emu/video/gf6800gt.h25
-rw-r--r--src/emu/video/video.mak9
-rw-r--r--src/mame/drivers/calchase.c2
-rw-r--r--src/mame/drivers/chihiro.c2
-rw-r--r--src/mame/drivers/cobra.c2
-rw-r--r--src/mame/drivers/fruitpc.c2
-rw-r--r--src/mame/drivers/funkball.c2
-rw-r--r--src/mame/drivers/gamecstl.c2
-rw-r--r--src/mame/drivers/gammagic.c2
-rw-r--r--src/mame/drivers/lindbergh.c77
-rw-r--r--src/mame/drivers/magictg.c2
-rw-r--r--src/mame/drivers/mediagx.c2
-rw-r--r--src/mame/drivers/midqslvr.c2
-rw-r--r--src/mame/drivers/photoply.c2
-rw-r--r--src/mame/drivers/pinball2k.c2
-rw-r--r--src/mame/drivers/queen.c2
-rw-r--r--src/mame/drivers/savquest.c2
-rw-r--r--src/mame/drivers/taitowlf.c2
-rw-r--r--src/mame/drivers/viper.c2
-rw-r--r--src/mame/drivers/voyager.c2
-rw-r--r--src/mame/drivers/xtom3d.c2
-rw-r--r--src/mame/machine/segabb.c30
-rw-r--r--src/mame/machine/segabb.h27
-rw-r--r--src/mame/mame.mak8
-rw-r--r--src/mess/drivers/bebox.c6
-rw-r--r--src/mess/includes/at.h8
-rw-r--r--src/mess/machine/bebox.c4
-rw-r--r--src/mess/mess.mak4
70 files changed, 1719 insertions, 374 deletions
diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak
index 78180db84d4..9a7420d11a9 100644
--- a/src/emu/bus/bus.mak
+++ b/src/emu/bus/bus.mak
@@ -991,19 +991,19 @@ endif
#-------------------------------------------------
#
-#@src/emu/bus/pci/pci.h,BUSES += PCI
-#-------------------------------------------------
-
-ifneq ($(filter PCI,$(BUSES)),)
-OBJDIRS += $(BUSOBJ)/pci
-BUSOBJS += $(BUSOBJ)/pci/pci.o
-BUSOBJS += $(BUSOBJ)/pci/cirrus.o
-BUSOBJS += $(BUSOBJ)/pci/i82371ab.o
-BUSOBJS += $(BUSOBJ)/pci/i82371sb.o
-BUSOBJS += $(BUSOBJ)/pci/i82439tx.o
-BUSOBJS += $(BUSOBJ)/pci/northbridge.o
-BUSOBJS += $(BUSOBJ)/pci/southbridge.o
-BUSOBJS += $(BUSOBJ)/pci/mpc105.o
+#@src/emu/bus/lpci/pci.h,BUSES += LPCI
+#-------------------------------------------------
+
+ifneq ($(filter LPCI,$(BUSES)),)
+OBJDIRS += $(BUSOBJ)/lpci
+BUSOBJS += $(BUSOBJ)/lpci/pci.o
+BUSOBJS += $(BUSOBJ)/lpci/cirrus.o
+BUSOBJS += $(BUSOBJ)/lpci/i82371ab.o
+BUSOBJS += $(BUSOBJ)/lpci/i82371sb.o
+BUSOBJS += $(BUSOBJ)/lpci/i82439tx.o
+BUSOBJS += $(BUSOBJ)/lpci/northbridge.o
+BUSOBJS += $(BUSOBJ)/lpci/southbridge.o
+BUSOBJS += $(BUSOBJ)/lpci/mpc105.o
endif
#-------------------------------------------------
diff --git a/src/emu/bus/pci/cirrus.c b/src/emu/bus/lpci/cirrus.c
index ac001b09b74..ac001b09b74 100644
--- a/src/emu/bus/pci/cirrus.c
+++ b/src/emu/bus/lpci/cirrus.c
diff --git a/src/emu/bus/pci/cirrus.h b/src/emu/bus/lpci/cirrus.h
index 8a458039650..9027f6827e4 100644
--- a/src/emu/bus/pci/cirrus.h
+++ b/src/emu/bus/lpci/cirrus.h
@@ -9,7 +9,7 @@
#ifndef CIRRUS_H
#define CIRRUS_H
-#include "bus/pci/pci.h"
+#include "bus/lpci/pci.h"
// ======================> cirrus_device
diff --git a/src/emu/bus/pci/i82371ab.c b/src/emu/bus/lpci/i82371ab.c
index 649d1ed3b78..649d1ed3b78 100644
--- a/src/emu/bus/pci/i82371ab.c
+++ b/src/emu/bus/lpci/i82371ab.c
diff --git a/src/emu/bus/pci/i82371ab.h b/src/emu/bus/lpci/i82371ab.h
index c90468e0481..c90468e0481 100644
--- a/src/emu/bus/pci/i82371ab.h
+++ b/src/emu/bus/lpci/i82371ab.h
diff --git a/src/emu/bus/pci/i82371sb.c b/src/emu/bus/lpci/i82371sb.c
index 7d173663596..7d173663596 100644
--- a/src/emu/bus/pci/i82371sb.c
+++ b/src/emu/bus/lpci/i82371sb.c
diff --git a/src/emu/bus/pci/i82371sb.h b/src/emu/bus/lpci/i82371sb.h
index c9ccbff9a8c..c9ccbff9a8c 100644
--- a/src/emu/bus/pci/i82371sb.h
+++ b/src/emu/bus/lpci/i82371sb.h
diff --git a/src/emu/bus/pci/i82439tx.c b/src/emu/bus/lpci/i82439tx.c
index daa612c70ac..daa612c70ac 100644
--- a/src/emu/bus/pci/i82439tx.c
+++ b/src/emu/bus/lpci/i82439tx.c
diff --git a/src/emu/bus/pci/i82439tx.h b/src/emu/bus/lpci/i82439tx.h
index 3e8d1514e49..3e8d1514e49 100644
--- a/src/emu/bus/pci/i82439tx.h
+++ b/src/emu/bus/lpci/i82439tx.h
diff --git a/src/emu/bus/pci/mpc105.c b/src/emu/bus/lpci/mpc105.c
index 57b448bd49d..57b448bd49d 100644
--- a/src/emu/bus/pci/mpc105.c
+++ b/src/emu/bus/lpci/mpc105.c
diff --git a/src/emu/bus/pci/mpc105.h b/src/emu/bus/lpci/mpc105.h
index ae3f4f2b1cc..ae3f4f2b1cc 100644
--- a/src/emu/bus/pci/mpc105.h
+++ b/src/emu/bus/lpci/mpc105.h
diff --git a/src/emu/bus/pci/northbridge.c b/src/emu/bus/lpci/northbridge.c
index 83db12613b9..83db12613b9 100644
--- a/src/emu/bus/pci/northbridge.c
+++ b/src/emu/bus/lpci/northbridge.c
diff --git a/src/emu/bus/pci/northbridge.h b/src/emu/bus/lpci/northbridge.h
index 1f0600deaaf..1f0600deaaf 100644
--- a/src/emu/bus/pci/northbridge.h
+++ b/src/emu/bus/lpci/northbridge.h
diff --git a/src/emu/bus/pci/pci.c b/src/emu/bus/lpci/pci.c
index 1f13b78dfe4..1f13b78dfe4 100644
--- a/src/emu/bus/pci/pci.c
+++ b/src/emu/bus/lpci/pci.c
diff --git a/src/emu/bus/pci/pci.h b/src/emu/bus/lpci/pci.h
index 97d7b45d988..97d7b45d988 100644
--- a/src/emu/bus/pci/pci.h
+++ b/src/emu/bus/lpci/pci.h
diff --git a/src/emu/bus/pci/southbridge.c b/src/emu/bus/lpci/southbridge.c
index d6797fdef06..d6797fdef06 100644
--- a/src/emu/bus/pci/southbridge.c
+++ b/src/emu/bus/lpci/southbridge.c
diff --git a/src/emu/bus/pci/southbridge.h b/src/emu/bus/lpci/southbridge.h
index 1fde011f414..1fde011f414 100644
--- a/src/emu/bus/pci/southbridge.h
+++ b/src/emu/bus/lpci/southbridge.h
diff --git a/src/emu/machine/i6300esb.c b/src/emu/machine/i6300esb.c
new file mode 100644
index 00000000000..59fc013a226
--- /dev/null
+++ b/src/emu/machine/i6300esb.c
@@ -0,0 +1,119 @@
+#include "i6300esb.h"
+
+const device_type I6300ESB_WATCHDOG = &device_creator<i6300esb_watchdog_device>;
+const device_type I6300ESB_LPC = &device_creator<i6300esb_lpc_device>;
+
+DEVICE_ADDRESS_MAP_START(map, 32, i6300esb_watchdog_device)
+ADDRESS_MAP_END
+
+i6300esb_watchdog_device::i6300esb_watchdog_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, I6300ESB_WATCHDOG, "i6300ESB southbridge watchdog", tag, owner, clock, "i6300esb_watchdog", __FILE__)
+{
+}
+
+void i6300esb_watchdog_device::device_start()
+{
+ pci_device::device_start();
+ add_map(16, M_MEM, FUNC(i6300esb_watchdog_device::map));
+}
+
+void i6300esb_watchdog_device::device_reset()
+{
+ pci_device::device_reset();
+}
+
+
+DEVICE_ADDRESS_MAP_START(config_map, 32, i6300esb_lpc_device)
+ AM_RANGE(0x58, 0x5b) AM_READWRITE (gpio_base_r, gpio_base_w)
+ AM_RANGE(0x5c, 0x5f) AM_READWRITE8 (gpio_cntl_r, gpio_cntl_w, 0x000000ff)
+ AM_RANGE(0xe4, 0xe7) AM_READWRITE16(gen1_dec_r, gen1_dec_w, 0x0000ffff)
+ AM_RANGE(0xe4, 0xe7) AM_READWRITE16(lpc_en_r, lpc_en_w, 0xffff0000)
+ AM_RANGE(0xe8, 0xeb) AM_READWRITE (fwh_sel1_r, fwh_sel1_w)
+
+ AM_INHERIT_FROM(pci_device::config_map)
+ADDRESS_MAP_END
+
+
+i6300esb_lpc_device::i6300esb_lpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, I6300ESB_LPC, "i6300ESB southbridge ISA/LPC bridge", tag, owner, clock, "i6300esb_lpc", __FILE__)
+{
+}
+
+void i6300esb_lpc_device::device_start()
+{
+ pci_device::device_start();
+}
+
+void i6300esb_lpc_device::device_reset()
+{
+ pci_device::device_reset();
+ gpio_base = 0;
+ gpio_cntl = 0x00;
+ gen1_dec = 0x0000;
+ lpc_en = 0x0000;
+ fwh_sel1 = 0x00112233;
+}
+
+READ32_MEMBER (i6300esb_lpc_device::gpio_base_r)
+{
+ return gpio_base | 1;
+}
+
+WRITE32_MEMBER(i6300esb_lpc_device::gpio_base_w)
+{
+ COMBINE_DATA(&gpio_base);
+ gpio_base &= 0x0000ffc0;
+ logerror("%s: gpio_base = %08x\n", tag(), gpio_base);
+}
+
+READ8_MEMBER (i6300esb_lpc_device::gpio_cntl_r)
+{
+ return gpio_cntl;
+}
+
+WRITE8_MEMBER (i6300esb_lpc_device::gpio_cntl_w)
+{
+ COMBINE_DATA(&gpio_cntl);
+ logerror("%s: gpio_cntl = %02x\n", tag(), gpio_cntl);
+}
+
+READ16_MEMBER (i6300esb_lpc_device::gen1_dec_r)
+{
+ return gen1_dec;
+}
+
+WRITE16_MEMBER(i6300esb_lpc_device::gen1_dec_w)
+{
+ COMBINE_DATA(&gen1_dec);
+ logerror("%s: gen1_dec = %04x\n", tag(), gen1_dec);
+}
+
+READ16_MEMBER (i6300esb_lpc_device::lpc_en_r)
+{
+ return lpc_en;
+}
+
+WRITE16_MEMBER(i6300esb_lpc_device::lpc_en_w)
+{
+ COMBINE_DATA(&lpc_en);
+ logerror("%s: lpc_en = %04x\n", tag(), lpc_en);
+}
+
+READ32_MEMBER (i6300esb_lpc_device::fwh_sel1_r)
+{
+ return fwh_sel1;
+}
+
+WRITE32_MEMBER(i6300esb_lpc_device::fwh_sel1_w)
+{
+ COMBINE_DATA(&fwh_sel1);
+ logerror("%s: fwh_sel1 = %08x\n", tag(), fwh_sel1);
+}
+
+void i6300esb_lpc_device::map_extra(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)
+{
+ memory_space->install_rom(0xfff00000, 0xffffffff, m_region->base());
+ memory_space->install_rom(0x000f0000, 0x000fffff, m_region->base()+0xf0000);
+}
+
diff --git a/src/emu/machine/i6300esb.h b/src/emu/machine/i6300esb.h
new file mode 100644
index 00000000000..1749b6dcefb
--- /dev/null
+++ b/src/emu/machine/i6300esb.h
@@ -0,0 +1,60 @@
+// Intel i6300ESB southbridge
+
+#ifndef I6300ESB_H
+#define I6300ESB_H
+
+#include "pci.h"
+
+#define MCFG_I6300ESB_LPC_ADD(_tag) \
+ MCFG_PCI_DEVICE_ADD(_tag, I6300ESB_LPC, 0x808625a1, 0x02, 0x060100, 0x00000000)
+
+#define MCFG_I6300ESB_WATCHDOG_ADD(_tag, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, I6300ESB_WATCHDOG, 0x808625ab, 0x02, 0x088000, _subdevice_id)
+
+class i6300esb_lpc_device : public pci_device {
+public:
+ i6300esb_lpc_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ virtual void map_extra(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 DECLARE_ADDRESS_MAP(config_map, 32);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ UINT32 gpio_base, fwh_sel1;
+ UINT16 gen1_dec, lpc_en;
+ UINT8 gpio_cntl;
+
+ DECLARE_READ32_MEMBER (gpio_base_r); // 58
+ DECLARE_WRITE32_MEMBER(gpio_base_w);
+ DECLARE_READ8_MEMBER (gpio_cntl_r); // 5c
+ DECLARE_WRITE8_MEMBER (gpio_cntl_w);
+
+ DECLARE_READ16_MEMBER (gen1_dec_r); // e4
+ DECLARE_WRITE16_MEMBER(gen1_dec_w);
+ DECLARE_READ16_MEMBER (lpc_en_r); // e6
+ DECLARE_WRITE16_MEMBER(lpc_en_w);
+ DECLARE_READ32_MEMBER (fwh_sel1_r); // e8
+ DECLARE_WRITE32_MEMBER(fwh_sel1_w);
+};
+
+class i6300esb_watchdog_device : public pci_device {
+public:
+ i6300esb_watchdog_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map, 32);
+};
+
+extern const device_type I6300ESB_LPC;
+extern const device_type I6300ESB_WATCHDOG;
+
+#endif
diff --git a/src/emu/machine/i82541.c b/src/emu/machine/i82541.c
new file mode 100644
index 00000000000..e6d415c6dd7
--- /dev/null
+++ b/src/emu/machine/i82541.c
@@ -0,0 +1,30 @@
+#include "i82541.h"
+
+const device_type I82541 = &device_creator<i82541_device>;
+
+DEVICE_ADDRESS_MAP_START(registers_map, 32, i82541_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(flash_map, 32, i82541_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(registers_io_map, 32, i82541_device)
+ADDRESS_MAP_END
+
+i82541_device::i82541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, I82541, "I82541 ethernet controller", tag, owner, clock, "i82541", __FILE__)
+{
+}
+
+void i82541_device::device_start()
+{
+ pci_device::device_start();
+ add_map(128*1024, M_MEM, FUNC(i82541_device::registers_map));
+ add_map(128*1024, M_MEM, FUNC(i82541_device::flash_map));
+ add_map(32, M_IO, FUNC(i82541_device::registers_io_map));
+}
+
+void i82541_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/machine/i82541.h b/src/emu/machine/i82541.h
new file mode 100644
index 00000000000..eaf57e54f60
--- /dev/null
+++ b/src/emu/machine/i82541.h
@@ -0,0 +1,27 @@
+// Intel I82541 ethernet controller
+
+#ifndef I82541_H
+#define I82541_H
+
+#include "pci.h"
+
+#define MCFG_I82541PI_ADD(_tag, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, I82541, 0x8086107c, 0x05, 0x020000, _subdevice_id)
+
+class i82541_device : public pci_device {
+public:
+ i82541_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(registers_map, 32);
+ DECLARE_ADDRESS_MAP(flash_map, 32);
+ DECLARE_ADDRESS_MAP(registers_io_map, 32);
+};
+
+extern const device_type I82541;
+
+#endif
diff --git a/src/emu/machine/i82875p.c b/src/emu/machine/i82875p.c
new file mode 100644
index 00000000000..9df538d9209
--- /dev/null
+++ b/src/emu/machine/i82875p.c
@@ -0,0 +1,71 @@
+#include "i82875p.h"
+
+const device_type I82875P_HOST = &device_creator<i82875p_host_device>;
+const device_type I82875P_AGP = &device_creator<i82875p_agp_device>;
+
+DEVICE_ADDRESS_MAP_START(agp_translation_map, 32, i82875p_host_device)
+ADDRESS_MAP_END
+
+i82875p_host_device::i82875p_host_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_host_device(mconfig, I82875P_HOST, "i82875p northbridge", tag, owner, clock, "i82875p_host", __FILE__)
+{
+}
+
+void i82875p_host_device::set_cpu_tag(const char *_cpu_tag)
+{
+ cpu_tag = _cpu_tag;
+}
+
+void i82875p_host_device::set_ram_size(int _ram_size)
+{
+ ram_size = _ram_size;
+}
+
+void i82875p_host_device::device_start()
+{
+ pci_host_device::device_start();
+ cpu = machine().device<cpu_device>(cpu_tag);
+ memory_space = &cpu->space(AS_PROGRAM);
+ io_space = &cpu->space(AS_IO);
+
+ memory_window_start = 0;
+ memory_window_end = 0xffffffff;
+ memory_offset = 0;
+ io_window_start = 0;
+ io_window_end = 0xffff;
+ io_offset = 0;
+
+ ram.resize(ram_size/4);
+
+ // Resizeable with the apsize register
+ add_map(256*1024*1024, M_MEM, FUNC(i82875p_host_device::agp_translation_map));
+}
+
+void i82875p_host_device::device_reset()
+{
+ pci_host_device::device_reset();
+}
+
+void i82875p_host_device::map_extra(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)
+{
+ io_space->install_device(0, 0xffff, *static_cast<pci_host_device *>(this), &pci_host_device::io_configuration_access_map);
+}
+
+
+
+
+i82875p_agp_device::i82875p_agp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : agp_bridge_device(mconfig, I82875P_AGP, "i82875p AGP bridge", tag, owner, clock, "i82875p_agp", __FILE__)
+{
+}
+
+void i82875p_agp_device::device_start()
+{
+ agp_bridge_device::device_start();
+}
+
+void i82875p_agp_device::device_reset()
+{
+ agp_bridge_device::device_reset();
+}
diff --git a/src/emu/machine/i82875p.h b/src/emu/machine/i82875p.h
new file mode 100644
index 00000000000..2f3d67f7570
--- /dev/null
+++ b/src/emu/machine/i82875p.h
@@ -0,0 +1,52 @@
+// Intel i82875p northbridge
+
+#ifndef I82875P_H
+#define I82875P_H
+
+#include "pci.h"
+
+#define MCFG_I82875P_HOST_ADD(_tag, _subdevice_id, _cpu_tag, _ram_size) \
+ MCFG_PCI_HOST_ADD(_tag, I82875P_HOST, 0x80862578, 0x02, _subdevice_id) \
+ downcast<i82875p_host_device *>(device)->set_cpu_tag(_cpu_tag); \
+ downcast<i82875p_host_device *>(device)->set_ram_size(_ram_size);
+
+#define MCFG_I82875P_AGP_ADD(_tag) \
+ MCFG_AGP_BRIDGE_ADD(_tag, I82875P_AGP, 0x80862579, 0x02)
+
+class i82875p_host_device : public pci_host_device {
+public:
+ i82875p_host_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ void set_cpu_tag(const char *tag);
+ void set_ram_size(int ram_size);
+
+ virtual void map_extra(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);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(agp_translation_map, 32);
+
+ const char *cpu_tag;
+ int ram_size;
+ cpu_device *cpu;
+ dynamic_array<UINT32> ram;
+};
+
+class i82875p_agp_device : public agp_bridge_device {
+public:
+ i82875p_agp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+};
+
+extern const device_type I82875P_HOST;
+extern const device_type I82875P_AGP;
+
+
+#endif
diff --git a/src/emu/machine/lpci.c b/src/emu/machine/lpci.c
new file mode 100644
index 00000000000..03eff2d5d6e
--- /dev/null
+++ b/src/emu/machine/lpci.c
@@ -0,0 +1,289 @@
+/***************************************************************************
+
+ machine/lpci.c
+
+ Legacy PCI bus
+
+ The PCI bus is a 32-bit bus introduced by Intel, so it is little endian
+
+ Control word:
+ bit 31: Enable bit
+ bits 30-24: Reserved
+ bits 23-16: PCI bus number
+ bits 15-11: PCI device number
+ bits 10- 8: PCI function number
+ bits 7- 0: Offset address
+
+ Standard PCI registers:
+ 0x00 2 Vendor ID
+ 0x02 2 Device ID
+ 0x04 2 PCI Command
+ 0x06 2 PCI Status
+ 0x08 1 Revision ID
+ 0x09 1 Programming Interface
+ 0x0A 1 Subclass Code
+ 0x0B 1 Class Code
+
+ Class Code/Subclass Code/Programming Interface
+ 0x00XXXX Pre-PCI 2.0 devices
+ 0x000000 Non-VGA device
+ 0x000101 VGA device
+ 0x01XXXX Storage Controller
+ 0x010000 SCSI
+ 0x0101XX IDE
+ 0x0102XX Floppy
+ 0x0103XX IPI
+ 0x0104XX RAID
+ 0x0180XX Other
+ 0x02XXXX Network Card
+ 0x020000 Ethernet
+ 0x020100 Tokenring
+ 0x020200 FDDI
+ 0x020300 ATM
+ 0x028000 Other
+ 0x03XXXX Display Controller
+ 0x030000 VGA
+ 0x030001 8514 Compatible
+ 0x030100 XGA
+ 0x038000 Other
+ 0x04XXXX Multimedia
+ 0x040000 Video
+ 0x040100 Audio
+ 0x048000 Other
+ 0x05XXXX Memory Controller
+ 0x050000 RAM
+ 0x050100 Flash
+ 0x058000 Other
+ 0x06XXXX Bridge
+ 0x060000 Host/PCI
+ 0x060100 PCI/ISA
+ 0x060200 PCI/EISA
+ 0x060300 PCI/Micro Channel
+ 0x060400 PCI/PCI
+ 0x060500 PCI/PCMCIA
+ 0x060600 PCI/NuBus
+ 0x060700 PCI/CardBus
+ 0x068000 Other
+
+ Information on PCI vendors can be found at http://www.pcidatabase.com/
+
+***************************************************************************/
+
+#include "emu.h"
+#include "machine/lpci.h"
+
+#define LOG_PCI 0
+
+//**************************************************************************
+// GLOBAL VARIABLES
+//**************************************************************************
+
+const device_type PCI_BUS_LEGACY = &device_creator<pci_bus_legacy_device>;
+
+//**************************************************************************
+// LIVE DEVICE
+//**************************************************************************
+
+//-------------------------------------------------
+// pci_bus_legacy_device - constructor
+//-------------------------------------------------
+pci_bus_legacy_device::pci_bus_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+ device_t(mconfig, PCI_BUS_LEGACY, "PCI Bus Legacy", tag, owner, clock, "pci_bus_legacy", __FILE__),
+ m_father(NULL)
+{
+ for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++) {
+ m_devtag[i]= NULL;
+ m_read_callback[i] = NULL;
+ m_write_callback[i] = NULL;
+ }
+ m_siblings_count = 0;
+}
+
+/***************************************************************************
+ INLINE FUNCTIONS
+***************************************************************************/
+
+READ32_MEMBER( pci_bus_legacy_device::read )
+{
+ UINT32 result = 0xffffffff;
+ int function, reg;
+
+ offset %= 2;
+
+ switch (offset)
+ {
+ case 0:
+ result = m_address;
+ break;
+
+ case 1:
+ if (m_devicenum != -1)
+ {
+ pci_read_func read = m_busnumaddr->m_read_callback[m_devicenum];
+ if (read != NULL)
+ {
+ function = (m_address >> 8) & 0x07;
+ reg = (m_address >> 0) & 0xfc;
+ result = (*read)(m_busnumaddr, m_busnumaddr->m_device[m_devicenum], function, reg, mem_mask);
+ }
+ }
+ break;
+ }
+
+ if (LOG_PCI)
+ logerror("read('%s'): offset=%d result=0x%08X\n", tag(), offset, result);
+
+ return result;
+}
+
+
+
+pci_bus_legacy_device *pci_bus_legacy_device::pci_search_bustree(int busnum, int devicenum, pci_bus_legacy_device *pcibus)
+{
+ int a;
+ pci_bus_legacy_device *ret;
+
+ if (pcibus->m_busnum == busnum)
+ {
+ return pcibus;
+ }
+ for (a = 0; a < pcibus->m_siblings_count; a++)
+ {
+ ret = pci_search_bustree(busnum, devicenum, pcibus->m_siblings[a]);
+ if (ret != NULL)
+ return ret;
+ }
+ return NULL;
+}
+
+
+
+WRITE32_MEMBER( pci_bus_legacy_device::write )
+{
+ offset %= 2;
+
+ if (LOG_PCI)
+ logerror("write('%s'): offset=%d data=0x%08X\n", tag(), offset, data);
+
+ switch (offset)
+ {
+ case 0:
+ m_address = data;
+
+ /* lookup current device */
+ if (m_address & 0x80000000)
+ {
+ int busnum = (m_address >> 16) & 0xff;
+ int devicenum = (m_address >> 11) & 0x1f;
+ m_busnumaddr = pci_search_bustree(busnum, devicenum, this);
+ if (m_busnumaddr != NULL)
+ {
+ m_busnumber = busnum;
+ m_devicenum = devicenum;
+ }
+ else
+ m_devicenum = -1;
+ if (LOG_PCI)
+ logerror(" bus:%d device:%d\n", busnum, devicenum);
+ }
+ break;
+
+ case 1:
+ if (m_devicenum != -1)
+ {
+ pci_write_func write = m_busnumaddr->m_write_callback[m_devicenum];
+ if (write != NULL)
+ {
+ int function = (m_address >> 8) & 0x07;
+ int reg = (m_address >> 0) & 0xfc;
+ (*write)(m_busnumaddr, m_busnumaddr->m_device[m_devicenum], function, reg, data, mem_mask);
+ }
+ if (LOG_PCI)
+ logerror(" function:%d register:%d\n", (m_address >> 8) & 0x07, (m_address >> 0) & 0xfc);
+ }
+ break;
+ }
+}
+
+
+
+READ64_MEMBER(pci_bus_legacy_device::read_64be)
+{
+ UINT64 result = 0;
+ mem_mask = FLIPENDIAN_INT64(mem_mask);
+ if (ACCESSING_BITS_0_31)
+ result |= (UINT64)read(space, offset * 2 + 0, mem_mask >> 0) << 0;
+ if (ACCESSING_BITS_32_63)
+ result |= (UINT64)read(space, offset * 2 + 1, mem_mask >> 32) << 32;
+ return FLIPENDIAN_INT64(result);
+}
+
+WRITE64_MEMBER(pci_bus_legacy_device::write_64be)
+{
+ data = FLIPENDIAN_INT64(data);
+ mem_mask = FLIPENDIAN_INT64(mem_mask);
+ if (ACCESSING_BITS_0_31)
+ write(space, offset * 2 + 0, data >> 0, mem_mask >> 0);
+ if (ACCESSING_BITS_32_63)
+ write(space, offset * 2 + 1, data >> 32, mem_mask >> 32);
+}
+
+
+void pci_bus_legacy_device::add_sibling(pci_bus_legacy_device *sibling, int busnum)
+{
+ m_siblings[m_siblings_count] = sibling;
+ m_siblings_busnum[m_siblings_count] = busnum;
+ m_siblings_count++;
+}
+
+
+//-------------------------------------------------
+// device_post_load - handle updating after a
+// restore
+//-------------------------------------------------
+
+void pci_bus_legacy_device::device_post_load()
+{
+ if (m_devicenum != -1)
+ {
+ m_busnumaddr = pci_search_bustree(m_busnumber, m_devicenum, this);
+ }
+}
+
+//-------------------------------------------------
+// device_start - device-specific startup
+//-------------------------------------------------
+
+void pci_bus_legacy_device::device_start()
+{
+ /* store a pointer back to the device */
+ m_devicenum = -1;
+
+ /* find all our devices */
+ for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++)
+ if (m_devtag[i] != NULL)
+ m_device[i] = machine().device(m_devtag[i]);
+
+ if (m_father != NULL) {
+ pci_bus_legacy_device *father = machine().device<pci_bus_legacy_device>(m_father);
+ if (father)
+ father->add_sibling(this, m_busnum);
+ }
+
+ /* register pci states */
+ save_item(NAME(m_address));
+ save_item(NAME(m_devicenum));
+ save_item(NAME(m_busnum));
+}
+
+
+//-------------------------------------------------
+// device_reset - device-specific reset
+//-------------------------------------------------
+
+void pci_bus_legacy_device::device_reset()
+{
+ /* reset the drive state */
+ m_devicenum = -1;
+ m_address = 0;
+}
diff --git a/src/emu/machine/lpci.h b/src/emu/machine/lpci.h
new file mode 100644
index 00000000000..f3c47a6a82c
--- /dev/null
+++ b/src/emu/machine/lpci.h
@@ -0,0 +1,81 @@
+/***************************************************************************
+
+ machine/lpci.h
+
+ Legacy PCI bus
+
+***************************************************************************/
+
+#ifndef LPCI_H
+#define LPCI_H
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+typedef UINT32 (*pci_read_func)(device_t *pcibus, device_t *device, int function, int reg, UINT32 mem_mask);
+typedef void (*pci_write_func)(device_t *pcibus, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask);
+
+// ======================> pci_bus_legacy_device
+
+class pci_bus_legacy_device : public device_t
+{
+public:
+ // construction/destruction
+ pci_bus_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ DECLARE_READ32_MEMBER( read );
+ DECLARE_WRITE32_MEMBER( write );
+
+ DECLARE_READ64_MEMBER( read_64be );
+ DECLARE_WRITE64_MEMBER( write_64be );
+
+ void set_busnum(int busnum) { m_busnum = busnum; }
+ void set_father(const char *father) { m_father = father; }
+ void set_device(int num, const char *tag, pci_read_func read_func, pci_write_func write_func) {
+ m_devtag[num] = tag; m_read_callback[num] = read_func; m_write_callback[num] = write_func; }
+
+ pci_bus_legacy_device *pci_search_bustree(int busnum, int devicenum, pci_bus_legacy_device *pcibus);
+ void add_sibling(pci_bus_legacy_device *sibling, int busnum);
+
+protected:
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+ virtual void device_post_load();
+
+private:
+ UINT8 m_busnum;
+ const char * m_devtag[32];
+ pci_read_func m_read_callback[32];
+ pci_write_func m_write_callback[32];
+ const char * m_father;
+ device_t * m_device[32];
+ pci_bus_legacy_device * m_siblings[8];
+ UINT8 m_siblings_busnum[8];
+ int m_siblings_count;
+
+ offs_t m_address;
+ INT8 m_devicenum; // device number we are addressing
+ INT8 m_busnumber; // pci bus number we are addressing
+ pci_bus_legacy_device * m_busnumaddr; // pci bus we are addressing
+};
+
+// device type definition
+extern const device_type PCI_BUS_LEGACY;
+
+
+/***************************************************************************
+ DEVICE CONFIGURATION MACROS
+***************************************************************************/
+
+#define MCFG_PCI_BUS_LEGACY_ADD(_tag, _busnum) \
+ MCFG_DEVICE_ADD(_tag, PCI_BUS_LEGACY, 0) \
+ downcast<pci_bus_legacy_device *>(device)->set_busnum(_busnum);
+#define MCFG_PCI_BUS_LEGACY_DEVICE(_devnum, _devtag, _configread, _configwrite) \
+ downcast<pci_bus_legacy_device *>(device)->set_device(_devnum, _devtag,_configread,_configwrite);
+#define MCFG_PCI_BUS_LEGACY_SIBLING(_father_tag) \
+ downcast<pci_bus_legacy_device *>(device)->set_father(_father_tag);
+
+
+#endif /* PCI_H */
diff --git a/src/emu/machine/machine.mak b/src/emu/machine/machine.mak
index dc8bca8373a..98ffdd4c8b1 100644
--- a/src/emu/machine/machine.mak
+++ b/src/emu/machine/machine.mak
@@ -1221,11 +1221,27 @@ endif
#-------------------------------------------------
#
+#@src/emu/machine/lpci.h,MACHINES += LPCI
+#-------------------------------------------------
+
+ifneq ($(filter LPCI,$(MACHINES)),)
+MACHINEOBJS += $(MACHINEOBJ)/lpci.o
+endif
+
+#-------------------------------------------------
+#
#@src/emu/machine/pci.h,MACHINES += PCI
#-------------------------------------------------
ifneq ($(filter PCI,$(MACHINES)),)
MACHINEOBJS += $(MACHINEOBJ)/pci.o
+MACHINEOBJS += $(MACHINEOBJ)/pci-usb.o
+MACHINEOBJS += $(MACHINEOBJ)/pci-sata.o
+MACHINEOBJS += $(MACHINEOBJ)/pci-apic.o
+MACHINEOBJS += $(MACHINEOBJ)/pci-smbus.o
+MACHINEOBJS += $(MACHINEOBJ)/i82541.o
+MACHINEOBJS += $(MACHINEOBJ)/i82875p.o
+MACHINEOBJS += $(MACHINEOBJ)/i6300esb.o
endif
#-------------------------------------------------
diff --git a/src/emu/machine/pci-apic.c b/src/emu/machine/pci-apic.c
new file mode 100644
index 00000000000..7b61167d1d4
--- /dev/null
+++ b/src/emu/machine/pci-apic.c
@@ -0,0 +1,18 @@
+#include "pci-apic.h"
+
+const device_type APIC = &device_creator<apic_device>;
+
+apic_device::apic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, APIC, "I/O Advanced Programmable Interrupt Controller", tag, owner, clock, "apic", __FILE__)
+{
+}
+
+void apic_device::device_start()
+{
+ pci_device::device_start();
+}
+
+void apic_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/machine/pci-apic.h b/src/emu/machine/pci-apic.h
new file mode 100644
index 00000000000..30e4f900185
--- /dev/null
+++ b/src/emu/machine/pci-apic.h
@@ -0,0 +1,20 @@
+#ifndef PCI_APIC_H
+#define PCI_APIC_H
+
+#include "pci.h"
+
+#define MCFG_APIC_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, APIC, _main_id, _revision, 0x0c0320, _subdevice_id)
+
+class apic_device : public pci_device {
+public:
+ apic_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+};
+
+extern const device_type APIC;
+
+#endif
diff --git a/src/emu/machine/pci-sata.c b/src/emu/machine/pci-sata.c
new file mode 100644
index 00000000000..55980ee20fe
--- /dev/null
+++ b/src/emu/machine/pci-sata.c
@@ -0,0 +1,44 @@
+#include "pci-sata.h"
+
+const device_type SATA = &device_creator<sata_device>;
+
+sata_device::sata_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, SATA, "SATA AHCI interface", tag, owner, clock, "sata", __FILE__)
+{
+}
+
+DEVICE_ADDRESS_MAP_START(primary_command_map, 32, sata_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(primary_control_map, 32, sata_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(secondary_command_map, 32, sata_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(secondary_control_map, 32, sata_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(bus_master_map, 32, sata_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(ide_command_posting_map, 32, sata_device)
+ADDRESS_MAP_END
+
+
+void sata_device::device_start()
+{
+ pci_device::device_start();
+
+ add_map(8, M_IO, FUNC(sata_device::primary_command_map));
+ add_map(4, M_IO, FUNC(sata_device::primary_control_map));
+ add_map(8, M_IO, FUNC(sata_device::secondary_command_map));
+ add_map(4, M_IO, FUNC(sata_device::secondary_control_map));
+ add_map(16, M_IO, FUNC(sata_device::bus_master_map));
+ add_map(1024, M_MEM, FUNC(sata_device::ide_command_posting_map));
+}
+
+void sata_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/machine/pci-sata.h b/src/emu/machine/pci-sata.h
new file mode 100644
index 00000000000..baf2e96aada
--- /dev/null
+++ b/src/emu/machine/pci-sata.h
@@ -0,0 +1,28 @@
+#ifndef PCI_SATA_H
+#define PCI_SATA_H
+
+#include "pci.h"
+
+#define MCFG_SATA_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, SATA, _main_id, _revision, 0x01018a, _subdevice_id)
+
+class sata_device : public pci_device {
+public:
+ sata_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(primary_command_map, 32);
+ DECLARE_ADDRESS_MAP(primary_control_map, 32);
+ DECLARE_ADDRESS_MAP(secondary_command_map, 32);
+ DECLARE_ADDRESS_MAP(secondary_control_map, 32);
+ DECLARE_ADDRESS_MAP(bus_master_map, 32);
+ DECLARE_ADDRESS_MAP(ide_command_posting_map, 32);
+};
+
+extern const device_type SATA;
+
+#endif
diff --git a/src/emu/machine/pci-smbus.c b/src/emu/machine/pci-smbus.c
new file mode 100644
index 00000000000..bc631951808
--- /dev/null
+++ b/src/emu/machine/pci-smbus.c
@@ -0,0 +1,22 @@
+#include "pci-smbus.h"
+
+const device_type SMBUS = &device_creator<smbus_device>;
+
+DEVICE_ADDRESS_MAP_START(map, 32, smbus_device)
+ADDRESS_MAP_END
+
+smbus_device::smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, SMBUS, "SMBUS interface", tag, owner, clock, "smbus", __FILE__)
+{
+}
+
+void smbus_device::device_start()
+{
+ pci_device::device_start();
+ add_map(32, M_IO, FUNC(smbus_device::map));
+}
+
+void smbus_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/machine/pci-smbus.h b/src/emu/machine/pci-smbus.h
new file mode 100644
index 00000000000..90c06aebee1
--- /dev/null
+++ b/src/emu/machine/pci-smbus.h
@@ -0,0 +1,23 @@
+#ifndef PCI_SMBUS_H
+#define PCI_SMBUS_H
+
+#include "pci.h"
+
+#define MCFG_SMBUS_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, SMBUS, _main_id, _revision, 0x0c0500, _subdevice_id)
+
+class smbus_device : public pci_device {
+public:
+ smbus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map, 32);
+};
+
+extern const device_type SMBUS;
+
+#endif
diff --git a/src/emu/machine/pci-usb.c b/src/emu/machine/pci-usb.c
new file mode 100644
index 00000000000..b7bc2d96556
--- /dev/null
+++ b/src/emu/machine/pci-usb.c
@@ -0,0 +1,42 @@
+#include "pci-usb.h"
+
+const device_type USB_UHCI = &device_creator<usb_uhci_device>;
+const device_type USB_EHCI = &device_creator<usb_ehci_device>;
+
+DEVICE_ADDRESS_MAP_START(map, 32, usb_uhci_device)
+ADDRESS_MAP_END
+
+usb_uhci_device::usb_uhci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, USB_UHCI, "USB 1.1 UHCI interface", tag, owner, clock, "usb_uhci", __FILE__)
+{
+}
+
+void usb_uhci_device::device_start()
+{
+ pci_device::device_start();
+ add_map(32, M_IO, FUNC(usb_uhci_device::map));
+}
+
+void usb_uhci_device::device_reset()
+{
+ pci_device::device_reset();
+}
+
+DEVICE_ADDRESS_MAP_START(map, 32, usb_ehci_device)
+ADDRESS_MAP_END
+
+usb_ehci_device::usb_ehci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, USB_EHCI, "USB 2.0 EHCI interface", tag, owner, clock, "usb_ehci", __FILE__)
+{
+}
+
+void usb_ehci_device::device_start()
+{
+ pci_device::device_start();
+ add_map(1024, M_MEM, FUNC(usb_ehci_device::map));
+}
+
+void usb_ehci_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/machine/pci-usb.h b/src/emu/machine/pci-usb.h
new file mode 100644
index 00000000000..5cc6c931031
--- /dev/null
+++ b/src/emu/machine/pci-usb.h
@@ -0,0 +1,39 @@
+#ifndef PCI_USB_H
+#define PCI_USB_H
+
+#include "pci.h"
+
+#define MCFG_USB_UHCI_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, USB_UHCI, _main_id, _revision, 0x0c0300, _subdevice_id)
+
+#define MCFG_USB_EHCI_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, USB_EHCI, _main_id, _revision, 0x0c0320, _subdevice_id)
+
+class usb_uhci_device : public pci_device {
+public:
+ usb_uhci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map, 32);
+};
+
+class usb_ehci_device : public pci_device {
+public:
+ usb_ehci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map, 32);
+};
+
+extern const device_type USB_UHCI;
+extern const device_type USB_EHCI;
+
+#endif
diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c
index ae611d67cae..0d1fdc72e30 100644
--- a/src/emu/machine/pci.c
+++ b/src/emu/machine/pci.c
@@ -1,289 +1,291 @@
-/***************************************************************************
-
- machine/pci.c
-
- PCI bus
-
- The PCI bus is a 32-bit bus introduced by Intel, so it is little endian
-
- Control word:
- bit 31: Enable bit
- bits 30-24: Reserved
- bits 23-16: PCI bus number
- bits 15-11: PCI device number
- bits 10- 8: PCI function number
- bits 7- 0: Offset address
-
- Standard PCI registers:
- 0x00 2 Vendor ID
- 0x02 2 Device ID
- 0x04 2 PCI Command
- 0x06 2 PCI Status
- 0x08 1 Revision ID
- 0x09 1 Programming Interface
- 0x0A 1 Subclass Code
- 0x0B 1 Class Code
-
- Class Code/Subclass Code/Programming Interface
- 0x00XXXX Pre-PCI 2.0 devices
- 0x000000 Non-VGA device
- 0x000101 VGA device
- 0x01XXXX Storage Controller
- 0x010000 SCSI
- 0x0101XX IDE
- 0x0102XX Floppy
- 0x0103XX IPI
- 0x0104XX RAID
- 0x0180XX Other
- 0x02XXXX Network Card
- 0x020000 Ethernet
- 0x020100 Tokenring
- 0x020200 FDDI
- 0x020300 ATM
- 0x028000 Other
- 0x03XXXX Display Controller
- 0x030000 VGA
- 0x030001 8514 Compatible
- 0x030100 XGA
- 0x038000 Other
- 0x04XXXX Multimedia
- 0x040000 Video
- 0x040100 Audio
- 0x048000 Other
- 0x05XXXX Memory Controller
- 0x050000 RAM
- 0x050100 Flash
- 0x058000 Other
- 0x06XXXX Bridge
- 0x060000 Host/PCI
- 0x060100 PCI/ISA
- 0x060200 PCI/EISA
- 0x060300 PCI/Micro Channel
- 0x060400 PCI/PCI
- 0x060500 PCI/PCMCIA
- 0x060600 PCI/NuBus
- 0x060700 PCI/CardBus
- 0x068000 Other
-
- Information on PCI vendors can be found at http://www.pcidatabase.com/
-
-***************************************************************************/
-
-#include "emu.h"
-#include "machine/pci.h"
-
-#define LOG_PCI 0
-
-//**************************************************************************
-// GLOBAL VARIABLES
-//**************************************************************************
-
-const device_type PCI_BUS_LEGACY = &device_creator<pci_bus_legacy_device>;
-
-//**************************************************************************
-// LIVE DEVICE
-//**************************************************************************
-
-//-------------------------------------------------
-// pci_bus_legacy_device - constructor
-//-------------------------------------------------
-pci_bus_legacy_device::pci_bus_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
- device_t(mconfig, PCI_BUS_LEGACY, "PCI Bus Legacy", tag, owner, clock, "pci_bus_legacy", __FILE__),
- m_father(NULL)
-{
- for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++) {
- m_devtag[i]= NULL;
- m_read_callback[i] = NULL;
- m_write_callback[i] = NULL;
- }
- m_siblings_count = 0;
-}
-
-/***************************************************************************
- INLINE FUNCTIONS
-***************************************************************************/
-
-READ32_MEMBER( pci_bus_legacy_device::read )
-{
- UINT32 result = 0xffffffff;
- int function, reg;
-
- offset %= 2;
-
- switch (offset)
- {
- case 0:
- result = m_address;
- break;
-
- case 1:
- if (m_devicenum != -1)
- {
- pci_read_func read = m_busnumaddr->m_read_callback[m_devicenum];
- if (read != NULL)
- {
- function = (m_address >> 8) & 0x07;
- reg = (m_address >> 0) & 0xfc;
- result = (*read)(m_busnumaddr, m_busnumaddr->m_device[m_devicenum], function, reg, mem_mask);
- }
- }
- break;
- }
+#include "pci.h"
- if (LOG_PCI)
- logerror("read('%s'): offset=%d result=0x%08X\n", tag(), offset, result);
+const device_type PCI_ROOT = &device_creator<pci_root_device>;
+const device_type PCI_BRIDGE = &device_creator<pci_bridge_device>;
- return result;
+DEVICE_ADDRESS_MAP_START(config_map, 32, pci_device)
+ADDRESS_MAP_END
+
+pci_device::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)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+{
+ main_id = 0xffffffff;
+ revision = 0x00;
+ pclass = 0xffffff;
+ subdevice_id = 0xffffffff;
}
+void pci_device::set_ids(UINT32 _main_id, UINT8 _revision, UINT32 _pclass, UINT32 _subdevice_id)
+{
+ main_id = _main_id;
+ revision = _revision;
+ pclass = _pclass;
+ subdevice_id = _subdevice_id;
+}
+void pci_device::device_start()
+{
+}
-pci_bus_legacy_device *pci_bus_legacy_device::pci_search_bustree(int busnum, int devicenum, pci_bus_legacy_device *pcibus)
+void pci_device::device_reset()
{
- int a;
- pci_bus_legacy_device *ret;
+}
- if (pcibus->m_busnum == busnum)
- {
- return pcibus;
- }
- for (a = 0; a < pcibus->m_siblings_count; a++)
- {
- ret = pci_search_bustree(busnum, devicenum, pcibus->m_siblings[a]);
- if (ret != NULL)
- return ret;
- }
- return NULL;
-}
-
-
-
-WRITE32_MEMBER( pci_bus_legacy_device::write )
-{
- offset %= 2;
-
- if (LOG_PCI)
- logerror("write('%s'): offset=%d data=0x%08X\n", tag(), offset, data);
-
- switch (offset)
- {
- case 0:
- m_address = data;
-
- /* lookup current device */
- if (m_address & 0x80000000)
- {
- int busnum = (m_address >> 16) & 0xff;
- int devicenum = (m_address >> 11) & 0x1f;
- m_busnumaddr = pci_search_bustree(busnum, devicenum, this);
- if (m_busnumaddr != NULL)
- {
- m_busnumber = busnum;
- m_devicenum = devicenum;
- }
- else
- m_devicenum = -1;
- if (LOG_PCI)
- logerror(" bus:%d device:%d\n", busnum, devicenum);
- }
- break;
-
- case 1:
- if (m_devicenum != -1)
- {
- pci_write_func write = m_busnumaddr->m_write_callback[m_devicenum];
- if (write != NULL)
- {
- int function = (m_address >> 8) & 0x07;
- int reg = (m_address >> 0) & 0xfc;
- (*write)(m_busnumaddr, m_busnumaddr->m_device[m_devicenum], function, reg, data, mem_mask);
- }
- if (LOG_PCI)
- logerror(" function:%d register:%d\n", (m_address >> 8) & 0x07, (m_address >> 0) & 0xfc);
- }
- break;
- }
+void pci_device::scan_sub_devices(pci_device **devices, dynamic_array<pci_device *> &all, dynamic_array<pci_device *> &bridges, device_t *root)
+{
}
+void pci_device::reset_all_mappings()
+{
+}
+void pci_device::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)
+{
+ map_extra(memory_window_start, memory_window_end, memory_offset, memory_space,
+ io_window_start, io_window_end, io_offset, io_space);
+}
-READ64_MEMBER(pci_bus_legacy_device::read_64be)
+void pci_device::map_extra(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)
{
- UINT64 result = 0;
- mem_mask = FLIPENDIAN_INT64(mem_mask);
- if (ACCESSING_BITS_0_31)
- result |= (UINT64)read(space, offset * 2 + 0, mem_mask >> 0) << 0;
- if (ACCESSING_BITS_32_63)
- result |= (UINT64)read(space, offset * 2 + 1, mem_mask >> 32) << 32;
- return FLIPENDIAN_INT64(result);
}
-WRITE64_MEMBER(pci_bus_legacy_device::write_64be)
+void pci_device::map_config(UINT8 device, address_space *config_space)
{
- data = FLIPENDIAN_INT64(data);
- mem_mask = FLIPENDIAN_INT64(mem_mask);
- if (ACCESSING_BITS_0_31)
- write(space, offset * 2 + 0, data >> 0, mem_mask >> 0);
- if (ACCESSING_BITS_32_63)
- write(space, offset * 2 + 1, data >> 32, mem_mask >> 32);
+ config_space->install_device(device << 12, (device << 12) | 0xfff, *this, &pci_device::config_map);
}
+void pci_device::add_map(UINT64 size, int flags, address_map_delegate &map)
+{
+ logerror("Device %s (%s) has 0x%llx bytes of %s named %s\n", tag(), name(), size, flags & M_IO ? "io" : "memory", map.name());
+}
-void pci_bus_legacy_device::add_sibling(pci_bus_legacy_device *sibling, int busnum)
+agp_device::agp_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)
+ : pci_device(mconfig, type, name, tag, owner, clock, shortname, source)
{
- m_siblings[m_siblings_count] = sibling;
- m_siblings_busnum[m_siblings_count] = busnum;
- m_siblings_count++;
+}
+
+void agp_device::device_start()
+{
+ pci_device::device_start();
+}
+
+void agp_device::device_reset()
+{
+ pci_device::device_reset();
}
-//-------------------------------------------------
-// device_post_load - handle updating after a
-// restore
-//-------------------------------------------------
-void pci_bus_legacy_device::device_post_load()
+pci_bridge_device::pci_bridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, PCI_BRIDGE, "PCI-PCI Bridge", tag, owner, clock, "pci_bridge", __FILE__),
+ device_memory_interface(mconfig, *this),
+ configure_space_config("configuration_space", ENDIANNESS_LITTLE, 32, 20)
{
- if (m_devicenum != -1)
- {
- m_busnumaddr = pci_search_bustree(m_busnumber, m_devicenum, this);
- }
}
-//-------------------------------------------------
-// device_start - device-specific startup
-//-------------------------------------------------
+pci_bridge_device::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)
+ : pci_device(mconfig, type, name, tag, owner, clock, shortname, source),
+ device_memory_interface(mconfig, *this),
+ configure_space_config("configuration_space", ENDIANNESS_LITTLE, 32, 20)
+{
+}
-void pci_bus_legacy_device::device_start()
+const address_space_config *pci_bridge_device::memory_space_config(address_spacenum spacenum) const
{
- /* store a pointer back to the device */
- m_devicenum = -1;
+ return spacenum == AS_PROGRAM ? &configure_space_config : NULL;
+}
- /* find all our devices */
- for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++)
- if (m_devtag[i] != NULL)
- m_device[i] = machine().device(m_devtag[i]);
+device_t *pci_bridge_device::bus_root()
+{
+ return this;
+}
- if (m_father != NULL) {
- pci_bus_legacy_device *father = machine().device<pci_bus_legacy_device>(m_father);
- if (father)
- father->add_sibling(this, m_busnum);
+void pci_bridge_device::device_start()
+{
+ pci_device::device_start();
+
+ for(int i=0; i<32*8; i++)
+ sub_devices[i] = NULL;
+
+ for(device_t *d = bus_root()->first_subdevice(); d != NULL; d = d->next()) {
+ if(d == this)
+ continue;
+ 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, 0, 16);
+ int fct = t[l-1] - '0';
+ sub_devices[(id << 3) | fct] = downcast<pci_device *>(d);
}
+ for(int i=0; i<32*8; i++)
+ if(sub_devices[i]) {
+ all_devices.append(sub_devices[i]);
+ pci_bridge_device *bridge = dynamic_cast<pci_bridge_device *>(sub_devices[i]);
+ if(bridge)
+ all_bridges.append(bridge);
+ }
+}
+
+void pci_bridge_device::device_reset()
+{
+ pci_device::device_reset();
+ regenerate_config_mapping();
+}
+
+void pci_bridge_device::reset_all_mappings()
+{
+ for(int i=0; i != all_devices.count(); i++)
+ all_devices[i]->reset_all_mappings();
+}
+
+
+void pci_bridge_device::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)
+{
+ for(int i = all_devices.count()-1; i>=0; i--)
+ all_devices[i]->map_device(memory_window_start, memory_window_end, memory_offset, memory_space,
+ io_window_start, io_window_end, io_offset, io_space);
+
+ map_extra(memory_window_start, memory_window_end, memory_offset, memory_space,
+ io_window_start, io_window_end, io_offset, io_space);
+}
+
+
+void pci_bridge_device::regenerate_config_mapping()
+{
+ address_space *config_space = &space(AS_PROGRAM);
+ config_space->unmap_readwrite(0x00000, 0xfffff);
+ for(int i=0; i<32*8; i++)
+ if(sub_devices[i])
+ sub_devices[i]->map_config(i, config_space);
+}
+
+
+agp_bridge_device::agp_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)
+ : pci_bridge_device(mconfig, type, name, tag, owner, clock, shortname, source)
+{
+}
- /* register pci states */
- save_item(NAME(m_address));
- save_item(NAME(m_devicenum));
- save_item(NAME(m_busnum));
+void agp_bridge_device::device_start()
+{
+ pci_bridge_device::device_start();
+}
+
+void agp_bridge_device::device_reset()
+{
+ pci_bridge_device::device_reset();
+}
+
+
+
+DEVICE_ADDRESS_MAP_START(io_configuration_access_map, 32, pci_host_device)
+ AM_RANGE(0xcf8, 0xcfb) AM_READWRITE(config_address_r, config_address_w)
+ AM_RANGE(0xcfc, 0xcff) AM_READWRITE(config_data_r, config_data_w)
+ADDRESS_MAP_END
+
+
+pci_host_device::pci_host_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)
+ : pci_bridge_device(mconfig, type, name, tag, owner, clock, shortname, source)
+{
+}
+
+device_t *pci_host_device::bus_root()
+{
+ return owner();
+}
+
+void pci_host_device::device_start()
+{
+ pci_bridge_device::device_start();
+
+ memory_window_start = memory_window_end = memory_offset = 0;
+ io_window_start = io_window_end = io_offset = 0;
+}
+
+void pci_host_device::device_reset()
+{
+ pci_bridge_device::device_reset();
+ for(int i=0; i != all_devices.count(); i++)
+ all_devices[i]->reset_all_mappings();
+ regenerate_mapping();
+
+ config_address = 0;
+}
+
+void pci_host_device::regenerate_mapping()
+{
+ memory_space->unmap_readwrite(memory_window_start, memory_window_end);
+ io_space->unmap_readwrite(io_window_start, io_window_end);
+
+ map_device(memory_window_start, memory_window_end, memory_offset, memory_space,
+ io_window_start, io_window_end, io_offset, io_space);
}
+void pci_host_device::regenerate_config_mapping()
+{
+ pci_bridge_device::regenerate_config_mapping();
+ map_config(0, &space(AS_PROGRAM));
+}
+
+READ32_MEMBER(pci_host_device::config_address_r)
+{
+ return config_address;
+}
+
+WRITE32_MEMBER(pci_host_device::config_address_w)
+{
+ COMBINE_DATA(&config_address);
+}
+
+READ32_MEMBER(pci_host_device::config_data_r)
+{
+ return config_address & 0x80000000 ? config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff;
+}
+
+WRITE32_MEMBER(pci_host_device::config_data_w)
+{
+ if(config_address & 0x80000000)
+ config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask);
+}
+
+UINT32 pci_host_device::config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask)
+{
+ UINT32 data = 0xffffffff;
+ if(!bus) {
+ if(sub_devices[device]) {
+ data = space(AS_PROGRAM).read_dword((device << 12) | reg, mem_mask);
+ logerror("config_read %02x:%02x.%x:%02x %08x @ %08x\n", bus, device >> 3, device & 7, reg, data, mem_mask);
+ }
+ } else
+ abort();
+
+ return data;
+}
+
+void pci_host_device::config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask)
+{
+ if(!bus) {
+ if(sub_devices[device]) {
+ space(AS_PROGRAM).write_dword((device << 12) | reg, data, mem_mask);
+ logerror("config_write %02x:%02x.%x:%02x %08x @ %08x\n", bus, device >> 3, device & 7, reg, data, mem_mask);
+ }
+ } else
+ abort();
+}
-//-------------------------------------------------
-// device_reset - device-specific reset
-//-------------------------------------------------
-void pci_bus_legacy_device::device_reset()
+pci_root_device::pci_root_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : device_t(mconfig, PCI_ROOT,"PCI virtual root", tag, owner, clock, "pci_root", __FILE__)
+{
+}
+
+void pci_root_device::device_start()
+{
+}
+
+void pci_root_device::device_reset()
{
- /* reset the drive state */
- m_devicenum = -1;
- m_address = 0;
}
diff --git a/src/emu/machine/pci.h b/src/emu/machine/pci.h
index c878ebd2d71..a2e48ddc7e8 100644
--- a/src/emu/machine/pci.h
+++ b/src/emu/machine/pci.h
@@ -1,81 +1,152 @@
-/***************************************************************************
+#ifndef PCI_H
+#define PCI_H
- machine/pci.h
+#include "emu.h"
- PCI bus
+#define MCFG_PCI_ROOT_ADD(_tag) \
+ MCFG_DEVICE_ADD(_tag, PCI_ROOT, 0)
-***************************************************************************/
+#define MCFG_PCI_DEVICE_ADD(_tag, _type, _main_id, _revision, _pclass, _subdevice_id) \
+ MCFG_DEVICE_ADD(_tag, _type, 0) \
+ downcast<pci_device *>(device)->set_ids(_main_id, _revision, _pclass, _subdevice_id);
-#ifndef PCI_H
-#define PCI_H
+#define MCFG_AGP_DEVICE_ADD(_tag, _type, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, _type, _main_id, _revision, 0x030000, _subdevice_id)
-//**************************************************************************
-// TYPE DEFINITIONS
-//**************************************************************************
+#define MCFG_PCI_HOST_ADD(_tag, _type, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, _type, _main_id, _revision, 0x060000, _subdevice_id)
-typedef UINT32 (*pci_read_func)(device_t *pcibus, device_t *device, int function, int reg, UINT32 mem_mask);
-typedef void (*pci_write_func)(device_t *pcibus, device_t *device, int function, int reg, UINT32 data, UINT32 mem_mask);
+#define MCFG_PCI_BRIDGE_ADD(_tag, _main_id, _revision) \
+ MCFG_PCI_DEVICE_ADD(_tag, PCI_BRIDGE, _main_id, _revision, 0x060400, 0x00000000)
-// ======================> pci_bus_legacy_device
+#define MCFG_AGP_BRIDGE_ADD(_tag, _type, _main_id, _revision) \
+ MCFG_PCI_DEVICE_ADD(_tag, _type, _main_id, _revision, 0x060400, 0x00000000)
-class pci_bus_legacy_device : public device_t
-{
+class pci_device : public device_t {
public:
- // construction/destruction
- pci_bus_legacy_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+ 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);
- DECLARE_READ32_MEMBER( read );
- DECLARE_WRITE32_MEMBER( write );
+ void set_ids(UINT32 main_id, UINT8 revision, UINT32 pclass, UINT32 subdevice_id);
- DECLARE_READ64_MEMBER( read_64be );
- DECLARE_WRITE64_MEMBER( write_64be );
+ 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);
+ virtual void map_extra(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);
- void set_busnum(int busnum) { m_busnum = busnum; }
- void set_father(const char *father) { m_father = father; }
- void set_device(int num, const char *tag, pci_read_func read_func, pci_write_func write_func) {
- m_devtag[num] = tag; m_read_callback[num] = read_func; m_write_callback[num] = write_func; }
+ void map_config(UINT8 device, address_space *config_space);
- pci_bus_legacy_device *pci_search_bustree(int busnum, int devicenum, pci_bus_legacy_device *pcibus);
- void add_sibling(pci_bus_legacy_device *sibling, int busnum);
+ virtual DECLARE_ADDRESS_MAP(config_map, 32);
protected:
- // device-level overrides
+ enum {
+ M_MEM = 0,
+ M_IO = 1,
+ M_64D = 2,
+ M_64A = 4,
+ M_PREF = 8
+ };
+
+ UINT32 main_id, subdevice_id;
+ UINT32 pclass;
+ UINT8 revision;
+
virtual void device_start();
virtual void device_reset();
- virtual void device_post_load();
+
+ static void scan_sub_devices(pci_device **devices, dynamic_array<pci_device *> &all, dynamic_array<pci_device *> &bridges, device_t *root);
+
+ void add_map(UINT64 size, int flags, address_map_delegate &map);
+ template <typename T> void add_map(UINT64 size, int flags, void (T::*map)(address_map &map, device_t &device), const char *name) {
+ address_map_delegate delegate(map, name, static_cast<T *>(this));
+ add_map(size, flags, delegate);
+ }
+};
+
+class agp_device : public pci_device {
+public:
+ agp_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);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+};
+
+class pci_bridge_device : public pci_device, public device_memory_interface {
+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 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();
+
+protected:
+ pci_device *sub_devices[32*8];
+ dynamic_array<pci_device *> all_devices;
+ dynamic_array<pci_device *> all_bridges;
+
+ virtual void device_start();
+ virtual void device_reset();
+ virtual const address_space_config *memory_space_config(address_spacenum spacenum) const;
+
+ virtual device_t *bus_root();
+ virtual void regenerate_config_mapping();
private:
- UINT8 m_busnum;
- const char * m_devtag[32];
- pci_read_func m_read_callback[32];
- pci_write_func m_write_callback[32];
- const char * m_father;
- device_t * m_device[32];
- pci_bus_legacy_device * m_siblings[8];
- UINT8 m_siblings_busnum[8];
- int m_siblings_count;
-
- offs_t m_address;
- INT8 m_devicenum; // device number we are addressing
- INT8 m_busnumber; // pci bus number we are addressing
- pci_bus_legacy_device * m_busnumaddr; // pci bus we are addressing
+ address_space_config configure_space_config;
};
-// device type definition
-extern const device_type PCI_BUS_LEGACY;
+class agp_bridge_device : public pci_bridge_device {
+public:
+ agp_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);
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+};
+
+class pci_host_device : public pci_bridge_device {
+public:
+ DECLARE_ADDRESS_MAP(io_configuration_access_map, 32);
+
+ pci_host_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);
+
+protected:
+ address_space *memory_space, *io_space;
+
+ UINT64 memory_window_start, memory_window_end, memory_offset;
+ UINT64 io_window_start, io_window_end, io_offset;
+
+ virtual void device_start();
+ virtual void device_reset();
+
+ virtual device_t *bus_root();
+
+ UINT32 config_address;
+
+ DECLARE_READ32_MEMBER(config_address_r);
+ DECLARE_WRITE32_MEMBER(config_address_w);
+ DECLARE_READ32_MEMBER(config_data_r);
+ DECLARE_WRITE32_MEMBER(config_data_w);
+
+ UINT32 config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask);
+ void config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask);
+
+ void regenerate_mapping();
+ virtual void regenerate_config_mapping();
+};
-/***************************************************************************
- DEVICE CONFIGURATION MACROS
-***************************************************************************/
+class pci_root_device : public device_t {
+public:
+ pci_root_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
-#define MCFG_PCI_BUS_LEGACY_ADD(_tag, _busnum) \
- MCFG_DEVICE_ADD(_tag, PCI_BUS_LEGACY, 0) \
- downcast<pci_bus_legacy_device *>(device)->set_busnum(_busnum);
-#define MCFG_PCI_BUS_LEGACY_DEVICE(_devnum, _devtag, _configread, _configwrite) \
- downcast<pci_bus_legacy_device *>(device)->set_device(_devnum, _devtag,_configread,_configwrite);
-#define MCFG_PCI_BUS_LEGACY_SIBLING(_father_tag) \
- downcast<pci_bus_legacy_device *>(device)->set_father(_father_tag);
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+};
+extern const device_type PCI_ROOT;
+extern const device_type PCI_BRIDGE;
-#endif /* PCI_H */
+#endif
diff --git a/src/emu/sound/pci-ac97.c b/src/emu/sound/pci-ac97.c
new file mode 100644
index 00000000000..6890b6add73
--- /dev/null
+++ b/src/emu/sound/pci-ac97.c
@@ -0,0 +1,34 @@
+#include "pci-ac97.h"
+
+const device_type AC97 = &device_creator<ac97_device>;
+
+DEVICE_ADDRESS_MAP_START(native_audio_mixer_map, 32, ac97_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(native_audio_bus_mastering_map, 32, ac97_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(mixer_map, 32, ac97_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(bus_mastering_map, 32, ac97_device)
+ADDRESS_MAP_END
+
+ac97_device::ac97_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, AC97, "AC97 audio", tag, owner, clock, "ac97", __FILE__)
+{
+}
+
+void ac97_device::device_start()
+{
+ pci_device::device_start();
+ add_map(256, M_IO, FUNC(ac97_device::native_audio_mixer_map));
+ add_map(64, M_IO, FUNC(ac97_device::native_audio_bus_mastering_map));
+ add_map(512, M_MEM, FUNC(ac97_device::mixer_map));
+ add_map(256, M_MEM, FUNC(ac97_device::bus_mastering_map));
+}
+
+void ac97_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/sound/pci-ac97.h b/src/emu/sound/pci-ac97.h
new file mode 100644
index 00000000000..ffe7c8165df
--- /dev/null
+++ b/src/emu/sound/pci-ac97.h
@@ -0,0 +1,26 @@
+#ifndef PCI_AC97_H
+#define PCI_AC97_H
+
+#include "machine/pci.h"
+
+#define MCFG_AC97_ADD(_tag, _main_id, _revision, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, AC97, _main_id, _revision, 0x040300, _subdevice_id)
+
+class ac97_device : public pci_device {
+public:
+ ac97_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(native_audio_mixer_map, 32);
+ DECLARE_ADDRESS_MAP(native_audio_bus_mastering_map, 32);
+ DECLARE_ADDRESS_MAP(mixer_map, 32);
+ DECLARE_ADDRESS_MAP(bus_mastering_map, 32);
+};
+
+extern const device_type AC97;
+
+#endif
diff --git a/src/emu/sound/sb0400.c b/src/emu/sound/sb0400.c
new file mode 100644
index 00000000000..6a8c522a525
--- /dev/null
+++ b/src/emu/sound/sb0400.c
@@ -0,0 +1,22 @@
+#include "sb0400.h"
+
+const device_type SB0400 = &device_creator<sb0400_device>;
+
+DEVICE_ADDRESS_MAP_START(map, 32, sb0400_device)
+ADDRESS_MAP_END
+
+sb0400_device::sb0400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, SB0400, "Creative Labs SB0400 Audigy2 Value", tag, owner, clock, "sb0400", __FILE__)
+{
+}
+
+void sb0400_device::device_start()
+{
+ pci_device::device_start();
+ add_map(64, M_IO, FUNC(sb0400_device::map));
+}
+
+void sb0400_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/sound/sb0400.h b/src/emu/sound/sb0400.h
new file mode 100644
index 00000000000..cea968503d9
--- /dev/null
+++ b/src/emu/sound/sb0400.h
@@ -0,0 +1,25 @@
+// Creative labs SB0400 Audigy2 Value
+
+#ifndef SB0400_H
+#define SB0400_H
+
+#include "machine/pci.h"
+
+#define MCFG_SB0400_ADD(_tag, _subdevice_id) \
+ MCFG_PCI_DEVICE_ADD(_tag, SB0400, 0x11020008, 0x00, 0x040100, _subdevice_id)
+
+class sb0400_device : public pci_device {
+public:
+ sb0400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map, 32);
+};
+
+extern const device_type SB0400;
+
+#endif
diff --git a/src/emu/sound/sound.mak b/src/emu/sound/sound.mak
index 6a6a0cf0d0d..de4f8024a5d 100644
--- a/src/emu/sound/sound.mak
+++ b/src/emu/sound/sound.mak
@@ -70,6 +70,17 @@ $(SOUNDOBJ)/discrete.o: $(SOUNDSRC)/discrete.c \
#-------------------------------------------------
+# AC97
+#@src/emu/sound/pic-ac97.h,SOUNDS += AC97
+#-------------------------------------------------
+
+ifneq ($(filter AC97,$(SOUNDS)),)
+SOUNDOBJS += $(SOUNDOBJ)/pci-ac97.o
+endif
+
+
+
+#-------------------------------------------------
# Apple custom sound chips
#@src/emu/sound/asc.h,SOUNDS += ASC
#@src/emu/sound/awacs.h,SOUNDS += AWACS
@@ -123,6 +134,14 @@ endif
#-------------------------------------------------
+#-------------------------------------------------
+# AC97
+#@src/emu/sound/pic-ac97.h,SOUNDS += AC97
+#-------------------------------------------------
+
+ifneq ($(filter AC97,$(SOUNDS)),)
+SOUNDOBJS += $(SOUNDOBJ)/pci-ac97.o
+endif
# CEM 3394 analog synthesizer chip
#@src/emu/sound/cem3394.h,SOUNDS += CEM3394
#-------------------------------------------------
@@ -134,6 +153,17 @@ endif
#-------------------------------------------------
+# Creative Labs SB0400 Audigy2 Value
+#@src/emu/sound/sb0400.h,SOUNDS += AC97
+#-------------------------------------------------
+
+ifneq ($(filter SB0400,$(SOUNDS)),)
+SOUNDOBJS += $(SOUNDOBJ)/sb0400.o
+endif
+
+
+
+#-------------------------------------------------
# Data East custom sound chips
#@src/emu/sound/bsmt2000.h,SOUNDS += BSMT2000
#-------------------------------------------------
diff --git a/src/emu/video/gf6800gt.c b/src/emu/video/gf6800gt.c
new file mode 100644
index 00000000000..578ee56da90
--- /dev/null
+++ b/src/emu/video/gf6800gt.c
@@ -0,0 +1,30 @@
+#include "gf6800gt.h"
+
+const device_type GEFORCE_6800GT = &device_creator<geforce_6800gt_device>;
+
+DEVICE_ADDRESS_MAP_START(map1, 32, geforce_6800gt_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(map2, 32, geforce_6800gt_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(map3, 32, geforce_6800gt_device)
+ADDRESS_MAP_END
+
+geforce_6800gt_device::geforce_6800gt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, GEFORCE_6800GT, "NVidia GeForce 6800GT", tag, owner, clock, "geforce_6800gt", __FILE__)
+{
+}
+
+void geforce_6800gt_device::device_start()
+{
+ pci_device::device_start();
+ add_map( 16*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map1));
+ add_map(256*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map2));
+ add_map( 16*1024*1024, M_MEM, FUNC(geforce_6800gt_device::map3));
+}
+
+void geforce_6800gt_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/emu/video/gf6800gt.h b/src/emu/video/gf6800gt.h
new file mode 100644
index 00000000000..cdd6a3bc184
--- /dev/null
+++ b/src/emu/video/gf6800gt.h
@@ -0,0 +1,25 @@
+#ifndef GF6800GT_H
+#define GF6800GT_H
+
+#include "machine/pci.h"
+
+#define MCFG_GEFORCE_6800GT_ADD(_tag, _subdevice_id) \
+ MCFG_AGP_DEVICE_ADD(_tag, GEFORCE_6800GT, 0x10de00f9, 0xa1, _subdevice_id)
+
+class geforce_6800gt_device : public pci_device {
+public:
+ geforce_6800gt_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map1, 32);
+ DECLARE_ADDRESS_MAP(map2, 32);
+ DECLARE_ADDRESS_MAP(map3, 32);
+};
+
+extern const device_type GEFORCE_6800GT;
+
+#endif
diff --git a/src/emu/video/video.mak b/src/emu/video/video.mak
index 25f724ebae4..67cef5683bf 100644
--- a/src/emu/video/video.mak
+++ b/src/emu/video/video.mak
@@ -174,6 +174,15 @@ endif
#-------------------------------------------------
#
+#@src/emu/video/gf6800gt.h,VIDEOS += GF6800GT
+#-------------------------------------------------
+
+ifneq ($(filter GF6800GT,$(VIDEOS)),)
+VIDEOOBJS+= $(VIDEOOBJ)/gf6800gt.o
+endif
+
+#-------------------------------------------------
+#
#@src/emu/video/h63484.h,VIDEOS += H63484
#-------------------------------------------------
diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c
index c9f63a498a5..4b5f0256bf2 100644
--- a/src/mame/drivers/calchase.c
+++ b/src/mame/drivers/calchase.c
@@ -121,7 +121,7 @@ something wrong in the disk geometry reported by calchase.chd (20,255,63) since
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
#include "video/pc_vga.h"
diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c
index 09513f3e383..b59273997ba 100644
--- a/src/mame/drivers/chihiro.c
+++ b/src/mame/drivers/chihiro.c
@@ -358,7 +358,7 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pic8259.h"
#include "machine/pit8253.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/cobra.c b/src/mame/drivers/cobra.c
index 2dc25d4bc10..f6ec50c7432 100644
--- a/src/mame/drivers/cobra.c
+++ b/src/mame/drivers/cobra.c
@@ -313,7 +313,7 @@
#include "emu.h"
#include "cpu/powerpc/ppc.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/ataintf.h"
#include "machine/idehd.h"
#include "machine/jvshost.h"
diff --git a/src/mame/drivers/fruitpc.c b/src/mame/drivers/fruitpc.c
index c326897f676..69e0e84dc0c 100644
--- a/src/mame/drivers/fruitpc.c
+++ b/src/mame/drivers/fruitpc.c
@@ -13,7 +13,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
#include "video/pc_vga.h"
diff --git a/src/mame/drivers/funkball.c b/src/mame/drivers/funkball.c
index 0e0530077dd..d96872f921c 100644
--- a/src/mame/drivers/funkball.c
+++ b/src/mame/drivers/funkball.c
@@ -71,7 +71,7 @@ Notes:
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
#include "video/voodoo.h"
diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c
index 362fcd82f89..06408abc5a0 100644
--- a/src/mame/drivers/gamecstl.c
+++ b/src/mame/drivers/gamecstl.c
@@ -64,7 +64,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/gammagic.c b/src/mame/drivers/gammagic.c
index 13148732ac6..d9a320d5926 100644
--- a/src/mame/drivers/gammagic.c
+++ b/src/mame/drivers/gammagic.c
@@ -32,7 +32,7 @@ Additional CD-ROM games: "99 Bottles of Beer"
#include "machine/cr589.h"
//#include "machine/i82371sb.h"
//#include "machine/i82439tx.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "video/pc_vga.h"
diff --git a/src/mame/drivers/lindbergh.c b/src/mame/drivers/lindbergh.c
index a29a7fe00d4..8e575b4c3fc 100644
--- a/src/mame/drivers/lindbergh.c
+++ b/src/mame/drivers/lindbergh.c
@@ -221,12 +221,20 @@ Sega 2005
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pcshare.h"
-#include "machine/pckeybrd.h"
-#include "video/pc_vga.h"
#include "machine/pci.h"
-
-class lindbergh_state : public pcat_base_state
+#include "machine/i82875p.h"
+#include "machine/i6300esb.h"
+#include "machine/pci-usb.h"
+#include "machine/pci-apic.h"
+#include "machine/pci-sata.h"
+#include "machine/pci-smbus.h"
+#include "machine/i82541.h"
+#include "machine/segabb.h"
+#include "sound/pci-ac97.h"
+#include "sound/sb0400.h"
+#include "video/gf6800gt.h"
+
+class lindbergh_state : public driver_device
{
public:
lindbergh_state(const machine_config &mconfig, device_type type, const char *tag);
@@ -235,24 +243,26 @@ public:
virtual void machine_reset();
};
+#if 0
static ADDRESS_MAP_START(lindbergh_map, AS_PROGRAM, 32, lindbergh_state)
AM_RANGE(0x00000000, 0x0009ffff) AM_RAM
- AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
- AM_RANGE(0x000c0000, 0x000cffff) AM_ROM AM_REGION("vid_bios", 0)
+ // AM_RANGE(0x000a0000, 0x000bffff) AM_DEVREADWRITE8("vga", vga_device, mem_r, mem_w, 0xffffffff)
+ // AM_RANGE(0x000c0000, 0x000cffff) AM_ROM AM_REGION("vid_bios", 0)
// 0xd0000 - 0xdffff tested, wants 0x414d ("AM") in there
AM_RANGE(0x000f0000, 0x000fffff) AM_ROM AM_REGION("mb_bios", 0xf0000)
- AM_RANGE(0xfd000000, 0xfd3fffff) AM_ROM AM_REGION("jvs_bios", 0) /* Hack to see the data */
+// AM_RANGE(0xfd000000, 0xfd3fffff) AM_ROM AM_REGION("jvs_bios", 0) /* Hack to see the data */
AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION("mb_bios", 0) /* System BIOS */
ADDRESS_MAP_END
static ADDRESS_MAP_START(lindbergh_io, AS_IO, 32, lindbergh_state)
- AM_IMPORT_FROM(pcat32_io_common)
+// AM_IMPORT_FROM(pcat32_io_common)
- AM_RANGE(0x00e8, 0x00ef) AM_NOP
- AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
+// AM_RANGE(0x00e8, 0x00ef) AM_NOP
+// AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
ADDRESS_MAP_END
+#endif
-lindbergh_state::lindbergh_state(const machine_config &mconfig, device_type type, const char *tag) : pcat_base_state(mconfig, type, tag)
+lindbergh_state::lindbergh_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag)
{
}
@@ -267,18 +277,37 @@ void lindbergh_state::machine_reset()
static MACHINE_CONFIG_START(lindbergh, lindbergh_state)
// MCFG_CPU_ADD("maincpu", PENTIUM, 2800000000U) /* Actually Celeron D at 2,8 GHz */
MCFG_CPU_ADD("maincpu", PENTIUM4, 28000000U*5) /* Actually Celeron D at 2,8 GHz */
- MCFG_CPU_PROGRAM_MAP(lindbergh_map)
- MCFG_CPU_IO_MAP(lindbergh_io)
- MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_1", pic8259_device, inta_cb)
-
- MCFG_FRAGMENT_ADD( pcat_common )
- MCFG_FRAGMENT_ADD( pcvideo_vga )
-
- MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0)
+// MCFG_CPU_PROGRAM_MAP(lindbergh_map)
+// MCFG_CPU_IO_MAP(lindbergh_io)
+// MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("pic8259_1", pic8259_device, inta_cb)
+
+// MCFG_FRAGMENT_ADD( pcat_common )
+// MCFG_FRAGMENT_ADD( pcvideo_vga )
+
+// MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0)
+
+ MCFG_PCI_ROOT_ADD( ":pci")
+ MCFG_I82875P_HOST_ADD( ":pci:00.0", 0x103382c0, ":maincpu", 512*1024*1024)
+ MCFG_I82875P_AGP_ADD( ":pci:01.0")
+ MCFG_GEFORCE_6800GT_ADD( ":pci:01.0:00.0", 0x10de0204)
+ MCFG_PCI_BRIDGE_ADD( ":pci:1c.0", 0x808625ae, 0x02)
+ MCFG_I82541PI_ADD( ":pci:1c.0:00.0", 0x103382c0)
+ MCFG_USB_UHCI_ADD( ":pci:1d.0", 0x808625a9, 0x02, 0x103382c0)
+ MCFG_USB_UHCI_ADD( ":pci:1d.1", 0x808625aa, 0x02, 0x103382c0)
+ MCFG_I6300ESB_WATCHDOG_ADD( ":pci:1d.4", 0x103382c0)
+ MCFG_APIC_ADD( ":pci:1d.5", 0x808625ac, 0x02, 0x103382c0)
+ MCFG_USB_EHCI_ADD( ":pci:1d.7", 0x808625ad, 0x02, 0x103382c0)
+ MCFG_PCI_BRIDGE_ADD( ":pci:1e.0", 0x8086244e, 0x0a)
+ MCFG_SB0400_ADD( ":pci:1e.0:02.0", 0x11021101)
+ MCFG_SEGA_LINDBERGH_BASEBOARD_ADD(":pci:1e.0:03.0")
+ MCFG_I6300ESB_LPC_ADD( ":pci:1f.0")
+ MCFG_SATA_ADD( ":pci:1f.2", 0x808625a3, 0x02, 0x103382c0)
+ MCFG_SMBUS_ADD( ":pci:1f.3", 0x808625a4, 0x02, 0x103382c0)
+ MCFG_AC97_ADD( ":pci:1f.5", 0x808625a6, 0x02, 0x103382c0)
MACHINE_CONFIG_END
ROM_START(lindbios)
- ROM_REGION32_LE(0x100000, "mb_bios", 0) // location 3j7
+ ROM_REGION32_LE(0x100000, ":pci:1f.0", 0) // PC bios, location 3j7
ROM_SYSTEM_BIOS(0, "bios0", "6.0.0010 alternate version")
ROMX_LOAD("6.0.0010a.bin", 0x00000, 0x100000, CRC(10dd9b76) SHA1(1fdf1f921bc395846a7c3180fbdbc4ca287a9670), ROM_BIOS(1) )
ROM_SYSTEM_BIOS(1, "bios1", "6.0.0009")
@@ -287,11 +316,11 @@ ROM_START(lindbios)
ROMX_LOAD("6.0.0010.bin", 0x00000, 0x100000, CRC(ea2bf888) SHA1(c9c5b6f0d4f4f36620939b15dd2f128a74347e37), ROM_BIOS(3) )
- ROM_REGION(0x400000, "jvs_bios", 0)
+ ROM_REGION(0x400000, ":pci:1e.0:03.0", 0) // Baseboard MPC firmware
ROM_LOAD("fpr-24370b.ic6", 0x000000, 0x400000, CRC(c3b021a4) SHA1(1b6938a50fe0e4ae813864649eb103838c399ac0))
- ROM_REGION(0x10000, "vid_bios", 0)
+ ROM_REGION32_LE(0x10000, ":pci:01.0:00.0", 0) // Geforce bios extension (custom or standard?)
ROM_LOAD("vid_bios.u504", 0x00000, 0x10000, CRC(f78d14d7) SHA1(f129787e487984edd23bf344f2e9500c85052275))
ROM_END
-GAME(1999, lindbios, 0, lindbergh, at_keyboard, driver_device, 0, ROT0, "Sega Lindbergh", "Sega Lindbergh Bios", GAME_IS_SKELETON)
+GAME(1999, lindbios, 0, lindbergh, 0, driver_device, 0, ROT0, "Sega Lindbergh", "Sega Lindbergh Bios", GAME_IS_SKELETON)
diff --git a/src/mame/drivers/magictg.c b/src/mame/drivers/magictg.c
index 035e8555f80..3214736ad09 100644
--- a/src/mame/drivers/magictg.c
+++ b/src/mame/drivers/magictg.c
@@ -118,7 +118,7 @@ Medium size chip with heat sink on it
#include "cpu/adsp2100/adsp2100.h"
#include "sound/dmadac.h"
#include "video/voodoo.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
/* TODO: Two 3Dfx Voodoo chipsets are used in SLI configuration */
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index dff598dcf18..c900f16dc0a 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -66,7 +66,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/midqslvr.c b/src/mame/drivers/midqslvr.c
index af631ee7206..d4995155e92 100644
--- a/src/mame/drivers/midqslvr.c
+++ b/src/mame/drivers/midqslvr.c
@@ -24,7 +24,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/photoply.c b/src/mame/drivers/photoply.c
index 381abdd8c40..a1d1626eb24 100644
--- a/src/mame/drivers/photoply.c
+++ b/src/mame/drivers/photoply.c
@@ -13,7 +13,7 @@ TODO:
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/pinball2k.c b/src/mame/drivers/pinball2k.c
index 6f0f5a5e5b3..71c16c3f2b1 100644
--- a/src/mame/drivers/pinball2k.c
+++ b/src/mame/drivers/pinball2k.c
@@ -19,7 +19,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/queen.c b/src/mame/drivers/queen.c
index 7d82b8e8a64..25329d10b2a 100644
--- a/src/mame/drivers/queen.c
+++ b/src/mame/drivers/queen.c
@@ -26,7 +26,7 @@ processor speed is 533MHz <- likely to be a Celeron or a Pentium III class CPU -
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/savquest.c b/src/mame/drivers/savquest.c
index 18901d3b6bf..c622728014d 100644
--- a/src/mame/drivers/savquest.c
+++ b/src/mame/drivers/savquest.c
@@ -46,7 +46,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c
index 3cdbbde6b68..e08ece8bac7 100644
--- a/src/mame/drivers/taitowlf.c
+++ b/src/mame/drivers/taitowlf.c
@@ -27,7 +27,7 @@ clocks 50MHz (near 3DFX) and 14.31818MHz (near RAMDAC)
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#if ENABLE_VGA
diff --git a/src/mame/drivers/viper.c b/src/mame/drivers/viper.c
index de35287dc6d..449d2c5874d 100644
--- a/src/mame/drivers/viper.c
+++ b/src/mame/drivers/viper.c
@@ -283,7 +283,7 @@ An additional control PCB is used for Mocap Golf for the golf club sensor. It co
#include "emu.h"
#include "cpu/powerpc/ppc.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/ataintf.h"
#include "machine/idehd.h"
#include "machine/timekpr.h"
diff --git a/src/mame/drivers/voyager.c b/src/mame/drivers/voyager.c
index 542b225f255..0cd0af108be 100644
--- a/src/mame/drivers/voyager.c
+++ b/src/mame/drivers/voyager.c
@@ -14,7 +14,7 @@ TODO: VIA KT133a chipset support, GeForce 2MX video support, lots of things ;-)
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/drivers/xtom3d.c b/src/mame/drivers/xtom3d.c
index 5d42912f4eb..7bf0d85c94d 100644
--- a/src/mame/drivers/xtom3d.c
+++ b/src/mame/drivers/xtom3d.c
@@ -40,7 +40,7 @@ MX29F1610MC 16M FlashROM (x7)
#include "emu.h"
#include "cpu/i386/i386.h"
-#include "machine/pci.h"
+#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
diff --git a/src/mame/machine/segabb.c b/src/mame/machine/segabb.c
new file mode 100644
index 00000000000..8620c8857e1
--- /dev/null
+++ b/src/mame/machine/segabb.c
@@ -0,0 +1,30 @@
+#include "segabb.h"
+
+const device_type SEGA_LINDBERGH_BASEBOARD = &device_creator<sega_lindbergh_baseboard_device>;
+
+DEVICE_ADDRESS_MAP_START(map1, 32, sega_lindbergh_baseboard_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(map2, 32, sega_lindbergh_baseboard_device)
+ADDRESS_MAP_END
+
+DEVICE_ADDRESS_MAP_START(map3, 32, sega_lindbergh_baseboard_device)
+ADDRESS_MAP_END
+
+sega_lindbergh_baseboard_device::sega_lindbergh_baseboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
+ : pci_device(mconfig, SEGA_LINDBERGH_BASEBOARD, "SEGA Lindbergh baseboard", tag, owner, clock, "sega_lindbergh_baseboard", __FILE__)
+{
+}
+
+void sega_lindbergh_baseboard_device::device_start()
+{
+ pci_device::device_start();
+ add_map( 128*1024, M_MEM, FUNC(sega_lindbergh_baseboard_device::map1));
+ add_map( 1024*1024, M_MEM, FUNC(sega_lindbergh_baseboard_device::map2));
+ add_map(2*1024*1024, M_MEM, FUNC(sega_lindbergh_baseboard_device::map3));
+}
+
+void sega_lindbergh_baseboard_device::device_reset()
+{
+ pci_device::device_reset();
+}
diff --git a/src/mame/machine/segabb.h b/src/mame/machine/segabb.h
new file mode 100644
index 00000000000..fefad6163a7
--- /dev/null
+++ b/src/mame/machine/segabb.h
@@ -0,0 +1,27 @@
+// Lindbergh Sega baseboard
+
+#ifndef SEGABB_H
+#define SEGABB_H
+
+#include "machine/pci.h"
+
+#define MCFG_SEGA_LINDBERGH_BASEBOARD_ADD(_tag) \
+ MCFG_PCI_DEVICE_ADD(_tag, SEGA_LINDBERGH_BASEBOARD, 0x105718c1, 0x10, 0x068000, 0x11db067b)
+
+class sega_lindbergh_baseboard_device : public pci_device {
+public:
+ sega_lindbergh_baseboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+protected:
+ virtual void device_start();
+ virtual void device_reset();
+
+private:
+ DECLARE_ADDRESS_MAP(map1, 32);
+ DECLARE_ADDRESS_MAP(map2, 32);
+ DECLARE_ADDRESS_MAP(map3, 32);
+};
+
+extern const device_type SEGA_LINDBERGH_BASEBOARD;
+
+#endif
diff --git a/src/mame/mame.mak b/src/mame/mame.mak
index 847d52bc9e3..612c5cb2f80 100644
--- a/src/mame/mame.mak
+++ b/src/mame/mame.mak
@@ -271,6 +271,8 @@ SOUNDS += T6721A
SOUNDS += MOS7360
#SOUNDS += ESQPUMP
#SOUNDS += VRC6
+SOUNDS += SB0400
+SOUNDS += AC97
#-------------------------------------------------
# specify available video cores
@@ -290,6 +292,7 @@ VIDEOS += DM9368
#VIDEOS += EF9340_1
#VIDEOS += EF9345
#VIDEOS += GF4500
+VIDEOS += GF6800GT
VIDEOS += EPIC12
VIDEOS += FIXFREQ
VIDEOS += H63484
@@ -436,6 +439,7 @@ MACHINES += LDV1000
MACHINES += LDVP931
#MACHINES += LH5810
MACHINES += LINFLASH
+MACHINES += LPCI
#MACHINES += LSI53C810
#MACHINES += M68307
#MACHINES += M68340
@@ -607,6 +611,7 @@ BUSES += GENERIC
BUSES += ISA
#BUSES += ISBX
#BUSES += KC
+#BUSES += LPCI
#BUSES += MACPDS
#BUSES += MIDI
#BUSES += MEGADRIVE
@@ -617,7 +622,6 @@ BUSES += NEOGEO
#BUSES += O2
#BUSES += ORICEXT
#BUSES += PCE
-#BUSES += PCI
#BUSES += PC_JOY
#BUSES += PC_KBD
#BUSES += PET
@@ -1697,7 +1701,7 @@ $(MAMEOBJ)/sega.a: \
$(DRIVERS)/hikaru.o \
$(DRIVERS)/hshavoc.o \
$(DRIVERS)/kopunch.o $(VIDEO)/kopunch.o \
- $(DRIVERS)/lindbergh.o \
+ $(DRIVERS)/lindbergh.o $(MACHINE)/segabb.o \
$(MACHINE)/megadriv.o \
$(DRIVERS)/megadrvb.o \
$(DRIVERS)/megaplay.o \
diff --git a/src/mess/drivers/bebox.c b/src/mess/drivers/bebox.c
index d118016a664..a7567a8cfc4 100644
--- a/src/mess/drivers/bebox.c
+++ b/src/mess/drivers/bebox.c
@@ -12,17 +12,17 @@
/* Components */
#include "video/pc_vga.h"
-#include "bus/pci/cirrus.h"
+#include "bus/lpci/cirrus.h"
#include "cpu/powerpc/ppc.h"
#include "sound/3812intf.h"
#include "machine/ins8250.h"
#include "machine/pic8259.h"
#include "machine/mc146818.h"
-#include "bus/pci/pci.h"
+#include "bus/lpci/pci.h"
#include "machine/am9517a.h"
#include "machine/pckeybrd.h"
#include "machine/idectrl.h"
-#include "bus/pci/mpc105.h"
+#include "bus/lpci/mpc105.h"
#include "machine/intelfsh.h"
#include "bus/scsi/scsi.h"
#include "machine/53c810.h"
diff --git a/src/mess/includes/at.h b/src/mess/includes/at.h
index b9ca4e17cc0..9a98a1a5105 100644
--- a/src/mess/includes/at.h
+++ b/src/mess/includes/at.h
@@ -17,9 +17,9 @@
#include "machine/ins8250.h"
#include "machine/mc146818.h"
#include "machine/pic8259.h"
-#include "bus/pci/i82371ab.h"
-#include "bus/pci/i82371sb.h"
-#include "bus/pci/i82439tx.h"
+#include "bus/lpci/i82371ab.h"
+#include "bus/lpci/i82371sb.h"
+#include "bus/lpci/i82439tx.h"
#include "machine/cs8221.h"
#include "machine/pit8253.h"
#include "machine/wd7600.h"
@@ -29,7 +29,7 @@
#include "imagedev/harddriv.h"
#include "machine/am9517a.h"
-#include "bus/pci/pci.h"
+#include "bus/lpci/pci.h"
#include "sound/dac.h"
#include "sound/speaker.h"
diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c
index 5bac695715b..b1db591ae6e 100644
--- a/src/mess/machine/bebox.c
+++ b/src/mess/machine/bebox.c
@@ -93,7 +93,7 @@
/* Components */
#include "video/pc_vga.h"
-#include "bus/pci/cirrus.h"
+#include "bus/lpci/cirrus.h"
#include "cpu/powerpc/ppc.h"
#include "machine/ins8250.h"
#include "machine/upd765.h"
@@ -101,7 +101,7 @@
#include "machine/pic8259.h"
#include "machine/am9517a.h"
#include "machine/ataintf.h"
-#include "bus/pci/pci.h"
+#include "bus/lpci/pci.h"
#include "machine/intelfsh.h"
#include "machine/53c810.h"
#include "machine/ram.h"
diff --git a/src/mess/mess.mak b/src/mess/mess.mak
index caa554cd408..aa5bec24951 100644
--- a/src/mess/mess.mak
+++ b/src/mess/mess.mak
@@ -425,6 +425,7 @@ MACHINES += LDV1000
MACHINES += LDVP931
MACHINES += LH5810
MACHINES += LINFLASH
+#MACHINES += LPCI
MACHINES += LSI53C810
MACHINES += M68307
MACHINES += M68340
@@ -478,7 +479,6 @@ MACHINES += PC_FDC
MACHINES += PC_LPT
MACHINES += PCCARD
MACHINES += PCF8593
-#MACHINES += PCI
MACHINES += PCKEYBRD
MACHINES += PIC8259
MACHINES += PIT8253
@@ -599,6 +599,7 @@ BUSES += IQ151
BUSES += ISA
BUSES += ISBX
BUSES += KC
+BUSES += LPCI
BUSES += MACPDS
BUSES += MIDI
BUSES += MEGADRIVE
@@ -609,7 +610,6 @@ BUSES += NUBUS
BUSES += O2
BUSES += ORICEXT
BUSES += PCE
-BUSES += PCI
BUSES += PC_JOY
BUSES += PC_KBD
BUSES += PET