Merged the ALi M1217 into the M6117 (that's based on the M1217), moved the M6117 out of the Dev branch, removed the broken M6117 Acrosser, and added three M1217 machines. This finishes the ALi work.

This commit is contained in:
OBattler
2021-08-05 18:16:17 +02:00
parent 5b867e6a32
commit 5ecf3ac6cb
8 changed files with 102 additions and 195 deletions

View File

@@ -13,8 +13,8 @@
# Copyright 2020,2021 David Hrdlička. # Copyright 2020,2021 David Hrdlička.
# #
add_library(chipset OBJECT acc2168.c cs8230.c ali1217.c ali1429.c ali1489.c ali1531.c ali1541.c add_library(chipset OBJECT acc2168.c cs8230.c ali1429.c ali1489.c ali1531.c ali1541.c ali1543.c
ali1543.c ali1621.c headland.c intel_82335.c contaq_82c59x.c cs4031.c intel_420ex.c ali1621.c ali6117.c headland.c intel_82335.c contaq_82c59x.c cs4031.c intel_420ex.c
intel_4x0.c intel_sio.c intel_piix.c ../ioapic.c neat.c opti283.c opti291.c opti391.c intel_4x0.c intel_sio.c intel_piix.c ../ioapic.c neat.c opti283.c opti291.c opti391.c
opti495.c opti822.c opti895.c opti5x7.c scamp.c scat.c sis_85c310.c sis_85c4xx.c opti495.c opti822.c opti895.c opti5x7.c scamp.c scat.c sis_85c310.c sis_85c4xx.c
sis_85c496.c sis_85c50x.c sis_5511.c sis_5571.c via_vt82c49x.c via_vt82c505.c sis_85c310.c sis_85c496.c sis_85c50x.c sis_5511.c sis_5571.c via_vt82c49x.c via_vt82c505.c sis_85c310.c
@@ -25,10 +25,6 @@ if(I450KX)
target_sources(chipset PRIVATE intel_i450kx.c) target_sources(chipset PRIVATE intel_i450kx.c)
endif() endif()
if(M6117)
target_sources(chipset PRIVATE ali6117.c)
endif()
if(OLIVETTI) if(OLIVETTI)
target_sources(chipset PRIVATE olivetti_eva.c) target_sources(chipset PRIVATE olivetti_eva.c)
endif() endif()

View File

@@ -1,145 +0,0 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Implementation of the ALi M1217 chipset.
*
* Note: This chipset has no datasheet, everything were done via
* reverse engineering the BIOS of various machines using it.
*
* Authors: Tiseno100
*
* Copyright 2021 Tiseno100
*
*/
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include "cpu.h"
#include <86box/timer.h>
#include <86box/io.h>
#include <86box/device.h>
#include <86box/mem.h>
#include <86box/port_92.h>
#include <86box/chipset.h>
#ifdef ENABLE_ALI1217_LOG
int ali1217_do_log = ENABLE_ALI1217_LOG;
static void
ali1217_log(const char *fmt, ...)
{
va_list ap;
if (ali1217_do_log)
{
va_start(ap, fmt);
pclog_ex(fmt, ap);
va_end(ap);
}
}
#else
#define ali1217_log(fmt, ...)
#endif
typedef struct
{
uint8_t index, regs[256];
int cfg_locked;
} ali1217_t;
static void ali1217_shadow_recalc(int reg_15, ali1217_t *dev)
{
for (uint8_t i = 0; i < 4; i++)
mem_set_mem_state_both((reg_15 ? 0xe0000 : 0xc0000) + (i << 15), 0x8000, ((dev->regs[0x14 + reg_15] & (1 << (i * 2))) ? MEM_READ_INTERNAL : MEM_READ_EXTANY) | ((dev->regs[0x14 + reg_15] & (1 << ((i * 2) + 1))) ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY));
flushmmucache_nopc();
}
static void
ali1217_write(uint16_t addr, uint8_t val, void *priv)
{
ali1217_t *dev = (ali1217_t *)priv;
switch (addr)
{
case 0x22:
dev->index = val;
break;
case 0x23:
if (dev->index != 0x13)
ali1217_log("ALi M1217: dev->regs[%02x] = %02x\n", dev->index, val);
else
dev->cfg_locked = !(val == 0xc5);
if (!dev->cfg_locked)
{
dev->regs[dev->index] = val;
if ((dev->index == 0x14) || (dev->index == 0x15))
ali1217_shadow_recalc(dev->index & 1, dev);
}
break;
}
}
static uint8_t
ali1217_read(uint16_t addr, void *priv)
{
ali1217_t *dev = (ali1217_t *)priv;
return (addr == 0x23) ? dev->regs[dev->index] : 0xff;
}
static void
ali1217_close(void *priv)
{
ali1217_t *dev = (ali1217_t *)priv;
free(dev);
}
static void *
ali1217_init(const device_t *info)
{
ali1217_t *dev = (ali1217_t *)malloc(sizeof(ali1217_t));
memset(dev, 0, sizeof(ali1217_t));
device_add(&port_92_device);
dev->cfg_locked = 1;
/*
ALi M1217 Ports
22h Index Port
23h Data Port
*/
io_sethandler(0x0022, 0x0002, ali1217_read, NULL, NULL, ali1217_write, NULL, NULL, dev);
return dev;
}
const device_t ali1217_device = {
"ALi M1217",
0,
0,
ali1217_init,
ali1217_close,
NULL,
{NULL},
NULL,
NULL,
NULL};

View File

@@ -109,7 +109,7 @@ ali6117_recalcmapping(ali6117_t *dev)
} }
} }
flushmmucache(); flushmmucache_nopc();
} }
@@ -127,12 +127,16 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv)
else if (dev->unlocked) { else if (dev->unlocked) {
ali6117_log("ALI6117: regs[%02X] = %02X\n", dev->reg_offset, val); ali6117_log("ALI6117: regs[%02X] = %02X\n", dev->reg_offset, val);
switch (dev->reg_offset) { if (!(dev->local & 0x08) || (dev->reg_offset < 0x30)) switch (dev->reg_offset) {
case 0x30: case 0x34: case 0x35: case 0x3e: case 0x30: case 0x34: case 0x35: case 0x3e:
case 0x3f: case 0x46: case 0x4c: case 0x6a: case 0x3f: case 0x46: case 0x4c: case 0x6a:
case 0x73: case 0x73:
return; /* read-only registers */ return; /* read-only registers */
case 0x10:
refresh_at_enable = !(val & 0x02) || !!(dev->regs[0x20] & 0x80);
break;
case 0x12: case 0x12:
val &= 0xf7; val &= 0xf7;
/* FALL-THROUGH */ /* FALL-THROUGH */
@@ -184,7 +188,7 @@ ali6117_reg_write(uint16_t addr, uint8_t val, void *priv)
case 0x20: case 0x20:
val &= 0xbf; val &= 0xbf;
refresh_at_enable = !!(val & 0x80); refresh_at_enable = !(dev->regs[0x10] & 0x02) || !!(val & 0x80);
break; break;
case 0x31: case 0x31:
@@ -311,13 +315,17 @@ ali6117_reset(void *priv)
dev->regs[0x1b] = 0xf0; dev->regs[0x1b] = 0xf0;
dev->regs[0x1d] = 0xff; dev->regs[0x1d] = 0xff;
dev->regs[0x20] = 0x80; dev->regs[0x20] = 0x80;
dev->regs[0x30] = 0x08; if (dev->local & 0x08) {
dev->regs[0x31] = 0x01; dev->regs[0x30] = 0x08;
dev->regs[0x34] = 0x04; /* enable internal RTC */ dev->regs[0x31] = 0x01;
dev->regs[0x35] = 0x20; /* enable internal KBC */ dev->regs[0x34] = 0x04; /* enable internal RTC */
dev->regs[0x36] = dev->local & 0x4; /* M6117D ID */ dev->regs[0x35] = 0x20; /* enable internal KBC */
dev->regs[0x36] = dev->local & 0x07; /* M6117D ID */
}
cpu_set_isa_speed(7159091); cpu_set_isa_speed(7159091);
refresh_at_enable = 1;
} }
@@ -361,13 +369,28 @@ ali6117_init(const device_t *info)
ali6117_setup(dev); ali6117_setup(dev);
ali6117_reset(dev); ali6117_reset(dev);
pic_elcr_io_handler(0); if (!(dev->local & 0x08))
refresh_at_enable = 0; pic_elcr_io_handler(0);
return dev; return dev;
} }
const device_t ali1217_device =
{
"ALi M1217",
DEVICE_AT,
0x8,
ali6117_init,
ali6117_close,
ali6117_reset,
{ NULL },
NULL,
NULL,
NULL
};
const device_t ali6117d_device = const device_t ali6117d_device =
{ {
"ALi M6117D", "ALi M6117D",

View File

@@ -30,9 +30,7 @@ extern const device_t ali1541_device;
extern const device_t ali1543_device; extern const device_t ali1543_device;
extern const device_t ali1543c_device; extern const device_t ali1543c_device;
extern const device_t ali1621_device; extern const device_t ali1621_device;
#if defined(DEV_BRANCH) && defined(USE_M6117)
extern const device_t ali6117d_device; extern const device_t ali6117d_device;
#endif
/* AMD */ /* AMD */
extern const device_t amd640_device; extern const device_t amd640_device;

View File

@@ -279,13 +279,13 @@ extern int machine_at_cmdsl386sx16_init(const machine_t *);
extern int machine_at_cmdsl386sx25_init(const machine_t *); extern int machine_at_cmdsl386sx25_init(const machine_t *);
extern int machine_at_spc6033p_init(const machine_t *); extern int machine_at_spc6033p_init(const machine_t *);
extern int machine_at_wd76c10_init(const machine_t *); extern int machine_at_wd76c10_init(const machine_t *);
extern int machine_at_arb1374_init(const machine_t *);
extern int machine_at_sbc_350a_init(const machine_t *);
extern int machine_at_flytech386_init(const machine_t *); extern int machine_at_flytech386_init(const machine_t *);
extern int machine_at_mr1217_init(const machine_t *);
extern int machine_at_pja511m_init(const machine_t *);
extern int machine_at_awardsx_init(const machine_t *); extern int machine_at_awardsx_init(const machine_t *);
#if defined(DEV_BRANCH) && defined(USE_M6117)
extern int machine_at_arb1375_init(const machine_t *);
extern int machine_at_pja511m_init(const machine_t *);
#endif
extern int machine_at_pc916sx_init(const machine_t *); extern int machine_at_pc916sx_init(const machine_t *);

View File

@@ -678,6 +678,49 @@ machine_at_awardsx_init(const machine_t *model)
return ret; return ret;
} }
int
machine_at_arb1374_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/arb1374/1374s.rom",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add(&ali1217_device);
device_add(&w83787f_ide_en_device);
device_add(&keyboard_ps2_ami_device);
return ret;
}
int
machine_at_sbc_350a_init(const machine_t *model)
{
int ret;
ret = bios_load_linear("roms/machines/sbc_350a/350a.rom",
0x000f0000, 65536, 0);
if (bios_only || !ret)
return ret;
machine_at_common_init(model);
device_add(&ali1217_device);
device_add(&sio_detect_device);
device_add(&keyboard_at_device);
return ret;
}
int int
machine_at_flytech386_init(const machine_t *model) machine_at_flytech386_init(const machine_t *model)
{ {
@@ -701,30 +744,31 @@ machine_at_flytech386_init(const machine_t *model)
return ret; return ret;
} }
const device_t * const device_t *
at_flytech386_get_device(void) at_flytech386_get_device(void)
{ {
return &tvga8900d_device; return &tvga8900d_device;
} }
#if defined(DEV_BRANCH) && defined(USE_M6117)
int int
machine_at_arb1375_init(const machine_t *model) machine_at_mr1217_init(const machine_t *model)
{ {
int ret; int ret;
ret = bios_load_linear("roms/machines/arb1375/a1375v25.u11-a", ret = bios_load_linear("roms/machines/mr1217/mrbios.BIN",
0x000e0000, 131072, 0); 0x000f0000, 65536, 0);
if (bios_only || !ret) if (bios_only || !ret)
return ret; return ret;
machine_at_common_init(model); machine_at_common_init(model);
device_add(&fdc37c669_device); device_add(&ali1217_device);
device_add(&keyboard_ps2_ami_pci_device); device_add(&fdc_at_device);
device_add(&ali6117d_device); device_add(&ide_isa_device);
device_add(&sst_flash_29ee010_device); device_add(&keyboard_ps2_device);
return ret; return ret;
} }
@@ -752,7 +796,6 @@ machine_at_pja511m_init(const machine_t *model)
return ret; return ret;
} }
#endif
/* /*
* Current bugs: * Current bugs:

View File

@@ -239,16 +239,19 @@ const machine_t machines[] = {
{ "[ISA] NCR PC916SX", "pc916sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 128, 127, machine_at_pc916sx_init, NULL }, { "[ISA] NCR PC916SX", "pc916sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 128, 127, machine_at_pc916sx_init, NULL },
/* Has Quadtel KBC firmware. */ /* Has Quadtel KBC firmware. */
{ "[ISA] QTC-SXM KT X20T02/HI", "quadt386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 128, 127, machine_at_quadt386sx_init, NULL }, { "[ISA] QTC-SXM KT X20T02/HI", "quadt386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 1024, 16384, 128, 127, machine_at_quadt386sx_init, NULL },
#if defined(DEV_BRANCH) && defined(USE_M6117) /* This has an AMIKey-2, which is an updated version of type 'H'. */
/* Has IBM PS/2 Type 1 KBC firmware. */ { "[ALi M1217] Acrosser AR-B1374", "arb1374", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_arb1374_init, NULL },
{ "[ALi M6117] Acrosser AR-B1375", "arb1375", MACHINE_TYPE_386SX, CPU_PKG_M6117, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_arb1375_init, NULL }, /* Has the AMIKey KBC firmware, which is an updated 'F' type. */
/* Has IBM PS/2 Type 1 KBC firmware. */ { "[ALi M1217] AAEON SBC-350A", "sbc-350a", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 16384, 1024, 127, machine_at_sbc_350a_init, NULL },
{ "[ALi M6117] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, CPU_PKG_M6117, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_pja511m_init, NULL },
#endif
/* Has an AMI KBC firmware, the only photo of this is too low resolution /* Has an AMI KBC firmware, the only photo of this is too low resolution
for me to read what's on the KBC chip, so I'm going to assume AMI 'F' for me to read what's on the KBC chip, so I'm going to assume AMI 'F'
based on the other known HT18 AMI BIOS strings. */ based on the other known HT18 AMI BIOS strings. */
{ "[ALi M1217] Flytech 386", "flytech386", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, machine_at_flytech386_init, at_flytech386_get_device }, { "[ALi M1217] Flytech 386", "flytech386", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, machine_at_flytech386_init, at_flytech386_get_device },
/* I'm going to assume this has a standard/generic IBM-compatible AT KBC
firmware until the board is identified. */
{ "[ALi M1217] MR 386SX clone", "mr1217", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE | MACHINE_VIDEO, 1024, 16384, 1024, 127, machine_at_mr1217_init, NULL },
/* Has IBM PS/2 Type 1 KBC firmware. */
{ "[ALi M6117] Acrosser PJ-A511M", "pja511m", MACHINE_TYPE_386SX, CPU_PKG_M6117, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT | MACHINE_BUS_PS2 | MACHINE_IDE, 1024, 32768,1024, 127, machine_at_pja511m_init, NULL },
/* Has an AMI KBC firmware, the only photo of this is too low resolution /* Has an AMI KBC firmware, the only photo of this is too low resolution
for me to read what's on the KBC chip, so I'm going to assume AMI 'F' for me to read what's on the KBC chip, so I'm going to assume AMI 'F'
based on the other known HT18 AMI BIOS strings. */ based on the other known HT18 AMI BIOS strings. */
@@ -256,7 +259,7 @@ const machine_t machines[] = {
/* Has an unknown KBC firmware with commands B8 and BB in the style of /* Has an unknown KBC firmware with commands B8 and BB in the style of
Phoenix MultiKey and AMIKey-3(!), but also commands E1 and EA with Phoenix MultiKey and AMIKey-3(!), but also commands E1 and EA with
unknown functions. */ unknown functions. */
{ "[Intel 82335 ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL }, { "[Intel 82335 ADI 386SX", "adi386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_adi386sx_init, NULL },
/* Has an AMI Keyboard BIOS PLUS KBC firmware ('8'). */ /* Has an AMI Keyboard BIOS PLUS KBC firmware ('8'). */
{ "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL }, { "[Intel 82335] Shuttle 386SX", "shuttle386sx", MACHINE_TYPE_386SX, CPU_PKG_386SX, 0, 0, 0, 0, 0, 0, 0, MACHINE_AT, 512, 8192, 128, 127, machine_at_shuttle386sx_init, NULL },
/* Uses Commodore (CBM) KBC firmware, to be implemented as identical to /* Uses Commodore (CBM) KBC firmware, to be implemented as identical to

View File

@@ -75,9 +75,6 @@ ifeq ($(DEV_BUILD), y)
ifndef SIO_DETECT ifndef SIO_DETECT
SIO_DETECT := y SIO_DETECT := y
endif endif
ifndef M6117
M6117 := y
endif
ifndef VGAWONDER ifndef VGAWONDER
VGAWONDER := y VGAWONDER := y
endif endif
@@ -145,9 +142,6 @@ else
ifndef SIO_DETECT ifndef SIO_DETECT
SIO_DETECT := n SIO_DETECT := n
endif endif
ifndef M6117
M6117 := n
endif
ifndef VGAWONDER ifndef VGAWONDER
VGAWONDER := n VGAWONDER := n
endif endif
@@ -551,11 +545,6 @@ OPTS += -DUSE_SIO_DETECT
DEVBROBJ += sio_detect.o DEVBROBJ += sio_detect.o
endif endif
ifeq ($(M6117), y)
OPTS += -DUSE_M6117
DEVBROBJ += ali6117.o
endif
ifeq ($(VGAWONDER), y) ifeq ($(VGAWONDER), y)
OPTS += -DUSE_VGAWONDER OPTS += -DUSE_VGAWONDER
endif endif
@@ -602,7 +591,7 @@ CPUOBJ := cpu.o cpu_table.o fpu.o x86.o \
CHIPSETOBJ := acc2168.o \ CHIPSETOBJ := acc2168.o \
contaq_82c59x.o \ contaq_82c59x.o \
cs4031.o cs8230.o \ cs4031.o cs8230.o \
ali1217.o ali1429.o ali1489.o ali1531.o ali1541.o ali1543.o ali1621.o \ ali1429.o ali1489.o ali1531.o ali1541.o ali1543.o ali1621.o ali6117.o \
gc100.o headland.o \ gc100.o headland.o \
intel_82335.o intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o \ intel_82335.o intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o \
neat.o \ neat.o \