Merge remote-tracking branch 'origin/master' into mke

This commit is contained in:
Cacodemon345
2025-07-27 02:27:14 +06:00
17 changed files with 673 additions and 255 deletions

View File

@@ -832,6 +832,7 @@ load_storage_controllers(void)
char temp[512];
int min = 0;
int free_p = 0;
int migrate_hdc[HDC_MAX] = { 1, 1, 1, 1 };
for (int c = min; c < SCSI_CARD_MAX; c++) {
sprintf(temp, "scsicard_%d", c + 1);
@@ -870,28 +871,62 @@ load_storage_controllers(void)
}
#endif
p = ini_section_get_string(cat, "hdc", NULL);
if (p == NULL) {
if (machine_has_flags(machine, MACHINE_HDC)) {
p = (char *) malloc((strlen("internal") + 1) * sizeof(char));
strcpy(p, "internal");
} else {
p = (char *) malloc((strlen("none") + 1) * sizeof(char));
strcpy(p, "none");
}
free_p = 1;
for (int c = min; c < HDC_MAX; c++) {
sprintf(temp, "hdc_%d", c + 1);
p = ini_section_get_string(cat, temp, NULL);
if (p != NULL) {
hdc_current[c] = hdc_get_from_internal_name(p);
migrate_hdc[c] = 0;
} else
hdc_current[c] = 0;
}
if (migrate_hdc[0]) {
p = ini_section_get_string(cat, "hdc", NULL);
if (p == NULL) {
if (machine_has_flags(machine, MACHINE_HDC)) {
p = (char *) malloc((strlen("internal") + 1) * sizeof(char));
strcpy(p, "internal");
} else {
p = (char *) malloc((strlen("none") + 1) * sizeof(char));
strcpy(p, "none");
}
free_p = 1;
}
/* Migrate renamed and merged cards. */
if (!strcmp(p, "xtide_plus")) {
hdc_current[0] = hdc_get_from_internal_name("xtide");
migration_cat = ini_find_or_create_section(config, "PC/XT XTIDE #1");
ini_section_set_string(migration_cat, "bios", "xt_plus");
} else if (!strcmp(p, "xtide_at_386")) {
hdc_current[0] = hdc_get_from_internal_name("xtide_at");
migration_cat = ini_find_or_create_section(config, "PC/AT XTIDE #1");
ini_section_set_string(migration_cat, "bios", "at_386");
} else
hdc_current[0] = hdc_get_from_internal_name(p);
ini_section_delete_var(cat, "hdc");
}
if (migrate_hdc[1]) {
int ide_ter_enabled = !!ini_section_get_int(cat, "ide_ter", 0);
if (ide_ter_enabled)
hdc_current[1] = hdc_get_from_internal_name("ide_ter");
ini_section_delete_var(cat, "ide_ter");
}
if (migrate_hdc[2]) {
int ide_qua_enabled = !!ini_section_get_int(cat, "ide_qua", 0);
if (ide_qua_enabled)
hdc_current[2] = hdc_get_from_internal_name("ide_qua");
ini_section_delete_var(cat, "ide_qua");
}
/* Migrate renamed and merged cards. */
if (!strcmp(p, "xtide_plus")) {
hdc_current[0] = hdc_get_from_internal_name("xtide");
migration_cat = ini_find_or_create_section(config, "PC/XT XTIDE");
ini_section_set_string(migration_cat, "bios", "xt_plus");
} else if (!strcmp(p, "xtide_at_386")) {
hdc_current[0] = hdc_get_from_internal_name("xtide_at");
migration_cat = ini_find_or_create_section(config, "PC/AT XTIDE");
ini_section_set_string(migration_cat, "bios", "at_386");
} else
hdc_current[0] = hdc_get_from_internal_name(p);
if (free_p) {
free(p);
@@ -908,9 +943,6 @@ load_storage_controllers(void)
p = NULL;
}
ide_ter_enabled = !!ini_section_get_int(cat, "ide_ter", 0);
ide_qua_enabled = !!ini_section_get_int(cat, "ide_qua", 0);
if (machine_has_bus(machine, MACHINE_BUS_CASSETTE))
cassette_enable = !!ini_section_get_int(cat, "cassette_enabled", 0);
else
@@ -1956,7 +1988,9 @@ config_load(void)
vid_resize = 0;
video_fullscreen_scale = 1;
time_sync = TIME_SYNC_ENABLED;
hdc_current[0] = hdc_get_from_internal_name("none");
for (int i = 0; i < HDC_MAX; i++)
hdc_current[i] = hdc_get_from_internal_name("none");
com_ports[0].enabled = 1;
com_ports[1].enabled = 1;
@@ -2712,16 +2746,22 @@ save_storage_controllers(void)
ini_section_set_string(cat, "fdc",
fdc_card_get_internal_name(fdc_current[0]));
if (machine_has_flags(machine, MACHINE_HDC))
def_hdc = "internal";
else
def_hdc = "none";
ini_section_delete_var(cat, "hdc");
if (!strcmp(hdc_get_internal_name(hdc_current[0]), def_hdc))
ini_section_delete_var(cat, "hdc");
else
ini_section_set_string(cat, "hdc",
hdc_get_internal_name(hdc_current[0]));
for (c = 0; c < HDC_MAX; c++) {
sprintf(temp, "hdc_%d", c + 1);
if ((c == 0) && machine_has_flags(machine, MACHINE_HDC))
def_hdc = "internal";
else
def_hdc = "none";
if (!strcmp(hdc_get_internal_name(hdc_current[c]), def_hdc))
ini_section_delete_var(cat, temp);
else
ini_section_set_string(cat, temp,
hdc_get_internal_name(hdc_current[c]));
}
if (cdrom_interface_current == 0)
ini_section_delete_var(cat, "cdrom_interface");
@@ -2729,15 +2769,8 @@ save_storage_controllers(void)
ini_section_set_string(cat, "cdrom_interface",
cdrom_interface_get_internal_name(cdrom_interface_current));
if (ide_ter_enabled == 0)
ini_section_delete_var(cat, "ide_ter");
else
ini_section_set_int(cat, "ide_ter", ide_ter_enabled);
if (ide_qua_enabled == 0)
ini_section_delete_var(cat, "ide_qua");
else
ini_section_set_int(cat, "ide_qua", ide_qua_enabled);
ini_section_delete_var(cat, "ide_ter");
ini_section_delete_var(cat, "ide_qua");
if (cassette_enable == 0)
ini_section_delete_var(cat, "cassette_enabled");

View File

@@ -78,6 +78,8 @@ static const struct {
{ &xtide_at_2ch_device },
{ &xtide_at_ps2_device },
{ &xtide_at_ps2_2ch_device },
{ &ide_ter_device },
{ &ide_qua_device },
{ &st506_at_wd1003_device },
{ &esdi_at_wd1007vse1_device },
/* MCA */
@@ -88,6 +90,8 @@ static const struct {
{ &ide_vlb_device },
{ &ide_vlb_2ch_device },
/* PCI */
{ &ide_cmd646_ter_qua_device },
{ &ide_cmd648_ter_qua_device },
{ &ide_pci_device },
{ &ide_pci_2ch_device },
{ NULL }
@@ -108,18 +112,14 @@ hdc_init(void)
void
hdc_reset(void)
{
hdc_log("HDC: reset(current=%d, internal=%d)\n",
hdc_current[0], (machines[machine].flags & MACHINE_HDC) ? 1 : 0);
for (int i = 0; i < HDC_MAX; i++) {
hdc_log("HDC %i: reset(current=%d, internal=%d)\n", i,
hdc_current[i], hdc_current[i] == HDC_INTERNAL);
/* If we have a valid controller, add its device. */
if (hdc_current[0] > HDC_INTERNAL)
device_add(controllers[hdc_current[0]].device);
/* Now, add the tertiary and/or quaternary IDE controllers. */
if (ide_ter_enabled)
device_add(&ide_ter_device);
if (ide_qua_enabled)
device_add(&ide_qua_device);
/* If we have a valid controller, add its device. */
if (hdc_current[i] > HDC_INTERNAL)
device_add_inst(controllers[hdc_current[i]].device, i + 1);
}
}
const char *

View File

@@ -235,8 +235,6 @@ static uint8_t ide_qua_pnp_rom[] = {
};
ide_t *ide_drives[IDE_NUM];
int ide_ter_enabled = 0;
int ide_qua_enabled = 0;
static void ide_atapi_callback(ide_t *ide);
static void ide_callback(void *priv);

View File

@@ -667,7 +667,7 @@ const device_t ide_cmd640_pci_legacy_only_device = {
};
const device_t ide_cmd640_pci_single_channel_device = {
.name = "CMD PCI-0640B PCI",
.name = "CMD PCI-0640B PCI (Single Channel)",
.internal_name = "ide_cmd640_pci_single_channel",
.flags = DEVICE_PCI,
.local = 0x2000a,
@@ -681,7 +681,7 @@ const device_t ide_cmd640_pci_single_channel_device = {
};
const device_t ide_cmd640_pci_single_channel_sec_device = {
.name = "CMD PCI-0640B PCI",
.name = "CMD PCI-0640B PCI (Single Channel, Secondary)",
.internal_name = "ide_cmd640_pci_single_channel_sec",
.flags = DEVICE_PCI,
.local = 0x4000a,

View File

@@ -35,7 +35,19 @@
#include <86box/hdc_ide.h>
#include <86box/hdc_ide_sff8038i.h>
#include <86box/rdisk.h>
#include <86box/hdd.h>
#include <86box/scsi_disk.h>
#include <86box/mo.h>
#include "cpu.h"
#include "x86.h"
#define CMD_TYPE_646 0x000000
#define CMD_TYPE_648 0x100000
#define CMD648_JP7 0x200000 /* Reload subsystem ID on reset. */
#define CMD648_RAID 0x400000
#define CMD64X_ONBOARD 0x800000
typedef struct cmd646_t {
uint8_t vlb_idx;
@@ -80,7 +92,8 @@ cmd646_set_irq_0(uint8_t status, void *priv)
if (!(dev->regs[0x50] & 0x04) || (status & 0x04))
dev->regs[0x50] = (dev->regs[0x50] & ~0x04) | status;
sff_bus_master_set_irq(status, dev->bm[0]);
if (!(dev->local & CMD_TYPE_648) || !(dev->regs[0x71] & 0x10))
sff_bus_master_set_irq(status, dev->bm[0]);
}
static void
@@ -91,7 +104,8 @@ cmd646_set_irq_1(uint8_t status, void *priv)
if (!(dev->regs[0x57] & 0x10) || (status & 0x04))
dev->regs[0x57] = (dev->regs[0x57] & ~0x10) | (status << 2);
sff_bus_master_set_irq(status, dev->bm[1]);
if (!(dev->local & CMD_TYPE_648) || !(dev->regs[0x71] & 0x20))
sff_bus_master_set_irq(status, dev->bm[1]);
}
static int
@@ -116,13 +130,24 @@ cmd646_ide_handlers(cmd646_t *dev)
uint16_t main;
uint16_t side;
int irq_mode[2] = { IRQ_MODE_LEGACY, IRQ_MODE_LEGACY };
int first = 0;
int reg09 = dev->regs[0x09];
int reg50 = dev->regs[0x50];
if ((dev->local & CMD_TYPE_648) && (dev->regs[0x0a] == 0x04) && (dev->regs[0x0b] == 0x01)) {
reg09 = 0xff;
reg50 |= 0x40;
}
if (dev->local & 0x80000)
first += 2;
sff_set_slot(dev->bm[0], dev->pci_slot);
sff_set_slot(dev->bm[1], dev->pci_slot);
ide_pri_disable();
ide_handlers(first, 0);
if ((dev->regs[0x09] & 0x01) && (dev->regs[0x50] & 0x40)) {
if ((reg09 & 0x01) && (reg50 & 0x40)) {
main = (dev->regs[0x11] << 8) | (dev->regs[0x10] & 0xf8);
side = ((dev->regs[0x15] << 8) | (dev->regs[0x14] & 0xfc)) + 2;
} else {
@@ -130,23 +155,28 @@ cmd646_ide_handlers(cmd646_t *dev)
side = 0x3f6;
}
ide_set_base(0, main);
ide_set_side(0, side);
ide_set_base(first, main);
ide_set_side(first, side);
if (dev->regs[0x09] & 0x01)
if (reg09 & 0x01)
irq_mode[0] = IRQ_MODE_PCI_IRQ_PIN;
sff_set_irq_mode(dev->bm[0], irq_mode[0]);
cmd646_log("IDE %i: %04X, %04X, %i\n", first, main, side, irq_mode[0]);
if (dev->regs[0x04] & 0x01)
ide_pri_enable();
int pri_enabled = (dev->regs[0x04] & 0x01);
if (dev->local & CMD_TYPE_648)
pri_enabled = pri_enabled && (dev->regs[0x51] & 0x04);
if (pri_enabled)
ide_handlers(first, 1);
if (dev->single_channel)
return;
ide_sec_disable();
ide_handlers(first + 1, 0);
if ((dev->regs[0x09] & 0x04) && (dev->regs[0x50] & 0x40)) {
if ((reg09 & 0x04) && (reg50 & 0x40)) {
main = (dev->regs[0x19] << 8) | (dev->regs[0x18] & 0xf8);
side = ((dev->regs[0x1d] << 8) | (dev->regs[0x1c] & 0xfc)) + 2;
} else {
@@ -154,16 +184,17 @@ cmd646_ide_handlers(cmd646_t *dev)
side = 0x376;
}
ide_set_base(1, main);
ide_set_side(1, side);
ide_set_base(first + 1, main);
ide_set_side(first + 1, side);
if (dev->regs[0x09] & 0x04)
irq_mode[1] = 1;
if (reg09 & 0x04)
irq_mode[1] = IRQ_MODE_PCI_IRQ_PIN;
sff_set_irq_mode(dev->bm[1], irq_mode[1]);
cmd646_log("IDE %i: %04X, %04X, %i\n", first + 1, main, side, irq_mode[1]);
if ((dev->regs[0x04] & 0x01) && (dev->regs[0x51] & 0x08))
ide_sec_enable();
ide_handlers(first + 1, 1);
}
static void
@@ -175,6 +206,51 @@ cmd646_ide_bm_handlers(cmd646_t *dev)
sff_bus_master_handler(dev->bm[1], (dev->regs[0x04] & 1), base + 8);
}
uint8_t
cmd646_bm_write(uint16_t port, uint8_t val, void *priv)
{
cmd646_t *dev = (cmd646_t *) priv;
uint8_t ret = val;
switch (port & 0x000f) {
case 0x0001:
dev->regs[(port & 0x000f) | 0x70] = val & 0xf0;
if (val & 0x04)
dev->regs[0x50] &= ~0x04;
if (val & 0x08)
dev->regs[0x57] &= ~0x10;
ret &= 0x03;
break;
case 0x0009:
dev->regs[(port & 0x000f) | 0x70] = (dev->regs[(port & 0x000f) | 0x70] & 0x0f) | (val & 0xf0);
ret &= 0x03;
break;
}
return ret;
}
uint8_t
cmd646_bm_read(uint16_t port, uint8_t val, void *priv)
{
cmd646_t *dev = (cmd646_t *) priv;
uint8_t ret = val;
switch (port & 0x000f) {
case 0x0001:
ret = (dev->regs[(port & 0x000f) | 0x70] & 0xf3) | (dev->regs[0x50] & 0x04) | ((dev->regs[0x57] & 0x10) >> 1);
break;
case 0x0002: case 0x000a:
ret |= 0x08;
break;
case 0x0009:
ret = dev->regs[(port & 0x000f) | 0x70];
break;
}
return ret;
}
static void
cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
{
@@ -192,10 +268,20 @@ cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
dev->regs[addr] &= ~(val & 0xb1);
break;
case 0x09:
if ((dev->regs[addr] & 0x0a) == 0x0a) {
dev->regs[addr] = (dev->regs[addr] & 0x0a) | (val & 0x05);
dev->irq_mode[0] = !!(val & 0x01);
dev->irq_mode[1] = !!(val & 0x04);
if (!(dev->local & CMD_TYPE_648) ||
((dev->regs[0x0a] == 0x01) && (dev->regs[0x0b] == 0x01))) {
if ((dev->regs[addr] & 0x0a) == 0x0a) {
dev->regs[addr] = (dev->regs[addr] & 0x0a) | (val & 0x05);
dev->regs[addr] = (dev->regs[addr] & 0x8a) | (val & 0x05);
dev->irq_mode[0] = !!(val & 0x01);
dev->irq_mode[1] = !!(val & 0x04);
cmd646_ide_handlers(dev);
}
}
break;
case 0x0a: case 0x0b:
if ((dev->local & CMD_TYPE_648) && (dev->regs[0x4f] & 0x04)) {
dev->regs[addr] = val;
cmd646_ide_handlers(dev);
}
break;
@@ -255,18 +341,36 @@ cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
dev->regs[0x21] = val;
cmd646_ide_bm_handlers(dev);
break;
case 0x2c ... 0x2f:
case 0x8c ... 0x8f:
if (dev->local & CMD_TYPE_648)
dev->regs[(addr & 0x0f) | 0x20] = val;
break;
case 0x3c:
dev->regs[0x3c] = val;
break;
case 0x4f:
if (dev->local & CMD_TYPE_648)
dev->regs[addr] = (dev->regs[addr] & 0xfa) | (val & 0x05);
break;
case 0x51:
dev->regs[addr] = val & 0xc8;
if (dev->local & CMD_TYPE_648)
dev->regs[addr] = val & 0xcc;
else
dev->regs[addr] = val & 0xc8;
cmd646_ide_handlers(dev);
break;
case 0x52:
case 0x54:
case 0x56:
case 0x58:
case 0x59:
case 0x5b:
dev->regs[addr] = val;
break;
case 0x59:
if (!(dev->local & CMD_TYPE_648))
dev->regs[addr] = val;
break;
case 0x53:
case 0x55:
dev->regs[addr] = val & 0xc0;
@@ -274,10 +378,32 @@ cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
case 0x57:
dev->regs[addr] = (dev->regs[addr] & 0x10) | (val & 0xcc);
break;
case 0x70 ... 0x77:
case 0x64:
if (dev->local & CMD_TYPE_648)
dev->regs[addr] = (dev->regs[addr] & 0xfc) | (val & 0x03);
break;
case 0x65:
if (dev->local & CMD_TYPE_648)
dev->regs[addr] = (dev->regs[addr] & 0x7f) | (val & 0x80);
break;
case 0x71:
if (dev->local & CMD_TYPE_648)
sff_bus_master_write(addr & 0x0f, val, dev->bm[0]);
else
sff_bus_master_write(addr & 0x0f, val & 0x03, dev->bm[0]);
break;
case 0x70:
case 0x72 ... 0x77:
sff_bus_master_write(addr & 0x0f, val, dev->bm[0]);
break;
case 0x78 ... 0x7f:
case 0x79:
if (dev->local & CMD_TYPE_648)
sff_bus_master_write(addr & 0x0f, val, dev->bm[1]);
else
sff_bus_master_write(addr & 0x0f, val & 0x03, dev->bm[1]);
break;
case 0x78:
case 0x7a ... 0x7f:
sff_bus_master_write(addr & 0x0f, val, dev->bm[1]);
break;
@@ -303,6 +429,8 @@ cmd646_pci_read(int func, int addr, void *priv)
ret = sff_bus_master_read(addr & 0x0f, dev->bm[0]);
else if ((addr >= 0x78) && (addr <= 0x7f))
ret = sff_bus_master_read(addr & 0x0f, dev->bm[1]);
else if ((dev->local & CMD_TYPE_648) && (addr >= 0x8c) && (addr <= 0x8f))
ret = dev->regs[(addr & 0x0f) | 0x20];
}
cmd646_log("[%04X:%08X] (%08X) cmd646_pci_read(%i, %02X, %02X)\n", CS, cpu_state.pc, ESI, func, addr, ret);
@@ -310,22 +438,44 @@ cmd646_pci_read(int func, int addr, void *priv)
return ret;
}
static int
check_ch(cmd646_t *dev, int channel)
{
int ret = 0;
int min = 0;
int max = dev->single_channel ? 1 : 3;
if (dev->local & 0x80000) {
min += 4;
max += 4;
}
if ((channel >= min) && (channel <= max))
ret = 1;
return ret;
}
static void
cmd646_reset(void *priv)
{
cmd646_t *dev = (cmd646_t *) priv;
int i = 0;
for (i = 0; i < HDD_NUM; i++) {
if ((hdd[i].bus_type == HDD_BUS_ATAPI) && check_ch(dev, hdd[i].ide_channel) && hdd[i].priv)
scsi_disk_reset((scsi_common_t *) hdd[i].priv);
}
for (i = 0; i < CDROM_NUM; i++) {
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) && (cdrom[i].ide_channel < 4) && cdrom[i].priv)
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) && check_ch(dev, cdrom[i].ide_channel) && cdrom[i].priv)
scsi_cdrom_reset((scsi_common_t *) cdrom[i].priv);
}
for (i = 0; i < RDISK_NUM; i++) {
if ((rdisk_drives[i].bus_type == RDISK_BUS_ATAPI) && (rdisk_drives[i].ide_channel < 4) && rdisk_drives[i].priv)
if ((rdisk_drives[i].bus_type == RDISK_BUS_ATAPI) && check_ch(dev, rdisk_drives[i].ide_channel) && rdisk_drives[i].priv)
rdisk_reset((scsi_common_t *) rdisk_drives[i].priv);
}
for (i = 0; i < MO_NUM; i++) {
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) && (mo_drives[i].ide_channel < 4) && mo_drives[i].priv)
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) && check_ch(dev, mo_drives[i].ide_channel) && mo_drives[i].priv)
mo_reset((scsi_common_t *) mo_drives[i].priv);
}
@@ -336,16 +486,26 @@ cmd646_reset(void *priv)
dev->regs[0x00] = 0x95; /* CMD */
dev->regs[0x01] = 0x10;
dev->regs[0x02] = 0x46; /* PCI-0646 */
if (dev->local & CMD_TYPE_648)
dev->regs[0x02] = 0x48; /* PCI-0648 */
else
dev->regs[0x02] = 0x46; /* PCI-0646 */
dev->regs[0x03] = 0x06;
dev->regs[0x04] = 0x00;
dev->regs[0x06] = 0x80;
dev->regs[0x07] = 0x02; /* DEVSEL timing: 01 medium */
dev->regs[0x09] = dev->local; /* Programming interface */
dev->regs[0x0a] = 0x01; /* IDE controller */
if ((dev->local & CMD_TYPE_648) && (dev->local & CMD648_RAID))
dev->regs[0x0a] = 0x04; /* RAID controller */
else
dev->regs[0x0a] = 0x01; /* IDE controller */
dev->regs[0x0b] = 0x01; /* Mass storage controller */
if ((dev->local & 0xffff) == 0x8a) {
if ((dev->local & CMD_TYPE_648) && (dev->local & CMD648_JP7))
for (int i = 0; i < 4; i++)
dev->regs[0x2c + i] = dev->regs[i];
if ((dev->regs[0x09] & 0x8a) == 0x8a) {
dev->regs[0x50] = 0x40; /* Enable Base address register R/W;
If 0, they return 0 and are read-only 8 */
@@ -370,12 +530,38 @@ cmd646_reset(void *priv)
if (!dev->single_channel)
dev->regs[0x51] = 0x08;
dev->regs[0x57] = 0x0c;
dev->regs[0x59] = 0x40;
if (dev->local & CMD_TYPE_648) {
dev->regs[0x34] = 0x60;
dev->regs[0x4f] = (dev->local & CMD648_JP7) ? 0x02 : 0x00;
dev->regs[0x51] |= 0x04;
dev->regs[0x60] = 0x01;
dev->regs[0x62] = 0x21;
dev->regs[0x63] = 0x06;
dev->regs[0x65] = 0x60;
dev->regs[0x67] = 0xf0;
/* 80-pin stuff. */
dev->regs[0x72] = 0x08;
dev->regs[0x7a] = 0x08;
dev->regs[0x79] = 0x83;
} else
dev->regs[0x59] = 0x40;
dev->regs[0x57] = 0x0c;
dev->irq_mode[0] = dev->irq_mode[1] = 0;
dev->irq_pin = PCI_INTA;
if ((dev->local & CMD_TYPE_648) && (dev->local & CMD648_RAID))
dev->irq_mode[0] = dev->irq_mode[1] = IRQ_MODE_PCI_IRQ_PIN;
else {
dev->irq_mode[0] = (dev->regs[0x09] & 0x01) ? IRQ_MODE_PCI_IRQ_PIN : IRQ_MODE_LEGACY;
dev->irq_mode[1] = (dev->regs[0x09] & 0x04) ? IRQ_MODE_PCI_IRQ_PIN : IRQ_MODE_LEGACY;
}
dev->irq_pin = PCI_INTA;
cmd646_ide_handlers(dev);
cmd646_ide_bm_handlers(dev);
}
@@ -391,34 +577,53 @@ cmd646_close(void *priv)
static void *
cmd646_init(const device_t *info)
{
cmd646_t *dev = (cmd646_t *) calloc(1, sizeof(cmd646_t));
cmd646_t *dev = (cmd646_t *) calloc(1, sizeof(cmd646_t));
int first = 0;
dev->local = info->local;
device_add(&ide_pci_2ch_device);
if (info->local & 0x80000)
pci_add_card(PCI_ADD_NORMAL, cmd646_pci_read, cmd646_pci_write, dev, &dev->pci_slot);
else
if (info->local & 0x80000) {
first = 2;
device_add(&ide_pci_ter_qua_2ch_device);
} else
device_add(&ide_pci_2ch_device);
if (info->local & CMD64X_ONBOARD)
pci_add_card(PCI_ADD_IDE, cmd646_pci_read, cmd646_pci_write, dev, &dev->pci_slot);
else
pci_add_card(PCI_ADD_NORMAL, cmd646_pci_read, cmd646_pci_write, dev, &dev->pci_slot);
dev->single_channel = !!(info->local & 0x20000);
dev->bm[0] = device_add_inst(&sff8038i_device, 1);
dev->bm[0] = device_add_inst(&sff8038i_device, first + 1);
if (!dev->single_channel)
dev->bm[1] = device_add_inst(&sff8038i_device, 2);
dev->bm[1] = device_add_inst(&sff8038i_device, first + 2);
ide_set_bus_master(0, cmd646_bus_master_dma_0, cmd646_set_irq_0, dev);
ide_set_bus_master(first, cmd646_bus_master_dma_0, cmd646_set_irq_0, dev);
if (!dev->single_channel)
ide_set_bus_master(1, cmd646_bus_master_dma_1, cmd646_set_irq_1, dev);
ide_set_bus_master(first + 1, cmd646_bus_master_dma_1, cmd646_set_irq_1, dev);
sff_set_irq_mode(dev->bm[0], IRQ_MODE_LEGACY);
if (!dev->single_channel)
sff_set_irq_mode(dev->bm[1], IRQ_MODE_LEGACY);
sff_set_slot(dev->bm[0], dev->pci_slot);
sff_set_slot(dev->bm[1], dev->pci_slot);
if (dev->local & CMD_TYPE_648) {
sff_set_ven_handlers(dev->bm[0], cmd646_bm_write, cmd646_bm_read, dev);
sff_set_ven_handlers(dev->bm[1], cmd646_bm_write, cmd646_bm_read, dev);
}
cmd646_reset(dev);
if (dev->local & CMD_TYPE_648)
for (int i = 0; i < 4; i++)
dev->regs[0x2c + i] = dev->regs[i];
return dev;
}
@@ -426,7 +631,7 @@ const device_t ide_cmd646_device = {
.name = "CMD PCI-0646",
.internal_name = "ide_cmd646",
.flags = DEVICE_PCI,
.local = 0x8a,
.local = 0x8a | CMD64X_ONBOARD,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,
@@ -440,7 +645,7 @@ const device_t ide_cmd646_legacy_only_device = {
.name = "CMD PCI-0646 (Legacy Mode Only)",
.internal_name = "ide_cmd646_legacy_only",
.flags = DEVICE_PCI,
.local = 0x80,
.local = 0x80 | CMD64X_ONBOARD,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,
@@ -451,10 +656,52 @@ const device_t ide_cmd646_legacy_only_device = {
};
const device_t ide_cmd646_single_channel_device = {
.name = "CMD PCI-0646",
.name = "CMD PCI-0646 (Single Channel)",
.internal_name = "ide_cmd646_single_channel",
.flags = DEVICE_PCI,
.local = 0x2008a,
.local = 0x2008a | CMD64X_ONBOARD,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ide_cmd646_ter_qua_device = {
.name = "CMD PCI-0646 (Tertiary and Quaternary)",
.internal_name = "ide_cmd646_ter_qua",
.flags = DEVICE_PCI,
.local = 0x8008f,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ide_cmd648_ter_qua_device = {
.name = "CMD PCI-0648 (Tertiary and Quaternary)",
.internal_name = "ide_cmd648_ter_qua",
.flags = DEVICE_PCI,
.local = 0x78008f,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t ide_cmd648_ter_qua_onboard_device = {
.name = "CMD PCI-0648 (Tertiary and Quaternary) On-Board",
.internal_name = "ide_cmd648_ter_qua_onboard",
.flags = DEVICE_PCI,
.local = 0x78008f | CMD64X_ONBOARD,
.init = cmd646_init,
.close = cmd646_close,
.reset = cmd646_reset,

View File

@@ -275,7 +275,7 @@ const device_t ide_rz1000_pci_device = {
};
const device_t ide_rz1000_pci_single_channel_device = {
.name = "PC Technology RZ-1000 PCI",
.name = "PC Technology RZ-1000 PCI (Single Channel)",
.internal_name = "ide_rz1000_pci_single_channel",
.flags = DEVICE_PCI,
.local = 0x20000,

View File

@@ -118,6 +118,9 @@ sff_bus_master_write(uint16_t port, uint8_t val, void *priv)
sff_log("SFF-8038i Bus master BYTE write: %04X %02X\n", port, val);
if (dev->ven_write != NULL)
val = dev->ven_write(port, val, dev->priv);
switch (port & 7) {
case 0:
sff_log("sff Cmd : val = %02X, old = %02X\n", val, dev->command);
@@ -255,6 +258,9 @@ sff_bus_master_read(uint16_t port, void *priv)
break;
}
if (dev->ven_read != NULL)
ret= dev->ven_read(port, ret, dev->priv);
sff_log("SFF-8038i Bus master BYTE read : %04X %02X\n", port, ret);
return ret;
@@ -569,6 +575,16 @@ sff_set_mirq(sff8038i_t *dev, uint8_t mirq)
dev->mirq = mirq;
}
void
sff_set_ven_handlers(sff8038i_t *dev, uint8_t (*ven_write)(uint16_t port, uint8_t val, void *priv),
uint8_t (*ven_read)(uint16_t port, uint8_t val, void *priv), void *priv)
{
dev->ven_write = ven_write;
dev->ven_read = ven_read;
dev->priv = priv;
}
static void
sff_close(void *priv)
{

View File

@@ -27,7 +27,7 @@
#define HDC_NONE 0
#define HDC_INTERNAL 1
#define HDC_MAX 2
#define HDC_MAX 4
extern int hdc_current[HDC_MAX];
@@ -79,6 +79,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_cmd646_ter_qua_device; /* CMD PCI-646 (Tertiary and quaternary channels) */
extern const device_t ide_cmd648_ter_qua_device; /* CMD PCI-648 (Tertiary and quaternary channels) */
extern const device_t ide_cmd648_ter_qua_onboard_device; /* CMD PCI-648 (Tertiary and quaternary channels, on-board) */
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) */

View File

@@ -178,9 +178,6 @@ enum {
TIMINGS_PIO_FC = 2
};
extern int ide_ter_enabled;
extern int ide_qua_enabled;
#ifdef SCSI_DEVICE_H
extern ide_t *ide_get_drive(int ch);
extern void ide_irq(ide_t *ide, int set, int log);

View File

@@ -56,6 +56,11 @@ typedef struct sff8038i_t
int irq_level;
int irq_pin;
int pci_irq_line;
uint8_t (*ven_write)(uint16_t port, uint8_t val, void *priv);
uint8_t (*ven_read)(uint16_t port, uint8_t val, void *priv);
void *priv;
} sff8038i_t;
extern const device_t sff8038i_device;
@@ -78,4 +83,7 @@ extern void sff_set_irq_pin(sff8038i_t *dev, int irq_pin);
extern void sff_set_irq_level(sff8038i_t *dev, int irq_level);
extern void sff_set_mirq(sff8038i_t *dev, uint8_t mirq);
extern void sff_set_ven_handlers(sff8038i_t *dev, uint8_t (*ven_write)(uint16_t port, uint8_t val, void *priv),
uint8_t (*ven_read)(uint16_t port, uint8_t val, void *priv), void *priv);
#endif /*EMU_HDC_IDE_SFF8038I_H*/

View File

@@ -250,6 +250,7 @@ machine_at_cubx_init(const machine_t *model)
device_add(&piix4e_device);
device_add(&keyboard_ps2_ami_pci_device);
device_add(&w83977ef_device);
device_add(&ide_cmd648_ter_qua_onboard_device);
device_add(ics9xxx_get(ICS9250_08));
device_add(&sst_flash_39sf020_device);
spd_register(SPD_TYPE_SDRAM, 0xF, 256);

View File

@@ -17135,7 +17135,7 @@ const machine_t machines[] = {
.max_multi = 8.0
},
.bus_flags = MACHINE_PS2_AGP | MACHINE_BUS_USB,
.flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_ACPI | MACHINE_USB, /* Machine has quad channel IDE with internal controller: CMD PCI-0648 */
.flags = MACHINE_IDE_QUAD | MACHINE_APM | MACHINE_ACPI | MACHINE_USB, /* Machine has quad channel IDE with internal controller: CMD PCI-0648 */
.ram = {
.min = 8192,
.max = 1048576,

View File

@@ -52,15 +52,16 @@ void
SettingsStorageControllers::save()
{
/* Storage devices category */
for (uint8_t i = 0; i < HDC_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxHD%1").arg(i + 1));
hdc_current[i] = cbox->currentData().toInt();
}
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
QComboBox *cbox = findChild<QComboBox *>(QString("comboBoxSCSI%1").arg(i + 1));
scsi_card_current[i] = cbox->currentData().toInt();
}
fdc_current[0] = ui->comboBoxFD->currentData().toInt();
hdc_current[0] = ui->comboBoxHD->currentData().toInt();
cdrom_interface_current = ui->comboBoxCDInterface->currentData().toInt();
ide_ter_enabled = ui->checkBoxTertiaryIDE->isChecked() ? 1 : 0;
ide_qua_enabled = ui->checkBoxQuaternaryIDE->isChecked() ? 1 : 0;
cassette_enable = ui->checkBoxCassette->isChecked() ? 1 : 0;
}
@@ -69,44 +70,12 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
{
this->machineId = machineId;
/*HD controller config*/
/* FD controller config */
int c = 0;
auto *model = ui->comboBoxHD->model();
auto *model = ui->comboBoxFD->model();
auto removeRows = model->rowCount();
int selectedRow = 0;
while (true) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && (machine_has_flags(machineId, MACHINE_HDC) == 0)) {
c++;
continue;
}
QString name = DeviceConfig::DeviceName(hdc_get_device(c), hdc_get_internal_name(c), 1);
if (name.isEmpty())
break;
if (hdc_available(c)) {
const device_t *hdc_dev = hdc_get_device(c);
if (device_is_valid(hdc_dev, machineId)) {
int row = Models::AddEntry(model, name, c);
if (c == hdc_current[0])
selectedRow = row - removeRows;
}
}
c++;
}
model->removeRows(0, removeRows);
ui->comboBoxHD->setEnabled(model->rowCount() > 0);
ui->comboBoxHD->setCurrentIndex(-1);
ui->comboBoxHD->setCurrentIndex(selectedRow);
/* FD controller config */
model = ui->comboBoxFD->model();
removeRows = model->rowCount();
c = 0;
selectedRow = 0;
while (true) {
#if 0
/* Skip "internal" if machine doesn't have it. */
@@ -177,6 +146,51 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
ui->comboBoxCDInterface->setCurrentIndex(-1);
ui->comboBoxCDInterface->setCurrentIndex(selectedRow);
// HD Controller
QComboBox * hd_cbox[HDC_MAX] = { 0 };
QAbstractItemModel *hd_models[HDC_MAX] = { 0 };
int hd_removeRows_[HDC_MAX] = { 0 };
int hd_selectedRows[HDC_MAX] = { 0 };
for (uint8_t i = 0; i < HDC_MAX; ++i) {
hd_cbox[i] = findChild<QComboBox *>(QString("comboBoxHD%1").arg(i + 1));
hd_models[i] = hd_cbox[i]->model();
hd_removeRows_[i] = hd_models[i]->rowCount();
}
c = 0;
while (true) {
const QString name = DeviceConfig::DeviceName(hdc_get_device(c),
hdc_get_internal_name(c), 1);
if (name.isEmpty())
break;
if (hdc_available(c)) {
if (device_is_valid(hdc_get_device(c), machineId)) {
for (uint8_t i = 0; i < HDC_MAX; ++i) {
/* Skip "internal" if machine doesn't have it. */
if ((c == 1) && ((i > 0) || (machine_has_flags(machineId, MACHINE_HDC) == 0)))
continue;
int row = Models::AddEntry(hd_models[i], name, c);
if (c == hdc_current[i])
hd_selectedRows[i] = row - hd_removeRows_[i];
}
}
}
c++;
}
for (uint8_t i = 0; i < HDC_MAX; ++i) {
hd_models[i]->removeRows(0, hd_removeRows_[i]);
hd_cbox[i]->setEnabled(hd_models[i]->rowCount() > 1);
hd_cbox[i]->setCurrentIndex(-1);
hd_cbox[i]->setCurrentIndex(hd_selectedRows[i]);
}
// SCSI Card
QComboBox * cbox[SCSI_CARD_MAX] = { 0 };
QAbstractItemModel *models[SCSI_CARD_MAX] = { 0 };
@@ -208,7 +222,7 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
}
}
c++;
c++;
}
for (uint8_t i = 0; i < SCSI_CARD_MAX; ++i) {
@@ -218,12 +232,6 @@ SettingsStorageControllers::onCurrentMachineChanged(int machineId)
cbox[i]->setCurrentIndex(selectedRows[i]);
}
int is_at = IS_AT(machineId);
ui->checkBoxTertiaryIDE->setEnabled(is_at > 0);
ui->checkBoxQuaternaryIDE->setEnabled(is_at > 0);
ui->checkBoxTertiaryIDE->setChecked(ui->checkBoxTertiaryIDE->isEnabled() && ide_ter_enabled);
ui->checkBoxQuaternaryIDE->setChecked(ui->checkBoxQuaternaryIDE->isEnabled() && ide_qua_enabled);
if (machine_has_bus(machineId, MACHINE_BUS_CASSETTE)) {
ui->checkBoxCassette->setChecked(cassette_enable > 0);
ui->checkBoxCassette->setEnabled(true);
@@ -243,12 +251,39 @@ SettingsStorageControllers::on_comboBoxFD_currentIndexChanged(int index)
}
void
SettingsStorageControllers::on_comboBoxHD_currentIndexChanged(int index)
SettingsStorageControllers::on_comboBoxHD1_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD->setEnabled(hdc_has_config(ui->comboBoxHD->currentData().toInt()) > 0);
ui->pushButtonHD1->setEnabled(hdc_has_config(ui->comboBoxHD1->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD2_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD2->setEnabled(hdc_has_config(ui->comboBoxHD2->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD3_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD3->setEnabled(hdc_has_config(ui->comboBoxHD3->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_comboBoxHD4_currentIndexChanged(int index)
{
if (index < 0)
return;
ui->pushButtonHD4->setEnabled(hdc_has_config(ui->comboBoxHD4->currentData().toInt()) > 0);
}
void
@@ -260,18 +295,6 @@ SettingsStorageControllers::on_comboBoxCDInterface_currentIndexChanged(int index
ui->pushButtonCDInterface->setEnabled(cdrom_interface_has_config(ui->comboBoxCDInterface->currentData().toInt()) > 0);
}
void
SettingsStorageControllers::on_checkBoxTertiaryIDE_stateChanged(int arg1)
{
ui->pushButtonTertiaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_checkBoxQuaternaryIDE_stateChanged(int arg1)
{
ui->pushButtonQuaternaryIDE->setEnabled(arg1 == Qt::Checked);
}
void
SettingsStorageControllers::on_pushButtonFD_clicked()
{
@@ -279,9 +302,27 @@ SettingsStorageControllers::on_pushButtonFD_clicked()
}
void
SettingsStorageControllers::on_pushButtonHD_clicked()
SettingsStorageControllers::on_pushButtonHD1_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD->currentData().toInt()));
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD1->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD2_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD2->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD3_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD3->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonHD4_clicked()
{
DeviceConfig::ConfigureDevice(hdc_get_device(ui->comboBoxHD4->currentData().toInt()));
}
void
@@ -290,18 +331,6 @@ SettingsStorageControllers::on_pushButtonCDInterface_clicked()
DeviceConfig::ConfigureDevice(cdrom_interface_get_device(ui->comboBoxCDInterface->currentData().toInt()));
}
void
SettingsStorageControllers::on_pushButtonTertiaryIDE_clicked()
{
DeviceConfig::ConfigureDevice(&ide_ter_device);
}
void
SettingsStorageControllers::on_pushButtonQuaternaryIDE_clicked()
{
DeviceConfig::ConfigureDevice(&ide_qua_device);
}
void
SettingsStorageControllers::on_comboBoxSCSI1_currentIndexChanged(int index)
{

View File

@@ -23,18 +23,18 @@ private slots:
void on_comboBoxFD_currentIndexChanged(int index);
void on_pushButtonFD_clicked();
void on_comboBoxHD_currentIndexChanged(int index);
void on_pushButtonHD_clicked();
void on_comboBoxHD1_currentIndexChanged(int index);
void on_pushButtonHD1_clicked();
void on_comboBoxHD2_currentIndexChanged(int index);
void on_pushButtonHD2_clicked();
void on_comboBoxHD3_currentIndexChanged(int index);
void on_pushButtonHD3_clicked();
void on_comboBoxHD4_currentIndexChanged(int index);
void on_pushButtonHD4_clicked();
void on_comboBoxCDInterface_currentIndexChanged(int index);
void on_pushButtonCDInterface_clicked();
void on_checkBoxTertiaryIDE_stateChanged(int arg1);
void on_pushButtonTertiaryIDE_clicked();
void on_checkBoxQuaternaryIDE_stateChanged(int arg1);
void on_pushButtonQuaternaryIDE_clicked();
void on_comboBoxSCSI1_currentIndexChanged(int index);
void on_pushButtonSCSI1_clicked();
void on_comboBoxSCSI2_currentIndexChanged(int index);

View File

@@ -50,89 +50,145 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHD">
<property name="text">
<string>HD Controller:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxHD">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonHD">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelCDInterface">
<property name="text">
<string>CD-ROM Controller:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="comboBoxCDInterface">
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="2">
<item row="1" column="2">
<widget class="QPushButton" name="pushButtonCDInterface">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxTertiaryIDE">
<property name="text">
<string>Tertiary IDE Controller</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pushButtonTertiaryIDE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxQuaternaryIDE">
<property name="text">
<string>Quaternary IDE Controller</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QPushButton" name="pushButtonQuaternaryIDE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxHD">
<property name="title">
<string>Hard disk</string>
</property>
<layout class="QGridLayout" name="gridLayoutHD">
<item row="0" column="0">
<widget class="QLabel" name="labelHD1">
<property name="text">
<string>Controller 1:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboBoxHD1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonHD1">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelHD2">
<property name="text">
<string>Controller 2:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboBoxHD2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButtonHD2">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelHD3">
<property name="text">
<string>Controller 3:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QComboBox" name="comboBoxHD3">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="pushButtonHD3">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelHD4">
<property name="text">
<string>Controller 4:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="comboBoxHD4">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>30</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonHD4">
<property name="text">
<string>Configure</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxSCSI">
<property name="title">

View File

@@ -315,6 +315,7 @@ ioctl_get_track_info(const void *local, const uint32_t track,
const raw_track_info_t *rti = (const raw_track_info_t *) ioctl->cur_rti;
int ret = 1;
int trk = -1;
int next = -1;
if ((track >= 1) && (track < 99))
for (int i = 0; i < ioctl->blocks_num; i++)
@@ -323,13 +324,35 @@ ioctl_get_track_info(const void *local, const uint32_t track,
break;
}
if ((track >= 1) && (track < 98))
for (int i = 0; i < ioctl->blocks_num; i++)
if ((rti[i].point == (track + 1)) && (rti[i].session == rti[trk].session)) {
next = i;
break;
}
if ((track >= 1) && (track < 99) && (trk != -1) && (next == -1))
for (int i = 0; i < ioctl->blocks_num; i++)
if ((rti[i].point == 0xa2) && (rti[i].session == rti[trk].session)) {
next = i;
break;
}
if ((track == 0xaa) || (trk == -1)) {
ioctl_log(ioctl->log, "ioctl_get_track_info(%02i)\n", track);
ret = 0;
} else {
ti->m = rti[trk].pm;
ti->s = rti[trk].ps;
ti->f = rti[trk].pf;
if (end) {
if (next != -1) {
ti->m = rti[next].pm;
ti->s = rti[next].ps;
ti->f = rti[next].pf;
}
} else {
ti->m = rti[trk].pm;
ti->s = rti[trk].ps;
ti->f = rti[trk].pf;
}
ti->number = rti[trk].point;
ti->attr = rti[trk].adr_ctl;

View File

@@ -1325,10 +1325,18 @@ scsi_cdrom_update_sector_flags(scsi_cdrom_t *dev)
dev->sector_type = 0x08 | ((2048 / dev->drv->sector_size) << 4);
dev->sector_flags = 0x0010;
break;
case 2052:
dev->sector_type = 0x18;
dev->sector_flags = 0x0030;
break;
case 2056:
dev->sector_type = 0x18;
dev->sector_flags = 0x0050;
break;
case 2060:
dev->sector_type = 0x18;
dev->sector_flags = 0x0070;
break;
case 2324: case 2328:
dev->sector_type = (dev->drv->sector_size == 2328) ? 0x1a : 0x1b;
dev->sector_flags = 0x0018;