From b1686e0f4bfde043ad9c82a2e160f1b8aa031ab9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 6 Jan 2021 16:20:02 -0300 Subject: [PATCH] ALi M6117 fixes, the Award BIOS now boots --- src/chipset/ali6117.c | 14 +++++++++----- src/cpu/cpu_table.c | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/chipset/ali6117.c b/src/chipset/ali6117.c index e5dd880f2..0b6beaf9c 100644 --- a/src/chipset/ali6117.c +++ b/src/chipset/ali6117.c @@ -6,7 +6,7 @@ * * This file is part of the 86Box distribution. * - * Implementation of the ALi M6117D SoC. + * Implementation of the ALi M6117 SoC. * * * @@ -34,6 +34,7 @@ #include <86box/port_92.h> #include <86box/usb.h> #include <86box/hdc.h> +#include <86box/hdc_ide.h> #include <86box/chipset.h> @@ -47,7 +48,7 @@ typedef struct ali6117_t uint8_t regs[256]; } ali6117_t; - +#define ENABLE_ALI6117_LOG 1 #ifdef ENABLE_ALI6117_LOG int ali6117_do_log = ENABLE_ALI6117_LOG; @@ -77,7 +78,7 @@ ali6117_recalcmapping(ali6117_t *dev) shadowbios = 0; shadowbios_write = 0; - ali6117_log("ALI6117: Shadowing for a0000-bffff (reg 12) = %s\n", (dev->regs[0x12] & 0x02) ? "on" : "off"); + ali6117_log("ALI6117: Shadowing for A0000-BFFFF (reg 12 bit 1) = %s\n", (dev->regs[0x12] & 0x02) ? "on" : "off"); mem_set_mem_state(0xa0000, 0x20000, (dev->regs[0x12] & 0x02) ? (MEM_WRITE_INTERNAL | MEM_READ_INTERNAL) : (MEM_WRITE_EXTANY | MEM_READ_EXTANY)); for (reg = 0; reg <= 1; reg++) { @@ -149,7 +150,7 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv) case 0x20: val &= 0xbf; - refresh_at_enable = (val & 0x02); + refresh_at_enable = !!(val & 0x80); break; case 0x31: @@ -175,8 +176,11 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv) break; case 0x3c: - /* TODO: IDE channel selection (bit 0, secondary if set) */ val &= 0x8f; + ide_pri_disable(); + ide_set_base(1, (val & 0x01) ? 0x170 : 0x1f0); + ide_set_side(1, (val & 0x01) ? 0x376 : 0x3f6); + ide_pri_enable(); break; case 0x44: case 0x45: diff --git a/src/cpu/cpu_table.c b/src/cpu/cpu_table.c index 73b7169bd..bf3b33c85 100644 --- a/src/cpu/cpu_table.c +++ b/src/cpu/cpu_table.c @@ -191,8 +191,8 @@ const cpu_family_t cpu_families[] = { .name = "M6117", .internal_name = "m6117", .cpus = (const CPU[]) { /* All timings and edx_reset values assumed. */ - {"33", CPU_386DX, fpus_80386, 33333333, 1, 5000, 0x2308, 0, 0, 0, 6,6,3,3, 4}, - {"40", CPU_386DX, fpus_80386, 40000000, 1, 5000, 0x2308, 0, 0, 0, 7,7,3,3, 5}, + {"33", CPU_386SX, fpus_none, 33333333, 1, 5000, 0x2308, 0, 0, 0, 6,6,3,3, 4}, + {"40", CPU_386SX, fpus_none, 40000000, 1, 5000, 0x2308, 0, 0, 0, 7,7,3,3, 5}, {"", 0} } },