src/mess/machine/i82439tx.c
| r6933 | r6934 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | machine/i82439tx.c |
| 3 | Intel 82439TX System Controller (MTXC) |
| 4 | 4 | |
| 5 | | Intel 82439TX PCI Bridge |
| 6 | | |
| 7 | 5 | ***************************************************************************/ |
| 8 | 6 | |
| 9 | 7 | #include "driver.h" |
| 10 | | #include "machine/i82439tx.h" |
| 11 | | #include "machine/pci.h" |
| 8 | #include "i82439tx.h" |
| 12 | 9 | |
| 13 | 10 | |
| 14 | | struct intel82439tx_info |
| 11 | /*************************************************************************** |
| 12 | TYPE DEFINITIONS |
| 13 | ***************************************************************************/ |
| 14 | |
| 15 | typedef struct _i82439tx_state i82439tx_state; |
| 16 | struct _i82439tx_state |
| 15 | 17 | { |
| 18 | const address_space *space; |
| 19 | UINT8 *rom; |
| 20 | |
| 16 | 21 | UINT32 regs[8]; |
| 17 | 22 | UINT32 bios_ram[0x40000 / 4]; |
| 18 | 23 | }; |
| 19 | 24 | |
| 20 | | static struct intel82439tx_info *i82439tx; |
| 21 | 25 | |
| 26 | /***************************************************************************** |
| 27 | INLINE FUNCTIONS |
| 28 | *****************************************************************************/ |
| 22 | 29 | |
| 23 | | UINT32 intel82439tx_pci_read(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 mem_mask) |
| 30 | INLINE i82439tx_state *get_safe_token(const device_config *device) |
| 24 | 31 | { |
| 32 | assert(device != NULL); |
| 33 | assert(device->token != NULL); |
| 34 | assert(device->type == I82439TX); |
| 35 | |
| 36 | return (i82439tx_state *)device->token; |
| 37 | } |
| 38 | |
| 39 | |
| 40 | /*************************************************************************** |
| 41 | IMPLEMENTATION |
| 42 | ***************************************************************************/ |
| 43 | |
| 44 | static void i82439tx_configure_memory(const device_config *device, UINT8 val, offs_t begin, offs_t end) |
| 45 | { |
| 46 | i82439tx_state *i82439tx = get_safe_token(device); |
| 47 | |
| 48 | switch (val & 0x03) |
| 49 | { |
| 50 | case 0: |
| 51 | memory_install_rom(i82439tx->space, begin, end, 0, 0, i82439tx->rom + (begin - 0xc0000)); |
| 52 | memory_nop_write(i82439tx->space, begin, end, 0, 0); |
| 53 | break; |
| 54 | case 1: |
| 55 | memory_install_rom(i82439tx->space, begin, end, 0, 0, i82439tx->bios_ram + (begin - 0xc0000) / 4); |
| 56 | memory_nop_write(i82439tx->space, begin, end, 0, 0); |
| 57 | break; |
| 58 | case 2: |
| 59 | memory_install_rom(i82439tx->space, begin, end, 0, 0, i82439tx->rom + (begin - 0xc0000)); |
| 60 | memory_install_writeonly(i82439tx->space, begin, end, 0, 0, i82439tx->bios_ram + (begin - 0xc0000) / 4); |
| 61 | break; |
| 62 | case 3: |
| 63 | memory_install_ram(i82439tx->space, begin, end, 0, 0, i82439tx->bios_ram + (begin - 0xc0000) / 4); |
| 64 | break; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | |
| 69 | /*************************************************************************** |
| 70 | PCI INTERFACE |
| 71 | ***************************************************************************/ |
| 72 | |
| 73 | UINT32 i82439tx_pci_read(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 mem_mask) |
| 74 | { |
| 75 | i82439tx_state *i82439tx = get_safe_token(device); |
| 25 | 76 | UINT32 result = 0; |
| 26 | 77 | |
| 27 | 78 | if (function != 0) |
| r6933 | r6934 | |
| 66 | 117 | break; |
| 67 | 118 | |
| 68 | 119 | default: |
| 69 | | fatalerror("intel82439tx_pci_read(): Unexpected PCI read 0x%02X\n", offset); |
| 120 | fatalerror("i82439tx_pci_read(): Unexpected PCI read 0x%02X\n", offset); |
| 70 | 121 | break; |
| 71 | 122 | } |
| 72 | 123 | return result; |
| 73 | 124 | } |
| 74 | 125 | |
| 75 | | |
| 76 | | |
| 77 | | static void intel82439tx_configure_memory(running_machine *machine, UINT8 val, offs_t begin, offs_t end) |
| 126 | void i82439tx_pci_write(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 data, UINT32 mem_mask) |
| 78 | 127 | { |
| 79 | | const address_space *space = cpu_get_address_space(machine->firstcpu, ADDRESS_SPACE_PROGRAM); |
| 128 | i82439tx_state *i82439tx = get_safe_token(device); |
| 80 | 129 | |
| 81 | | char read_bank[10]; |
| 82 | | sprintf(read_bank, "%05x_r", begin); |
| 83 | | |
| 84 | | memory_install_read_bank(space, begin, end, 0, 0, read_bank); |
| 85 | | |
| 86 | | if (BIT(val, 0)) |
| 87 | | memory_set_bankptr(machine, read_bank, i82439tx->bios_ram + (begin - 0xc0000) / 4); |
| 88 | | else |
| 89 | | memory_set_bankptr(machine, read_bank, memory_region(machine, "user1") + (begin - 0xc0000)); |
| 90 | | |
| 91 | | /* write enabled? */ |
| 92 | | if (BIT(val, 1)) |
| 93 | | { |
| 94 | | char write_bank[10]; |
| 95 | | sprintf(write_bank, "%05x_w", begin); |
| 96 | | |
| 97 | | memory_install_write_bank(space, begin, end, 0, 0, write_bank); |
| 98 | | memory_set_bankptr(machine, write_bank, i82439tx->bios_ram + (begin - 0xc0000) / 4); |
| 99 | | } |
| 100 | | else |
| 101 | | memory_nop_write(space, begin, end, 0, 0); |
| 102 | | } |
| 103 | | |
| 104 | | |
| 105 | | |
| 106 | | void intel82439tx_pci_write(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 data, UINT32 mem_mask) |
| 107 | | { |
| 108 | | running_machine *machine = busdevice->machine; |
| 109 | | |
| 110 | 130 | if (function != 0) |
| 111 | 131 | return; |
| 112 | 132 | |
| r6933 | r6934 | |
| 145 | 165 | { |
| 146 | 166 | case 0x58: |
| 147 | 167 | if ((mem_mask & 0x0000f000)) |
| 148 | | intel82439tx_configure_memory(machine, data >> 12, 0xF0000, 0xFFFFF); |
| 168 | i82439tx_configure_memory(device, data >> 12, 0xf0000, 0xfffff); |
| 149 | 169 | if ((mem_mask & 0x000f0000)) |
| 150 | | intel82439tx_configure_memory(machine, data >> 16, 0xC0000, 0xC3FFF); |
| 170 | i82439tx_configure_memory(device, data >> 16, 0xc0000, 0xc3fff); |
| 151 | 171 | if ((mem_mask & 0x00f00000)) |
| 152 | | intel82439tx_configure_memory(machine, data >> 20, 0xC4000, 0xC7FFF); |
| 172 | i82439tx_configure_memory(device, data >> 20, 0xc4000, 0xc7fff); |
| 153 | 173 | if ((mem_mask & 0x0f000000)) |
| 154 | | intel82439tx_configure_memory(machine, data >> 24, 0xC8000, 0xCCFFF); |
| 174 | i82439tx_configure_memory(device, data >> 24, 0xc8000, 0xccfff); |
| 155 | 175 | if ((mem_mask & 0xf0000000)) |
| 156 | | intel82439tx_configure_memory(machine, data >> 28, 0xCC000, 0xCFFFF); |
| 176 | i82439tx_configure_memory(device, data >> 28, 0xcc000, 0xcffff); |
| 157 | 177 | break; |
| 158 | 178 | |
| 159 | 179 | case 0x5C: |
| 160 | 180 | if ((mem_mask & 0x0000000f)) |
| 161 | | intel82439tx_configure_memory(machine, data >> 0, 0xD0000, 0xD3FFF); |
| 181 | i82439tx_configure_memory(device, data >> 0, 0xd0000, 0xd3fff); |
| 162 | 182 | if ((mem_mask & 0x000000f0)) |
| 163 | | intel82439tx_configure_memory(machine, data >> 4, 0xD4000, 0xD7FFF); |
| 183 | i82439tx_configure_memory(device, data >> 4, 0xd4000, 0xd7fff); |
| 164 | 184 | if ((mem_mask & 0x00000f00)) |
| 165 | | intel82439tx_configure_memory(machine, data >> 8, 0xD8000, 0xDBFFF); |
| 185 | i82439tx_configure_memory(device, data >> 8, 0xd8000, 0xdbfff); |
| 166 | 186 | if ((mem_mask & 0x0000f000)) |
| 167 | | intel82439tx_configure_memory(machine, data >> 12, 0xDC000, 0xDFFFF); |
| 187 | i82439tx_configure_memory(device, data >> 12, 0xdc000, 0xdffff); |
| 168 | 188 | if ((mem_mask & 0x000f0000)) |
| 169 | | intel82439tx_configure_memory(machine, data >> 16, 0xE0000, 0xE3FFF); |
| 189 | i82439tx_configure_memory(device, data >> 16, 0xe0000, 0xe3fff); |
| 170 | 190 | if ((mem_mask & 0x00f00000)) |
| 171 | | intel82439tx_configure_memory(machine, data >> 20, 0xE4000, 0xE7FFF); |
| 191 | i82439tx_configure_memory(device, data >> 20, 0xe4000, 0xe7fff); |
| 172 | 192 | if ((mem_mask & 0x0f000000)) |
| 173 | | intel82439tx_configure_memory(machine, data >> 24, 0xE8000, 0xECFFF); |
| 193 | i82439tx_configure_memory(device, data >> 24, 0xe8000, 0xecfff); |
| 174 | 194 | if ((mem_mask & 0xf0000000)) |
| 175 | | intel82439tx_configure_memory(machine, data >> 28, 0xEC000, 0xEFFFF); |
| 195 | i82439tx_configure_memory(device, data >> 28, 0xec000, 0xeffff); |
| 176 | 196 | break; |
| 177 | 197 | } |
| 178 | 198 | |
| r6933 | r6934 | |
| 180 | 200 | break; |
| 181 | 201 | |
| 182 | 202 | default: |
| 183 | | fatalerror("intel82439tx_pci_write(): Unexpected PCI write 0x%02X <-- 0x%08X\n", offset, data); |
| 203 | fatalerror("i82439tx_pci_write(): Unexpected PCI write 0x%02X <-- 0x%08X\n", offset, data); |
| 184 | 204 | break; |
| 185 | 205 | } |
| 186 | 206 | } |
| 187 | 207 | |
| 188 | 208 | |
| 189 | | void intel82439tx_init(running_machine *machine) |
| 209 | /***************************************************************************** |
| 210 | DEVICE INTERFACE |
| 211 | *****************************************************************************/ |
| 212 | |
| 213 | static DEVICE_START( i82439tx ) |
| 190 | 214 | { |
| 191 | | i82439tx = auto_alloc(machine, struct intel82439tx_info); |
| 215 | i82439tx_state *i82439tx = get_safe_token(device); |
| 216 | i82439tx_config *config = device->inline_config; |
| 217 | |
| 218 | /* get address space we are working on */ |
| 219 | const device_config *cpu = devtag_get_device(device->machine, config->cputag); |
| 220 | assert(cpu != NULL); |
| 221 | |
| 222 | i82439tx->space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); |
| 223 | |
| 224 | /* get rom region */ |
| 225 | i82439tx->rom = memory_region(device->machine, config->rom_region); |
| 226 | |
| 227 | /* setup save states */ |
| 228 | state_save_register_device_item_array(device, 0, i82439tx->regs); |
| 229 | state_save_register_device_item_array(device, 0, i82439tx->bios_ram); |
| 192 | 230 | } |
| 193 | 231 | |
| 194 | | void intel82439tx_reset(running_machine *machine) |
| 232 | static DEVICE_RESET( i82439tx ) |
| 195 | 233 | { |
| 196 | | /* setup PCI */ |
| 197 | | memset(i82439tx, 0, sizeof(*i82439tx)); |
| 234 | i82439tx_state *i82439tx = get_safe_token(device); |
| 235 | |
| 236 | /* setup initial values */ |
| 198 | 237 | i82439tx->regs[0x00] = 0x14020000; |
| 199 | 238 | i82439tx->regs[0x01] = 0x01520000; |
| 200 | 239 | i82439tx->regs[0x02] = 0x00000000; |
| 240 | i82439tx->regs[0x03] = 0x00000000; |
| 201 | 241 | i82439tx->regs[0x04] = 0x02020202; |
| 202 | 242 | i82439tx->regs[0x05] = 0x00000002; |
| 243 | i82439tx->regs[0x06] = 0x00000000; |
| 244 | i82439tx->regs[0x07] = 0x00000000; |
| 203 | 245 | |
| 204 | | intel82439tx_configure_memory(machine, 0, 0xF0000, 0xFFFFF); |
| 205 | | intel82439tx_configure_memory(machine, 0, 0xC0000, 0xC3FFF); |
| 206 | | intel82439tx_configure_memory(machine, 0, 0xC4000, 0xC7FFF); |
| 207 | | intel82439tx_configure_memory(machine, 0, 0xC8000, 0xCCFFF); |
| 208 | | intel82439tx_configure_memory(machine, 0, 0xCC000, 0xCFFFF); |
| 209 | | intel82439tx_configure_memory(machine, 0, 0xD0000, 0xD3FFF); |
| 210 | | intel82439tx_configure_memory(machine, 0, 0xD4000, 0xD7FFF); |
| 211 | | intel82439tx_configure_memory(machine, 0, 0xD8000, 0xDBFFF); |
| 212 | | intel82439tx_configure_memory(machine, 0, 0xDC000, 0xDFFFF); |
| 213 | | intel82439tx_configure_memory(machine, 0, 0xE0000, 0xE3FFF); |
| 214 | | intel82439tx_configure_memory(machine, 0, 0xE4000, 0xE7FFF); |
| 215 | | intel82439tx_configure_memory(machine, 0, 0xE8000, 0xECFFF); |
| 216 | | intel82439tx_configure_memory(machine, 0, 0xEC000, 0xEFFFF); |
| 246 | /* configure initial memory state */ |
| 247 | i82439tx_configure_memory(device, 0, 0xf0000, 0xfffff); |
| 248 | i82439tx_configure_memory(device, 0, 0xc0000, 0xc3fff); |
| 249 | i82439tx_configure_memory(device, 0, 0xc4000, 0xc7fff); |
| 250 | i82439tx_configure_memory(device, 0, 0xc8000, 0xccfff); |
| 251 | i82439tx_configure_memory(device, 0, 0xcc000, 0xcffff); |
| 252 | i82439tx_configure_memory(device, 0, 0xd0000, 0xd3fff); |
| 253 | i82439tx_configure_memory(device, 0, 0xd4000, 0xd7fff); |
| 254 | i82439tx_configure_memory(device, 0, 0xd8000, 0xdbfff); |
| 255 | i82439tx_configure_memory(device, 0, 0xdc000, 0xdffff); |
| 256 | i82439tx_configure_memory(device, 0, 0xe0000, 0xe3fff); |
| 257 | i82439tx_configure_memory(device, 0, 0xe4000, 0xe7fff); |
| 258 | i82439tx_configure_memory(device, 0, 0xe8000, 0xecfff); |
| 259 | i82439tx_configure_memory(device, 0, 0xec000, 0xeffff); |
| 217 | 260 | } |
| 261 | |
| 262 | |
| 263 | /*************************************************************************** |
| 264 | DEVICE GETINFO |
| 265 | ***************************************************************************/ |
| 266 | |
| 267 | static const char DEVTEMPLATE_SOURCE[] = __FILE__; |
| 268 | |
| 269 | #define DEVTEMPLATE_ID(p,s) p##i82439tx##s |
| 270 | #define DEVTEMPLATE_FEATURES DT_HAS_START | DT_HAS_RESET | DT_HAS_INLINE_CONFIG |
| 271 | #define DEVTEMPLATE_NAME "Intel 82439TX" |
| 272 | #define DEVTEMPLATE_FAMILY "System controller" |
| 273 | #define DEVTEMPLATE_CLASS DEVICE_CLASS_OTHER |
| 274 | #define DEVTEMPLATE_VERSION "1.0" |
| 275 | #define DEVTEMPLATE_CREDITS "Copyright MESS Team" |
| 276 | #include "devtempl.h" |
src/mess/drivers/at.c
| r6933 | r6934 | |
| 164 | 164 | write32le_with_write8_handler(at_kbdc8042_w, space, offset, data, mem_mask); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | |
| 167 | 168 | static ADDRESS_MAP_START(at16_io, ADDRESS_SPACE_IO, 16) |
| 168 | 169 | AM_RANGE(0x0000, 0x001f) AM_DEVREADWRITE8("dma8237_1", i8237_r, i8237_w, 0xffff) |
| 169 | 170 | AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", pic8259_r, pic8259_w, 0xffff) |
| r6933 | r6934 | |
| 833 | 834 | static MACHINE_DRIVER_START( at586 ) |
| 834 | 835 | MDRV_IMPORT_FROM( at386 ) |
| 835 | 836 | |
| 836 | | MDRV_MACHINE_START( at586 ) |
| 837 | | MDRV_MACHINE_RESET( at586 ) |
| 838 | | |
| 839 | 837 | MDRV_CPU_REPLACE("maincpu", PENTIUM, 60000000) |
| 840 | 838 | MDRV_CPU_PROGRAM_MAP(at586_map) |
| 841 | 839 | MDRV_CPU_IO_MAP(at586_io) |
| 842 | 840 | |
| 841 | MDRV_I82439TX_ADD("i82439tx", "maincpu", "user1") |
| 842 | |
| 843 | 843 | MDRV_PCI_BUS_ADD("pcibus", 0) |
| 844 | | MDRV_PCI_BUS_DEVICE(0, NULL, intel82439tx_pci_read, intel82439tx_pci_write) |
| 844 | MDRV_PCI_BUS_DEVICE(0, "i82439tx", i82439tx_pci_read, i82439tx_pci_write) |
| 845 | 845 | MACHINE_DRIVER_END |
| 846 | 846 | |
| 847 | 847 | |
| r6933 | r6934 | |
| 1001 | 1001 | |
| 1002 | 1002 | ROM_START( at ) |
| 1003 | 1003 | ROM_REGION(0x1000000,"maincpu", 0) |
| 1004 | | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 1004 | ROM_LOAD("wdbios.rom", 0xc8000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 1005 | 1005 | ROM_SYSTEM_BIOS(0, "at", "PC 286") |
| 1006 | 1006 | ROMX_LOAD("at110387.1", 0xf0001, 0x8000, CRC(679296a7) SHA1(ae891314cac614dfece686d8e1d74f4763cf40e3),ROM_SKIP(1) | ROM_BIOS(1) ) |
| 1007 | 1007 | ROMX_LOAD("at110387.0", 0xf0000, 0x8000, CRC(65ae1f97) SHA1(91a29c7deecf7a9afbba330e64e0eee9aafee4d1),ROM_SKIP(1) | ROM_BIOS(1) ) |
| r6933 | r6934 | |
| 1206 | 1206 | ROM_LOAD("et4000.bin", 0x00000, 0x08000, CRC(f01e4be0) SHA1(95d75ff41bcb765e50bd87a8da01835fd0aa01d5)) |
| 1207 | 1207 | ROM_LOAD("wdbios.rom", 0x08000, 0x02000, CRC(8e9e2bd4) SHA1(601d7ceab282394ebab50763c267e915a6a2166a)) |
| 1208 | 1208 | ROM_SYSTEM_BIOS(0, "sptx", "SP-586TX") |
| 1209 | | ROMX_LOAD("sp586tx.bin", 0x20000, 0x20000, CRC(1003d72c) SHA1(ec9224ff9b0fdfd6e462cb7bbf419875414739d6), ROM_BIOS(1)) |
| 1209 | ROMX_LOAD("sp586tx.bin", 0x20000, 0x20000, CRC(1003d72c) SHA1(ec9224ff9b0fdfd6e462cb7bbf419875414739d6), ROM_BIOS(1)) |
| 1210 | 1210 | ROM_SYSTEM_BIOS(1, "unisys", "Unisys 586") // probably bad dump due to need of hac in i82439tx to work |
| 1211 | 1211 | ROMX_LOAD("at586.bin", 0x20000, 0x20000, CRC(717037f5) SHA1(1d49d1b7a4a40d07d1a897b7f8c827754d76f824), ROM_BIOS(2)) |
| 1212 | 1212 | /* 8042 keyboard controller */ |