Re: 2.2.13ac3 and ide19991111 patch

Andre Hedrick (andre@suse.com)
Wed, 17 Nov 1999 13:25:10 -0800 (PST)


Thankyou!!!!!!!!!!

I have had my head in other projects and then there is COMDEX.....

Andre Hedrick
The Linux IDE guy

On Wed, 17 Nov 1999, Ted Cabeen wrote:

> Unfortuately, 2.2.13-ac3 and ide-19991111 don't work well together, so here
> are two patches which make them work together. The first one is to be
> applied to ide-cd.c after the ide patch fails on ide-cd.c The second patch
> (bzipped) is the complete patch for ide-cd.c after the ac3 patch but before
> ide-19991111. Enjoy!
>
> --- linux-13ac3/drivers/block/ide-cd.c Wed Nov 17 14:50:10 1999
> +++ kernel-source-2.2.13/drivers/block/ide-cd.c Wed Nov 17 14:25:08 1999
> @@ -282,6 +282,7 @@
> #include <linux/interrupt.h>
> #include <linux/errno.h>
> #include <linux/cdrom.h>
> +#include <linux/ide.h>
>
> #include <asm/irq.h>
> #include <asm/io.h>
> @@ -289,7 +290,6 @@
> #include <asm/uaccess.h>
> #include <asm/unaligned.h>
>
> -#include "ide.h"
> #include "ide-cd.h"
>
> /****************************************************************************
> @@ -664,13 +664,15 @@
> called when the interrupt from the drive arrives. Otherwise, HANDLER
> will be called immediately after the drive is prepared for the transfer. */
>
> -static int cdrom_start_packet_command (ide_drive_t *drive, int xferlen,
> +static ide_startstop_t cdrom_start_packet_command (ide_drive_t *drive, int xferlen,
> ide_handler_t *handler)
> {
> + ide_startstop_t startstop;
> struct cdrom_info *info = drive->driver_data;
>
> /* Wait for the controller to be idle. */
> - if (ide_wait_stat(drive, 0, BUSY_STAT, WAIT_READY)) return 1;
> + if (ide_wait_stat (&startstop, drive, 0, BUSY_STAT, WAIT_READY))
> + return startstop;
>
> if (info->dma)
> info->dma = !HWIF(drive)->dmaproc(ide_dma_read, drive);
> @@ -684,7 +686,7 @@
> OUT_BYTE (xferlen >> 8 , IDE_HCYL_REG);
> if (IDE_CONTROL_REG)
> OUT_BYTE (drive->ctl, IDE_CONTROL_REG);
> -
> +
> if (info->dma)
> (void) (HWIF(drive)->dmaproc(ide_dma_begin, drive));
>
> @@ -704,7 +706,7 @@
> by cdrom_start_packet_command.
> HANDLER is the interrupt handler to call when the command completes
> or there's data ready. */
> -static int cdrom_transfer_packet_command (ide_drive_t *drive,
> +static ide_startstop_t cdrom_transfer_packet_command (ide_drive_t *drive,
> unsigned char *cmd_buf, int cmd_len,
> ide_handler_t *handler)
> {
> @@ -843,14 +845,13 @@
>
> if (dma) {
> if (dma_error) {
> - ide_error (drive, "dma error", stat);
> - return;
> + return ide_error (drive, "dma error", stat);
> }
> for (i = rq->nr_sectors; i > 0;) {
> i -= rq->current_nr_sectors;
> ide_end_request(1, HWGROUP(drive));
> }
> - return;
> + return ide_stopped;
> }
>
> /* Read the interrupt reason and the transfer length. */
> @@ -947,6 +948,7 @@
> /* Done moving data!
> Wait for another interrupt. */
> ide_set_handler(drive, &cdrom_read_intr, WAIT_CMD);
> + return ide_started;
> }
>
> /*
> @@ -1063,7 +1065,7 @@
> put_unaligned(htonl (frame), (unsigned int *) &pc.c[2]);
>
> /* Send the command to the drive and return. */
> - (void) cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c),
> + return cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c),
> &cdrom_read_intr);
> }
>
> @@ -1072,14 +1074,15 @@
> #define IDECD_SEEK_TIMER (5 * WAIT_MIN_SLEEP) /* 100 ms */
> #define IDECD_SEEK_TIMEOUT WAIT_CMD /* 10 sec */
>
> -static void cdrom_seek_intr (ide_drive_t *drive)
> +static ide_startstop_t cdrom_seek_intr (ide_drive_t *drive)
> {
> struct cdrom_info *info = drive->driver_data;
> int stat;
> static int retry = 10;
> + ide_startstop_t startstop;
>
> - if (cdrom_decode_status (drive, 0, &stat))
> - return;
> + if (cdrom_decode_status (&startstop, drive, 0, &stat))
> + return startstop;
> CDROM_CONFIG_FLAGS(drive)->seeking = 1;
>
> if (retry && jiffies - info->start_seek > IDECD_SEEK_TIMER) {
> @@ -1106,16 +1109,16 @@
> memset (&pc.c, 0, sizeof (pc.c));
> pc.c[0] = GPCMD_SEEK;
> put_unaligned(cpu_to_be32(frame), (unsigned int *) &pc.c[2]);
> - (void) cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c), &cdrom_seek_intr);
> + return cdrom_transfer_packet_command (drive, pc.c, sizeof (pc.c), &cdrom_seek_intr);
> }
>
> -static void cdrom_start_seek (ide_drive_t *drive, unsigned int block)
> +static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
> {
> struct cdrom_info *info = drive->driver_data;
>
> info->dma = 0;
> info->start_seek = jiffies;
> - cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
> + return cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
> }
>
> /* Fix up a possibly partially-processed request so that we can
> @@ -1134,7 +1137,7 @@
> /*
> * Start a read request from the CD-ROM.
> */
> -static void cdrom_start_read (ide_drive_t *drive, unsigned int block)
> +static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
> {
> struct cdrom_info *info = drive->driver_data;
> struct request *rq = HWGROUP(drive)->rq;
> @@ -1154,7 +1157,7 @@
>
> /* Satisfy whatever we can of this request from our cached sector. */
> if (cdrom_read_from_buffer(drive))
> - return;
> + return ide_stopped;
>
> info->nsectors_buffered = 0;
>
> @@ -1166,7 +1169,7 @@
> info->dma = 0;
>
> /* Start sending the read request to the drive. */
> - cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);
> + return cdrom_start_packet_command(drive, 32768, cdrom_start_read_continuation);
> }
>
> /****************************************************************************
> @@ -1272,21 +1275,22 @@
>
> /* Now we wait for another interrupt. */
> ide_set_handler(drive, &cdrom_pc_intr, WAIT_CMD);
> + return ide_started;
> }
>
>
> -static void cdrom_do_pc_continuation (ide_drive_t *drive)
> +static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
> {
> struct request *rq = HWGROUP(drive)->rq;
> struct packet_command *pc = (struct packet_command *)rq->buffer;
>
> /* Send the command to the drive and return. */
> - cdrom_transfer_packet_command (drive, pc->c,
> + return cdrom_transfer_packet_command (drive, pc->c,
> sizeof (pc->c), &cdrom_pc_intr);
> }
>
>
> -static void cdrom_do_packet_command (ide_drive_t *drive)
> +static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
> {
> int len;
> struct request *rq = HWGROUP(drive)->rq;
> @@ -1383,9 +1387,10 @@
> /****************************************************************************
> * cdrom driver request routine.
> */
> -static
> +static ide_startstop_t
> void ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, unsigned long block)
> {
> + ide_startstop_t action;
> struct cdrom_info *info = drive->driver_data;
>
> switch (rq->cmd) {
> @@ -1397,36 +1402,34 @@
> if ((stat & SEEK_STAT) != SEEK_STAT) {
> if (elpased < IDECD_SEEK_TIMEOUT) {
> ide_stall_queue(drive, IDECD_SEEK_TIMER);
> - return;
> + return ide_stopped;
> }
> printk ("%s: DSC timeout\n", drive->name);
> }
> CDROM_CONFIG_FLAGS(drive)->seeking = 0;
> }
> if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
> - cdrom_start_seek (drive, block);
> + action = cdrom_start_seek (drive, block);
> else
> - cdrom_start_read (drive, block);
> + action = cdrom_start_read (drive, block);
> info->last_block = block;
> - break;
> + return action;
> }
>
> case PACKET_COMMAND:
> case REQUEST_SENSE_COMMAND: {
> - cdrom_do_packet_command(drive);
> - break;
> + return cdrom_do_packet_command(drive);
> }
>
> case RESET_DRIVE_COMMAND: {
> cdrom_end_request(1, drive);
> - ide_do_reset(drive);
> - break;
> + return ide_do_reset(drive);
> }
>
> default: {
> printk("ide-cd: bad cmd %d\n", rq -> cmd);
> cdrom_end_request(0, drive);
> - break;
> + return ide_stopped;
> }
> }
> }
> @@ -2545,19 +2548,24 @@
> else
> printk (" drive");
>
> - printk (", %dkB Cache", be16_to_cpu(buf.cap.buffer_size));
> -
> - if (drive->using_dma) {
> - if ((drive->id->field_valid & 4) &&
> - (drive->id->dma_ultra & (drive->id->dma_ultra >> 8) & 7)) {
> - printk(", UDMA"); /* UDMA BIOS-enabled! */
> - } else if (drive->id->field_valid & 4) {
> - printk(", (U)DMA"); /* Can be BIOS-enabled! */
> - } else {
> - printk(", DMA");
> - }
> - }
> - printk("\n");
> + printk (", %dkB Cache", ntohs(buf.cap.buffer_size));
> +
> + if (drive->using_dma) {
> + if ((drive->id->field_valid & 4) &&
> + (drive->id->word93 & 0x2000) &&
> + (HWIF(drive)->udma_four) &&
> + (drive->id->dma_ultra & (drive->id->dma_ultra >> 11) & 3)) {
> + printk(", UDMA(66)"); /* UDMA BIOS-enabled! */
> + } else if ((drive->id->field_valid & 4) &&
> + (drive->id->dma_ultra & (drive->id->dma_ultra >> 8) & 7)) {
> + printk(", UDMA(33)"); /* UDMA BIOS-enabled! */
> + } else if (drive->id->field_valid & 4) {
> + printk(", (U)DMA"); /* Can be BIOS-enabled! */
> + } else {
> + printk(", DMA");
> + }
> + }
> + printk("\n");
>
> return nslots;
> }
>
> --
> Ted Cabeen http://www.pobox.com/~secabeen secabeen@pobox.com
> Check Website or finger for PGP Public Key secabeen@midway.uchicago.edu
> "I have taken all knowledge to be my province." -F. Bacon cococabeen@aol.com
> "Human kind cannot bear very much reality."-T.S.Eliot 73126.626@compuserve.com
>
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/