From f1b59303ab97642e224934fe841cc87b0632d3f4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 20 Oct 2020 18:38:41 +0200 Subject: [PATCH] Implemented VIA PIPC device PCI reset function and improved that of PIIX. --- src/chipset/intel_piix.c | 16 ++++++++++++++++ src/chipset/via_pipc.c | 39 ++++++++++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index 85448bdde..4d2919219 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -1170,7 +1170,23 @@ piix_reset(void *p) piix_write(0, 0xa8, 0x0f, p); } + if (dev->type == 5) + piix_write(0, 0xe1, 0x40, p); piix_write(1, 0x04, 0x00, p); + if (dev->type == 5) { + piix_write(1, 0x09, 0x8a, p); + piix_write(1, 0x10, 0xf1, p); + piix_write(1, 0x11, 0x01, p); + piix_write(1, 0x14, 0xf5, p); + piix_write(1, 0x15, 0x03, p); + piix_write(1, 0x18, 0x71, p); + piix_write(1, 0x19, 0x01, p); + piix_write(1, 0x1c, 0x75, p); + piix_write(1, 0x1d, 0x03, p); + } else + piix_write(1, 0x09, 0x80, p); + piix_write(1, 0x20, 0x01, p); + piix_write(1, 0x21, 0x00, p); piix_write(1, 0x41, 0x00, p); piix_write(1, 0x43, 0x00, p); diff --git a/src/chipset/via_pipc.c b/src/chipset/via_pipc.c index 6233ac488..4c4917002 100644 --- a/src/chipset/via_pipc.c +++ b/src/chipset/via_pipc.c @@ -805,6 +805,35 @@ pipc_write(int func, int addr, uint8_t val, void *priv) } +static void +pipc_reset(void *p) +{ + pipc_t *dev = (pipc_t *) p; + uint8_t pm_func = dev->usb[1] ? 4 : 3; + + pipc_write(pm_func, 0x41, 0x00, p); + pipc_write(pm_func, 0x48, 0x01, p); + pipc_write(pm_func, 0x49, 0x00, p); + + pipc_write(1, 0x04, 0x80, p); + pipc_write(1, 0x09, 0x85, p); + pipc_write(1, 0x10, 0xf1, p); + pipc_write(1, 0x11, 0x01, p); + pipc_write(1, 0x14, 0xf5, p); + pipc_write(1, 0x15, 0x03, p); + pipc_write(1, 0x18, 0x71, p); + pipc_write(1, 0x19, 0x01, p); + pipc_write(1, 0x1c, 0x75, p); + pipc_write(1, 0x1d, 0x03, p); + pipc_write(1, 0x20, 0x01, p); + pipc_write(1, 0x21, 0xcc, p); + if (dev->local <= VIA_PIPC_586B) + pipc_write(1, 0x40, 0x04, p); + else + pipc_write(1, 0x40, 0x00, p); +} + + static void * pipc_init(const device_t *info) { @@ -884,7 +913,7 @@ const device_t via_vt82c586b_device = VIA_PIPC_586B, pipc_init, pipc_close, - NULL, + pipc_reset, NULL, NULL, NULL, @@ -898,7 +927,7 @@ const device_t via_vt82c596_device = VIA_PIPC_596A, pipc_init, pipc_close, - NULL, + pipc_reset, NULL, NULL, NULL, @@ -913,7 +942,7 @@ const device_t via_vt82c596b_device = VIA_PIPC_596B, pipc_init, pipc_close, - NULL, + pipc_reset, NULL, NULL, NULL, @@ -928,7 +957,7 @@ const device_t via_vt82c686a_device = VIA_PIPC_686A, pipc_init, pipc_close, - NULL, + pipc_reset, NULL, NULL, NULL, @@ -943,7 +972,7 @@ const device_t via_vt82c686b_device = VIA_PIPC_686B, pipc_init, pipc_close, - NULL, + pipc_reset, NULL, NULL, NULL,