diff --git a/src/chipset/intel_420ex.c b/src/chipset/intel_420ex.c index 61f77352b..ca872599d 100644 --- a/src/chipset/intel_420ex.c +++ b/src/chipset/intel_420ex.c @@ -353,9 +353,11 @@ i420ex_write(int func, int addr, uint8_t val, void *priv) dev->regs[addr] = val & 0xff; apm_set_do_smi(dev->apm, !!(dev->regs[0xa0] & 0x01) && !!(val & 0x80)); break; - case 0xaa: case 0xac: case 0xae: - if (dev->id == 0x03) - dev->regs[addr] = val & 0xff; + case 0xaa: + dev->regs[addr] &= (val & 0xff); + break; + case 0xac: case 0xae: + dev->regs[addr] = val & 0xff; break; case 0xa4: dev->regs[addr] = val & 0xfb; diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index db1e8e1c2..85562b7be 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -279,10 +279,10 @@ piix_write(int func, int addr, uint8_t val, void *priv) /* Return on unsupported function. */ if (dev->max_func > 0) { - if (func > dev->max_func) + if (func > dev->max_func) return; } else { - if (func > 1) + if (func > 1) return; } @@ -478,11 +478,11 @@ piix_write(int func, int addr, uint8_t val, void *priv) apm_set_do_smi(dev->apm, !!(fregs[0xa0] & 0x01) && !!(val & 0x80)); } break; - case 0xaa: case 0xac: case 0xae: + case 0xac: case 0xae: if (dev->type < 4) fregs[addr] = val & 0xff; break; - case 0xa3: case 0xab: + case 0xa3: if (dev->type == 3) fregs[addr] = val & 0x01; break; @@ -522,6 +522,14 @@ piix_write(int func, int addr, uint8_t val, void *priv) timer_on_auto(&dev->fast_off_timer, dev->fast_off_period); } break; + case 0xaa: + if (dev->type < 4) + fregs[addr] &= val; + break; + case 0xab: + if (dev->type == 3) + fregs[addr] &= (val & 0x01); + break; case 0xb0: if (dev->type == 4) fregs[addr] = (fregs[addr] & 0x8c) | (val & 0x73); @@ -753,16 +761,16 @@ piix_write(int func, int addr, uint8_t val, void *priv) fregs[addr] = val & 0x01; break; case 0x6a: - if (dev->type == 4) + if (dev->type <= 4) fregs[0x6a] = val & 0x01; break; case 0xc0: - if (dev->type == 4) - fregs[0xc0] = val; + if (dev->type <= 4) + fregs[0xc0] = (fregs[0xc0] & ~(val & 0xbf)) | (val & 0x20); break; case 0xc1: - if (dev->type == 4) - fregs[0xc1] = val & 0xbf; + if (dev->type <= 4) + fregs[0xc1] &= ~val; break; case 0xff: if (dev->type == 4) { @@ -871,6 +879,9 @@ piix_read(int func, int addr, void *priv) piix_t *dev = (piix_t *) priv; uint8_t ret = 0xff, *fregs; + if ((dev->type == 3) && (func == 2) && (dev->max_func == 1) && (addr >= 0x40)) + ret = 0x00; + /* Return on unsupported function. */ if ((func <= dev->max_func) || ((func == 1) && (dev->max_func == 0))) { fregs = (uint8_t *) dev->regs[func]; @@ -993,6 +1004,8 @@ piix_reset_hard(piix_t *dev) fregs[0x69] = 0x02; if ((dev->type == 1) && (dev->rev != 2)) fregs[0x6a] = 0x04; + else if (dev->type == 3) + fregs[0x6a] = 0x10; fregs[0x70] = (dev->type < 4) ? 0x80 : 0x00; fregs[0x71] = (dev->type < 3) ? 0x80 : 0x00; if (dev->type <= 4) { @@ -1063,7 +1076,7 @@ piix_reset_hard(piix_t *dev) fregs[0xc1] = 0x20; fregs[0xff] = (dev->type > 3) ? 0x10 : 0x00; } - dev->max_func = 1; /* It starts with USB disabled, then enables it. */ + dev->max_func = 2; /* It starts with USB disabled, then enables it. */ } /* Function 3: Power Management */ diff --git a/src/chipset/intel_sio.c b/src/chipset/intel_sio.c index 158179a18..370bed928 100644 --- a/src/chipset/intel_sio.c +++ b/src/chipset/intel_sio.c @@ -276,7 +276,11 @@ sio_write(int func, int addr, uint8_t val, void *priv) apm_set_do_smi(dev->apm, !!(dev->regs[0xa0] & 0x01) && !!(val & 0x80)); } break; - case 0xaa: case 0xac: case 0xae: + case 0xaa: + if (dev->id == 0x03) + dev->regs[addr] &= (val & 0xff); + break; + case 0xac: case 0xae: if (dev->id == 0x03) dev->regs[addr] = val & 0xff; break; diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 6cb0243da..d23e76fbd 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -2764,7 +2764,7 @@ void cpu_RDMSR() case 0x1B: EAX = apic_base_msr & 0xffffffff; EDX = apic_base_msr >> 32; - /* pclog("APIC_BASE read : %08X%08X\n", EDX, EAX); */ + cpu_log("APIC_BASE read : %08X%08X\n", EDX, EAX); break; case 0x2A: EAX = 0xC4000000; @@ -3268,7 +3268,7 @@ void cpu_WRMSR() ecx17_msr = EAX | ((uint64_t)EDX << 32); break; case 0x1B: - /* pclog("APIC_BASE write: %08X%08X\n", EDX, EAX); */ + cpu_log("APIC_BASE write: %08X%08X\n", EDX, EAX); // apic_base_msr = EAX | ((uint64_t)EDX << 32); break; case 0x2A: diff --git a/src/device/postcard.c b/src/device/postcard.c index 92166cc97..91eb29fcd 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -79,6 +79,7 @@ postcard_setui(void) int len = strlen(postcard_str); postcard_str[len + 1] = '\0'; postcard_str[len] = '\n'; + postcard_log("[%04X:%08X] ", CS, cpu_state.pc); postcard_log(postcard_str); } } diff --git a/src/io.c b/src/io.c index 0091fae01..a9f41f3ad 100644 --- a/src/io.c +++ b/src/io.c @@ -307,7 +307,7 @@ inb(uint16_t port) if (!found) sub_cycles(io_delay); - io_log("(%i, %i, %04i) in b(%04X) = %02X\n", in_smm, found, qfound, port, ret); + io_log("[%04X:%08X] (%i, %i, %04i) in b(%04X) = %02X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret); return(ret); } @@ -338,7 +338,7 @@ outb(uint16_t port, uint8_t val) #endif } - io_log("(%i, %i, %04i) outb(%04X, %02X)\n", in_smm, found, qfound, port, val); + io_log("[%04X:%08X] (%i, %i, %04i) outb(%04X, %02X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val); return; } @@ -389,7 +389,7 @@ inw(uint16_t port) if (!found) sub_cycles(io_delay); - io_log("(%i, %i, %04i) in w(%04X) = %04X\n", in_smm, found, qfound, port, ret); + io_log("[%04X:%08X] (%i, %i, %04i) in w(%04X) = %04X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret); return ret; } @@ -433,7 +433,7 @@ outw(uint16_t port, uint16_t val) #endif } - io_log("(%i, %i, %04i) outw(%04X, %04X)\n", in_smm, found, qfound, port, val); + io_log("[%04X:%08X] (%i, %i, %04i) outw(%04X, %04X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val); return; } @@ -503,7 +503,7 @@ inl(uint16_t port) sub_cycles(io_delay); if (in_smm) - io_log("(%i, %i, %04i) in l(%04X) = %08X\n", in_smm, found, qfound, port, ret); + io_log("[%04X:%08X] (%i, %i, %04i) in l(%04X) = %08X\n", CS, cpu_state.pc, in_smm, found, qfound, port, ret); return ret; } @@ -562,7 +562,7 @@ outl(uint16_t port, uint32_t val) #endif } - io_log("(%i, %i, %04i) outl(%04X, %08X)\n", in_smm, found, qfound, port, val); + io_log("[%04X:%08X] (%i, %i, %04i) outl(%04X, %08X)\n", CS, cpu_state.pc, in_smm, found, qfound, port, val); return; } diff --git a/src/machine/m_at_socket8.c b/src/machine/m_at_socket8.c index ad648c4ce..7cfa66c11 100644 --- a/src/machine/m_at_socket8.c +++ b/src/machine/m_at_socket8.c @@ -148,15 +148,16 @@ machine_at_vs440fx_init(const machine_t *model) pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0B, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0F, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x11, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x13, PCI_CARD_NORMAL, 2, 3, 4, 1); pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); - pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); - pci_register_slot(0x11, PCI_CARD_NORMAL, 2, 3, 4, 1); - pci_register_slot(0x0F, PCI_CARD_NORMAL, 3, 4, 1, 2); - pci_register_slot(0x0B, PCI_CARD_NORMAL, 4, 1, 2, 3); device_add(&i440fx_device); device_add(&piix3_device); - device_add(&keyboard_ps2_ami_pci_device); + device_add(&keyboard_ps2_intel_ami_pci_device); device_add(&pc87307_device); + device_add(&intel_flash_bxt_ami_device); return ret; diff --git a/src/sio/sio_pc87307.c b/src/sio/sio_pc87307.c index c1372aa92..0921c4677 100644 --- a/src/sio/sio_pc87307.c +++ b/src/sio/sio_pc87307.c @@ -154,10 +154,10 @@ fdc_handler(pc87307_t *dev) fdc_remove(dev->fdc); active = (dev->ld_regs[0x03][0x00] & 0x01) && (dev->pm[0x00] & 0x08); - addr = ((dev->ld_regs[0x03][0x30] << 8) | dev->ld_regs[0x00][0x31]) - 0x0002; + addr = ((dev->ld_regs[0x03][0x30] << 8) | dev->ld_regs[0x03][0x31]) - 0x0002; irq = (dev->ld_regs[0x03][0x40] & 0x0f); - if (active) { + if (active && (addr <= 0xfff2)) { fdc_set_base(dev->fdc, addr); fdc_set_irq(dev->fdc, irq); } @@ -176,7 +176,7 @@ lpt1_handler(pc87307_t *dev) addr = (dev->ld_regs[0x04][0x30] << 8) | dev->ld_regs[0x04][0x31]; irq = (dev->ld_regs[0x04][0x40] & 0x0f); - if (active) { + if (active && (addr <= 0xfffc)) { lpt1_init(addr); lpt1_irq(irq); } @@ -195,7 +195,7 @@ serial_handler(pc87307_t *dev, int uart) addr = (dev->ld_regs[0x06 - uart][0x30] << 8) | dev->ld_regs[0x06 - uart][0x31]; irq = (dev->ld_regs[0x06 - uart][0x40] & 0x0f); - if (active) + if (active && (addr <= 0xfff8)) serial_setup(dev->uart[uart], addr, irq); } @@ -355,7 +355,6 @@ pc87307_write(uint16_t port, uint8_t val, void *priv) case 0x74: case 0x75: switch (dev->regs[0x07]) { case 0x03: - dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa; fdc_handler(dev); break; case 0x04: @@ -434,7 +433,7 @@ pc87307_reset(pc87307_t *dev) for (i = 0; i < 256; i++) memset(dev->ld_regs[i], 0x00, 0xd0); memset(dev->pcregs, 0x00, 0x10); - memset(dev->gpio, 0x00, 0x08); + memset(dev->gpio, 0xff, 0x08); memset(dev->pm, 0x00, 0x08); dev->regs[0x20] = dev->id; diff --git a/src/sio/sio_pc87309.c b/src/sio/sio_pc87309.c index 683af7089..f60d02374 100644 --- a/src/sio/sio_pc87309.c +++ b/src/sio/sio_pc87309.c @@ -283,7 +283,6 @@ pc87309_write(uint16_t port, uint8_t val, void *priv) case 0x74: case 0x75: switch (dev->regs[0x07]) { case 0x00: - dev->ld_regs[dev->regs[0x07]][dev->cur_reg - 0x30] = val & 0xfa; fdc_handler(dev); break; case 0x01: diff --git a/src/win/Makefile.mingw b/src/win/Makefile.mingw index 2eb242ce3..30a545c14 100644 --- a/src/win/Makefile.mingw +++ b/src/win/Makefile.mingw @@ -560,8 +560,8 @@ CPUOBJ := cpu.o cpu_table.o \ $(DYNARECOBJ) CHIPSETOBJ := acc2168.o acer_m3a.o cs8230.o ali1429.o headland.o \ - intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o neat.o \ - opti495.o opti5x7.o scamp.o scat.o \ + intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o \ + neat.o opti495.o opti5x7.o scamp.o scat.o \ sis_85c310.o sis_85c471.o sis_85c496.o \ via_apollo.o via_vpx.o via_vt82c586b.o via_vt82c596b.o wd76c10.o