From fcf68054f42d9f964a41c3692ed7804e36a42288 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 26 Oct 2022 02:44:37 +0200 Subject: [PATCH] ATAPI CD-ROM now identifies as Hitachi instead of NEC so we can emulate the regular ATAPI standard instead of a preliminary one, while still passing the PB640 CD-ROM drive detection check. --- src/scsi/scsi_cdrom.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index b4b91cce8..83451e71c 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -349,7 +349,11 @@ scsi_cdrom_init(scsi_cdrom_t *dev) dev->sense[0] = 0xf0; dev->sense[7] = 10; +#ifdef POSSIBLE_EARLY_ATAPI dev->status = READY_STAT | DSC_STAT; +#else + dev->status = 0; +#endif dev->pos = 0; dev->packet_status = PHASE_NONE; scsi_cdrom_sense_key = scsi_cdrom_asc = scsi_cdrom_ascq = dev->unit_attention = 0; @@ -1352,8 +1356,10 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) int toc_format, block_desc = 0; int ret, format = 0; int real_pos, track = 0; +#ifdef USE_86BOX_CD char device_identify[9] = { '8', '6', 'B', '_', 'C', 'D', '0', '0', 0 }; char device_identify_ex[15] = { '8', '6', 'B', '_', 'C', 'D', '0', '0', ' ', 'v', '1', '.', '0', '0', 0 }; +#endif int32_t blen = 0, *BufLen; uint8_t *b; uint32_t profiles[2] = { MMC_PROFILE_CD_ROM, MMC_PROFILE_DVD_ROM }; @@ -1371,12 +1377,14 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) dev->packet_len = 0; dev->request_pos = 0; +#ifdef USE_86BOX_CD device_identify[7] = dev->id + 0x30; device_identify_ex[7] = dev->id + 0x30; device_identify_ex[10] = EMU_VERSION_EX[0]; device_identify_ex[12] = EMU_VERSION_EX[2]; device_identify_ex[13] = EMU_VERSION_EX[3]; +#endif memcpy(dev->current_cdb, cdb, 12); @@ -2301,16 +2309,25 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) if (dev->drv->bus_type == CDROM_BUS_SCSI) ide_padstr8(dev->buffer + idx, 8, "TOSHIBA"); /* Vendor */ else +#ifdef USE_86BOX_CD ide_padstr8(dev->buffer + idx, 8, EMU_NAME); /* Vendor */ +#else + ide_padstr8(dev->buffer + idx, 8, "HITACHI"); /* Vendor */ +#endif idx += 8; if (dev->drv->bus_type == CDROM_BUS_SCSI) ide_padstr8(dev->buffer + idx, 40, "XM6201TASUN32XCD1103"); /* Product */ else +#ifdef USE_86BOX_CD ide_padstr8(dev->buffer + idx, 40, device_identify_ex); /* Product */ +#else + ide_padstr8(dev->buffer + idx, 40, "CDR-8130"); /* Product */ +#endif idx += 40; ide_padstr8(dev->buffer + idx, 20, "53R141"); /* Product */ idx += 20; break; + default: scsi_cdrom_log("INQUIRY: Invalid page: %02X\n", cdb[2]); scsi_cdrom_invalid_field(dev); @@ -2344,9 +2361,15 @@ scsi_cdrom_command(scsi_common_t *sc, uint8_t *cdb) ide_padstr8(dev->buffer + 16, 16, "XM6201TASUN32XCD"); /* Product */ ide_padstr8(dev->buffer + 32, 4, "1103"); /* Revision */ } else { +#ifdef USE_86BOX_CD ide_padstr8(dev->buffer + 8, 8, EMU_NAME); /* Vendor */ ide_padstr8(dev->buffer + 16, 16, device_identify); /* Product */ ide_padstr8(dev->buffer + 32, 4, EMU_VERSION_EX); /* Revision */ +#else + ide_padstr8(dev->buffer + 8, 8, "HITACHI"); /* Vendor */ + ide_padstr8(dev->buffer + 16, 16, "CDR-8130"); /* Product */ + ide_padstr8(dev->buffer + 32, 4, "0020"); /* Revision */ +#endif } idx = 36; @@ -2615,7 +2638,7 @@ scsi_cdrom_get_timings(int ide_has_dma, int type) static void scsi_cdrom_identify(ide_t *ide, int ide_has_dma) { -#if 0 +#ifdef USE_86BOX_CD scsi_cdrom_t *dev; char device_identify[9] = { '8', '6', 'B', '_', 'C', 'D', '0', '0', 0 }; @@ -2627,12 +2650,17 @@ scsi_cdrom_identify(ide_t *ide, int ide_has_dma) ide->buffer[0] = 0x8000 | (5 << 8) | 0x80 | (2 << 5); /* ATAPI device, CD-ROM drive, removable media, accelerated DRQ */ ide_padstr((char *) (ide->buffer + 10), "", 20); /* Serial Number */ -#if 0 +#ifdef USE_86BOX_CD ide_padstr((char *) (ide->buffer + 23), EMU_VERSION_EX, 8); /* Firmware */ ide_padstr((char *) (ide->buffer + 27), device_identify, 40); /* Model */ #else + #ifdef USE_NEC_CD ide_padstr((char *) (ide->buffer + 23), "4.20 ", 8); /* Firmware */ ide_padstr((char *) (ide->buffer + 27), "NEC CD-ROM DRIVE:273 ", 40); /* Model */ + #else + ide_padstr((char *) (ide->buffer + 23), "0020 ", 8); /* Firmware */ + ide_padstr((char *) (ide->buffer + 27), "HITACHI CDR-8130 ", 40); /* Model */ + #endif #endif ide->buffer[49] = 0x200; /* LBA supported */ ide->buffer[126] = 0xfffe; /* Interpret zero byte count limit as maximum length */