Added the Sanyo MBC-17, Sharp AX 286, ECS Socket 4 machine, LG Multinet x52, and Taken Socket 4/5 machine, also IDE PIO mode 3+ fixes, and ATA-3 IDE drives now default to PIO mode 3 maximum instead of 0.

This commit is contained in:
OBattler
2025-08-15 20:59:07 +02:00
parent c3fae26ec7
commit 28e7f86296
16 changed files with 614 additions and 27 deletions

View File

@@ -480,7 +480,7 @@ static int
ide_get_max(const ide_t *ide, const int type)
{
const int ata_4 = ide_is_ata4(ide_boards[ide->board]);
const int max[2][4] = { { 0, -1, -1, -1 }, { 4, 2, 2, 5 } };
const int max[2][4] = { { 3, -1, -1, -1 }, { 4, 2, 2, 5 } };
int ret;
if (ide->type == IDE_ATAPI)
@@ -495,7 +495,7 @@ static int
ide_get_timings(const ide_t *ide, const int type)
{
const int ata_4 = ide_is_ata4(ide_boards[ide->board]);
const int timings[2][3] = { { 0, 0, 0 }, { 120, 120, 0 } };
const int timings[2][3] = { { 0, 240, 180 }, { 120, 120, 120 } };
int ret;
if (ide->type == IDE_ATAPI)
@@ -666,8 +666,9 @@ ide_identify(ide_t *ide)
ide->buffer[88] = 0x0000;
if (max_pio >= 3) {
ide->buffer[49] |= 0x0c00;
ide->buffer[53] |= 0x0002;
ide->buffer[67] = ide_get_timings(ide, TIMINGS_PIO);
ide->buffer[67] = ide_get_timings(ide, TIMINGS_PIO_FC);
ide->buffer[68] = ide_get_timings(ide, TIMINGS_PIO_FC);
for (i = 3; i <= max_pio; i++)
ide->buffer[64] |= (1 << (i - 3));
@@ -710,12 +711,8 @@ ide_identify(ide_t *ide)
}
if (ide->mdma_mode != -1) {
d = (ide->mdma_mode & 0xff);
d <<= 8;
if ((ide->mdma_mode & 0x300) == 0x000) {
if ((ide->mdma_mode & 0xff) >= 3)
ide->buffer[64] |= d;
} else if ((ide->mdma_mode & 0x300) == 0x100)
d = (ide->mdma_mode & 0xff) << 8;
if ((ide->mdma_mode & 0x300) == 0x100)
ide->buffer[62] |= d;
else if ((ide->mdma_mode & 0x300) == 0x200)
ide->buffer[63] |= d;
@@ -829,6 +826,7 @@ ide_set_features(ide_t *ide)
int mode;
int submode;
int max;
int max_pio_submode;
features = ide->tf->cylprecomp;
features_data = ide->tf->secount;
@@ -844,9 +842,10 @@ ide_set_features(ide_t *ide)
switch (mode) {
case 0x00: /* PIO default */
if (submode != 0)
max = ide_get_max(ide, TYPE_PIO);
max_pio_submode = (max >= 3) ? 1 : 0;
if (submode > max_pio_submode)
return 0;
max = ide_get_max(ide, TYPE_PIO);
ide->mdma_mode = (1 << max);
ide_log("IDE %02X: Setting DPIO mode: %02X, %08X\n", ide->channel,
submode, ide->mdma_mode);

View File

@@ -45,7 +45,7 @@ typedef struct cmd640_t {
uint8_t pci;
uint8_t irq_state;
uint8_t pci_slot;
uint8_t pad0;
uint8_t force_on;
uint8_t regs[256];
uint32_t local;
int irq_mode[2];
@@ -143,7 +143,7 @@ cmd640_ide_handlers(cmd640_t *dev)
ide_set_base(0, main);
ide_set_side(0, side);
if (dev->regs[0x04] & 0x01)
if ((dev->regs[0x04] & 0x01) || dev->force_on)
ide_pri_enable();
}
@@ -161,7 +161,7 @@ cmd640_ide_handlers(cmd640_t *dev)
ide_set_base(1, main);
ide_set_side(1, side);
if ((dev->regs[0x04] & 0x01) && (dev->regs[0x51] & 0x08))
if (((dev->regs[0x04] & 0x01) || dev->force_on) && (dev->regs[0x51] & 0x08))
ide_sec_enable();
}
}
@@ -512,6 +512,7 @@ cmd640_init(const device_t *info)
dev->local = info->local;
dev->channels = ((info->local & 0x60000) >> 17) & 0x03;
dev->force_on = !!(info->local & 0x100000);
if (info->flags & DEVICE_PCI) {
device_add(&ide_pci_2ch_device);

View File

@@ -2016,7 +2016,7 @@ mo_get_max(UNUSED(const ide_t *ide), const int ide_has_dma, const int type)
switch (type) {
case TYPE_PIO:
ret = ide_has_dma ? 3 : 0;
ret = 3;
break;
case TYPE_SDMA:
default:
@@ -2043,10 +2043,10 @@ mo_get_timings(UNUSED(const ide_t *ide), const int ide_has_dma, const int type)
ret = ide_has_dma ? 0x96 : 0;
break;
case TIMINGS_PIO:
ret = ide_has_dma ? 0xb4 : 0;
ret = 0xf0;
break;
case TIMINGS_PIO_FC:
ret = ide_has_dma ? 0xb4 : 0;
ret = 0xb4;
break;
default:
ret = 0;

View File

@@ -2090,7 +2090,7 @@ rdisk_get_max(UNUSED(const ide_t *ide), const int ide_has_dma, const int type)
switch (type) {
case TYPE_PIO:
ret = ide_has_dma ? 3 : 0;
ret = 3;
break;
case TYPE_SDMA:
default:
@@ -2117,10 +2117,10 @@ rdisk_get_timings(UNUSED(const ide_t *ide), const int ide_has_dma, const int typ
ret = ide_has_dma ? 0x96 : 0;
break;
case TIMINGS_PIO:
ret = ide_has_dma ? 0xb4 : 0;
ret = 0xf0;
break;
case TIMINGS_PIO_FC:
ret = ide_has_dma ? 0xb4 : 0;
ret = 0xb4;
break;
default:
ret = 0;