diff options
-rw-r--r-- | src/devices/machine/pci.cpp | 32 | ||||
-rw-r--r-- | src/devices/machine/pci.h | 2 | ||||
-rw-r--r-- | src/mame/apple/bandit.cpp | 29 | ||||
-rw-r--r-- | src/mame/apple/bandit.h | 2 | ||||
-rw-r--r-- | src/mame/apple/macpci.cpp | 2 |
5 files changed, 59 insertions, 8 deletions
diff --git a/src/devices/machine/pci.cpp b/src/devices/machine/pci.cpp index c0f2676ca56..10433028f2a 100644 --- a/src/devices/machine/pci.cpp +++ b/src/devices/machine/pci.cpp @@ -938,6 +938,38 @@ void pci_host_device::config_data_w(offs_t offset, uint32_t data, uint32_t mem_m root_config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); } +uint32_t pci_host_device::config_data_ex_r(offs_t offset, uint32_t mem_mask) +{ + // is this a Type 0 or Type 1 configuration address? (page 31, PCI 2.2 Specification) + if ((config_address & 3) == 0) + { + const int devnum = 31 - count_leading_zeros_32(config_address & 0xfffff800); + return root_config_read(0, devnum << 3, config_address & 0xfc, mem_mask); + } + else if ((config_address & 3) == 1) + return config_address & 0x80000000 ? root_config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff; + + logerror("pci: configuration address format %d unsupported", config_address & 3); + return 0xffffffff; +} + +void pci_host_device::config_data_ex_w(offs_t offset, uint32_t data, uint32_t mem_mask) +{ + // is this a Type 0 or Type 1 configuration address? (page 31, PCI 2.2 Specification) + if ((config_address & 3) == 0) + { + const int devnum = 31 - count_leading_zeros_32(config_address & 0xfffff800); + root_config_write(0, devnum << 3, config_address & 0xfc, data, mem_mask); + } + else if ((config_address & 3) == 1) + { + if (config_address & 0x80000000) + root_config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); + } + else + logerror("pci: configuration address format %d unsupported", config_address & 3); +} + uint32_t pci_host_device::root_config_read(uint8_t bus, uint8_t device, uint16_t reg, uint32_t mem_mask) { if(bus == 0x00) diff --git a/src/devices/machine/pci.h b/src/devices/machine/pci.h index 53e1a6be3d1..1bb75f52f67 100644 --- a/src/devices/machine/pci.h +++ b/src/devices/machine/pci.h @@ -249,6 +249,8 @@ protected: void config_address_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); uint32_t config_data_r(offs_t offset, uint32_t mem_mask = ~0); void config_data_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); + uint32_t config_data_ex_r(offs_t offset, uint32_t mem_mask = ~0); + void config_data_ex_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); virtual void device_start() override; virtual void device_reset() override; diff --git a/src/mame/apple/bandit.cpp b/src/mame/apple/bandit.cpp index 62fe6170125..a1c9309646a 100644 --- a/src/mame/apple/bandit.cpp +++ b/src/mame/apple/bandit.cpp @@ -29,6 +29,7 @@ void bandit_host_device::config_map(address_map &map) bandit_host_device::bandit_host_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : pci_host_device(mconfig, type, tag, owner, clock) + , m_last_config_address(0xffffffff) , m_mem_config("memory_space", ENDIANNESS_LITTLE, 32, 32) , m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32) , m_cpu(*this, finder_base::DUMMY_TAG) @@ -123,19 +124,26 @@ void bandit_host_device::cpu_map(address_map &map) u32 bandit_host_device::be_config_address_r() { - u32 temp = pci_host_device::config_address_r(); - return (temp >> 24) | (temp << 24) | ((temp & 0xff00) << 8) | ((temp & 0xff0000) >> 8); + return m_last_config_address; } void bandit_host_device::be_config_address_w(offs_t offset, u32 data, u32 mem_mask) { u32 tempdata = (data >> 24) | (data << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8); - pci_host_device::config_address_w(offset, tempdata|0x80000000, mem_mask); + + m_last_config_address = tempdata; + + if ((tempdata & 3) == 1) + { + tempdata |= 0x80000000; + } + + pci_host_device::config_address_w(offset, tempdata, mem_mask); } u32 bandit_host_device::be_config_data_r(offs_t offset, u32 mem_mask) { - u32 temp = pci_host_device::config_data_r(offset, mem_mask); + u32 temp = pci_host_device::config_data_ex_r(offset, mem_mask); return (temp >> 24) | (temp << 24) | ((temp & 0xff00) << 8) | ((temp & 0xff0000) >> 8); } @@ -146,7 +154,7 @@ void bandit_host_device::be_config_data_w(offs_t offset, u32 data, u32 mem_mask) // printf("config_data_w: %08x @ %08x mask %08x\n", data, offset, mem_mask); tempdata = (data >> 24) | (data << 24) | ((data & 0xff00) << 8) | ((data & 0xff0000) >> 8); - pci_host_device::config_data_w(offset, tempdata, mem_mask); + pci_host_device::config_data_ex_w(offset, tempdata, mem_mask); } template <u32 Base> @@ -194,10 +202,17 @@ void bandit_host_device::map_extra(u64 memory_window_start, u64 memory_window_en u32 aspen_host_device::be_config_address_r() { - return pci_host_device::config_address_r(); + return m_last_config_address; } void aspen_host_device::be_config_address_w(offs_t offset, u32 data, u32 mem_mask) { - pci_host_device::config_address_w(offset, data | 0x80000000, mem_mask); + m_last_config_address = data; + + if ((data & 3) == 1) + { + data |= 0x80000000; + } + + pci_host_device::config_address_w(offset, data, mem_mask); } diff --git a/src/mame/apple/bandit.h b/src/mame/apple/bandit.h index f3386ff29f0..0df9e1bfd80 100644 --- a/src/mame/apple/bandit.h +++ b/src/mame/apple/bandit.h @@ -42,6 +42,8 @@ protected: virtual space_config_vector memory_space_config() const override; + u32 m_last_config_address; + private: void cpu_map(address_map &map); virtual u32 be_config_address_r(); diff --git a/src/mame/apple/macpci.cpp b/src/mame/apple/macpci.cpp index 09de9427aea..8fd6317bbcd 100644 --- a/src/mame/apple/macpci.cpp +++ b/src/mame/apple/macpci.cpp @@ -171,7 +171,7 @@ void macpci_state::pippin(machine_config &config) RAM(config, m_ram); m_ram->set_default_size("32M"); - grandcentral_device &grandcentral(GRAND_CENTRAL(config, "pci:05.0", 0)); + grandcentral_device &grandcentral(GRAND_CENTRAL(config, "pci:0d.0", 0)); grandcentral.set_maincpu_tag("maincpu"); MACADB(config, m_macadb, 15.6672_MHz_XTAL); |