2.5.30 IDE 115
PATCH 1/1 2.5.30 IDE 115
- Fix small typo introduced in 113, which prevented CD-ROMs from working altogether.
- Eliminate block_ioctl(). This code can't be shared in the way proposed by this file. We will port it to the proper blk_insert_request() soon. This will eliminate the _elv_add_request() "layering violation".
- Don't play IRQ wreck havoc in ata_dump().
- Fix delays on seeks in ide-cd.c
- Integrate special_intr() and tcq_nop_intr() in to one single IRQ handler. This way we don't have to kmalloc anything for sending a NOP to the drive in TCQ.
- Eliminate the usage of the XXX_handler from the ata_taskfile structure. Now we always deduce which handler will be needed from the command which will be executed. This makes the usage of the channel IRQ handler pointer much more cleaner now.
- Don't pass taskfiles through rq->special. Pass them through rq->cmd[] as every other block device does or at least should do. This way we don't pass pointers to structures on local stack around any more.
- pdc4030 code doesn't have anything to do with the normal taskfile stuff.
drivers/block/block_ioctl.c +0 -83
@@ -1,83 +0,0 @@ -/* -* Copyright (C) 2001 Jens Axboe <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of - -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public Licens -* along with this program; if not, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111- -* -*/ -#include <linux/sched.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/config.h> -#include <linux/swap.h> -#include <linux/init.h> -#include <linux/smp_lock.h> -#include <linux/module.h> -#include <linux/blk.h> -#include <linux/completion.h> - -#include <linux/cdrom.h> - -int blk_do_rq (request_queue_t *q,struct request *rq) -{ -DECLARE_COMPLETION (wait); -int err =0 ; - - rq->flags |=REQ_NOMERGE ; - rq->waiting = &wait; -elv_add_request (q, rq,1 ); -generic_unplug_device (q); -wait_for_completion (&wait); - -/* -* for now, never retry anything -*/ -if (rq->errors) - err = -EIO ; - -return err; -} - -int block_ioctl (struct block_device *bdev,unsigned int cmd,unsigned long arg) -{ -request_queue_t *q; -struct request *rq; -int close =0 , err; - - q =bdev_get_queue (bdev); -if (!q) -return -ENXIO ; - -switch (cmd) { -case CDROMCLOSETRAY : - close =1 ; -case CDROMEJECT : - rq =blk_get_request (q,WRITE , __GFP_WAIT); - rq->flags =REQ_BLOCK_PC ; -memset (rq->cmd,0 ,sizeof (rq->cmd)); - rq->cmd[0 ] =GPCMD_START_STOP_UNIT ; - rq->cmd[4 ] =0x02 + (close !=0 ); - err =blk_do_rq (q, rq); -blk_put_request (rq); -break ; -default : - err = -ENOTTY ; - } - -blk_put_queue (q); -return err; -} - -EXPORT_SYMBOL (block_ioctl);
drivers/block/Makefile +2 -3
@@ -8,10 +8,9 @@ # In the future, some of these should be built conditionally. # -export-objs := elevator.o ll_rw_blk.o blkpg.o loop.o genhd.o \ - block_ioctl.o acsi.o +export-objs := elevator.o ll_rw_blk.o blkpg.o loop.o genhd.o acsi.o -obj-y := elevator.o ll_rw_blk.o blkpg.o genhd.o block_ioctl.o +obj-y := elevator.o ll_rw_blk.o blkpg.o genhd.o obj-$(CONFIG_MAC_FLOPPY) += swim3.o obj-$(CONFIG_BLK_DEV_FD) += floppy.o
drivers/ide/ide.c +9 -14
@@ -233,12 +233,12 @@ static inline u32 read_24(struct ata_dev#if FANCY_STATUS_DUMPS struct ata_bit_messages { -u8 mask; -u8 match; +const u8 mask; +const u8 match;const char *msg; }; -static struct ata_bit_messages ata_status_msgs[] = { +static const struct ata_bit_messages ata_status_msgs[] = { {BUSY_STAT ,BUSY_STAT ,"busy" }, {READY_STAT ,READY_STAT ,"drive ready" }, { WRERR_STAT, WRERR_STAT, "device fault" },
@@ -249,7 +249,7 @@ static struct ata_bit_messages ata_statu { ERR_STAT, ERR_STAT, "error" } }; -static struct ata_bit_messages ata_error_msgs[] = { +static const struct ata_bit_messages ata_error_msgs[] = { {ICRC_ERR |ABRT_ERR ,ABRT_ERR ,"drive status error" }, {ICRC_ERR |ABRT_ERR ,ICRC_ERR ,"bad sector" }, {ICRC_ERR |ABRT_ERR ,ICRC_ERR |ABRT_ERR ,"invalid checksum" },
@@ -259,22 +259,23 @@ static struct ata_bit_messages ata_error { MARK_ERR, MARK_ERR, "addr mark not found" } }; -static void dump_bits(struct ata_bit_messages *msgs, int nr, u8 bits) +static void dump_bits(const struct ata_bit_messages *msgs, int n, u8 bits) { int i; int first = 1; printk(" [ "); - for (i = 0; i < nr; i++, msgs++) + for (i = 0; i < n; i++, msgs++) { if ((bits & msgs->mask) == msgs->match) { if (!first) - printk(","); + printk(", "); printk("%s", msgs->msg); first = 0; } + } - printk("] "); + printk(" ] "); } #else # define dump_bits(msgs,nr,bits) do { } while (0)
@@ -285,13 +286,8 @@ static void dump_bits(struct ata_bit_mes*/ u8 ata_dump (struct ata_device *drive,struct request * rq,const char *msg) { -unsigned long flags;u8 err =0 ; -/* FIXME: --bzolnier */ -local_save_flags (flags); -local_irq_enable (); -printk ("%s: %s: status=0x%02x" , drive->name, msg, drive->status);dump_bits (ata_status_msgs,ARRAY_SIZE (ata_status_msgs), drive->status);printk ("\n" );
@@ -338,7 +334,6 @@ u8 ata_dump(struct ata_device *drive, st#endif printk ("\n" ); } -local_irq_restore (flags);return err; }
drivers/ide/ide-cd.c +10 -4
@@ -306,6 +306,7 @@#include <linux/errno.h> #include <linux/cdrom.h> #include <linux/completion.h> +#include <linux/delay.h> #include <linux/hdreg.h> #include <linux/ide.h>
@@ -1617,11 +1618,16 @@ ide_cdrom_do_request(struct ata_device *if (rq->flags &REQ_CMD ) {if (CDROM_CONFIG_FLAGS (drive)->seeking) { -if (ATA_OP_READY !=ata_status_poll (drive,SEEK_STAT ,0 ,IDECD_SEEK_TIMEOUT , rq)) { +unsigned long elpased = jiffies - info->start_seek; + +if (!ata_status (drive,SEEK_STAT ,0 )) { +if (elpased <IDECD_SEEK_TIMEOUT ) { +udelay (IDECD_SEEK_TIMER /HZ ); +return ATA_OP_FINISHED ; + }printk ("%s: DSC timeout\n" , drive->name); -CDROM_CONFIG_FLAGS (drive)->seeking =0 ; - }else -return ATA_OP_FINISHED ; + } +CDROM_CONFIG_FLAGS (drive)->seeking =0 ; }if (IDE_LARGE_SEEK (info->last_block, block,IDECD_SEEK_THRESHOLD ) && drive->dsc_overlap) { ret =cdrom_start_seek (drive, rq, block);
drivers/ide/ide-disk.c +72 -20
179 lines not on this page · raw message
drivers/ide/ide-pci.c +1 -1
@@ -236,7 +236,7 @@ static void __init setup_channel_dma(str/* * Setup a particular port on an ATA host controller. * -* This gets called once for the master and for the slave interface. +* This gets called once for the primary and for the seondary interface. */ static int __init setup_host_channel(struct pci_dev *dev, struct ata_pci_device *d,
drivers/ide/ide-taskfile.c +8 -60
109 lines not on this page · raw message
drivers/ide/ioctl.c +58 -4
82 lines not on this page · raw message
drivers/ide/pcidma.c +25 -5
@@ -86,6 +86,26 @@ static ide_startstop_t dma_timer_expiry(return ATA_OP_FINISHED ; } +int ata_start_dma (struct ata_device *drive,struct request *rq) +{ +struct ata_channel *ch = drive->channel; +unsigned long dma_base = ch->dma_base; +unsigned int reading =0 ; + +if (rq_data_dir (rq) ==READ ) + reading =1 <<3 ; + +/* try PIO instead of DMA */ +if (!udma_new_table (drive, rq)) +return 1 ; + +outl (ch->dmatable_dma, dma_base +4 );/* PRD table */ +outb (reading, dma_base);/* specify r/w */ +outb (inb (dma_base+2 )|6 , dma_base+2 );/* clear INTR & ERROR flags */ + +return 0 ; +} +/* generic udma_setup() function for drivers having ->speedproc/tuneproc */ int udma_generic_setup (struct ata_device *drive,int map) {
@@ -468,11 +488,7 @@ int udma_pci_init(struct ata_device *dri/* try PIO instead of DMA */ if (!udma_new_table (drive, rq)) -return 1 ; - -/* No DMA transfers on ATAPI devices. */ -if (drive->type !=ATA_DISK ) -return ATA_OP_CONTINUES ; +return ATA_OP_FINISHED ;if (rq_data_dir (rq) ==READ ) cmd =0x08 ;
@@ -483,6 +499,10 @@ int udma_pci_init(struct ata_device *drioutb (cmd, dma_base);/* specify r/w */ outb (inb (dma_base +2 ) |6 , dma_base +2 );/* clear INTR & ERROR flags */ +/* No DMA transfers on ATAPI devices. */ +if (drive->type !=ATA_DISK ) +return ATA_OP_CONTINUES ; +ata_set_handler (drive, ide_dma_intr,WAIT_CMD , dma_timer_expiry);if (drive->addressing)outb (cmd ?WIN_READDMA_EXT :WIN_WRITEDMA_EXT ,IDE_COMMAND_REG );
drivers/ide/pdc4030.c +103 -16
143 lines not on this page · raw message
drivers/ide/tcq.c +3 -30
@@ -56,27 +56,6 @@static ide_startstop_t ide_dmaq_intr (struct ata_device *drive,struct request *rq);static ide_startstop_t service (struct ata_device *drive,struct request *rq); -static ide_startstop_t tcq_nop_handler (struct ata_device *drive,struct request *rq) -{ -unsigned long flags; -struct ata_taskfile *args = rq->special; -struct ata_channel *ch = drive->channel; - -local_irq_enable (); - -spin_lock_irqsave (ch->lock, flags); - -blkdev_dequeue_request (rq); - drive->rq =NULL ; -end_that_request_last (rq); - -spin_unlock_irqrestore (ch->lock, flags); - -kfree (args); - -return ATA_OP_FINISHED ; -} -/* * If we encounter _any_ error doing I/O to one of the tags, we must * invalidate the pending queue. Clear the software busy queue and requeue
@@ -112,11 +91,6 @@ static void tcq_invalidate_queue(struct* executed before any new commands are started. issue a NOP * to clear internal queue on drive. */ - ar =kmalloc (sizeof (*ar),GFP_ATOMIC ); -if (!ar) { -printk (KERN_ERR "ATA: %s: failed to issue NOP\n" , drive->name); - goto out; - } rq =__blk_get_request (&drive->queue,READ );if (!rq)
@@ -130,14 +104,13 @@ static void tcq_invalidate_queue(struct/* WIN_NOP is a special request so set it's flags ?? */ rq->flags =REQ_SPECIAL ; - rq->special = ar; + ar = (struct ata_taskfile *) rq->cmd; ar->cmd =WIN_NOP ; - ar->XXX_handler = tcq_nop_handler; ar->command_type =IDE_DRIVE_TASK_NO_DATA ; +memcpy (rq->cmd, ar,sizeof (*ar));_elv_add_request (q, rq,0 ,0 ); -out:#ifdef IDE_TCQ_NIEN ata_irq_enable (drive,1 );#endif
@@ -566,7 +539,7 @@ ide_startstop_t udma_tcq_init(struct atau8 stat;u8 feat; -struct ata_taskfile *args = rq->special; +struct ata_taskfile *args = (struct ata_taskfile *) rq->cmd;TCQ_PRINTK ("%s: start tag %d\n" , drive->name, rq->tag);
include/linux/blkdev.h +1 -2
@@ -28,7 +28,7 @@ struct request {* blkdev_dequeue_request! */ void *elevator_private; -unsigned char cmd[16 ]; +unsigned char cmd[32 ];unsigned long flags;/* see REQ_ bits below */
@@ -293,7 +293,6 @@ extern int blk_remove_plug(request_queueextern void blk_recount_segments (request_queue_t *,struct bio *);extern inline int blk_phys_contig_segment (request_queue_t *q,struct bio *,struct bio *);extern inline int blk_hw_contig_segment (request_queue_t *q,struct bio *,struct bio *); -extern int block_ioctl (struct block_device *,unsigned int ,unsigned long );extern void blk_start_queue (request_queue_t *q);extern void blk_stop_queue (request_queue_t *q);extern void __blk_stop_queue (request_queue_t *q);
include/linux/ide.h +2 -3
@@ -1101,11 +1101,10 @@ struct ata_device *get_info_ptr(kdev_t i#define ide_rq_offset (rq) (((rq)->hard_cur_sectors - (rq)->current_nr_sectors) << 9)struct ata_taskfile { +u8 cmd;/* actual ATA command */ +int command_type;struct hd_drive_task_hdr taskfile;struct hd_drive_task_hdr hobfile; -u8 cmd;/* actual ATA command */ -int command_type; -ide_startstop_t (*XXX_handler)(struct ata_device *,struct request *); };extern void ata_read (struct ata_device *,void *,unsigned int );
Quoted 2 lines · Marcin Dalecki
- Fix small typo introduced in 113, which prevented CD-ROMs from working altogether.
Have you fixed the sense reporting issue I told you about months ago?
Quoted 4 lines
- Eliminate
block_ioctl(). This code can't be shared in the way proposed by this file. We will port it to the properblk_insert_request()soon. This will eliminate the_elv_add_request()"layering violation".
What are you talking about?
Signature · 1 line
Jens Axboe
Quoted 7 lines · Jens Axboe
Quoted 2 lines · Marcin Dalecki
- Fix small typo introduced in 113, which prevented CD-ROMs from working altogether.
Have you fixed the sense reporting issue I told you about months ago?
Well at least ide-116 will start to unify the corresponding code. But please don't expecty anything "revolutionary" yet... Just for example using GPCMD_ constants throughout the code and a unified error dissection function. One of the issues involved is rq->buffer in ide-floppy versus rq->special in ide-cd.c
Quoted 7 lines
Quoted 4 lines
- Eliminate
block_ioctl(). This code can't be shared in the way proposed by this file. We will port it to the properblk_insert_request()soon. This will eliminate the_elv_add_request()"layering violation".What are you talking about?
Hmm, so apparently you where not the one who "inventid" it?
Anyway I talk about the block_ioctl.c file, which was supposed to contain the two eject ioctl functions for "generic" packet code. But since we don't have any kind of "generic" packet commands this didn't make much sense.
It was inventing a function called blk_do_rq(), which was using elv_add_request(). You called this not a long time ago a "layering violation" yourself. And I simply intend to replace it in one of the forthcomming patches with the recently inventid blk_insert_request() function.
Oh, I realize I didn't express myself properly. I certinaly don't intend to eliminate elv_add_request() itself any time soon ;-).
Quoted 7 lines · Marcin Dalecki
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Marcin Dalecki
- Fix small typo introduced in 113, which prevented CD-ROMs from working altogether.
Quoted 7 lines
Quoted 1 line
Have you fixed the sense reporting issue I told you about months ago?
Well at least ide-116 will start to unify the corresponding code. But please don't expecty anything "revolutionary" yet... Just for example using
GPCMD_constants throughout the code and a unified error dissection function. One of the issues involved isrq->bufferin ide-floppy versusrq->specialinide-cd.c
Well I consider the sense decoding a somewhat important feature, hence it's really bad it has been broken for months now. It's impossible to diagnose problems in ide-cd code without it.
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
- Eliminate
block_ioctl(). This code can't be shared in the way proposed by this file. We will port it to the properblk_insert_request()soon. This will eliminate the_elv_add_request()"layering violation".What are you talking about?
Hmm, so apparently you where not the one who "inventid" it?
? I added block_ioct.c, yes.
Quoted 2 lines
Anyway I talk about the
block_ioctl.cfile, which was supposed to contain the two eject ioctl functions for "generic" packet code.
It _did_ contain two eject ioctl as a "here's what it's supposed to do" proof of concept type thing.
Quoted 2 lines
But since we don't have any kind of "generic" packet commands this didn't make much sense.
What are you talking about?!
Quoted 5 lines
It was inventing a function called
blk_do_rq(), which was usingelv_add_request(). You called this not a long time ago a "layering violation" yourself. And I simply intend to replace it in one of the forthcomming patches with the recently inventidblk_insert_request()function.
Sigh... Martin, for fscks sake please stop always just assuming and get your facts straight. This is why you are repeatedly pissing me (and others) off. blk_do_rq() means "insert request and execute it, return when it's done". It probably should have been in ll_rw_blk.c itself, sinoce it's that sort of helper.
Using elv_add_request() is not a layering violation, that's the exported interface... The layering violation is using __elv_add_request() since it exposes the internal queue lists, which may not be appropriate for all io schedulers.
Quoted 2 lines
Oh, I realize I didn't express myself properly. I certinaly don't intend to eliminate
elv_add_request()itself any time soon ;-).
No, I would appreciate it if you would keep your hands out of the block code.
Signature · 1 line
Jens Axboe
Quoted 4 lines · Jens Axboe
No, I would appreciate it if you would keep your hands out of the block code.
OK. I have enough.