Various SCSI and CD-ROM bugfixes.
This commit is contained in:
@@ -2389,6 +2389,13 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
|
|||||||
case GPCMD_REQUEST_SENSE:
|
case GPCMD_REQUEST_SENSE:
|
||||||
/* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE
|
/* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE
|
||||||
should forget about the not ready, and report unit attention straight away. */
|
should forget about the not ready, and report unit attention straight away. */
|
||||||
|
if (cdrom_drives[id].bus_type == CDROM_BUS_SCSI)
|
||||||
|
{
|
||||||
|
if (SCSIDevices[cdrom_drives[id].scsi_device_id][cdrom_drives[id].scsi_device_lun].InitLength < cdb[4])
|
||||||
|
{
|
||||||
|
cdb[4] = SCSIDevices[cdrom_drives[id].scsi_device_id][cdrom_drives[id].scsi_device_lun].InitLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
cdrom_request_sense(id, cdbufferb, cdb[4]);
|
cdrom_request_sense(id, cdbufferb, cdb[4]);
|
||||||
cdrom_data_command_finish(id, 18, 18, cdb[4], 0);
|
cdrom_data_command_finish(id, 18, 18, cdb[4], 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -780,6 +780,7 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
|||||||
int number;
|
int number;
|
||||||
unsigned char attr;
|
unsigned char attr;
|
||||||
TMSF tmsf;
|
TMSF tmsf;
|
||||||
|
|
||||||
cdimg[id]->GetAudioTracks(first_track, last_track, tmsf);
|
cdimg[id]->GetAudioTracks(first_track, last_track, tmsf);
|
||||||
|
|
||||||
b[2] = first_track;
|
b[2] = first_track;
|
||||||
@@ -795,8 +796,12 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
|
||||||
b[2] = number;
|
if (starttrack != 0xAA)
|
||||||
|
{
|
||||||
|
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
||||||
|
b[2] = number;
|
||||||
|
}
|
||||||
|
|
||||||
for (c = d; c <= last_track; c++)
|
for (c = d; c <= last_track; c++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -781,6 +781,10 @@ aha_mbi(aha_t *dev)
|
|||||||
dev->MailboxInPosCur = 0;
|
dev->MailboxInPosCur = 0;
|
||||||
|
|
||||||
RaiseIntr(dev, 0, INTR_MBIF | INTR_ANY);
|
RaiseIntr(dev, 0, INTR_MBIF | INTR_ANY);
|
||||||
|
|
||||||
|
while (dev->Interrupt) {
|
||||||
|
thread_wait_event(dev->evt, 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1230,13 +1234,24 @@ aha_do_mail(aha_t *dev)
|
|||||||
|
|
||||||
CodeOffset = dev->Mbx24bit ? 0 : 7;
|
CodeOffset = dev->Mbx24bit ? 0 : 7;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (dev->Interrupt || dev->PendingInterrupt)
|
if (dev->Interrupt || dev->PendingInterrupt)
|
||||||
{
|
{
|
||||||
aha_log("%s: Interrupt set, waiting...\n", dev->name);
|
aha_log("%s: Interrupt set, waiting...\n", dev->name);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
Outgoing = aha_mbo(dev, &mb32);
|
uint8_t MailboxCur = dev->MailboxOutPosCur;
|
||||||
|
|
||||||
|
/* Search for a filled mailbox - stop if we have scanned all mailboxes. */
|
||||||
|
do {
|
||||||
|
/* Fetch mailbox from guest memory. */
|
||||||
|
Outgoing = aha_mbo(dev, &mb32);
|
||||||
|
|
||||||
|
/* Check the next mailbox. */
|
||||||
|
aha_mbo_adv(dev);
|
||||||
|
} while ((mb32.u.out.ActionCode == MBO_FREE) && (MailboxCur != dev->MailboxOutPosCur));
|
||||||
|
|
||||||
if (mb32.u.out.ActionCode != MBO_FREE) {
|
if (mb32.u.out.ActionCode != MBO_FREE) {
|
||||||
/* We got the mailbox, mark it as free in the guest. */
|
/* We got the mailbox, mark it as free in the guest. */
|
||||||
@@ -1247,9 +1262,14 @@ aha_do_mail(aha_t *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->MailboxOutInterrupts)
|
if (dev->MailboxOutInterrupts) {
|
||||||
RaiseIntr(dev, 0, INTR_MBOA | INTR_ANY);
|
RaiseIntr(dev, 0, INTR_MBOA | INTR_ANY);
|
||||||
|
|
||||||
|
while (dev->Interrupt) {
|
||||||
|
thread_wait_event(dev->evt, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mb32.u.out.ActionCode == MBO_START) {
|
if (mb32.u.out.ActionCode == MBO_START) {
|
||||||
aha_log("Start Mailbox Command\n");
|
aha_log("Start Mailbox Command\n");
|
||||||
aha_req_setup(dev, mb32.CCBPointer, &mb32);
|
aha_req_setup(dev, mb32.CCBPointer, &mb32);
|
||||||
@@ -1260,9 +1280,6 @@ aha_do_mail(aha_t *dev)
|
|||||||
aha_log("Invalid action code: %02X\n", mb32.u.out.ActionCode);
|
aha_log("Invalid action code: %02X\n", mb32.u.out.ActionCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Advance to the next mailbox. */
|
|
||||||
aha_mbo_adv(dev);
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1279,6 +1296,7 @@ aha_event_restart:
|
|||||||
aha_scan_restart:
|
aha_scan_restart:
|
||||||
while (aha_do_mail(dev) != 0)
|
while (aha_do_mail(dev) != 0)
|
||||||
{
|
{
|
||||||
|
thread_wait_event(dev->evt, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->scan_restart)
|
if (dev->scan_restart)
|
||||||
@@ -1331,9 +1349,11 @@ aha_read(uint16_t port, void *priv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
#ifndef WALTJE
|
#ifndef WALTJE
|
||||||
aha_log("%s: Read Port 0x%02X, Returned Value %02X\n",
|
aha_log("%s: Read Port 0x%02X, Returned Value %02X\n",
|
||||||
dev->name, port, ret);
|
dev->name, port, ret);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
|
|||||||
@@ -813,6 +813,10 @@ void scsi_hd_command(uint8_t id, uint8_t *cdb)
|
|||||||
case GPCMD_REQUEST_SENSE:
|
case GPCMD_REQUEST_SENSE:
|
||||||
/* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE
|
/* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE
|
||||||
should forget about the not ready, and report unit attention straight away. */
|
should forget about the not ready, and report unit attention straight away. */
|
||||||
|
if (SCSIDevices[hdc[id].scsi_id][hdc[id].scsi_lun].InitLength < cdb[4])
|
||||||
|
{
|
||||||
|
cdb[4] = SCSIDevices[hdc[id].scsi_id][hdc[id].scsi_lun].InitLength;
|
||||||
|
}
|
||||||
scsi_hd_request_sense(id, hdbufferb, cdb[4]);
|
scsi_hd_request_sense(id, hdbufferb, cdb[4]);
|
||||||
scsi_hd_data_command_finish(id, 18, 18, cdb[4], 0);
|
scsi_hd_data_command_finish(id, 18, 18, cdb[4], 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user