From a06491813389b11b9f45be6020532a557be93d8a Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 26 Jul 2022 00:18:28 +0200 Subject: [PATCH] WIN_WRITE_MULTIPLE now correctly fails with command aborted if ide->blocksize = 0, instead of a fatal(). --- src/disk/hdc_ide.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 55f60c8e3..b49e2e926 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -1682,8 +1682,7 @@ ide_writeb(uint16_t addr, uint8_t val, void *priv) return; case WIN_WRITE_MULTIPLE: - if (!ide->blocksize && (ide->type != IDE_ATAPI)) - fatal("Write_MULTIPLE - blocksize = 0\n"); + /* Fatal removed for the same reason as for WIN_READ_MULTIPLE. */ ide->blockcount = 0; /* Turn on the activity indicator *here* so that it gets turned on less times. */ @@ -2410,7 +2409,13 @@ ide_callback(void *priv) return; case WIN_WRITE_MULTIPLE: - if (ide->type == IDE_ATAPI) + /* According to the official ATA reference: + + If the Read Multiple command is attempted before the Set Multiple Mode + command has been executed or when Read Multiple commands are + disabled, the Read Multiple operation is rejected with an Aborted Com- + mand error. */ + if ((ide->type == IDE_ATAPI) || !ide->blocksize) goto abort_cmd; if (!ide->lba && (ide->cfg_spt == 0)) goto id_not_found;