ECP DMA jumpers, configuration via MBDMA where supported, and the Radisys Configuration device.

This commit is contained in:
OBattler
2025-08-13 12:52:24 +02:00
parent 71a1d2a3b6
commit a276ae94f8
15 changed files with 19659 additions and 18538 deletions

View File

@@ -54,6 +54,7 @@ add_library(dev OBJECT
pci_bridge.c
phoenix_486_jumper.c
postcard.c
radisys_config.c
serial.c
serial_passthrough.c
smbus_ali7101.c

View File

@@ -25,12 +25,14 @@
#include <86box/network.h>
#include <86box/plat_fallthrough.h>
static int next_inst = 0;
int lpt_3bc_used = 0;
static int next_inst = 0;
static int lpt_3bc_used = 0;
lpt_port_t lpt_ports[PARALLEL_MAX];
static lpt_t *lpt1;
lpt_device_t lpt_devs[PARALLEL_MAX];
lpt_port_t lpt_ports[PARALLEL_MAX];
lpt_device_t lpt_devs[PARALLEL_MAX];
const lpt_device_t lpt_none_device = {
.name = "None",
@@ -825,6 +827,13 @@ lpt_port_dma(lpt_t *dev, const uint8_t dma)
lpt_log("Port %i DMA = %02X\n", dev->id, dma);
}
void
lpt1_dma(const uint8_t dma)
{
if (lpt1 != NULL)
lpt_port_dma(lpt1, dma);
}
void
lpt_port_remove(lpt_t *dev)
{
@@ -894,6 +903,9 @@ lpt_close(void *priv)
}
if (lpt1 == dev)
lpt1 = NULL;
free(dev);
}
@@ -962,7 +974,10 @@ lpt_init(const device_t *info)
dev->addr = 0xffff;
dev->irq = 0xff;
dev->dma = 0xff;
if ((jumpered_internal_ecp_dma >= 0) && (jumpered_internal_ecp_dma != 4))
dev->dma = jumpered_internal_ecp_dma;
else
dev->dma = 0xff;
dev->enable_irq = 0x00;
dev->cfg_regs_enabled = 0;
dev->ext = 0;
@@ -1005,6 +1020,9 @@ lpt_init(const device_t *info)
if (!(info->local & 0xfff00000))
next_inst++;
if (lpt1 == NULL)
lpt1 = dev;
return dev;
}

View File

@@ -0,0 +1,89 @@
/*
* 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 Radisys EPC-2012 Configuration registers.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2025 Miran Grca.
*/
#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/machine.h>
#include <86box/lpt.h>
#include <86box/machine.h>
#include <86box/chipset.h>
#include <86box/plat_unused.h>
typedef struct radisys_config_t {
uint8_t regs[2];
} radisys_config_t;
static uint8_t
radisys_config_read(uint16_t port, void *priv)
{
radisys_config_t *dev = (radisys_config_t *) priv;
uint8_t ret = dev->regs[port & 0x0001];
return ret;
}
static void
radisys_config_write(uint16_t port, uint8_t val, void *priv)
{
radisys_config_t *dev = (radisys_config_t *) priv;
dev->regs[port & 0x0001] = val;
if (!(port & 0x0001) && machine_has_jumpered_ecp_dma(machine, MACHINE_DMA_USE_CONFIG))
lpt1_dma((val & 0x02) ? 3 : 1);
}
static void
radisys_config_close(void *priv)
{
radisys_config_t *dev = (radisys_config_t *) priv;
free(dev);
}
static void *
radisys_config_init(UNUSED(const device_t *info))
{
/* We have to return something non-NULL. */
radisys_config_t *dev = (radisys_config_t *) calloc(1, sizeof(radisys_config_t));
/* 370h is also supported. */
io_sethandler(0x0270, 0x0002, radisys_config_read, NULL, NULL, radisys_config_write, NULL, NULL, dev);
return dev;
}
const device_t radisys_config_device = {
.name = "Radisys EPC-2012 Configuration",
.internal_name = "radisys_config",
.flags = 0,
.local = 0,
.init = radisys_config_init,
.close = radisys_config_close,
.reset = NULL,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};