From 74741d748a7fbe54153031cebc1eaa14cce169f1 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 23 Jul 2022 01:01:45 -0400 Subject: [PATCH] Missing ports from M&K --- src/device/pci_bridge.c | 1 + src/device/smbus_piix4.c | 3 +-- src/include/86box/machine.h | 5 +++++ src/include/86box/smbus.h | 1 - src/machine/machine_table.c | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/device/pci_bridge.c b/src/device/pci_bridge.c index 73fd3d157..583b77262 100644 --- a/src/device/pci_bridge.c +++ b/src/device/pci_bridge.c @@ -471,6 +471,7 @@ pci_bridge_init(const device_t *info) pci_bridge_reset(dev); dev->slot = pci_add_card(AGP_BRIDGE(dev->local) ? PCI_ADD_AGPBRIDGE : PCI_ADD_BRIDGE, pci_bridge_read, pci_bridge_write, dev); + interrupt_count = sizeof(interrupts); interrupt_mask = interrupt_count - 1; if (dev->slot < 32) { diff --git a/src/device/smbus_piix4.c b/src/device/smbus_piix4.c index de26b061c..c96a9fa57 100644 --- a/src/device/smbus_piix4.c +++ b/src/device/smbus_piix4.c @@ -28,7 +28,6 @@ #include <86box/i2c.h> #include <86box/smbus.h> - #ifdef ENABLE_SMBUS_PIIX4_LOG int smbus_piix4_do_log = ENABLE_SMBUS_PIIX4_LOG; @@ -99,7 +98,7 @@ smbus_piix4_write(uint16_t addr, uint8_t val, void *priv) { smbus_piix4_t *dev = (smbus_piix4_t *) priv; uint8_t smbus_addr, cmd, read, block_len, prev_stat; - uint16_t timer_bytes = 0, i; + uint16_t timer_bytes = 0, i = 0; smbus_piix4_log("SMBus PIIX4: write(%02X, %02X)\n", addr, val); diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 3f887e7a9..1873d329c 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -332,6 +332,11 @@ extern int machine_get_ram_granularity(int m); extern int machine_get_type(int m); extern void machine_close(void); +extern uint8_t machine_get_p1(void); +extern void machine_load_p1(int m); +extern uint32_t machine_get_gpi(void); +extern void machine_load_gpi(int m); +extern void machine_set_gpi(uint32_t gpi); /* Initialization functions for boards and systems. */ extern void machine_common_init(const machine_t *); diff --git a/src/include/86box/smbus.h b/src/include/86box/smbus.h index 4c2c00c17..2a4d4f0ee 100644 --- a/src/include/86box/smbus.h +++ b/src/include/86box/smbus.h @@ -53,7 +53,6 @@ typedef struct { void *i2c; } smbus_ali7101_t; - extern void smbus_piix4_remap(smbus_piix4_t *dev, uint16_t new_io_base, uint8_t enable); extern void smbus_piix4_setclock(smbus_piix4_t *dev, int clock); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 91f9ddf76..2c4a3bba9 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -10967,6 +10967,41 @@ const machine_t machines[] = { } }; +/* Saved copies - jumpers get applied to these. + We use also machine_gpio to store IBM PC/XT jumpers as they need more than one byte. */ +static uint16_t machine_p1; +static uint32_t machine_gpio; + +uint8_t +machine_get_p1(void) +{ + return machine_p1; +} + +void +machine_load_p1(int m) +{ + machine_p1 = machines[machine].kbc_p1; +} + +uint32_t +machine_get_gpio(void) +{ + return machine_gpio; +} + +void +machine_load_gpio(int m) +{ + machine_gpio = machines[machine].gpio; +} + +void +machine_set_gpio(uint32_t gpio) +{ + machine_gpio = gpio; +} + int machine_count(void) {