diff options
Diffstat (limited to 'src/emu/machine/pci.c')
-rw-r--r-- | src/emu/machine/pci.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/src/emu/machine/pci.c b/src/emu/machine/pci.c index f4681aaaf9e..c61d2045d20 100644 --- a/src/emu/machine/pci.c +++ b/src/emu/machine/pci.c @@ -133,7 +133,7 @@ READ32_MEMBER(pci_device::address_base_r) if(bank_reg_infos[offset].hi) return bank_infos[bid].adr >> 32; int flags = bank_infos[bid].flags; - return bank_infos[bid].adr | (flags & M_IO ? 1 : 0) | (flags & M_64A ? 4 : 0) | (flags & M_PREF ? 8 : 0); + return (bank_infos[bid].adr & ~(bank_infos[bid].size - 1)) | (flags & M_IO ? 1 : 0) | (flags & M_64A ? 4 : 0) | (flags & M_PREF ? 8 : 0); } WRITE32_MEMBER(pci_device::address_base_w) @@ -147,7 +147,6 @@ WRITE32_MEMBER(pci_device::address_base_w) if(bank_reg_infos[offset].hi) bank_infos[bid].adr = (bank_infos[bid].adr & 0xffffffff) | (UINT64(data) << 32); else { - data &= ~(bank_infos[bid].size - 1); bank_infos[bid].adr = (bank_infos[bid].adr & U64(0xffffffff00000000)) | data; } remap_cb(); @@ -257,19 +256,20 @@ void pci_device::map_device(UINT64 memory_window_start, UINT64 memory_window_end { for(int i=0; i<bank_count; i++) { bank_info &bi = bank_infos[i]; - if(bi.adr==-1) + if(UINT32(bi.adr) == 0xffffffff) continue; - if(UINT32(bi.adr) == UINT32(~(bi.size - 1))) + if(!bi.size || (bi.flags & M_DISABLED)) continue; - UINT64 start; address_space *space; + UINT64 start = bi.adr & ~(bi.size - 1); + if(bi.flags & M_IO) { space = io_space; - start = bi.adr + io_offset; + start += io_offset; } else { space = memory_space; - start = bi.adr + memory_offset; + start += memory_offset; } UINT64 end = start + bi.size-1; switch(i) { @@ -280,6 +280,7 @@ void pci_device::map_device(UINT64 memory_window_start, UINT64 memory_window_end case 4: space->install_readwrite_handler(start, end, 0, 0, read32_delegate(FUNC(pci_device::unmapped4_r), this), write32_delegate(FUNC(pci_device::unmapped4_w), this)); break; case 5: space->install_readwrite_handler(start, end, 0, 0, read32_delegate(FUNC(pci_device::unmapped5_r), this), write32_delegate(FUNC(pci_device::unmapped5_w), this)); break; } + space->install_device_delegate(start, end, *this, bi.map); logerror("%s: map %s at %0*x-%0*x\n", tag(), bi.map.name(), bi.flags & M_IO ? 4 : 8, UINT32(start), bi.flags & M_IO ? 4 : 8, UINT32(end)); } @@ -337,7 +338,7 @@ void pci_device::add_map(UINT64 size, int flags, address_map_delegate &map) bank_reg_infos[breg].hi = 0; } - logerror("Device %s (%s) has 0x%" I64FMT "x bytes of %s named %s\n", tag(), name(), size, flags & M_IO ? "io" : "memory", map.name()); + logerror("Device %s (%s) has 0x%" I64FMT "x bytes of %s named %s\n", tag(), name(), size, flags & M_IO ? "io" : "memory", bank_infos[bid].map.name()); } void pci_device::add_rom(const UINT8 *rom, UINT32 size) @@ -352,6 +353,24 @@ void pci_device::add_rom_from_region() add_rom(m_region->base(), m_region->bytes()); } +void pci_device::set_map_address(int id, UINT64 adr) +{ + bank_infos[id].adr = adr; + remap_cb(); +} + +void pci_device::set_map_size(int id, UINT64 size) +{ + bank_infos[id].size = size; + remap_cb(); +} + +void pci_device::set_map_flags(int id, int flags) +{ + bank_infos[id].flags = flags; + remap_cb(); +} + 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) { |