Changed the IOCtl implementation of READ TRACK INFORMATION so that it returns if it succeded or failed, so the ATAPI and SCSI controllers can then act accordingly.
This commit is contained in:
@@ -537,11 +537,13 @@ static void ioctl_read_header(uint8_t *in_cdb, uint8_t *b)
|
|||||||
ioctl_close();
|
ioctl_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ioctl_read_track_information(uint8_t *in_cdb, uint8_t *b)
|
static int ioctl_read_track_information(uint8_t *in_cdb, uint8_t *b)
|
||||||
{
|
{
|
||||||
int maxlen = 0;
|
int maxlen = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
const UCHAR cdb[12];
|
const UCHAR cdb[12];
|
||||||
UCHAR buf[65535];
|
UCHAR buf[65535];
|
||||||
|
|
||||||
@@ -552,7 +554,12 @@ static void ioctl_read_track_information(uint8_t *in_cdb, uint8_t *b)
|
|||||||
ioctl_open(0);
|
ioctl_open(0);
|
||||||
|
|
||||||
memcpy(cdb, in_cdb, 12);
|
memcpy(cdb, in_cdb, 12);
|
||||||
SCSICommand(cdb, buf, 65535);
|
ret = SCSICommand(cdb, buf, 65535);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
len = buf[0];
|
len = buf[0];
|
||||||
len <<= 8;
|
len <<= 8;
|
||||||
@@ -569,6 +576,8 @@ static void ioctl_read_track_information(uint8_t *in_cdb, uint8_t *b)
|
|||||||
memcpy(b, buf, len);
|
memcpy(b, buf, len);
|
||||||
|
|
||||||
ioctl_close();
|
ioctl_close();
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ioctl_read_disc_information(uint8_t *b)
|
static void ioctl_read_disc_information(uint8_t *b)
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ static void null_readsector_raw(uint8_t *b, int sector, int ismsf)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int null_read_track_information(uint8_t *in_cdb, uint8_t *b)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int null_readtoc(unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single)
|
static int null_readtoc(unsigned char *b, unsigned char starttrack, int msf, int maxlen, int single)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ typedef struct CDROM
|
|||||||
void (*read_capacity)(uint8_t *b);
|
void (*read_capacity)(uint8_t *b);
|
||||||
void (*read_header)(uint8_t *in_cdb, uint8_t *b);
|
void (*read_header)(uint8_t *in_cdb, uint8_t *b);
|
||||||
void (*read_disc_information)(uint8_t *b);
|
void (*read_disc_information)(uint8_t *b);
|
||||||
void (*read_track_information)(uint8_t *in_cdb, uint8_t *b);
|
int (*read_track_information)(uint8_t *in_cdb, uint8_t *b);
|
||||||
int (*sector_data_type)(int sector, int ismsf);
|
int (*sector_data_type)(int sector, int ismsf);
|
||||||
void (*readsector_raw)(uint8_t *b, int sector, int ismsf);
|
void (*readsector_raw)(uint8_t *b, int sector, int ismsf);
|
||||||
void (*playaudio)(uint32_t pos, uint32_t len, int ismsf);
|
void (*playaudio)(uint32_t pos, uint32_t len, int ismsf);
|
||||||
|
|||||||
14
src/ide.c
14
src/ide.c
@@ -2563,7 +2563,17 @@ static void atapicommand(int ide_board)
|
|||||||
|
|
||||||
if (cdrom->read_track_information)
|
if (cdrom->read_track_information)
|
||||||
{
|
{
|
||||||
cdrom->read_track_information(idebufferb, idebufferb);
|
ret = cdrom->read_track_information(idebufferb, idebufferb);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/
|
||||||
|
ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR;
|
||||||
|
SCSISense.Asc = ASC_INV_FIELD_IN_CMD_PACKET;
|
||||||
|
ide->packetstatus = ATAPI_STATUS_ERROR;
|
||||||
|
idecallback[ide_board]=50*IDE_TIME;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
len = idebufferb[0];
|
len = idebufferb[0];
|
||||||
len <<= 8;
|
len <<= 8;
|
||||||
@@ -2576,8 +2586,6 @@ static void atapicommand(int ide_board)
|
|||||||
{
|
{
|
||||||
ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/
|
ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/
|
||||||
ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR;
|
ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR;
|
||||||
/* if (SCSISense.SenseKey == SENSE_UNIT_ATTENTION)
|
|
||||||
ide->error |= MCR_ERR; */
|
|
||||||
SCSISense.Asc = ASC_INV_FIELD_IN_CMD_PACKET;
|
SCSISense.Asc = ASC_INV_FIELD_IN_CMD_PACKET;
|
||||||
ide->packetstatus = ATAPI_STATUS_ERROR;
|
ide->packetstatus = ATAPI_STATUS_ERROR;
|
||||||
idecallback[ide_board]=50*IDE_TIME;
|
idecallback[ide_board]=50*IDE_TIME;
|
||||||
|
|||||||
@@ -1159,6 +1159,7 @@ void SCSICDROM_ReadData(uint8_t id, uint8_t *cdb, uint8_t *data, int datalen)
|
|||||||
int read_length = 0;
|
int read_length = 0;
|
||||||
int max_length = 0;
|
int max_length = 0;
|
||||||
int track = 0;
|
int track = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
msf = cdb[1] & 2;
|
msf = cdb[1] & 2;
|
||||||
|
|
||||||
@@ -1567,7 +1568,19 @@ SCSIOut:
|
|||||||
|
|
||||||
if (cdrom->read_track_information)
|
if (cdrom->read_track_information)
|
||||||
{
|
{
|
||||||
cdrom->read_track_information(SCSIDevices[id].Cdb, SCSIDevices[id].CmdBuffer);
|
ret = cdrom->read_track_information(SCSIDevices[id].Cdb, SCSIDevices[id].CmdBuffer);
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
{
|
||||||
|
SCSIStatus = SCSI_STATUS_CHECK_CONDITION;
|
||||||
|
SCSISenseCodeError(SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET, 0x00);
|
||||||
|
if (SCSISense.UnitAttention)
|
||||||
|
{
|
||||||
|
SCSISenseCodeError(SENSE_UNIT_ATTENTION, ASC_MEDIUM_MAY_HAVE_CHANGED, 0);
|
||||||
|
}
|
||||||
|
SCSICallback[id]=50*SCSI_TIME;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
datalen = SCSIDevices[id].CmdBuffer[0];
|
datalen = SCSIDevices[id].CmdBuffer[0];
|
||||||
datalen <<= 8;
|
datalen <<= 8;
|
||||||
|
|||||||
Reference in New Issue
Block a user