linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Dalecki <dalecki@evision-ventures.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.5.8 IDE 40
Date: Mon, 22 Apr 2002 17:36:45 +0200	[thread overview]
Message-ID: <3CC42E0D.7060703@evision-ventures.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0203181243210.10517-100000@penguin.transmeta.com>

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Thu Apr 18 00:08:00 CEST 2002 ide-clean-40

This applies on top of 2.5.8, all patches up to IDE 39 + the laters ide-update
for 2.5.8. from Jens Axboe.

- Make the ide-cd driver usable again in DMA mode by adapting it to the TCQ
   related request handling changes and fixing some other minor stuff related to
   this. This patch is ugly like hell I know. Cleanup will follow separately.
   It was hard enough to make this going agian at all.

[-- Attachment #2: ide-clean-40.diff --]
[-- Type: text/plain, Size: 4372 bytes --]

diff -urN linux-2.5.8/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.8/drivers/ide/ide-cd.c	Mon Apr 22 18:31:37 2002
+++ linux/drivers/ide/ide-cd.c	Mon Apr 22 18:23:43 2002
@@ -535,9 +535,9 @@
 
 	/* stuff the sense request in front of our current request */
 	rq = &info->request_sense_request;
+	ide_init_drive_cmd(rq);
 	rq->cmd[0] = GPCMD_REQUEST_SENSE;
 	rq->cmd[4] = pc->buflen;
-	ide_init_drive_cmd(rq);
 	rq->flags = REQ_SENSE;
 
 	/* FIXME --mdcki */
@@ -558,8 +558,10 @@
 	if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
 		uptodate = 1;
 
+#if 0
 	/* FIXME --mdcki */
 	HWGROUP(drive)->rq->special = NULL;
+#endif
 	ide_end_request(drive, uptodate);
 }
 
@@ -1215,13 +1217,22 @@
 /*
  * Start a read request from the CD-ROM.
  */
-static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
+static ide_startstop_t cdrom_start_read(struct ata_device *drive, struct ata_request *ar, unsigned int block)
 {
 	struct cdrom_info *info = drive->driver_data;
-	struct request *rq = HWGROUP(drive)->rq;
+	struct request *rq = ar->ar_rq;
+
+	if (ar->ar_flags & ATA_AR_QUEUED) {
+//		spin_lock_irqsave(DRIVE_LOCK(drive), flags);
+		blkdev_dequeue_request(rq);
+//		spin_unlock_irqrestore(DRIVE_LOCK(drive), flags);
+	}
+
 
 	restore_request(rq);
 
+	rq->special = ar;
+
 	/* Satisfy whatever we can of this request from our cached sector. */
 	if (cdrom_read_from_buffer(drive))
 		return ide_stopped;
@@ -1404,10 +1415,10 @@
 	struct request rq;
 	int retries = 10;
 
-	memcpy(rq.cmd, cmd, CDROM_PACKET_SIZE);
 	/* Start of retry loop. */
 	do {
 		ide_init_drive_cmd(&rq);
+		memcpy(rq.cmd, cmd, CDROM_PACKET_SIZE);
 
 		rq.flags = REQ_PC;
 
@@ -1630,12 +1641,14 @@
  * cdrom driver request routine.
  */
 static ide_startstop_t
-ide_do_rw_cdrom(ide_drive_t *drive, struct request *rq, unsigned long block)
+ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t block)
 {
 	ide_startstop_t action;
 	struct cdrom_info *info = drive->driver_data;
 
 	if (rq->flags & REQ_CMD) {
+	
+
 		if (CDROM_CONFIG_FLAGS(drive)->seeking) {
 			unsigned long elpased = jiffies - info->start_seek;
 			int stat = GET_STAT();
@@ -1652,8 +1665,30 @@
 		if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
 			action = cdrom_start_seek (drive, block);
 		else {
+			unsigned long flags;
+			struct ata_request *ar;
+
+			/*
+			 * get a new command (push ar further down to avoid grabbing lock here
+			 */
+			spin_lock_irqsave(DRIVE_LOCK(drive), flags);
+
+			ar = ata_ar_get(drive);
+
+			/*
+			 * we've reached maximum queue depth, bail
+			 */
+			if (!ar) {
+				spin_unlock_irqrestore(DRIVE_LOCK(drive), flags);
+
+				return ide_started;
+			}
+
+			ar->ar_rq = rq;
+			spin_unlock_irqrestore(DRIVE_LOCK(drive), flags);
+
 			if (rq_data_dir(rq) == READ)
-				action = cdrom_start_read(drive, block);
+				action = cdrom_start_read(drive, ar, block);
 			else
 				action = cdrom_start_write(drive, rq);
 		}
@@ -2297,7 +2332,7 @@
 	struct request req;
 	int ret;
 
-	ide_init_drive_cmd (&req);
+	ide_init_drive_cmd(&req);
 	req.flags = REQ_SPECIAL;
 	ret = ide_do_drive_cmd(drive, &req, ide_wait);
 
@@ -2927,7 +2962,7 @@
 	owner:			THIS_MODULE,
 	cleanup:		ide_cdrom_cleanup,
 	standby:		NULL,
-	do_request:		ide_do_rw_cdrom,
+	do_request:		ide_cdrom_do_request,
 	end_request:		NULL,
 	ioctl:			ide_cdrom_ioctl,
 	open:			ide_cdrom_open,
diff -urN linux-2.5.8/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
--- linux-2.5.8/drivers/ide/ide-dma.c	Mon Apr 22 18:31:40 2002
+++ linux/drivers/ide/ide-dma.c	Mon Apr 22 13:19:24 2002
@@ -549,8 +549,11 @@
 	/* This can happen with drivers abusing the special request field.
 	 */
 
-	if (!ar)
+	if (!ar) {
+		printk(KERN_ERR "DMA without ATA request\n");
+
 		return 1;
+	}
 
 	if (rq_data_dir(ar->ar_rq) == READ)
 		reading = 1 << 3;
diff -urN linux-2.5.8/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
--- linux-2.5.8/drivers/ide/ide-probe.c	Mon Apr 22 18:31:32 2002
+++ linux/drivers/ide/ide-probe.c	Mon Apr 22 18:08:45 2002
@@ -168,6 +168,9 @@
 		}
 		printk (" drive\n");
 		drive->type = type;
+
+		goto init_queue;
+
 		return;
 	}
 
@@ -198,6 +201,7 @@
 	if (drive->channel->quirkproc)
 		drive->quirk_list = drive->channel->quirkproc(drive);
 
+init_queue:
 	/*
 	 * it's an ata drive, build command list
 	 */

  parent reply	other threads:[~2002-04-22 16:39 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-18 20:47 Linux 2.5.7 Linus Torvalds
2002-03-18 21:57 ` Xavier Bestel
2002-03-28  9:21 ` [PATCH] 2.5.7 IDE 23 Martin Dalecki
2002-03-28  9:23 ` PATCH 2.5.7 IDE 24 Martin Dalecki
2002-03-28  9:29   ` Zwane Mwaikambo
2002-03-28  9:25 ` [PATCH] 2.5.7 IDE 25 Martin Dalecki
2002-03-28  9:29 ` [PATCH] 2.5.7 IDE 26 Martin Dalecki
2002-03-28 20:34   ` Vojtech Pavlik
2002-03-28 20:58     ` Anton Altaparmakov
2002-03-29 13:53       ` Martin Dalecki
2002-03-28  9:31 ` [PATCH] 2.5.7 IDE 27 Martin Dalecki
2002-03-28 18:01   ` Davide Libenzi
2002-03-29 13:49     ` Martin Dalecki
2002-03-29 20:39       ` Davide Libenzi
2002-03-28  9:32 ` [PATCH] 2.5.7 IDE 28a Martin Dalecki
2002-04-15  7:42 ` [PATCH] 2.5.8 IDE 34 Martin Dalecki
2002-04-15  8:51   ` Jens Axboe
2002-04-15  8:11     ` Martin Dalecki
2002-04-22 15:36 ` Martin Dalecki [this message]
2002-04-25 14:32 ` [PATCH] 2.5.10 IDE 41 Martin Dalecki
2002-04-25 17:39   ` Jens Axboe
2002-04-25 17:18     ` Martin Dalecki
2002-04-29  8:21       ` Jens Axboe
2002-04-30  8:09 ` [PATCH] 2.5.11 IDE 46 Martin Dalecki
2002-04-30  8:11 ` Linux 2.5.7 Martin Dalecki
2002-04-30  8:45 ` [PATCH] 2.5.11 IDE 47 Martin Dalecki
2002-04-30 15:16 ` [PATCH] 2.5.11 IDE 48 Martin Dalecki
2002-05-02  8:39 ` [PATCH] 2.5.12 IDE 49 Martin Dalecki
2002-05-02  8:42 ` Linux 2.5.7 Martin Dalecki
2002-05-02 13:22   ` Dave Jones
2002-05-02 12:44     ` Martin Dalecki
2002-05-02 13:54       ` David Woodhouse
2002-05-02 13:02         ` Martin Dalecki
2002-05-02 14:06           ` David Woodhouse
2002-05-03 12:59 ` [PATCH] 2.5.13 IDE 50 Martin Dalecki
2002-05-03 18:12   ` Tim Schmielau
2002-05-04 23:53     ` Martin Dalecki
2002-05-05 17:08       ` Denis Vlasenko
2002-05-03 14:48 ` [PATCH] 2.5.13 IDE 51 Martin Dalecki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CC42E0D.7060703@evision-ventures.com \
    --to=dalecki@evision-ventures.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).