Move port 0xcf9 handling from i430FX/VX to PIIX, adding reset callback for FX/HX/VX northbridges.
Add IDE reset to port 0xcf9. Reset IDE error register on reset of non-existent devices. Fixes IDE related issues on soft reset for ASUS boards.
This commit is contained in:
parent
8b46bbe1af
commit
1dd8cf1e81
12 changed files with 83 additions and 28 deletions
24
src/i430fx.c
24
src/i430fx.c
|
|
@ -119,23 +119,6 @@ uint8_t i430fx_read(int func, int addr, void *priv)
|
|||
return card_i430fx[addr];
|
||||
}
|
||||
|
||||
static uint8_t trc = 0;
|
||||
|
||||
void i430fx_trc_write(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
if ((val & 4) && !(trc & 4))
|
||||
{
|
||||
if (val & 2) /*Hard reset*/
|
||||
{
|
||||
i430fx_write(0, 0x59, 0xf, NULL); /*Should reset all PCI devices, but just set PAM0 to point to ROM for now*/
|
||||
keyboard_at_reset(); /*Reset keyboard controller to reset system flag*/
|
||||
}
|
||||
resetx86();
|
||||
}
|
||||
|
||||
trc = val;
|
||||
}
|
||||
|
||||
void i430fx_init()
|
||||
{
|
||||
pci_add_specific(0, i430fx_read, i430fx_write, NULL);
|
||||
|
|
@ -158,6 +141,9 @@ void i430fx_init()
|
|||
card_i430fx[0x72] = 0x02;
|
||||
// card_i430fx[0x74] = 0x0e;
|
||||
// card_i430fx[0x78] = 0x23;
|
||||
|
||||
io_sethandler(0x0cf9, 0x0001, NULL, NULL, NULL, i430fx_trc_write, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void i430fx_reset()
|
||||
{
|
||||
i430fx_write(0, 0x59, 0xf, NULL); /*Should reset all PCI devices, but just set PAM0 to point to ROM for now*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
void i430fx_init();
|
||||
void i430fx_reset();
|
||||
|
|
|
|||
|
|
@ -142,3 +142,8 @@ void i430hx_init()
|
|||
card_i430hx[0x65] = card_i430hx[0x66] = card_i430hx[0x67] = 0x02;
|
||||
card_i430hx[0x68] = 0x11;
|
||||
}
|
||||
|
||||
void i430hx_reset()
|
||||
{
|
||||
i430hx_write(0, 0x59, 0xf, NULL); /*Should reset all PCI devices, but just set PAM0 to point to ROM for now*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
void i430hx_init();
|
||||
void i430hx_reset();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
#include "io.h"
|
||||
#include "keyboard_at.h"
|
||||
#include "mem.h"
|
||||
|
|
@ -134,6 +135,7 @@ void i430lx_trc_write(uint16_t port, uint8_t val, void *p)
|
|||
{
|
||||
i430lx_write(0, 0x59, 0xf, NULL); /*Should reset all PCI devices, but just set PAM0 to point to ROM for now*/
|
||||
keyboard_at_reset(); /*Reset keyboard controller to reset system flag*/
|
||||
ide_reset_devices();
|
||||
}
|
||||
resetx86();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,3 +142,8 @@ void i430vx_init()
|
|||
card_i430vx[0x74] = 0x0e;
|
||||
card_i430vx[0x78] = 0x23;
|
||||
}
|
||||
|
||||
void i430vx_reset()
|
||||
{
|
||||
i430vx_write(0, 0x59, 0xf, NULL); /*Should reset all PCI devices, but just set PAM0 to point to ROM for now*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
void i430vx_init();
|
||||
void i430vx_reset();
|
||||
|
|
|
|||
26
src/ide.c
26
src/ide.c
|
|
@ -824,6 +824,7 @@ void callbackide(int ide_board)
|
|||
if (ide->type == IDE_NONE)
|
||||
{
|
||||
ide->cylinder=0xFFFF;
|
||||
ide->error = 0xff;
|
||||
atapi->stop();
|
||||
}
|
||||
if (IDE_DRIVE_IS_CDROM(ide_other))
|
||||
|
|
@ -835,6 +836,7 @@ void callbackide(int ide_board)
|
|||
if (ide_other->type == IDE_NONE)
|
||||
{
|
||||
ide_other->cylinder=0xFFFF;
|
||||
ide_other->error = 0xff;
|
||||
atapi->stop();
|
||||
}
|
||||
// pclog("Reset callback\n");
|
||||
|
|
@ -1281,6 +1283,30 @@ void ide_set_bus_master(int (*read_data)(int channel, uint8_t *data, int size, v
|
|||
ide_bus_master_p = p;
|
||||
}
|
||||
|
||||
void ide_reset_devices()
|
||||
{
|
||||
if (ide_drives[0].type != IDE_NONE || ide_drives[1].type != IDE_NONE)
|
||||
{
|
||||
timer_set_delay_u64(&ide_timer[0], 500*IDE_TIME);
|
||||
ide_drives[0].reset = ide_drives[1].reset = 1;
|
||||
ide_drives[0].atastat = ide_drives[1].atastat = BUSY_STAT;
|
||||
if (ide_drives[0].type != IDE_NONE)
|
||||
cur_ide[0] = 0;
|
||||
else
|
||||
cur_ide[0] = 1;
|
||||
}
|
||||
if (ide_drives[2].type != IDE_NONE || ide_drives[3].type != IDE_NONE)
|
||||
{
|
||||
timer_set_delay_u64(&ide_timer[1], 500*IDE_TIME);
|
||||
ide_drives[2].reset = ide_drives[3].reset = 1;
|
||||
ide_drives[2].atastat = ide_drives[3].atastat = BUSY_STAT;
|
||||
if (ide_drives[2].type != IDE_NONE)
|
||||
cur_ide[1] = 2;
|
||||
else
|
||||
cur_ide[1] = 3;
|
||||
}
|
||||
}
|
||||
|
||||
device_t ide_device =
|
||||
{
|
||||
"Standard IDE",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ extern void ide_pri_disable();
|
|||
extern void ide_sec_disable();
|
||||
extern void ide_set_bus_master(int (*read_data)(int channel, uint8_t *data, int size, void *p), int (*write_data)(int channel, uint8_t *data, int size, void *p), void (*set_irq)(int channel, void *p), void *p);
|
||||
void ide_irq_raise(struct IDE *ide);
|
||||
void ide_reset_devices();
|
||||
|
||||
extern int (*ide_bus_master_read_data)(int channel, uint8_t *data, int size, void *p);
|
||||
extern int (*ide_bus_master_write_data)(int channel, uint8_t *data, int size, void *p);
|
||||
|
|
|
|||
14
src/model.c
14
src/model.c
|
|
@ -675,7 +675,7 @@ void at_endeavor_init()
|
|||
pci_slot(0xf);
|
||||
pci_slot(0x10);
|
||||
i430fx_init();
|
||||
piix_init(7, 0xd, 0xe, 0xf, 0x10);
|
||||
piix_init(7, 0xd, 0xe, 0xf, 0x10, i430fx_reset);
|
||||
pc87306_init(0x2e);
|
||||
intel_endeavor_init();
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
|
@ -687,7 +687,7 @@ void at_pb570_init()
|
|||
pci_slot(0x11);
|
||||
pci_slot(0x13);
|
||||
i430fx_init();
|
||||
piix_init(7, 0x11, 0x13, 0xb, 0x8);
|
||||
piix_init(7, 0x11, 0x13, 0xb, 0x8, i430fx_reset);
|
||||
pc87306_init(0x2e);
|
||||
intel_endeavor_init();
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
|
@ -701,7 +701,7 @@ void at_zappa_init()
|
|||
pci_slot(0xf);
|
||||
pci_slot(0x10);
|
||||
i430fx_init();
|
||||
piix_init(7, 0xd, 0xf, 0xe, 0x10);
|
||||
piix_init(7, 0xd, 0xf, 0xe, 0x10, i430fx_reset);
|
||||
pc87306_init(0x2e);
|
||||
intel_zappa_init();
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
|
@ -716,7 +716,7 @@ void at_p55va_init()
|
|||
pci_slot(0x0A);
|
||||
pci_slot(0x0B);
|
||||
i430vx_init();
|
||||
piix_init(7, 0x08, 0x09, 0x0A, 0x0B);
|
||||
piix_init(7, 0x08, 0x09, 0x0A, 0x0B, i430vx_reset);
|
||||
fdc37c932fr_init();
|
||||
device_add(&intel_flash_bxt_device);
|
||||
}
|
||||
|
|
@ -730,7 +730,7 @@ void at_p55tvp4_init()
|
|||
pci_slot(0x0A);
|
||||
pci_slot(0x09);
|
||||
i430vx_init();
|
||||
piix_init(7, 0x0C, 0x0B, 0x0A, 0x09);
|
||||
piix_init(7, 0x0C, 0x0B, 0x0A, 0x09, i430vx_reset);
|
||||
w83877f_init(0x3f0, 0x87);
|
||||
device_add(&intel_flash_bxt_device);
|
||||
}
|
||||
|
|
@ -744,7 +744,7 @@ void at_i430vx_init()
|
|||
pci_slot(0x13);
|
||||
pci_slot(0x14);
|
||||
i430vx_init();
|
||||
piix_init(7, 18, 17, 20, 19);
|
||||
piix_init(7, 18, 17, 20, 19, i430vx_reset);
|
||||
um8669f_init();
|
||||
device_add(&intel_flash_bxt_device);
|
||||
}
|
||||
|
|
@ -758,7 +758,7 @@ void at_p55t2p4_init()
|
|||
pci_slot(0x0A);
|
||||
pci_slot(0x09);
|
||||
i430hx_init();
|
||||
piix_init(7, 0x0C, 0x0B, 0x0A, 0x09);
|
||||
piix_init(7, 0x0C, 0x0B, 0x0A, 0x09, i430hx_reset);
|
||||
w83877f_init(0x3f0, 0x87);
|
||||
device_add(&intel_flash_bxt_device);
|
||||
}
|
||||
|
|
|
|||
29
src/piix.c
29
src/piix.c
|
|
@ -8,6 +8,7 @@
|
|||
#include "ibm.h"
|
||||
#include "ide.h"
|
||||
#include "ide_sff8038i.h"
|
||||
#include "keyboard_at.h"
|
||||
#include "io.h"
|
||||
#include "mem.h"
|
||||
#include "pci.h"
|
||||
|
|
@ -17,6 +18,8 @@
|
|||
|
||||
static uint8_t card_piix[256], card_piix_ide[256];
|
||||
static sff_busmaster_t piix_busmaster[2];
|
||||
static uint8_t piix_rc = 0;
|
||||
static void (*piix_nb_reset)();
|
||||
|
||||
void piix_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
|
|
@ -140,7 +143,28 @@ uint8_t piix_read(int func, int addr, void *priv)
|
|||
}
|
||||
|
||||
|
||||
void piix_init(int card, int pci_a, int pci_b, int pci_c, int pci_d)
|
||||
uint8_t piix_rc_read(uint16_t port, void *p)
|
||||
{
|
||||
return piix_rc;
|
||||
}
|
||||
|
||||
void piix_rc_write(uint16_t port, uint8_t val, void *p)
|
||||
{
|
||||
if (val & 4)
|
||||
{
|
||||
if (val & 2) /*Hard reset*/
|
||||
{
|
||||
piix_nb_reset();
|
||||
keyboard_at_reset(); /*Reset keyboard controller to reset system flag*/
|
||||
ide_reset_devices();
|
||||
}
|
||||
resetx86();
|
||||
}
|
||||
|
||||
piix_rc = val & ~4;
|
||||
}
|
||||
|
||||
void piix_init(int card, int pci_a, int pci_b, int pci_c, int pci_d, void (*nb_reset)())
|
||||
{
|
||||
pci_add_specific(card, piix_read, piix_write, NULL);
|
||||
|
||||
|
|
@ -190,4 +214,7 @@ void piix_init(int card, int pci_a, int pci_b, int pci_c, int pci_d)
|
|||
ide_sec_disable();
|
||||
|
||||
pic_init_elcrx();
|
||||
|
||||
io_sethandler(0x0cf9, 0x0001, piix_rc_read, NULL, NULL, piix_rc_write, NULL, NULL, NULL);
|
||||
piix_nb_reset = nb_reset;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
void piix_init(int card, int pci_a, int pci_b, int pci_c, int pci_d);
|
||||
void piix_init(int card, int pci_a, int pci_b, int pci_c, int pci_d, void (*nb_reset)());
|
||||
|
|
|
|||
Loading…
Reference in a new issue