From: Martin Dalecki <dalecki@evision-ventures.com>
To: unlisted-recipients:; (no To-header on input)@localhost.localdomain
Cc: Linus Torvalds <torvalds@transmeta.com>,
Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.5.8-pre3 IDE 33
Date: Sun, 14 Apr 2002 15:55:40 +0200 [thread overview]
Message-ID: <3CB98A5C.6060407@evision-ventures.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0204051657270.16281-100000@penguin.transmeta.com> <3CB592DA.7000202@evision-ventures.com>
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
Thu Apr 11 16:42:43 CEST 2002 ide-clean-33
- Kill unneded parameters to ide_cmd_ioctl() and ide_task_ioctl().
- Apply Petr Vendrovecs fix for 32bit ver 16bit transfers.
- Make CD-ROM usable again by guarding the generic routines against request
field abuse found there. We will try to convert this driver to the just to be
finished struct ata_request after the generic changes stabilize a bit.
The strcut ata_taskfile and struct ata_request merge to be more preciese.
Therefore it's time for the next patch round.
[-- Attachment #2: ide-clean-33.diff --]
[-- Type: text/plain, Size: 8169 bytes --]
diff -urN linux-2.5.8-pre3/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.8-pre3/drivers/ide/ide-cd.c Wed Apr 10 14:38:29 2002
+++ linux/drivers/ide/ide-cd.c Sun Apr 14 16:13:51 2002
@@ -512,7 +512,7 @@
#endif /* not VERBOSE_IDE_CD_ERRORS */
}
-static void cdrom_queue_request_sense(ide_drive_t *drive,
+static void cdrom_queue_request_sense(ide_drive_t *drive,
struct completion *wait,
struct request_sense *sense,
struct packet_command *failed_command)
@@ -536,7 +536,7 @@
rq->flags = REQ_SENSE;
rq->special = (char *) pc;
rq->waiting = wait;
- (void) ide_do_drive_cmd(drive, rq, ide_preempt);
+ ide_do_drive_cmd(drive, rq, ide_preempt);
}
@@ -554,6 +554,7 @@
if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
uptodate = 1;
+ HWGROUP(drive)->rq->special = NULL;
ide_end_request(drive, uptodate);
}
diff -urN linux-2.5.8-pre3/drivers/ide/ide-dma.c linux/drivers/ide/ide-dma.c
--- linux-2.5.8-pre3/drivers/ide/ide-dma.c Fri Apr 12 00:43:19 2002
+++ linux/drivers/ide/ide-dma.c Sun Apr 14 16:19:16 2002
@@ -546,6 +546,12 @@
unsigned long dma_base = hwif->dma_base;
struct ata_request *ar = IDE_CUR_AR(drive);
+ /* This can happen with drivers abusing the special request field.
+ */
+
+ if (!ar)
+ return 1;
+
if (rq_data_dir(ar->ar_rq) == READ)
reading = 1 << 3;
diff -urN linux-2.5.8-pre3/drivers/ide/ide-probe.c linux/drivers/ide/ide-probe.c
--- linux-2.5.8-pre3/drivers/ide/ide-probe.c Fri Apr 12 00:43:19 2002
+++ linux/drivers/ide/ide-probe.c Fri Apr 12 01:16:27 2002
@@ -195,6 +195,9 @@
#ifndef CONFIG_BLK_DEV_IDE_TCQ
drive->queue_depth = 1;
#else
+# ifndef CONFIG_BLK_DEV_IDE_TCQ_DEPTH
+# define CONFIG_BLK_DEV_IDE_TCQ_DEPTH 1
+# endif
drive->queue_depth = drive->id->queue_depth + 1;
if (drive->queue_depth > CONFIG_BLK_DEV_IDE_TCQ_DEPTH)
drive->queue_depth = CONFIG_BLK_DEV_IDE_TCQ_DEPTH;
diff -urN linux-2.5.8-pre3/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.8-pre3/drivers/ide/ide-taskfile.c Fri Apr 12 00:43:23 2002
+++ linux/drivers/ide/ide-taskfile.c Fri Apr 12 14:33:01 2002
@@ -311,6 +311,7 @@
static ide_startstop_t task_mulout_intr (ide_drive_t *drive)
{
byte stat = GET_STAT();
+ /* FIXME: this should go possible as well */
byte io_32bit = drive->io_32bit;
struct request *rq = &HWGROUP(drive)->wrq;
ide_hwgroup_t *hwgroup = HWGROUP(drive);
@@ -612,6 +613,7 @@
static ide_startstop_t task_out_intr(ide_drive_t *drive)
{
byte stat = GET_STAT();
+ /* FIXME: this should go possible as well */
byte io_32bit = drive->io_32bit;
struct request *rq = HWGROUP(drive)->rq;
char *pBuf = NULL;
@@ -628,7 +630,7 @@
rq = HWGROUP(drive)->rq;
pBuf = ide_map_rq(rq, &flags);
DTF("write: %p, rq->current_nr_sectors: %d\n", pBuf, (int) rq->current_nr_sectors);
- drive->io_32bit = 0;
+
taskfile_output_data(drive, pBuf, SECTOR_WORDS);
ide_unmap_rq(rq, pBuf, &flags);
drive->io_32bit = io_32bit;
@@ -647,6 +649,7 @@
{
unsigned int msect, nsect;
byte stat = GET_STAT();
+ /* FIXME: this should go possible as well */
byte io_32bit = drive->io_32bit;
struct request *rq = HWGROUP(drive)->rq;
char *pBuf = NULL;
@@ -913,68 +916,76 @@
}
/*
- * Issue ATA command and wait for completion. Use for implementing commands in
- * kernel.
+ * Implement generic ioctls invoked from userspace to imlpement specific
+ * functionality.
+ *
+ * FIXME:
+ *
+ * 1. Rewrite hdparm to use the ide_task_ioctl function.
*
- * The caller has to make sure buf is never NULL!
+ * 2. Publish it.
+ *
+ * 3. Kill this and HDIO_DRIVE_CMD alltogether.
*/
-static int ide_wait_cmd(ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *argbuf)
-{
- struct request rq;
-
- /* FIXME: Do we really have to zero out the buffer?
- */
- memset(argbuf, 0, 4 + SECTOR_WORDS * 4 * sectors);
- ide_init_drive_cmd(&rq);
- rq.buffer = argbuf;
- argbuf[0] = cmd;
- argbuf[1] = nsect;
- argbuf[2] = feature;
- argbuf[3] = sectors;
-
- return ide_do_drive_cmd(drive, &rq, ide_wait);
-}
-int ide_cmd_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
{
int err = 0;
- u8 args[4];
- u8 *argbuf = args;
+ u8 vals[4];
+ u8 *argbuf = vals;
byte xfer_rate = 0;
int argsize = 4;
- /* FIXME: this should not reside on the stack */
- struct ata_taskfile tfargs;
+ struct ata_taskfile args;
+ struct request rq;
+ /*
+ * First phase.
+ */
if (NULL == (void *) arg) {
struct request rq;
ide_init_drive_cmd(&rq);
return ide_do_drive_cmd(drive, &rq, ide_wait);
}
- if (copy_from_user(args, (void *)arg, 4))
+
+ /*
+ * Second phase.
+ */
+ if (copy_from_user(vals, (void *)arg, 4))
return -EFAULT;
- tfargs.taskfile.feature = args[2];
- tfargs.taskfile.sector_count = args[3];
- tfargs.taskfile.sector_number = args[1];
- tfargs.taskfile.low_cylinder = 0x00;
- tfargs.taskfile.high_cylinder = 0x00;
- tfargs.taskfile.device_head = 0x00;
- tfargs.taskfile.command = args[0];
+ args.taskfile.feature = vals[2];
+ args.taskfile.sector_count = vals[3];
+ args.taskfile.sector_number = vals[1];
+ args.taskfile.low_cylinder = 0x00;
+ args.taskfile.high_cylinder = 0x00;
+ args.taskfile.device_head = 0x00;
+ args.taskfile.command = vals[0];
- if (args[3]) {
- argsize = 4 + (SECTOR_WORDS * 4 * args[3]);
+ if (vals[3]) {
+ argsize = 4 + (SECTOR_WORDS * 4 * vals[3]);
argbuf = kmalloc(argsize, GFP_KERNEL);
if (argbuf == NULL)
return -ENOMEM;
- memcpy(argbuf, args, 4);
+ memcpy(argbuf, vals, 4);
}
- if (set_transfer(drive, &tfargs)) {
- xfer_rate = args[1];
- if (ide_ata66_check(drive, &tfargs))
+
+ if (set_transfer(drive, &args)) {
+ xfer_rate = vals[1];
+ if (ide_ata66_check(drive, &args))
goto abort;
}
- err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf);
+ /* Issue ATA command and wait for completion.
+ */
+
+ /* FIXME: Do we really have to zero out the buffer?
+ */
+ memset(argbuf, 0, 4 + SECTOR_WORDS * 4 * vals[3]);
+ ide_init_drive_cmd(&rq);
+ rq.buffer = argbuf;
+ memcpy(argbuf, vals, 4);
+
+ err = ide_do_drive_cmd(drive, &rq, ide_wait);
if (!err && xfer_rate) {
/* active-retuning-calls future */
@@ -987,10 +998,11 @@
err = -EFAULT;
if (argsize > 4)
kfree(argbuf);
+
return err;
}
-int ide_task_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
{
int err = 0;
u8 args[7];
diff -urN linux-2.5.8-pre3/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.8-pre3/drivers/ide/ide.c Fri Apr 12 00:43:23 2002
+++ linux/drivers/ide/ide.c Fri Apr 12 01:40:11 2002
@@ -2640,12 +2640,12 @@
case HDIO_DRIVE_CMD:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
- return ide_cmd_ioctl(drive, inode, file, cmd, arg);
+ return ide_cmd_ioctl(drive, arg);
case HDIO_DRIVE_TASK:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
- return ide_task_ioctl(drive, inode, file, cmd, arg);
+ return ide_task_ioctl(drive, arg);
case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
diff -urN linux-2.5.8-pre3/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.8-pre3/include/linux/ide.h Fri Apr 12 00:43:23 2002
+++ linux/include/linux/ide.h Sun Apr 14 15:48:46 2002
@@ -864,10 +864,10 @@
extern void ide_cmd_type_parser(struct ata_taskfile *args);
extern int ide_raw_taskfile(ide_drive_t *drive, struct ata_taskfile *cmd, byte *buf);
-extern int ide_cmd_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
-extern int ide_task_ioctl(ide_drive_t *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
+extern int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg);
+extern int ide_task_ioctl(ide_drive_t *drive, unsigned long arg);
-void ide_delay_50ms (void);
+void ide_delay_50ms(void);
byte ide_auto_reduce_xfer (ide_drive_t *drive);
int ide_driveid_update (ide_drive_t *drive);
next prev parent reply other threads:[~2002-04-14 14:57 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-06 1:01 Linux 2.5.8-pre2 Linus Torvalds
2002-04-06 6:59 ` Larry McVoy
2002-04-07 10:17 ` Geert Uytterhoeven
2002-04-07 10:27 ` Russell King
2002-04-07 10:42 ` Geert Uytterhoeven
2002-04-07 10:56 ` Russell King
2002-04-07 13:34 ` Russell King
2002-04-07 14:51 ` Geert Uytterhoeven
2002-04-07 10:50 ` Andrew Morton
2002-04-09 8:05 ` [PATCH] 2.5.8-pre2 IDE 29b Martin Dalecki
2002-04-10 13:14 ` [PATCH] 2.5.8-pre3 IDE 30 Martin Dalecki
2002-04-10 13:16 ` [PATCH] 2.5.8-pre3 IDE 31 Martin Dalecki
2002-04-11 13:42 ` [PATCH] 2.5.8-pre3 IDE 32 Martin Dalecki
2002-04-14 13:55 ` Martin Dalecki [this message]
2002-04-15 13:45 ` [PATCH] 2.5.8 IDE 35 Martin Dalecki
2002-04-16 7:05 ` [PATCH] 2.5.8 IDE 36 Martin Dalecki
2002-04-16 8:30 ` Vojtech Pavlik
2002-04-16 7:33 ` Martin Dalecki
2002-04-16 8:43 ` Vojtech Pavlik
2002-04-16 9:19 ` David Lang
2002-04-16 8:43 ` Martin Dalecki
2002-04-16 14:14 ` Richard Gooch
2002-04-16 13:49 ` Martin Dalecki
2002-04-16 15:24 ` Vojtech Pavlik
2002-04-16 15:46 ` Linus Torvalds
2002-04-16 16:15 ` Alan Cox
2002-04-16 16:01 ` Linus Torvalds
2002-04-16 16:25 ` Alan Cox
2002-04-16 16:33 ` Padraig Brady
2002-04-16 17:42 ` Andreas Dilger
2002-04-16 17:00 ` Vojtech Pavlik
2002-04-16 17:04 ` David Lang
2002-04-16 17:00 ` David S. Miller
2002-04-16 17:09 ` David Lang
2002-04-16 17:06 ` David S. Miller
2002-04-16 17:16 ` David Lang
2002-04-17 7:44 ` Martin Dalecki
2002-04-17 9:33 ` David Lang
2002-04-16 17:40 ` Benjamin Herrenschmidt
2002-04-17 7:46 ` Martin Dalecki
2002-04-17 9:26 ` Anton Altaparmakov
2002-04-17 9:39 ` David Lang
2002-04-17 20:58 ` Mike Fedyk
2002-04-17 9:13 ` Geert Uytterhoeven
2002-04-17 1:55 ` Benjamin Herrenschmidt
2002-04-17 8:39 ` Martin Dalecki
2002-04-17 8:25 ` Geert Uytterhoeven
2002-04-16 15:43 ` Linus Torvalds
2002-04-16 15:58 ` Richard Gooch
2002-04-16 16:06 ` Linus Torvalds
2002-04-17 7:38 ` Martin Dalecki
2002-04-16 15:30 ` Linus Torvalds
2002-04-16 16:05 ` Alan Cox
2002-04-16 15:56 ` Linus Torvalds
2002-04-16 16:23 ` Alan Cox
2002-04-16 17:06 ` Vojtech Pavlik
2002-04-18 20:33 ` eNBD on loopback [was Re: [PATCH] 2.5.8 IDE 36] Pavel Machek
2002-04-18 20:39 ` Linus Torvalds
2002-04-18 10:45 ` regarding NFS Jehanzeb Hameed
2002-04-19 9:36 ` Trond Myklebust
2002-04-19 1:19 ` Jehanzeb Hameed
2002-04-19 12:24 ` Trond Myklebust
2002-04-19 2:26 ` Jehanzeb Hameed
2002-04-19 13:46 ` Trond Myklebust
2002-04-17 7:36 ` [PATCH] 2.5.8 IDE 36 Martin Dalecki
2002-04-17 9:24 ` Alan Cox
2002-04-16 22:46 ` Brian Gerst
2002-04-17 7:52 ` Martin Dalecki
2002-04-16 9:22 ` [PATCH] 2.5.8 IDE 37 Martin Dalecki
2002-04-18 9:14 ` [PATCH] 2.5.8 IDE 38 Martin Dalecki
2002-04-18 10:48 ` Russell King
2002-04-18 9:54 ` Martin Dalecki
2002-04-18 9:16 ` [PATCH] 2.5.8 IDE 37 Martin Dalecki
2002-04-18 9:22 ` [PATCH] 2.5.8 IDE 39 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=3CB98A5C.6060407@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