Shuffle PCI and some more PC related devices around (nw)

cirrus is not moved since it's not made as proper pci device
This commit is contained in:
Miodrag Milanovic 2014-03-07 14:41:36 +00:00
parent 250dac1722
commit d6a62ffd47
28 changed files with 508 additions and 406 deletions

30
.gitattributes vendored
View File

@ -919,6 +919,20 @@ src/emu/bus/pc_kbd/pcat84.c svneol=native#text/plain
src/emu/bus/pc_kbd/pcat84.h svneol=native#text/plain
src/emu/bus/pc_kbd/pcxt83.c svneol=native#text/plain
src/emu/bus/pc_kbd/pcxt83.h svneol=native#text/plain
src/emu/bus/pci/i82371ab.c svneol=native#text/plain
src/emu/bus/pci/i82371ab.h svneol=native#text/plain
src/emu/bus/pci/i82371sb.c svneol=native#text/plain
src/emu/bus/pci/i82371sb.h svneol=native#text/plain
src/emu/bus/pci/i82439tx.c svneol=native#text/plain
src/emu/bus/pci/i82439tx.h svneol=native#text/plain
src/emu/bus/pci/mpc105.c svneol=native#text/plain
src/emu/bus/pci/mpc105.h svneol=native#text/plain
src/emu/bus/pci/northbridge.c svneol=native#text/plain
src/emu/bus/pci/northbridge.h svneol=native#text/plain
src/emu/bus/pci/pci.c svneol=native#text/plain
src/emu/bus/pci/pci.h svneol=native#text/plain
src/emu/bus/pci/southbridge.c svneol=native#text/plain
src/emu/bus/pci/southbridge.h svneol=native#text/plain
src/emu/bus/pet/64k.c svneol=native#text/plain
src/emu/bus/pet/64k.h svneol=native#text/plain
src/emu/bus/pet/c2n.c svneol=native#text/plain
@ -1939,6 +1953,8 @@ src/emu/machine/at29040a.c svneol=native#text/plain
src/emu/machine/at29040a.h svneol=native#text/plain
src/emu/machine/at45dbxx.c svneol=native#text/plain
src/emu/machine/at45dbxx.h svneol=native#text/plain
src/emu/machine/at_keybc.c svneol=native#text/plain
src/emu/machine/at_keybc.h svneol=native#text/plain
src/emu/machine/atadev.c svneol=native#text/plain
src/emu/machine/atadev.h svneol=native#text/plain
src/emu/machine/ataflash.c svneol=native#text/plain
@ -8035,8 +8051,6 @@ src/mess/machine/applefdc.h svneol=native#text/plain
src/mess/machine/apricotkb.c svneol=native#text/plain
src/mess/machine/apricotkb.h svneol=native#text/plain
src/mess/machine/at.c svneol=native#text/plain
src/mess/machine/at_keybc.c svneol=native#text/plain
src/mess/machine/at_keybc.h svneol=native#text/plain
src/mess/machine/ataricrt.c svneol=native#text/plain
src/mess/machine/atarifdc.c svneol=native#text/plain
src/mess/machine/atarifdc.h svneol=native#text/plain
@ -8152,12 +8166,6 @@ src/mess/machine/hd64610.h svneol=native#text/plain
src/mess/machine/hec2hrp.c svneol=native#text/plain
src/mess/machine/hecdisk2.c svneol=native#text/plain
src/mess/machine/hp48.c svneol=native#text/plain
src/mess/machine/i82371ab.c svneol=native#text/plain
src/mess/machine/i82371ab.h svneol=native#text/plain
src/mess/machine/i82371sb.c svneol=native#text/plain
src/mess/machine/i82371sb.h svneol=native#text/plain
src/mess/machine/i82439tx.c svneol=native#text/plain
src/mess/machine/i82439tx.h svneol=native#text/plain
src/mess/machine/i8271.c svneol=native#text/plain
src/mess/machine/i8271.h svneol=native#text/plain
src/mess/machine/intv.c svneol=native#text/plain
@ -8224,8 +8232,6 @@ src/mess/machine/micropolis.c svneol=native#text/plain
src/mess/machine/micropolis.h svneol=native#text/plain
src/mess/machine/microtan.c svneol=native#text/plain
src/mess/machine/mikro80.c svneol=native#text/plain
src/mess/machine/mpc105.c svneol=native#text/plain
src/mess/machine/mpc105.h svneol=native#text/plain
src/mess/machine/msm6222b.c svneol=native#text/plain
src/mess/machine/msm6222b.h svneol=native#text/plain
src/mess/machine/msx.c svneol=native#text/plain
@ -8341,8 +8347,6 @@ src/mess/machine/nextkbd.c svneol=native#text/plain
src/mess/machine/nextkbd.h svneol=native#text/plain
src/mess/machine/nextmo.c svneol=native#text/plain
src/mess/machine/nextmo.h svneol=native#text/plain
src/mess/machine/northbridge.c svneol=native#text/plain
src/mess/machine/northbridge.h svneol=native#text/plain
src/mess/machine/ondra.c svneol=native#text/plain
src/mess/machine/orao.c svneol=native#text/plain
src/mess/machine/oric.c svneol=native#text/plain
@ -8482,8 +8486,6 @@ src/mess/machine/sns_upd.h svneol=native#text/plain
src/mess/machine/sonydriv.c svneol=native#text/plain
src/mess/machine/sonydriv.h svneol=native#text/plain
src/mess/machine/sorcerer.c svneol=native#text/plain
src/mess/machine/southbridge.c svneol=native#text/plain
src/mess/machine/southbridge.h svneol=native#text/plain
src/mess/machine/spec_snqk.c svneol=native#text/plain
src/mess/machine/spec_snqk.h svneol=native#text/plain
src/mess/machine/special.c svneol=native#text/plain

View File

@ -667,3 +667,19 @@ BUSOBJS += $(BUSOBJ)/midi/midi.o
BUSOBJS += $(BUSOBJ)/midi/midiinport.o
BUSOBJS += $(BUSOBJ)/midi/midioutport.o
endif
#-------------------------------------------------
#
#@src/emu/bus/pci/pci.h,BUSES += PCI
#-------------------------------------------------
ifneq ($(filter PCI,$(BUSES)),)
BUSOBJS += $(BUSOBJ)/pci/pci.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
endif

View File

@ -9,8 +9,8 @@
#ifndef __I82371AB_H__
#define __I82371AB_H__
#include "machine/pci.h"
#include "machine/southbridge.h"
#include "pci.h"
#include "southbridge.h"
// ======================> i82371ab_device

View File

@ -9,8 +9,8 @@
#ifndef __I82371SB_H__
#define __I82371SB_H__
#include "machine/pci.h"
#include "machine/southbridge.h"
#include "pci.h"
#include "southbridge.h"
// ======================> i82371sb_device

View File

@ -9,8 +9,8 @@
#ifndef __I82439TX_H__
#define __I82439TX_H__
#include "machine/pci.h"
#include "machine/northbridge.h"
#include "pci.h"
#include "northbridge.h"
#define MCFG_I82439TX_CPU( _tag ) \
i82439tx_device::static_set_cpu(*device, _tag);

View File

@ -1,6 +1,6 @@
/***************************************************************************
machine/mpc105.h
mpc105.h
Motorola MPC105 PCI bridge

View File

@ -1,6 +1,6 @@
/***************************************************************************
machine/mpc105.h
mpc105.h
Motorola MPC105 PCI bridge
@ -9,7 +9,7 @@
#ifndef MPC105_H
#define MPC105_H
#include "machine/pci.h"
#include "pci.h"
#define MPC105_MEMORYBANK_COUNT 8

View File

@ -5,7 +5,7 @@
***************************************************************************/
#include "emu.h"
#include "machine/northbridge.h"
#include "northbridge.h"
//**************************************************************************
// GLOBAL VARIABLES

332
src/emu/bus/pci/pci.c Normal file
View File

@ -0,0 +1,332 @@
/***************************************************************************
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 "pci.h"
#define LOG_PCI 0
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type PCI_BUS = &device_creator<pci_bus_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pci_bus_device - constructor
//-------------------------------------------------
pci_bus_device::pci_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PCI_BUS, "PCI Bus", tag, owner, clock, "pci_bus", __FILE__),
m_father(NULL)
{
for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++) {
m_devtag[i]= NULL;
}
m_siblings_count = 0;
}
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
READ32_MEMBER( pci_bus_device::read )
{
UINT32 result = 0xffffffff;
int function, reg;
offset %= 2;
switch (offset)
{
case 0:
result = m_address;
break;
case 1:
if (m_devicenum != -1)
{
if (m_busnumaddr->m_device[m_devicenum] != NULL)
{
function = (m_address >> 8) & 0x07;
reg = (m_address >> 0) & 0xfc;
result = m_busnumaddr->m_device[m_devicenum]->pci_read(m_busnumaddr, function, reg, mem_mask);
}
}
break;
}
if (LOG_PCI)
logerror("read('%s'): offset=%d result=0x%08X\n", tag(), offset, result);
return result;
}
pci_bus_device *pci_bus_device::pci_search_bustree(int busnum, int devicenum, pci_bus_device *pcibus)
{
int a;
pci_bus_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_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)
{
if (m_busnumaddr->m_device[m_devicenum] != NULL)
{
int function = (m_address >> 8) & 0x07;
int reg = (m_address >> 0) & 0xfc;
m_busnumaddr->m_device[m_devicenum]->pci_write(m_busnumaddr, 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_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_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_device::add_sibling(pci_bus_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_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_device::device_start()
{
/* store a pointer back to the device */
m_devicenum = -1;
char id[3];
/* find all our devices */
for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++)
{
sprintf(id, "%d", i);
pci_connector *conn = downcast<pci_connector *>(subdevice(id));
if (conn!=NULL)
m_device[i] = conn->get_device();
else
m_device[i] = NULL;
}
if (m_father != NULL) {
pci_bus_device *father = machine().device<pci_bus_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_device::device_reset()
{
/* reset the drive state */
m_devicenum = -1;
m_address = 0;
}
//-------------------------------------------------
// pci_device_interface - constructor
//-------------------------------------------------
pci_device_interface::pci_device_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
{
}
//-------------------------------------------------
// ~pci_device_interface - destructor
//-------------------------------------------------
pci_device_interface::~pci_device_interface()
{
}
const device_type PCI_CONNECTOR = &device_creator<pci_connector>;
pci_connector::pci_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PCI_CONNECTOR, "PCI device connector abstraction", tag, owner, clock, "pci_connector", __FILE__),
device_slot_interface(mconfig, *this)
{
}
pci_connector::~pci_connector()
{
}
void pci_connector::device_start()
{
}
pci_device_interface *pci_connector::get_device()
{
return dynamic_cast<pci_device_interface *>(get_card_device());
}

110
src/emu/bus/pci/pci.h Normal file
View File

@ -0,0 +1,110 @@
/***************************************************************************
pci.h
PCI bus
***************************************************************************/
#ifndef PCI_H
#define PCI_H
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class pci_bus_device;
// ======================> pci_device_interface
class pci_device_interface : public device_slot_card_interface
{
public:
// construction/destruction
pci_device_interface(const machine_config &mconfig, device_t &device);
virtual ~pci_device_interface();
virtual UINT32 pci_read(pci_bus_device *pcibus, int function, int offset, UINT32 mem_mask) = 0;
virtual void pci_write(pci_bus_device *pcibus, int function, int offset, UINT32 data, UINT32 mem_mask) = 0;
private:
};
class pci_connector: public device_t,
public device_slot_interface
{
public:
pci_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~pci_connector();
pci_device_interface *get_device();
protected:
virtual void device_start();
};
extern const device_type PCI_CONNECTOR;
// ======================> pci_bus_device
class pci_bus_device : public device_t
{
public:
// construction/destruction
pci_bus_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) {
m_devtag[num] = tag; }
pci_bus_device *pci_search_bustree(int busnum, int devicenum, pci_bus_device *pcibus);
void add_sibling(pci_bus_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_device_interface *m_device[32];
const char * m_father;
pci_bus_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_device * m_busnumaddr; // pci bus we are addressing
};
// device type definition
extern const device_type PCI_BUS;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_PCI_BUS_ADD(_tag, _busnum) \
MCFG_DEVICE_ADD(_tag, PCI_BUS, 0) \
downcast<pci_bus_device *>(device)->set_busnum(_busnum);
#define MCFG_PCI_BUS_DEVICE(_tag, _slot_intf, _def_slot, _fixed) \
MCFG_DEVICE_ADD(_tag, PCI_CONNECTOR, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
#define MCFG_PCI_BUS_SIBLING(_father_tag) \
downcast<pci_bus_device *>(device)->set_father(_father_tag);
#endif /* PCI_H */

View File

@ -6,7 +6,7 @@
#include "emu.h"
#include "cpu/i386/i386.h"
#include "machine/southbridge.h"
#include "southbridge.h"
#include "bus/pc_kbd/keyboards.h"

View File

@ -14,7 +14,7 @@
#include "machine/at_keybc.h"
#include "imagedev/harddriv.h"
#include "machine/pci.h"
#include "pci.h"
#include "sound/dac.h"
#include "sound/speaker.h"

View File

@ -45,6 +45,7 @@ OBJDIRS += \
$(EMUOBJ)/bus/isa \
$(EMUOBJ)/bus/isbx \
$(EMUOBJ)/bus/midi \
$(EMUOBJ)/bus/pci \
$(EMUOBJ)/bus/pc_joy \
$(EMUOBJ)/bus/pc_kbd \
$(EMUOBJ)/bus/pet \

View File

@ -1652,3 +1652,11 @@ ifneq ($(filter MPU401,$(MACHINES)),)
MACHINEOBJS += $(MACHINEOBJ)/mpu401.o
endif
#-------------------------------------------------
#
#@src/emu/machine/at_keybc.h,MACHINES += AT_KEYBC
#-------------------------------------------------
ifneq ($(filter AT_KEYBC,$(MACHINES)),)
MACHINEOBJS += $(MACHINEOBJ)/at_keybc.o
endif

View File

@ -88,7 +88,7 @@ const device_type PCI_BUS_LEGACY = &device_creator<pci_bus_legacy_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, "PCI Bus Legacy", tag, owner, clock, "pci_bus_legacy", __FILE__),
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++) {
@ -288,262 +288,3 @@ void pci_bus_legacy_device::device_reset()
m_address = 0;
}
// NEW IMPLEMENTATION
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
const device_type PCI_BUS = &device_creator<pci_bus_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// pci_bus_device - constructor
//-------------------------------------------------
pci_bus_device::pci_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PCI_BUS, "PCI Bus", tag, owner, clock, "pci_bus", __FILE__),
m_father(NULL)
{
for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++) {
m_devtag[i]= NULL;
}
m_siblings_count = 0;
}
/***************************************************************************
INLINE FUNCTIONS
***************************************************************************/
READ32_MEMBER( pci_bus_device::read )
{
UINT32 result = 0xffffffff;
int function, reg;
offset %= 2;
switch (offset)
{
case 0:
result = m_address;
break;
case 1:
if (m_devicenum != -1)
{
if (m_busnumaddr->m_device[m_devicenum] != NULL)
{
function = (m_address >> 8) & 0x07;
reg = (m_address >> 0) & 0xfc;
result = m_busnumaddr->m_device[m_devicenum]->pci_read(m_busnumaddr, function, reg, mem_mask);
}
}
break;
}
if (LOG_PCI)
logerror("read('%s'): offset=%d result=0x%08X\n", tag(), offset, result);
return result;
}
pci_bus_device *pci_bus_device::pci_search_bustree(int busnum, int devicenum, pci_bus_device *pcibus)
{
int a;
pci_bus_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_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)
{
if (m_busnumaddr->m_device[m_devicenum] != NULL)
{
int function = (m_address >> 8) & 0x07;
int reg = (m_address >> 0) & 0xfc;
m_busnumaddr->m_device[m_devicenum]->pci_write(m_busnumaddr, 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_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_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_device::add_sibling(pci_bus_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_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_device::device_start()
{
/* store a pointer back to the device */
m_devicenum = -1;
char id[3];
/* find all our devices */
for (int i = 0; i < ARRAY_LENGTH(m_devtag); i++)
{
sprintf(id, "%d", i);
pci_connector *conn = downcast<pci_connector *>(subdevice(id));
if (conn!=NULL)
m_device[i] = conn->get_device();
else
m_device[i] = NULL;
}
if (m_father != NULL) {
pci_bus_device *father = machine().device<pci_bus_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_device::device_reset()
{
/* reset the drive state */
m_devicenum = -1;
m_address = 0;
}
//-------------------------------------------------
// pci_device_interface - constructor
//-------------------------------------------------
pci_device_interface::pci_device_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
{
}
//-------------------------------------------------
// ~pci_device_interface - destructor
//-------------------------------------------------
pci_device_interface::~pci_device_interface()
{
}
const device_type PCI_CONNECTOR = &device_creator<pci_connector>;
pci_connector::pci_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, PCI_CONNECTOR, "PCI device connector abstraction", tag, owner, clock, "pci_connector", __FILE__),
device_slot_interface(mconfig, *this)
{
}
pci_connector::~pci_connector()
{
}
void pci_connector::device_start()
{
}
pci_device_interface *pci_connector::get_device()
{
return dynamic_cast<pci_device_interface *>(get_card_device());
}

View File

@ -77,104 +77,5 @@ extern const device_type PCI_BUS_LEGACY;
#define MCFG_PCI_BUS_LEGACY_SIBLING(_father_tag) \
downcast<pci_bus_legacy_device *>(device)->set_father(_father_tag);
// NEW IMPLEMENTATION
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class pci_bus_device;
// ======================> pci_device_interface
class pci_device_interface : public device_slot_card_interface
{
public:
// construction/destruction
pci_device_interface(const machine_config &mconfig, device_t &device);
virtual ~pci_device_interface();
virtual UINT32 pci_read(pci_bus_device *pcibus, int function, int offset, UINT32 mem_mask) = 0;
virtual void pci_write(pci_bus_device *pcibus, int function, int offset, UINT32 data, UINT32 mem_mask) = 0;
private:
};
class pci_connector: public device_t,
public device_slot_interface
{
public:
pci_connector(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~pci_connector();
pci_device_interface *get_device();
protected:
virtual void device_start();
};
extern const device_type PCI_CONNECTOR;
// ======================> pci_bus_device
class pci_bus_device : public device_t
{
public:
// construction/destruction
pci_bus_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) {
m_devtag[num] = tag; }
pci_bus_device *pci_search_bustree(int busnum, int devicenum, pci_bus_device *pcibus);
void add_sibling(pci_bus_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_device_interface *m_device[32];
const char * m_father;
pci_bus_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_device * m_busnumaddr; // pci bus we are addressing
};
// device type definition
extern const device_type PCI_BUS;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_PCI_BUS_ADD(_tag, _busnum) \
MCFG_DEVICE_ADD(_tag, PCI_BUS, 0) \
downcast<pci_bus_device *>(device)->set_busnum(_busnum);
#define MCFG_PCI_BUS_DEVICE(_tag, _slot_intf, _def_slot, _fixed) \
MCFG_DEVICE_ADD(_tag, PCI_CONNECTOR, 0) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed)
#define MCFG_PCI_BUS_SIBLING(_father_tag) \
downcast<pci_bus_device *>(device)->set_father(_father_tag);
#endif /* PCI_H */

View File

@ -64,7 +64,7 @@ static ADDRESS_MAP_START( gammagic_io, AS_IO, 32, gammagic_state)
AM_RANGE(0x03b0, 0x03bf) AM_DEVREADWRITE8("vga", vga_device, port_03b0_r, port_03b0_w, 0xffffffff)
AM_RANGE(0x03c0, 0x03cf) AM_DEVREADWRITE8("vga", vga_device, port_03c0_r, port_03c0_w, 0xffffffff)
AM_RANGE(0x03d0, 0x03df) AM_DEVREADWRITE8("vga", vga_device, port_03d0_r, port_03d0_w, 0xffffffff)
AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_device, read, write)
AM_RANGE(0x0cf8, 0x0cff) AM_DEVREADWRITE("pcibus", pci_bus_legacy_device, read, write)
AM_RANGE(0x0400, 0xffff) AM_NOP
ADDRESS_MAP_END
@ -131,7 +131,7 @@ static MACHINE_CONFIG_START( gammagic, gammagic_state )
// MCFG_I82371SB_ADD("i82371sb")
// MCFG_I82439TX_ADD("i82439tx", "maincpu", "user")
MCFG_PCI_BUS_ADD("pcibus", 0)
MCFG_PCI_BUS_LEGACY_ADD("pcibus", 0)
// MCFG_PCI_BUS_DEVICE(0, "i82439tx", i82439tx_pci_read, i82439tx_pci_write)
// MCFG_PCI_BUS_DEVICE(1, "i82371sb", i82371sb_pci_read, i82371sb_pci_write)
/* video hardware */

View File

@ -18,12 +18,12 @@
#include "machine/ins8250.h"
#include "machine/pic8259.h"
#include "machine/mc146818.h"
#include "machine/pci.h"
#include "bus/pci/pci.h"
#include "machine/am9517a.h"
#include "machine/pckeybrd.h"
#include "machine/8042kbdc.h"
#include "machine/idectrl.h"
#include "machine/mpc105.h"
#include "bus/pci/mpc105.h"
#include "machine/intelfsh.h"
#include "machine/scsibus.h"
#include "machine/53c810.h"

View File

@ -17,9 +17,9 @@
#include "machine/ins8250.h"
#include "machine/mc146818.h"
#include "machine/pic8259.h"
#include "machine/i82371ab.h"
#include "machine/i82371sb.h"
#include "machine/i82439tx.h"
#include "bus/pci/i82371ab.h"
#include "bus/pci/i82371sb.h"
#include "bus/pci/i82439tx.h"
#include "machine/cs8221.h"
#include "machine/pit8253.h"
#include "video/pc_cga.h"
@ -29,7 +29,7 @@
#include "imagedev/harddriv.h"
#include "machine/am9517a.h"
#include "machine/pci.h"
#include "bus/pci/pci.h"
#include "sound/dac.h"
#include "sound/speaker.h"

View File

@ -101,7 +101,7 @@
#include "machine/pic8259.h"
#include "machine/am9517a.h"
#include "machine/ataintf.h"
#include "machine/pci.h"
#include "bus/pci/pci.h"
#include "machine/intelfsh.h"
#include "machine/53c810.h"
#include "machine/ram.h"

View File

@ -418,7 +418,6 @@ MACHINES += NMC9306
MACHINES += NSCSI
MACHINES += PCCARD
MACHINES += PCF8593
MACHINES += PCI
MACHINES += PCKEYBRD
MACHINES += PD4990A_OLD
MACHINES += PIC8259
@ -485,6 +484,7 @@ MACHINES += PC_LPT
MACHINES += PC_FDC
MACHINES += DP8390
MACHINES += MPU401
MACHINES += AT_KEYBC
#MACHINES += PROFILE
#-------------------------------------------------
@ -512,6 +512,7 @@ BUSES += ISBX
BUSES += KC
BUSES += MIDI
BUSES += NUBUS
BUSES += PCI
BUSES += PC_JOY
BUSES += PC_KBD
BUSES += PET
@ -648,7 +649,6 @@ DRVLIBS += \
$(MESSOBJ)/parker.a \
$(MESSOBJ)/pc.a \
$(MESSOBJ)/pc9801.a \
$(MESSOBJ)/pcshare.a \
$(MESSOBJ)/pdp1.a \
$(MESSOBJ)/pel.a \
$(MESSOBJ)/philips.a \
@ -811,7 +811,6 @@ $(MESSOBJ)/shared.a: \
$(MESS_MACHINE)/kr2376.o \
$(MESS_MACHINE)/mb8795.o \
$(MESS_MACHINE)/microdrv.o \
$(MESS_MACHINE)/mpc105.o \
$(MESS_MACHINE)/msm6222b.o \
$(MESS_MACHINE)/ncr5380.o \
$(MESS_MACHINE)/ncr5390.o \
@ -955,7 +954,6 @@ $(MESSOBJ)/ascii.a: \
$(MESS_MACHINE)/msx_slot.o \
$(MESSOBJ)/at.a: \
$(MESS_MACHINE)/at_keybc.o \
$(MESS_MACHINE)/cs8221.o \
$(MESS_MACHINE)/at.o \
$(MESS_DRIVERS)/at.o \
@ -1640,13 +1638,6 @@ $(MESSOBJ)/pc9801.a: \
$(MESS_MACHINE)/pc9801_cbus.o \
$(MESS_MACHINE)/pc9801_kbd.o\
$(MESSOBJ)/pcshare.a: \
$(MESS_MACHINE)/i82371ab.o \
$(MESS_MACHINE)/i82371sb.o \
$(MESS_MACHINE)/i82439tx.o \
$(MESS_MACHINE)/northbridge.o \
$(MESS_MACHINE)/southbridge.o \
$(MESSOBJ)/pdp1.a: \
$(MESS_VIDEO)/pdp1.o \
$(MESS_DRIVERS)/pdp1.o \

View File

@ -9,7 +9,7 @@
#ifndef CIRRUS_H
#define CIRRUS_H
#include "machine/pci.h"
#include "bus/pci/pci.h"
// ======================> cirrus_device