Commit 7d72e466 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] update ide-cd to new changes, add abort() handlers

parent 4015c949
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
* *
*************************************************************************/ *************************************************************************/
#define IDECD_VERSION "4.59" #define IDECD_VERSION "4.59-ac1"
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -635,6 +635,23 @@ ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat) ...@@ -635,6 +635,23 @@ ide_startstop_t ide_cdrom_error (ide_drive_t *drive, const char *msg, byte stat)
return ide_stopped; return ide_stopped;
} }
ide_startstop_t ide_cdrom_abort (ide_drive_t *drive, const char *msg)
{
struct request *rq;
if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
return ide_stopped;
/* retry only "normal" I/O: */
if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) {
rq->errors = 1;
ide_end_drive_cmd(drive, BUSY_STAT, 0);
return ide_stopped;
}
rq->errors |= ERROR_RESET;
DRIVER(drive)->end_request(drive, 0, 0);
return ide_stopped;
}
static void cdrom_end_request (ide_drive_t *drive, int uptodate) static void cdrom_end_request (ide_drive_t *drive, int uptodate)
{ {
struct request *rq = HWGROUP(drive)->rq; struct request *rq = HWGROUP(drive)->rq;
...@@ -899,9 +916,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive, ...@@ -899,9 +916,6 @@ static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
return startstop; return startstop;
} }
if (HWGROUP(drive)->handler != NULL) /* paranoia check */
BUG();
/* Arm the interrupt handler. */ /* Arm the interrupt handler. */
ide_set_handler(drive, handler, rq->timeout, cdrom_timer_expiry); ide_set_handler(drive, handler, rq->timeout, cdrom_timer_expiry);
...@@ -1133,9 +1147,6 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive) ...@@ -1133,9 +1147,6 @@ static ide_startstop_t cdrom_read_intr (ide_drive_t *drive)
} }
} }
if (HWGROUP(drive)->handler != NULL) /* paranoia check */
BUG();
/* Done moving data! Wait for another interrupt. */ /* Done moving data! Wait for another interrupt. */
ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL); ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD, NULL);
return ide_started; return ide_started;
...@@ -1470,9 +1481,6 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive) ...@@ -1470,9 +1481,6 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
rq->flags |= REQ_FAILED; rq->flags |= REQ_FAILED;
} }
if (HWGROUP(drive)->handler != NULL)
BUG();
/* Now we wait for another interrupt. */ /* Now we wait for another interrupt. */
ide_set_handler(drive, &cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry); ide_set_handler(drive, &cdrom_pc_intr, WAIT_CMD, cdrom_timer_expiry);
return ide_started; return ide_started;
...@@ -1863,9 +1871,6 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive) ...@@ -1863,9 +1871,6 @@ static ide_startstop_t cdrom_write_intr(ide_drive_t *drive)
cdrom_end_request(drive, 1); cdrom_end_request(drive, 1);
} }
if (HWGROUP(drive)->handler != NULL) /* paranoia check */
BUG();
/* re-arm handler */ /* re-arm handler */
ide_set_handler(drive, &cdrom_write_intr, 5 * WAIT_CMD, NULL); ide_set_handler(drive, &cdrom_write_intr, 5 * WAIT_CMD, NULL);
return ide_started; return ide_started;
...@@ -2837,11 +2842,9 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag ...@@ -2837,11 +2842,9 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, struct atapi_capabilities_pag
* ACER50 (and others?) require the full spec length mode sense * ACER50 (and others?) require the full spec length mode sense
* page capabilities size, but older drives break. * page capabilities size, but older drives break.
*/ */
if (drive->id) { if (!(!strcmp(drive->id->model, "ATAPI CD ROM DRIVE 50X MAX") ||
if (!(!strcmp(drive->id->model, "ATAPI CD ROM DRIVE 50X MAX") || !strcmp(drive->id->model, "WPI CDS-32X")))
!strcmp(drive->id->model, "WPI CDS-32X"))) size -= sizeof(cap->pad);
size -= sizeof(cap->pad);
}
/* we have to cheat a little here. the packet will eventually /* we have to cheat a little here. the packet will eventually
* be queued with ide_cdrom_packet(), which extracts the * be queued with ide_cdrom_packet(), which extracts the
...@@ -2924,7 +2927,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive) ...@@ -2924,7 +2927,7 @@ int ide_cdrom_probe_capabilities (ide_drive_t *drive)
} }
/* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */ /* The ACER/AOpen 24X cdrom has the speed fields byte-swapped */
if (drive->id && !drive->id->model[0] && if (!drive->id->model[0] &&
!strncmp(drive->id->fw_rev, "241N", 4)) { !strncmp(drive->id->fw_rev, "241N", 4)) {
CDROM_STATE_FLAGS(drive)->current_speed = CDROM_STATE_FLAGS(drive)->current_speed =
(((unsigned int)cap.curspeed) + (176/2)) / 176; (((unsigned int)cap.curspeed) + (176/2)) / 176;
...@@ -3089,12 +3092,7 @@ int ide_cdrom_setup (ide_drive_t *drive) ...@@ -3089,12 +3092,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)->no_doorlock = 0; CDROM_CONFIG_FLAGS(drive)->no_doorlock = 0;
#endif #endif
if (drive->id != NULL) CDROM_CONFIG_FLAGS(drive)->drq_interrupt = ((drive->id->config & 0x0060) == 0x20);
CDROM_CONFIG_FLAGS(drive)->drq_interrupt =
((drive->id->config & 0x0060) == 0x20);
else
CDROM_CONFIG_FLAGS(drive)->drq_interrupt = 0;
CDROM_CONFIG_FLAGS(drive)->is_changer = 0; CDROM_CONFIG_FLAGS(drive)->is_changer = 0;
CDROM_CONFIG_FLAGS(drive)->cd_r = 0; CDROM_CONFIG_FLAGS(drive)->cd_r = 0;
CDROM_CONFIG_FLAGS(drive)->cd_rw = 0; CDROM_CONFIG_FLAGS(drive)->cd_rw = 0;
...@@ -3109,16 +3107,14 @@ int ide_cdrom_setup (ide_drive_t *drive) ...@@ -3109,16 +3107,14 @@ int ide_cdrom_setup (ide_drive_t *drive)
/* limit transfer size per interrupt. */ /* limit transfer size per interrupt. */
CDROM_CONFIG_FLAGS(drive)->limit_nframes = 0; CDROM_CONFIG_FLAGS(drive)->limit_nframes = 0;
if (drive->id != NULL) { /* a testament to the nice quality of Samsung drives... */
/* a testament to the nice quality of Samsung drives... */ if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430"))
if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2430")) CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432"))
else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-2432")) CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1;
CDROM_CONFIG_FLAGS(drive)->limit_nframes = 1; /* the 3231 model does not support the SET_CD_SPEED command */
/* the 3231 model does not support the SET_CD_SPEED command */ else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231"))
else if (!strcmp(drive->id->model, "SAMSUNG CD-ROM SCR-3231")) cdi->mask |= CDC_SELECT_SPEED;
cdi->mask |= CDC_SELECT_SPEED;
}
#if ! STANDARD_ATAPI #if ! STANDARD_ATAPI
/* by default Sanyo 3 CD changer support is turned off and /* by default Sanyo 3 CD changer support is turned off and
...@@ -3131,55 +3127,47 @@ int ide_cdrom_setup (ide_drive_t *drive) ...@@ -3131,55 +3127,47 @@ int ide_cdrom_setup (ide_drive_t *drive)
CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 0; CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 0;
CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 0; CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 0;
if (drive->id != NULL) { if (strcmp (drive->id->model, "V003S0DS") == 0 &&
if (strcmp (drive->id->model, "V003S0DS") == 0 && drive->id->fw_rev[4] == '1' &&
drive->id->fw_rev[4] == '1' && drive->id->fw_rev[6] <= '2') {
drive->id->fw_rev[6] <= '2') { /* Vertos 300.
/* Vertos 300. Some versions of this drive like to talk BCD. */
Some versions of this drive like to talk BCD. */ CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; }
}
else if (strcmp (drive->id->model, "V006E0DS") == 0 &&
else if (strcmp (drive->id->model, "V006E0DS") == 0 && drive->id->fw_rev[4] == '1' &&
drive->id->fw_rev[4] == '1' && drive->id->fw_rev[6] <= '2') {
drive->id->fw_rev[6] <= '2') { /* Vertos 600 ESD. */
/* Vertos 600 ESD. */ CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->toctracks_as_bcd = 1; }
} else if (strcmp(drive->id->model, "NEC CD-ROM DRIVE:260") == 0 &&
strncmp(drive->id->fw_rev, "1.01", 4) == 0) { /* FIXME */
else if (strcmp(drive->id->model, /* Old NEC260 (not R).
"NEC CD-ROM DRIVE:260") == 0 && This drive was released before the 1.2 version
strncmp(drive->id->fw_rev, "1.01", 4) == 0) { /* FIXME */ of the spec. */
/* Old NEC260 (not R). CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1;
This drive was released before the 1.2 version CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1;
of the spec. */ CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1;
CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd = 1; CDROM_CONFIG_FLAGS(drive)->nec260 = 1;
CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; }
CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; else if (strcmp(drive->id->model, "WEARNES CDD-120") == 0 &&
CDROM_CONFIG_FLAGS(drive)->nec260 = 1; strncmp(drive->id->fw_rev, "A1.1", 4) == 0) { /* FIXME */
} /* Wearnes */
CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1;
else if (strcmp(drive->id->model, "WEARNES CDD-120") == 0 && CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1;
strncmp(drive->id->fw_rev, "A1.1", 4) == 0) { /* FIXME */ }
/* Wearnes */ /* Sanyo 3 CD changer uses a non-standard command
CDROM_CONFIG_FLAGS(drive)->playmsf_as_bcd = 1; for CD changing */
CDROM_CONFIG_FLAGS(drive)->subchan_as_bcd = 1; else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) ||
} (strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) ||
(strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) {
/* Sanyo 3 CD changer uses a non-standard command /* uses CD in slot 0 when value is set to 3 */
for CD changing */ cdi->sanyo_slot = 3;
else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) || }
(strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) ||
(strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) {
/* uses CD in slot 0 when value is set to 3 */
cdi->sanyo_slot = 3;
}
}
#endif /* not STANDARD_ATAPI */ #endif /* not STANDARD_ATAPI */
info->toc = NULL; info->toc = NULL;
...@@ -3246,6 +3234,7 @@ int ide_cdrom_cleanup(ide_drive_t *drive) ...@@ -3246,6 +3234,7 @@ int ide_cdrom_cleanup(ide_drive_t *drive)
printk("%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name); printk("%s: ide_cdrom_cleanup failed to unregister device from the cdrom driver.\n", drive->name);
kfree(info); kfree(info);
drive->driver_data = NULL; drive->driver_data = NULL;
blk_queue_prep_rq(&drive->queue, NULL);
del_gendisk(g); del_gendisk(g);
g->fops = ide_fops; g->fops = ide_fops;
return 0; return 0;
...@@ -3265,6 +3254,7 @@ static ide_driver_t ide_cdrom_driver = { ...@@ -3265,6 +3254,7 @@ static ide_driver_t ide_cdrom_driver = {
.do_request = ide_do_rw_cdrom, .do_request = ide_do_rw_cdrom,
.sense = ide_cdrom_dump_status, .sense = ide_cdrom_dump_status,
.error = ide_cdrom_error, .error = ide_cdrom_error,
.abort = ide_cdrom_abort,
.capacity = ide_cdrom_capacity, .capacity = ide_cdrom_capacity,
.attach = ide_cdrom_attach, .attach = ide_cdrom_attach,
.drives = LIST_HEAD_INIT(ide_cdrom_driver.drives), .drives = LIST_HEAD_INIT(ide_cdrom_driver.drives),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment