Bring machine flags on par with device flag and clean up device_is_valid() accordingly.

This commit is contained in:
OBattler
2025-02-14 07:10:55 +01:00
parent 63fbe6ab4f
commit 5b6a965900
6 changed files with 112 additions and 137 deletions

View File

@@ -490,7 +490,7 @@ device_get_name(const device_t *dev, int bus, char *name)
const char *sbus = NULL; const char *sbus = NULL;
const char *fbus; const char *fbus;
char *tname; char *tname;
char pbus[8] = { 0 }; char pbus[11] = { 0 };
if (dev == NULL) if (dev == NULL)
return; return;
@@ -498,8 +498,21 @@ device_get_name(const device_t *dev, int bus, char *name)
name[0] = 0x00; name[0] = 0x00;
if (bus) { if (bus) {
if (dev->flags & DEVICE_ISA) if ((dev->flags & (DEVICE_PCJR | DEVICE_ISA)) ==
sbus = (dev->flags & DEVICE_AT) ? "ISA16" : "ISA"; (DEVICE_PCJR | DEVICE_ISA))
sbus = "ISA/PCJR";
else if (dev->flags & DEVICE_SIDECAR)
sbus = "Sidecar";
else if (dev->flags & DEVICE_XT_KBC)
sbus = "XT KBC";
else if (dev->flags & DEVICE_ISA16)
sbus = "ISA16";
else if (dev->flags & DEVICE_AT_KBC)
sbus = "AT KBC";
else if (dev->flags & DEVICE_PS2_KBC)
sbus = "PS/2 KBC";
else if (dev->flags & DEVICE_ISA)
sbus = "ISA";
else if (dev->flags & DEVICE_CBUS) else if (dev->flags & DEVICE_CBUS)
sbus = "C-BUS"; sbus = "C-BUS";
else if (dev->flags & DEVICE_PCMCIA) else if (dev->flags & DEVICE_PCMCIA)
@@ -519,7 +532,7 @@ device_get_name(const device_t *dev, int bus, char *name)
else if (dev->flags & DEVICE_PCI) else if (dev->flags & DEVICE_PCI)
sbus = "PCI"; sbus = "PCI";
else if (dev->flags & DEVICE_CARDBUS) else if (dev->flags & DEVICE_CARDBUS)
sbus = "CARDBUS"; sbus = "CardBus";
else if (dev->flags & DEVICE_USB) else if (dev->flags & DEVICE_USB)
sbus = "USB"; sbus = "USB";
else if (dev->flags & DEVICE_AGP) else if (dev->flags & DEVICE_AGP)
@@ -780,67 +793,12 @@ device_set_config_mac(const char *str, int val)
int int
device_is_valid(const device_t *device, int mch) device_is_valid(const device_t *device, int mch)
{ {
if (device == NULL) int ret = 1;
return 1;
if ((device->flags & DEVICE_PCJR) && !machine_has_bus(mch, MACHINE_BUS_PCJR)) if (device != NULL)
return 0; ret = machine_has_bus(mch, device->flags & DEVICE_BUS);
if ((device->flags & DEVICE_XTKBC) && machine_has_bus(mch, MACHINE_BUS_ISA16) && !machine_has_bus(mch, MACHINE_BUS_DM_KBC)) return ret;
return 0;
if ((device->flags & DEVICE_AT) && !machine_has_bus(mch, MACHINE_BUS_ISA16))
return 0;
if ((device->flags & DEVICE_ATKBC) && !machine_has_bus(mch, MACHINE_BUS_ISA16) && !machine_has_bus(mch, MACHINE_BUS_DM_KBC))
return 0;
if ((device->flags & DEVICE_PS2) && !machine_has_bus(mch, MACHINE_BUS_PS2_PORTS))
return 0;
if ((device->flags & DEVICE_ISA) && !machine_has_bus(mch, MACHINE_BUS_ISA))
return 0;
if ((device->flags & DEVICE_CBUS) && !machine_has_bus(mch, MACHINE_BUS_CBUS))
return 0;
if ((device->flags & DEVICE_PCMCIA) && !machine_has_bus(mch, MACHINE_BUS_PCMCIA) && !machine_has_bus(mch, MACHINE_BUS_ISA))
return 0;
if ((device->flags & DEVICE_MCA) && !machine_has_bus(mch, MACHINE_BUS_MCA))
return 0;
if ((device->flags & DEVICE_HIL) && !machine_has_bus(mch, MACHINE_BUS_HIL))
return 0;
if ((device->flags & DEVICE_EISA) && !machine_has_bus(mch, MACHINE_BUS_EISA))
return 0;
if ((device->flags & DEVICE_AT32) && !machine_has_bus(mch, MACHINE_BUS_AT32))
return 0;
if ((device->flags & DEVICE_OLB) && !machine_has_bus(mch, MACHINE_BUS_OLB))
return 0;
if ((device->flags & DEVICE_VLB) && !machine_has_bus(mch, MACHINE_BUS_VLB))
return 0;
if ((device->flags & DEVICE_PCI) && !machine_has_bus(mch, MACHINE_BUS_PCI))
return 0;
if ((device->flags & DEVICE_CARDBUS) && !machine_has_bus(mch, MACHINE_BUS_CARDBUS) && !machine_has_bus(mch, MACHINE_BUS_PCI))
return 0;
if ((device->flags & DEVICE_USB) && !machine_has_bus(mch, MACHINE_BUS_USB))
return 0;
if ((device->flags & DEVICE_AGP) && !machine_has_bus(mch, MACHINE_BUS_AGP))
return 0;
if ((device->flags & DEVICE_AC97) && !machine_has_bus(mch, MACHINE_BUS_AC97))
return 0;
return 1;
} }
int int

View File

@@ -810,27 +810,18 @@ write_p2(atkbc_t *dev, uint8_t val)
if (!(val & 0x01)) { /* Pin 0 selected. */ if (!(val & 0x01)) { /* Pin 0 selected. */
/* Pin 0 selected. */ /* Pin 0 selected. */
kbc_at_log("write_p2(): Pulse reset!\n"); kbc_at_log("write_p2(): Pulse reset!\n");
if (machines[machine].flags & MACHINE_COREBOOT) { softresetx86(); /* Pulse reset! */
/* The SeaBIOS hard reset code attempts a KBC reset if ACPI RESET_REG cpu_set_edx();
is not available. However, the KBC reset is normally a soft reset, so flushmmucache();
SeaBIOS gets caught in a soft reset loop as it tries to hard reset the if ((kbc_ven == KBC_VEN_ALI) || !strcmp(machine_get_internal_name(), "spc7700plw"))
machine. Hack around this by making the KBC reset a hard reset only on smbase = 0x00030000;
coreboot machines. */
pc_reset_hard();
} else {
softresetx86(); /* Pulse reset! */
cpu_set_edx();
flushmmucache();
if ((kbc_ven == KBC_VEN_ALI) || !strcmp(machine_get_internal_name(), "spc7700plw"))
smbase = 0x00030000;
/* Yes, this is a hack, but until someone gets ahold of the real PCD-2L /* Yes, this is a hack, but until someone gets ahold of the real PCD-2L
and can find out what they actually did to make it boot from FFFFF0 and can find out what they actually did to make it boot from FFFFF0
correctly despite A20 being gated when the CPU is reset, this will correctly despite A20 being gated when the CPU is reset, this will
have to do. */ have to do. */
if ((kbc_ven == KBC_VEN_SIEMENS) || !strcmp(machine_get_internal_name(), "acera1g")) if ((kbc_ven == KBC_VEN_SIEMENS) || !strcmp(machine_get_internal_name(), "acera1g"))
is486 ? loadcs(0xf000) : loadcs_2386(0xf000); is486 ? loadcs(0xf000) : loadcs_2386(0xf000);
}
} }
} }

View File

@@ -79,15 +79,15 @@
// #define CONFIG_STANDALONE 257 /* not available on the on-board variant */ // #define CONFIG_STANDALONE 257 /* not available on the on-board variant */
enum { enum {
DEVICE_PCJR = 2, /* requires an IBM PCjr */ DEVICE_SIDECAR = 2, /* requires an IBM PCjr */
DEVICE_XTKBC = 4, /* requires an XT-compatible keyboard controller */ DEVICE_ISA = 4, /* requires the ISA bus */
DEVICE_AT = 8, /* requires an AT-compatible system */ DEVICE_XT_KBC = 8, /* requires an XT-compatible keyboard controller */
DEVICE_ATKBC = 0x10, /* requires an AT-compatible keyboard controller */ DEVICE_CBUS = 0x10, /* requires the C-BUS bus */
DEVICE_PS2 = 0x20, /* requires a PS/1 or PS/2 system */ DEVICE_ISA16 = 0x20, /* requires an AT-compatible system */
DEVICE_ISA = 0x40, /* requires the ISA bus */ DEVICE_AT_KBC = 0x40, /* requires an AT-compatible keyboard controller */
DEVICE_CBUS = 0x80, /* requires the C-BUS bus */ DEVICE_MCA = 0x80, /* requires the MCA bus */
DEVICE_PCMCIA = 0x100, /* requires the PCMCIA bus */ DEVICE_PS2_KBC = 0x100, /* requires a PS/1 or PS/2 system */
DEVICE_MCA = 0x200, /* requires the MCA bus */ DEVICE_PCMCIA = 0x200, /* requires the PCMCIA bus */
DEVICE_HIL = 0x400, /* requires the HP HIL bus */ DEVICE_HIL = 0x400, /* requires the HP HIL bus */
DEVICE_EISA = 0x800, /* requires the EISA bus */ DEVICE_EISA = 0x800, /* requires the EISA bus */
DEVICE_AT32 = 0x1000, /* requires the Mylex AT/32 local bus */ DEVICE_AT32 = 0x1000, /* requires the Mylex AT/32 local bus */
@@ -98,8 +98,11 @@ enum {
DEVICE_USB = 0x20000, /* requires the USB bus */ DEVICE_USB = 0x20000, /* requires the USB bus */
DEVICE_AGP = 0x40000, /* requires the AGP bus */ DEVICE_AGP = 0x40000, /* requires the AGP bus */
DEVICE_AC97 = 0x80000, /* requires the AC'97 bus */ DEVICE_AC97 = 0x80000, /* requires the AC'97 bus */
DEVICE_BUS = 0xfffff, /* requires a machine bus */
DEVICE_COM = 0x100000, /* requires a serial port */ DEVICE_COM = 0x100000, /* requires a serial port */
DEVICE_LPT = 0x200000, /* requires a parallel port */ DEVICE_LPT = 0x200000, /* requires a parallel port */
DEVICE_KBC = 0x400000, /* is a keyboard controller */ DEVICE_KBC = 0x400000, /* is a keyboard controller */
DEVICE_SOFTRESET = 0x800000, /* requires to be reset on soft reset */ DEVICE_SOFTRESET = 0x800000, /* requires to be reset on soft reset */
@@ -109,6 +112,11 @@ enum {
DEVICE_ALL = 0xffffffff /* match all devices */ DEVICE_ALL = 0xffffffff /* match all devices */
}; };
/* TODO: Remove this once all the devices' flags have been updated. */
#define DEVICE_AT DEVICE_ISA16
#define DEVICE_PCJR DEVICE_SIDECAR
#define DEVICE_PS2 DEVICE_PS2_KBC
#define BIOS_NORMAL 0 #define BIOS_NORMAL 0
#define BIOS_INTERLEAVED 1 #define BIOS_INTERLEAVED 1
#define BIOS_INTERLEAVED_SINGLEFILE 2 #define BIOS_INTERLEAVED_SINGLEFILE 2

View File

@@ -23,34 +23,31 @@
#define EMU_MACHINE_H #define EMU_MACHINE_H
/* Machine feature flags. */ /* Machine feature flags. */
#define MACHINE_BUS_NONE 0x00000000 /* sys has no bus */ #define MACHINE_BUS_NONE 0x00000000 /* sys has no bus */
/* Feature flags for BUS'es. */ /* Feature flags for BUS'es. */
#define MACHINE_BUS_ISA 0x00000001 /* sys has ISA bus */ #define MACHINE_BUS_CASSETTE 0x00000001 /* sys has cassette port */
#define MACHINE_BUS_CASSETTE 0x00000002 /* sys has cassette port */ #define MACHINE_BUS_ISA 0x00000002 /* sys has ISA bus */
#define MACHINE_BUS_CARTRIDGE 0x00000004 /* sys has two cartridge bays */ #define MACHINE_BUS_SIDECAR 0x00000004 /* sys has PCjr sidecar bus */
#define MACHINE_BUS_PCJR 0x00000008 /* sys has PCjr sidecar bus */ #define MACHINE_BUS_XT_KBD 0x00000008 /* sys has an XT keyboard port */
#define MACHINE_BUS_DM_KBC 0x00000010 /* system has keyboard controller that supports #define MACHINE_BUS_CBUS 0x00000010 /* sys has C-BUS bus */
both XT and AT keyboards */
#define MACHINE_BUS_ISA16 0x00000020 /* sys has ISA16 bus - PC/AT architecture */ #define MACHINE_BUS_ISA16 0x00000020 /* sys has ISA16 bus - PC/AT architecture */
#define MACHINE_BUS_CBUS 0x00000040 /* sys has C-BUS bus */ #define MACHINE_BUS_AT_KBD 0x00000040 /* sys has an AT keyboard port */
#define MACHINE_BUS_PCMCIA 0x00000080 /* sys has PCMCIA bus */ #define MACHINE_BUS_MCA 0x00000080 /* sys has MCA bus */
#define MACHINE_BUS_PS2_LATCH 0x00000100 /* system has PS/2 keyboard controller IRQ latch */ #define MACHINE_BUS_PS2_PORTS 0x00000100 /* system has PS/2 keyboard and mouse ports */
#define MACHINE_BUS_PS2_PORTS 0x00000200 /* system has PS/2 keyboard and mouse ports */ #define MACHINE_BUS_PS2 MACHINE_BUS_PS2_PORTS
#define MACHINE_BUS_PS2 (MACHINE_BUS_PS2_LATCH | MACHINE_BUS_PS2_PORTS) #define MACHINE_BUS_PCMCIA 0x00000200 /* sys has PCMCIA bus */
#define MACHINE_BUS_HIL 0x00000400 /* system has HP HIL keyboard and mouse ports */ #define MACHINE_BUS_HIL 0x00000400 /* system has HP HIL keyboard and mouse ports */
#define MACHINE_BUS_EISA 0x00000800 /* sys has EISA bus */ #define MACHINE_BUS_EISA 0x00000800 /* sys has EISA bus */
#define MACHINE_BUS_AT32 0x00001000 /* sys has Mylex AT/32 local bus */ #define MACHINE_BUS_AT32 0x00001000 /* sys has Mylex AT/32 local bus */
#define MACHINE_BUS_OLB 0x00002000 /* sys has OPTi local bus */ #define MACHINE_BUS_OLB 0x00002000 /* sys has OPTi local bus */
#define MACHINE_BUS_VLB 0x00004000 /* sys has VL bus */ #define MACHINE_BUS_VLB 0x00004000 /* sys has VL bus */
#define MACHINE_BUS_MCA 0x00008000 /* sys has MCA bus */ #define MACHINE_BUS_PCI 0x00008000 /* sys has PCI bus */
#define MACHINE_BUS_PCI 0x00010000 /* sys has PCI bus */ #define MACHINE_BUS_CARDBUS 0x00010000 /* sys has CardBus bus */
#define MACHINE_BUS_CARDBUS 0x00020000 /* sys has CardBus bus */ #define MACHINE_BUS_USB 0x00020000 /* sys has USB bus */
#define MACHINE_BUS_USB 0x00040000 /* sys has USB bus */ #define MACHINE_BUS_AGP 0x00040000 /* sys has AGP bus */
#define MACHINE_BUS_AGP 0x00080000 /* sys has AGP bus */ #define MACHINE_BUS_AC97 0x00080000 /* sys has AC97 bus (ACR/AMR/CNR slot) */
#define MACHINE_BUS_AC97 0x00100000 /* sys has AC97 bus (ACR/AMR/CNR slot) */
/* Aliases. */ /* Aliases. */
#define MACHINE_CASSETTE (MACHINE_BUS_CASSETTE) /* sys has cassette port */ #define MACHINE_CASSETTE (MACHINE_BUS_CASSETTE) /* sys has cassette port */
#define MACHINE_CARTRIDGE (MACHINE_BUS_CARTRIDGE) /* sys has two cartridge bays */
/* Combined flags. */ /* Combined flags. */
#define MACHINE_PC (MACHINE_BUS_ISA) /* sys is PC/XT-compatible (ISA) */ #define MACHINE_PC (MACHINE_BUS_ISA) /* sys is PC/XT-compatible (ISA) */
#define MACHINE_AT (MACHINE_BUS_ISA | MACHINE_BUS_ISA16) /* sys is AT-compatible (ISA + ISA16) */ #define MACHINE_AT (MACHINE_BUS_ISA | MACHINE_BUS_ISA16) /* sys is AT-compatible (ISA + ISA16) */
@@ -69,18 +66,18 @@
#define MACHINE_AGP (MACHINE_BUS_AGP | MACHINE_PCI) /* sys is AT-compatible with AGP */ #define MACHINE_AGP (MACHINE_BUS_AGP | MACHINE_PCI) /* sys is AT-compatible with AGP */
#define MACHINE_AGP98 (MACHINE_BUS_AGP | MACHINE_PCI98) /* sys is NEC PC-98x1 series with AGP (did that even exist?) */ #define MACHINE_AGP98 (MACHINE_BUS_AGP | MACHINE_PCI98) /* sys is NEC PC-98x1 series with AGP (did that even exist?) */
#define MACHINE_PC5150 (MACHINE_PC | MACHINE_CASSETTE) /* sys is IBM PC 5150 */ #define MACHINE_PC5150 (MACHINE_PC | MACHINE_CASSETTE) /* sys is IBM PC 5150 */
#define MACHINE_PCJR (MACHINE_PC | MACHINE_CASSETTE | MACHINE_CARTRIDGE) /* sys is PCjr */ #define MACHINE_PCJR (MACHINE_PC | MACHINE_CASSETTE | MACHINE_BUS_SIDECAR) /* sys is PCjr */
#define MACHINE_PS2 (MACHINE_AT | MACHINE_BUS_PS2) /* sys is PS/2 */ #define MACHINE_PS2 (MACHINE_AT | MACHINE_BUS_PS2) /* sys is PS/2 */
#define MACHINE_PS2_MCA (MACHINE_MCA | MACHINE_BUS_PS2) /* sys is MCA PS/2 */ #define MACHINE_PS2_MCA (MACHINE_MCA | MACHINE_BUS_PS2) /* sys is MCA PS/2 */
#define MACHINE_PS2_VLB (MACHINE_VLB | MACHINE_BUS_PS2) /* sys is VLB PS/2 */ #define MACHINE_PS2_VLB (MACHINE_VLB | MACHINE_BUS_PS2) /* sys is VLB PS/2 */
#define MACHINE_PS2_PCI (MACHINE_PCI | MACHINE_BUS_PS2) /* sys is PCI PS/2 */ #define MACHINE_PS2_PCI (MACHINE_PCI | MACHINE_BUS_PS2) /* sys is PCI PS/2 */
#define MACHINE_PS2_PCIV (MACHINE_PCIV | MACHINE_BUS_PS2) /* sys is VLB/PCI PS/2 */ #define MACHINE_PS2_PCIV (MACHINE_PCIV | MACHINE_BUS_PS2) /* sys is VLB/PCI PS/2 */
#define MACHINE_PS2_AGP (MACHINE_AGP | MACHINE_BUS_PS2) /* sys is AGP PS/2 */ #define MACHINE_PS2_AGP (MACHINE_AGP | MACHINE_BUS_PS2) /* sys is AGP PS/2 */
#define MACHINE_PS2_A97 (MACHINE_PS2_AGP | MACHINE_BUS_AC97) /* sys is AGP/AC97 PS/2 */ #define MACHINE_PS2_A97 (MACHINE_PS2_AGP | MACHINE_BUS_AC97) /* sys is AGP/AC97 PS/2 */
#define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */ #define MACHINE_PS2_NOISA (MACHINE_PS2_AGP & ~MACHINE_AT) /* sys is AGP PS/2 without ISA */
#define MACHINE_PS2_PCIONLY (MACHINE_PS2_NOISA & ~MACHINE_BUS_AGP) /* sys is PCI PS/2 without ISA */ #define MACHINE_PS2_PCIONLY (MACHINE_PS2_NOISA & ~MACHINE_BUS_AGP) /* sys is PCI PS/2 without ISA */
#define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */ #define MACHINE_PS2_NOI97 (MACHINE_PS2_A97 & ~MACHINE_AT) /* sys is AGP/AC97 PS/2 without ISA */
/* Feature flags for miscellaneous internal devices. */ /* Feature flags for miscellaneous internal devices. */
#define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */ #define MACHINE_FLAGS_NONE 0x00000000 /* sys has no int devices */
#define MACHINE_SOFTFLOAT_ONLY 0x00000001 /* sys requires SoftFloat FPU */ #define MACHINE_SOFTFLOAT_ONLY 0x00000001 /* sys requires SoftFloat FPU */
@@ -93,7 +90,8 @@
#define MACHINE_LPT_PRI 0x00000080 /* sys has int pri LPT */ #define MACHINE_LPT_PRI 0x00000080 /* sys has int pri LPT */
#define MACHINE_LPT_SEC 0x00000100 /* sys has int sec LPT */ #define MACHINE_LPT_SEC 0x00000100 /* sys has int sec LPT */
#define MACHINE_LPT_TER 0x00000200 /* sys has int ter LPT */ #define MACHINE_LPT_TER 0x00000200 /* sys has int ter LPT */
#define MACHINE_LPT_QUA 0x00000400 /* sys has int qua LPT */ #define MACHINE_PS2_KBC 0x00000400 /* sys has a PS/2 keyboard controller */
/* this is separate from having PS/2 ports */
#define MACHINE_UART_PRI 0x00000800 /* sys has int pri UART */ #define MACHINE_UART_PRI 0x00000800 /* sys has int pri UART */
#define MACHINE_UART_SEC 0x00001000 /* sys has int sec UART */ #define MACHINE_UART_SEC 0x00001000 /* sys has int sec UART */
#define MACHINE_UART_TER 0x00002000 /* sys has int ter UART */ #define MACHINE_UART_TER 0x00002000 /* sys has int ter UART */
@@ -106,7 +104,7 @@
#define MACHINE_APM 0x00080000 /* sys has APM */ #define MACHINE_APM 0x00080000 /* sys has APM */
#define MACHINE_ACPI 0x00100000 /* sys has ACPI */ #define MACHINE_ACPI 0x00100000 /* sys has ACPI */
#define MACHINE_HWM 0x00200000 /* sys has hw monitor */ #define MACHINE_HWM 0x00200000 /* sys has hw monitor */
#define MACHINE_COREBOOT 0x00400000 /* sys has coreboot BIOS */ #define MACHINE_CARTRIDGE 0x00400000 /* sys has cartridge bays */
/* Feature flags for internal storage controllers. */ /* Feature flags for internal storage controllers. */
#define MACHINE_MFM 0x00800000 /* sys has int MFM/RLL */ #define MACHINE_MFM 0x00800000 /* sys has int MFM/RLL */
#define MACHINE_XTA 0x01000000 /* sys has int XTA */ #define MACHINE_XTA 0x01000000 /* sys has int XTA */

View File

@@ -8257,8 +8257,8 @@ const machine_t machines[] = {
.min_multi = 0, .min_multi = 0,
.max_multi = 0 .max_multi = 0
}, },
.bus_flags = MACHINE_BUS_PS2_LATCH | MACHINE_PCI, .bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM, .flags = MACHINE_PS2_KBC | MACHINE_IDE_DUAL | MACHINE_APM,
.ram = { .ram = {
.min = 1024, .min = 1024,
.max = 131072, .max = 131072,
@@ -8337,8 +8337,8 @@ const machine_t machines[] = {
.min_multi = 0, .min_multi = 0,
.max_multi = 0 .max_multi = 0
}, },
.bus_flags = MACHINE_BUS_PS2_LATCH | MACHINE_PCI, .bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM, .flags = MACHINE_PS2_KBC | MACHINE_IDE_DUAL | MACHINE_APM,
.ram = { .ram = {
.min = 1024, .min = 1024,
.max = 261120, .max = 261120,
@@ -8539,8 +8539,8 @@ const machine_t machines[] = {
.min_multi = 0, .min_multi = 0,
.max_multi = 0 .max_multi = 0
}, },
.bus_flags = MACHINE_PCI | MACHINE_BUS_PS2_LATCH, .bus_flags = MACHINE_PCI,
.flags = MACHINE_IDE_DUAL | MACHINE_APM, .flags = MACHINE_PS2_KBC | MACHINE_IDE_DUAL | MACHINE_APM,
.ram = { .ram = {
.min = 1024, .min = 1024,
.max = 131072, .max = 131072,
@@ -9198,8 +9198,8 @@ const machine_t machines[] = {
.min_multi = MACHINE_MULTIPLIER_FIXED, .min_multi = MACHINE_MULTIPLIER_FIXED,
.max_multi = MACHINE_MULTIPLIER_FIXED .max_multi = MACHINE_MULTIPLIER_FIXED
}, },
.bus_flags = MACHINE_BUS_PS2_LATCH | MACHINE_PCI, .bus_flags = MACHINE_PCI,
.flags = MACHINE_APM, .flags = MACHINE_PS2_KBC | MACHINE_APM,
.ram = { .ram = {
.min = 2048, .min = 2048,
.max = 196608, .max = 196608,
@@ -16497,19 +16497,39 @@ machine_get_nvrmask(int m)
int int
machine_has_flags(int m, int flags) machine_has_flags(int m, int flags)
{ {
return (machines[m].flags & flags); int ret = machines[m].flags & flags;
/* Can't have PS/2 ports with an AT KBC. */
if ((flags & MACHINE_PS2_KBC) &&
(machines[m].bus_flags & MACHINE_BUS_PS2_PORTS))
ret |= MACHINE_PS2_KBC;
return ret;
} }
int int
machine_has_bus(int m, int bus_flags) machine_has_bus(int m, int bus_flags)
{ {
return (machines[m].bus_flags & bus_flags); int ret = machines[m].bus_flags & bus_flags;
/* TODO: Move the KBD flags to the machine table! */
if ((bus_flags & MACHINE_BUS_XT_KBD) &&
!(machines[m].bus_flags & MACHINE_BUS_ISA16) &&
!(machines[m].bus_flags & MACHINE_BUS_PS2_PORTS))
ret |= MACHINE_BUS_XT_KBD;
if ((bus_flags & MACHINE_BUS_AT_KBD) &&
(IS_AT(m)) &&
!(machines[m].bus_flags & MACHINE_BUS_PS2_PORTS))
ret |= MACHINE_BUS_AT_KBD;
return ret;
} }
int int
machine_has_cartridge(int m) machine_has_cartridge(int m)
{ {
return (machine_has_bus(m, MACHINE_CARTRIDGE) ? 1 : 0); return (machine_has_flags(m, MACHINE_CARTRIDGE) ? 1 : 0);
} }
int int

View File

@@ -629,7 +629,7 @@ pic_reset_hard(void)
/* The situation is as follows: There is a giant mess when it comes to these latches on real hardware, /* The situation is as follows: There is a giant mess when it comes to these latches on real hardware,
to the point that there's even boards with board-level latched that get used in place of the latches to the point that there's even boards with board-level latched that get used in place of the latches
on the chipset, therefore, I'm just doing this here for the sake of simplicity. */ on the chipset, therefore, I'm just doing this here for the sake of simplicity. */
if (machine_has_bus(machine, MACHINE_BUS_PS2_LATCH)) { if (machine_has_flags(machine, MACHINE_PS2_KBC)) {
pic_kbd_latch(0x01); pic_kbd_latch(0x01);
pic_mouse_latch(0x01); pic_mouse_latch(0x01);
} else { } else {