Added the secondary version of the OPTi 82c611 VLB IDE controller.
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
typedef struct opti611_t {
|
||||
uint8_t is_sec;
|
||||
uint8_t tries;
|
||||
uint8_t in_cfg;
|
||||
uint8_t cfg_locked;
|
||||
@@ -254,28 +255,54 @@ opti611_ide_readl(uint16_t addr, void *priv)
|
||||
static void
|
||||
opti611_ide_handler(opti611_t *dev)
|
||||
{
|
||||
ide_pri_disable();
|
||||
io_removehandler(0x01f0, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
io_removehandler(0x01f0, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
if (dev->is_sec) {
|
||||
ide_sec_disable();
|
||||
io_removehandler(0x0170, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
io_removehandler(0x0170, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
|
||||
if (dev->in_cfg && !dev->cfg_locked) {
|
||||
io_sethandler(0x01f0, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
if (dev->in_cfg && !dev->cfg_locked) {
|
||||
io_sethandler(0x0170, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
} else {
|
||||
if (dev->regs[0x03] & 0x01)
|
||||
ide_sec_enable();
|
||||
io_sethandler(0x0170, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
}
|
||||
} else {
|
||||
if (dev->regs[0x03] & 0x01)
|
||||
ide_pri_enable();
|
||||
io_sethandler(0x01f0, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
ide_pri_disable();
|
||||
io_removehandler(0x01f0, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
io_removehandler(0x01f0, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
|
||||
if (dev->in_cfg && !dev->cfg_locked) {
|
||||
io_sethandler(0x01f0, 0x0007,
|
||||
opti611_cfg_read, opti611_cfg_readw, opti611_cfg_readl,
|
||||
opti611_cfg_write, opti611_cfg_writew, opti611_cfg_writel,
|
||||
dev);
|
||||
} else {
|
||||
if (dev->regs[0x03] & 0x01)
|
||||
ide_pri_enable();
|
||||
io_sethandler(0x01f0, 0x0007,
|
||||
opti611_ide_read, opti611_ide_readw, opti611_ide_readl,
|
||||
opti611_ide_write, opti611_ide_writew, opti611_ide_writel,
|
||||
dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +320,8 @@ opti611_init(UNUSED(const device_t *info))
|
||||
opti611_t *dev = (opti611_t *) malloc(sizeof(opti611_t));
|
||||
memset(dev, 0, sizeof(opti611_t));
|
||||
|
||||
dev->is_sec = info->local;
|
||||
|
||||
dev->regs[0x12] = 0x80;
|
||||
dev->regs[0x03] = 0x01;
|
||||
dev->regs[0x05] = 0x20;
|
||||
@@ -317,3 +346,17 @@ const device_t ide_opti611_vlb_device = {
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
||||
const device_t ide_opti611_vlb_sec_device = {
|
||||
.name = "OPTi 82C611/82C611A VLB (Secondary)",
|
||||
.internal_name = "ide_opti611_vlb",
|
||||
.flags = DEVICE_VLB,
|
||||
.local = 1,
|
||||
.init = opti611_init,
|
||||
.close = opti611_close,
|
||||
.reset = NULL,
|
||||
{ .available = NULL },
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = NULL
|
||||
};
|
||||
|
@@ -74,7 +74,8 @@ extern const device_t ide_cmd646_device; /* CMD PCI-646 *
|
||||
extern const device_t ide_cmd646_legacy_only_device; /* CMD PCI-646 (Legacy Mode Only) */
|
||||
extern const device_t ide_cmd646_single_channel_device; /* CMD PCI-646 (Only primary channel) */
|
||||
|
||||
extern const device_t ide_opti611_vlb_device; /* OPTi 82c611/611A VLB */
|
||||
extern const device_t ide_opti611_vlb_device; /* OPTi 82c611/611A VLB */
|
||||
extern const device_t ide_opti611_vlb_sec_device; /* OPTi 82c611/611A VLB (Secondary channel) */
|
||||
|
||||
extern const device_t ide_ter_device;
|
||||
extern const device_t ide_ter_pnp_device;
|
||||
|
Reference in New Issue
Block a user