9 #include <linux/kernel.h>
10 #include <linux/cdrom.h>
13 #include <scsi/scsi.h>
56 if (med.media_present)
58 else if (med.door_open)
65 && sense.
ascq == 0x04)
74 if (sense.
asc == 0x3a && sense.
ascq == 1)
89 unsigned int clearing,
int slot_nr)
98 return retval ? DISK_EVENT_MEDIA_CHANGE : 0;
113 unsigned char cmd[BLK_MAX_CDB];
126 memset(cmd, 0, BLK_MAX_CDB);
129 cmd[4] = loej | (ejectflag != 0);
136 int ide_cd_lockdoor(
ide_drive_t *drive,
int lockflag,
149 unsigned char cmd[BLK_MAX_CDB];
151 memset(cmd, 0, BLK_MAX_CDB);
154 cmd[4] = lockflag ? 1 : 0;
164 (sense->
asc == 0x24 || sense->
asc == 0x20)) {
172 if (stat != 0 && sense->sense_key ==
NOT_READY && sense->
asc == 0x3a)
191 int stat = ide_cd_lockdoor(drive, 0, &sense);
197 return cdrom_eject(drive, !position, &sense);
204 return ide_cd_lockdoor(drive, lock,
NULL);
218 unsigned char cmd[BLK_MAX_CDB];
225 memset(cmd, 0, BLK_MAX_CDB);
229 cmd[2] = (speed >> 8) & 0xff;
230 cmd[3] = speed & 0xff;
234 cmd[4] = (speed >> 8) & 0xff;
235 cmd[5] = speed & 0xff;
276 unsigned char cmd[BLK_MAX_CDB];
277 unsigned len =
sizeof(
buf);
279 memset(cmd, 0, BLK_MAX_CDB);
307 rq->cmd_type = REQ_TYPE_SPECIAL;
316 (
void)ide_cd_lockdoor(drive, 1, &sense);
335 ntracks = toc->
hdr.last_track - toc->
hdr.first_track + 1;
341 *ent = &toc->
ent[ntracks];
345 *ent = &toc->
ent[track - toc->
hdr.first_track];
354 unsigned long lba_start, lba_end;
357 unsigned char cmd[BLK_MAX_CDB];
359 stat = ide_cd_get_toc_entry(drive, ti->
cdti_trk0, &first_toc);
363 stat = ide_cd_get_toc_entry(drive, ti->
cdti_trk1, &last_toc);
369 lba_start = first_toc->
addr.
lba;
372 if (lba_end <= lba_start)
375 memset(cmd, 0, BLK_MAX_CDB);
378 lba_to_msf(lba_start, &cmd[3], &cmd[4], &cmd[5]);
379 lba_to_msf(lba_end - 1, &cmd[6], &cmd[7], &cmd[8]);
384 static int ide_cd_read_tochdr(
ide_drive_t *drive,
void *arg)
403 static int ide_cd_read_tocentry(
ide_drive_t *drive,
void *arg)
409 stat = ide_cd_get_toc_entry(drive, tocentry->
cdte_track, &toce);
427 unsigned int cmd,
void *arg)
437 return ide_cd_fake_play_trkind(drive, arg);
439 return ide_cd_read_tochdr(drive, arg);
441 return ide_cd_read_tocentry(drive, arg);
452 unsigned int flags = 0;