ide: set IDE_AFLAG_DRQ_INTERRUPT in do_identify()
PATCH 1/6 ide: set IDE_AFLAG_DRQ_INTERRUPT in do_identify()
Set IDE_AFLAG_DRQ_INTERRUPT in do_identify() instead of ATAPI device drivers *_setup() methods.
While at it:
- use ata_id_cdb_intr()
There should be no functional changes caused by this patch.
--- drivers/ide/ide-cd.c | 3 --- drivers/ide/ide-floppy.c | 5 ----- drivers/ide/ide-probe.c | 2 ++ drivers/ide/ide-tape.c | 7 ------- drivers/scsi/ide-scsi.c | 2 -- 5 files changed, 2 insertions(+), 17 deletions(-)
drivers/ide/ide-cd.c +0 -3
@@ -1887,9 +1887,6 @@ static int ide_cdrom_setup(ide_drive_t * drive->atapi_flags =IDE_AFLAG_MEDIA_CHANGED |IDE_AFLAG_NO_EJECT |ide_cd_flags (id); -if ((id[ATA_ID_CONFIG ] &0x0060 ) ==0x20 ) - drive->atapi_flags |=IDE_AFLAG_DRQ_INTERRUPT ; -if ((drive->atapi_flags &IDE_AFLAG_VERTOS_300_SSD ) && fw_rev[4 ] =='1' && fw_rev[6 ] <='2' ) drive->atapi_flags |= (IDE_AFLAG_TOCTRACKS_AS_BCD |
drivers/ide/ide-floppy.c +0 -5
@@ -578,16 +578,11 @@ static const struct ide_proc_devset idefstatic void idefloppy_setup (ide_drive_t *drive,idefloppy_floppy_t *floppy) {u16 *id = drive->id; -u8 gcw[2 ]; - - *((u16 *)&gcw) = id[ATA_ID_CONFIG ]; drive->pc_callback = ide_floppy_callback; drive->pc_update_buffers = idefloppy_update_buffers; drive->pc_io_buffers = ide_io_buffers; -if (((gcw[0 ] &0x60 ) >>5 ) ==1 ) - drive->atapi_flags |=IDE_AFLAG_DRQ_INTERRUPT ;/* * We used to check revisions here. At this point however I'm giving up. * Just assume they are all broken, its easier.
drivers/ide/ide-probe.c +2 -0
@@ -206,6 +206,8 @@ static inline void do_identify (ide_driv drive->media = type;/* an ATAPI device ignores DRDY */ drive->ready_stat =0 ; +if (ata_id_cdb_intr (id)) + drive->atapi_flags |=IDE_AFLAG_DRQ_INTERRUPT ;return ; }
drivers/ide/ide-tape.c +0 -7
@@ -2184,7 +2184,6 @@ static void idetape_setup(ide_drive_t *dunsigned long t;int speed;int buffer_size; -u8 gcw[2 ];u16 *ctl = (u16 *)&tape->caps[12 ]; drive->pc_callback = ide_tape_callback;
@@ -2211,12 +2210,6 @@ static void idetape_setup(ide_drive_t *d tape->name[2 ] ='0' + minor; tape->chrdev_dir =IDETAPE_DIR_NONE ; - *((u16 *)&gcw) = drive->id[ATA_ID_CONFIG ]; - -/* Command packet DRQ type */ -if (((gcw[0 ] &0x60 ) >>5 ) ==1 ) -set_bit (IDE_AFLAG_DRQ_INTERRUPT , &drive->atapi_flags); -idetape_get_inquiry_results (drive);idetape_get_mode_sense_results (drive);ide_tape_get_bsize_from_bdesc (drive);
drivers/scsi/ide-scsi.c +0 -2
@@ -385,8 +385,6 @@ static const struct ide_proc_devset ides*/ static void idescsi_setup (ide_drive_t *drive,idescsi_scsi_t *scsi) { -if ((drive->id[ATA_ID_CONFIG ] &0x0060 ) ==0x20 ) -set_bit (IDE_AFLAG_DRQ_INTERRUPT , &drive->atapi_flags);clear_bit (IDESCSI_SG_TRANSFORM , &scsi->transform);#if IDESCSI_DEBUG_LOG set_bit (IDESCSI_LOG_CMD , &scsi->log);
PATCH 2/6 ide-cd: no need to zero drive->special.all
--- drivers/ide/ide-cd.c | 2 -- 1 file changed, 2 deletions(-)
drivers/ide/ide-cd.c +0 -2
@@ -1882,8 +1882,6 @@ static int ide_cdrom_setup(ide_drive_t *if (!drive->queue->unplug_delay) drive->queue->unplug_delay =1 ; - drive->special.all =0 ; - drive->atapi_flags =IDE_AFLAG_MEDIA_CHANGED |IDE_AFLAG_NO_EJECT |ide_cd_flags (id);
PATCH 3/6 ide-floppy: move all ioctl handling to ide-floppy_ioctl.c
In reply to Bartlomiej ZolnierkiewiczWhile at it:
- idefloppy_ioctl() -> ide_floppy_ioctl()
--- drivers/ide/ide-floppy.c | 52 --------------------------------------- drivers/ide/ide-floppy.h | 3 -- drivers/ide/ide-floppy_ioctl.c | 54 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 54 insertions(+), 55 deletions(-)
drivers/ide/ide-floppy.c +1 -51
@@ -767,56 +767,6 @@ static int idefloppy_getgeo(struct blockreturn 0 ; } -static int ide_floppy_lockdoor (ide_drive_t *drive,struct ide_atapi_pc *pc, -unsigned long arg,unsigned int cmd) -{ -idefloppy_floppy_t *floppy = drive->driver_data; -struct gendisk *disk = floppy->disk; -int prevent = (arg && cmd !=CDROMEJECT ) ?1 :0 ; - -if (floppy->openers >1 ) -return -EBUSY ; - -ide_set_media_lock (drive, disk, prevent); - -if (cmd ==CDROMEJECT ) -ide_do_start_stop (drive, disk,2 ); - -return 0 ; -} - -static int idefloppy_ioctl (struct inode *inode,struct file *file, -unsigned int cmd,unsigned long arg) -{ -struct block_device *bdev = inode->i_bdev; -struct ide_floppy_obj *floppy =ide_drv_g (bdev->bd_disk, - ide_floppy_obj); -ide_drive_t *drive = floppy->drive; -struct ide_atapi_pc pc; -void __user *argp = (void __user *)arg; -int err; - -if (cmd ==CDROMEJECT || cmd ==CDROM_LOCKDOOR ) -return ide_floppy_lockdoor (drive, &pc, arg, cmd); - - err =ide_floppy_format_ioctl (drive, file, cmd, argp); -if (err != -ENOTTY ) -return err; - -/* -* skip SCSI_IOCTL_SEND_COMMAND (deprecated) -* and CDROM_SEND_PACKET (legacy) ioctls -*/ -if (cmd !=CDROM_SEND_PACKET && cmd !=SCSI_IOCTL_SEND_COMMAND ) - err =scsi_cmd_ioctl (file, bdev->bd_disk->queue, - bdev->bd_disk, cmd, argp); - -if (err == -ENOTTY ) - err =generic_ide_ioctl (drive, file, bdev, cmd, arg); - -return err; -} -static int idefloppy_media_changed (struct gendisk *disk) {struct ide_floppy_obj *floppy =ide_drv_g (disk, ide_floppy_obj);
@@ -844,7 +794,7 @@ static struct block_device_operations id .owner = THIS_MODULE, .open = idefloppy_open, .release = idefloppy_release, - .ioctl = idefloppy_ioctl, + .ioctl = ide_floppy_ioctl, .getgeo = idefloppy_getgeo, .media_changed = idefloppy_media_changed, .revalidate_disk = idefloppy_revalidate_disk
drivers/ide/ide-floppy.h +1 -2
@@ -50,7 +50,6 @@ void ide_floppy_create_mode_sense_cmd(stvoid ide_floppy_create_read_capacity_cmd (struct ide_atapi_pc *);/* ide-floppy_ioctl.c */ -int ide_floppy_format_ioctl (ide_drive_t *,struct file *,unsigned int , -void __user *); +int ide_floppy_ioctl (struct inode *,struct file *,unsigned ,unsigned long );#endif /*__IDE_FLOPPY_H */
drivers/ide/ide-floppy_ioctl.c +52 -2
63 lines not on this page · raw message
PATCH 4/6 ide-floppy: move /proc handling to ide-floppy_proc.c
In reply to Bartlomiej ZolnierkiewiczWhile at it:
- idefloppy_capacity() -> ide_floppy_capacity()
- idefloppy_proc[] -> ide_floppy_proc[]
- idefloppy_settings[] -> ide_floppy_settings[]
--- drivers/ide/Makefile | 2 +- drivers/ide/ide-floppy.c | 41 ++++------------------------------------- drivers/ide/ide-floppy.h | 5 +++++ drivers/ide/ide-floppy_proc.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 38 deletions(-)
drivers/ide/Makefile +1 -1
@@ -37,7 +37,7 @@ obj-$(CONFIG_IDE_GENERIC) += ide-generi obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o -ide-floppy_mod-y += ide-floppy.o ide-floppy_ioctl.o +ide-floppy_mod-y += ide-floppy.o ide-floppy_ioctl.o ide-floppy_proc.o obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd_mod.o
drivers/ide/ide-floppy.c +4 -37
71 lines not on this page · raw message
drivers/ide/ide-floppy.h +5 -0
@@ -48,8 +48,13 @@ typedef struct ide_floppy_obj {/* ide-floppy.c */ void ide_floppy_create_mode_sense_cmd (struct ide_atapi_pc *,u8 );void ide_floppy_create_read_capacity_cmd (struct ide_atapi_pc *); +sector_t ide_floppy_capacity (ide_drive_t *);/* ide-floppy_ioctl.c */ int ide_floppy_ioctl (struct inode *,struct file *,unsigned ,unsigned long ); +/* ide-floppy_proc.c */ +extern ide_proc_entry_t ide_floppy_proc[]; +extern const struct ide_proc_devset ide_floppy_settings[]; +#endif /*__IDE_FLOPPY_H */
drivers/ide/ide-floppy_proc.c new file +35 -0
@@ -0,0 +1,35 @@ +#include <linux/kernel.h> +#include <linux/ide.h> + +#include "ide-floppy.h" + +#ifdef CONFIG_IDE_PROC_FS +static int proc_idefloppy_read_capacity (char *page,char **start,off_t off, +int count,int *eof,void *data) +{ +ide_drive_t *drive = (ide_drive_t *)data; +int len; + + len =sprintf (page,"%llu\n" , (long long )ide_floppy_capacity (drive)); +PROC_IDE_READ_RETURN (page, start, off, count, eof, len); +} + +ide_proc_entry_t ide_floppy_proc[] = { + {"capacity" ,S_IFREG |S_IRUGO , proc_idefloppy_read_capacity,NULL }, + {"geometry" ,S_IFREG |S_IRUGO , proc_ide_read_geometry,NULL }, + {NULL ,0 ,NULL ,NULL } +}; + +ide_devset_rw_field (bios_cyl, bios_cyl); +ide_devset_rw_field (bios_head, bios_head); +ide_devset_rw_field (bios_sect, bios_sect); +ide_devset_rw_field (ticks, pc_delay); + +const struct ide_proc_devset ide_floppy_settings[] = { +IDE_PROC_DEVSET (bios_cyl,0 ,1023 ), +IDE_PROC_DEVSET (bios_head,0 ,255 ), +IDE_PROC_DEVSET (bios_sect,0 ,63 ), +IDE_PROC_DEVSET (ticks,0 ,255 ), + {0 }, +}; +#endif /* CONFIG_IDE_PROC_FS */
PATCH 5/6 ide-disk: move all ioctl handling to ide-disk_ioctl.c
In reply to Bartlomiej ZolnierkiewiczWhile at it:
- idedisk_ioctl() -> ide_disk_ioctl()
--- drivers/ide/Makefile | 3 +- drivers/ide/ide-disk.c | 48 +++++++------------------------------------ drivers/ide/ide-disk.h | 25 ++++++++++++++++++++++ drivers/ide/ide-disk_ioctl.c | 29 +++++++++++++++++++++++++ drivers/ide/ide.c | 11 +++------ include/linux/ide.h | 7 ++++-- 6 files changed, 73 insertions(+), 50 deletions(-)
drivers/ide/Makefile +2 -1
@@ -36,10 +36,11 @@ obj-$(CONFIG_IDE_H8300) += h8300/ obj-$(CONFIG_IDE_GENERIC) += ide-generic.o obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o +ide-disk_mod-y += ide-disk.o ide-disk_ioctl.o ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o ide-floppy_mod-y += ide-floppy.o ide-floppy_ioctl.o ide-floppy_proc.o -obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk.o +obj-$(CONFIG_BLK_DEV_IDEDISK) += ide-disk_mod.o obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd_mod.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy_mod.o obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o
drivers/ide/ide-disk.c +8 -40
84 lines not on this page · raw message
drivers/ide/ide-disk.h new file +25 -0
@@ -0,0 +1,25 @@ +#ifndef __IDE_DISK_H +#define __IDE_DISK_H + +struct ide_disk_obj { +ide_drive_t *drive; +ide_driver_t *driver; +struct gendisk *disk; +struct kref kref; +unsigned int openers;/* protected by BKL for now */ +}; + +#define ide_disk_g (disk) \ + container_of((disk)->private_data, struct ide_disk_obj, driver) + +/* ide-disk.c */ +ide_decl_devset (address); +ide_decl_devset (multcount); +ide_decl_devset (nowerr); +ide_decl_devset (wcache); +ide_decl_devset (acoustic); + +/* ide-disk_ioctl.c */ +int ide_disk_ioctl (struct inode *,struct file *,unsigned int ,unsigned long ); + +#endif /* __IDE_DISK_H */
drivers/ide/ide-disk_ioctl.c new file +29 -0
@@ -0,0 +1,29 @@ +#include <linux/kernel.h> +#include <linux/ide.h> +#include <linux/hdreg.h> + +#include "ide-disk.h" + +static const struct ide_ioctl_devset ide_disk_ioctl_settings[] = { +{HDIO_GET_ADDRESS ,HDIO_SET_ADDRESS , &ide_devset_address }, +{HDIO_GET_MULTCOUNT ,HDIO_SET_MULTCOUNT , &ide_devset_multcount }, +{HDIO_GET_NOWERR ,HDIO_SET_NOWERR , &ide_devset_nowerr }, +{HDIO_GET_WCACHE ,HDIO_SET_WCACHE , &ide_devset_wcache }, +{HDIO_GET_ACOUSTIC ,HDIO_SET_ACOUSTIC , &ide_devset_acoustic }, +{0 } +}; + +int ide_disk_ioctl (struct inode *inode,struct file *file, +unsigned int cmd,unsigned long arg) +{ +struct block_device *bdev = inode->i_bdev; +struct ide_disk_obj *idkp =ide_disk_g (bdev->bd_disk); +ide_drive_t *drive = idkp->drive; +int err; + + err =ide_setting_ioctl (drive, bdev, cmd, arg, ide_disk_ioctl_settings); +if (err != -EOPNOTSUPP ) +return err; + +return generic_ide_ioctl (drive, file, bdev, cmd, arg); +}
drivers/ide/ide.c +4 -7
@@ -392,13 +392,10 @@ static int set_unmaskirq(ide_drive_t *drreturn 0 ; } -#define ide_gen_devset_rw (_name, _func) \ -__IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) - -ide_gen_devset_rw (io_32bit, io_32bit); -ide_gen_devset_rw (keepsettings, ksettings); -ide_gen_devset_rw (unmaskirq, unmaskirq); -ide_gen_devset_rw (using_dma, using_dma); +ide_ext_devset_rw_sync (io_32bit, io_32bit); +ide_ext_devset_rw_sync (keepsettings, ksettings); +ide_ext_devset_rw_sync (unmaskirq, unmaskirq); +ide_ext_devset_rw_sync (using_dma, using_dma);__IDE_DEVSET (pio_mode,DS_SYNC ,NULL , set_pio_mode);static int generic_ide_suspend (struct device *dev,pm_message_t mesg)
include/linux/ide.h +5 -2
@@ -942,8 +942,11 @@ IDE_DEVSET(_name, 0, get_##_func, set_###define ide_devset_w (_name, _func) \ IDE_DEVSET(_name, 0, NULL, set_##_func) -#define ide_devset_rw_sync (_name, _func) \ -IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func) +#define ide_ext_devset_rw (_name, _func) \ +__IDE_DEVSET(_name, 0, get_##_func, set_##_func) + +#define ide_ext_devset_rw_sync (_name, _func) \ +__IDE_DEVSET(_name, DS_SYNC, get_##_func, set_##_func)#define ide_decl_devset (_name) \ extern const struct ide_devset ide_devset_##_name
PATCH 6/6 ide-disk: move /proc handling to ide-disk_proc.c
In reply to Bartlomiej ZolnierkiewiczWhile at it:
- idedisk_capacity() -> ide_disk_capacity()
- idedisk_proc[] -> ide_disk_proc[]
- idedisk_settings[] -> ide_disk_settings[]
--- drivers/ide/Makefile | 2 drivers/ide/ide-disk.c | 142 ++------------------------------------------ drivers/ide/ide-disk.h | 5 + drivers/ide/ide-disk_proc.c | 131 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+), 136 deletions(-)
drivers/ide/Makefile +1 -1
@@ -36,7 +36,7 @@ obj-$(CONFIG_IDE_H8300) += h8300/ obj-$(CONFIG_IDE_GENERIC) += ide-generic.o obj-$(CONFIG_BLK_DEV_IDEPNP) += ide-pnp.o -ide-disk_mod-y += ide-disk.o ide-disk_ioctl.o +ide-disk_mod-y += ide-disk.o ide-disk_ioctl.o ide-disk_proc.o ide-cd_mod-y += ide-cd.o ide-cd_ioctl.o ide-cd_verbose.o ide-floppy_mod-y += ide-floppy.o ide-floppy_ioctl.o ide-floppy_proc.o
drivers/ide/ide-disk.c +7 -135
188 lines not on this page · raw message
drivers/ide/ide-disk.h +5 -0
@@ -13,6 +13,7 @@ struct ide_disk_obj { container_of((disk)->private_data, struct ide_disk_obj, driver) /* ide-disk.c */ +sector_t ide_disk_capacity (ide_drive_t *);ide_decl_devset (address);ide_decl_devset (multcount);ide_decl_devset (nowerr);
@@ -22,4 +23,8 @@ ide_decl_devset(acoustic);/* ide-disk_ioctl.c */ int ide_disk_ioctl (struct inode *,struct file *,unsigned int ,unsigned long ); +/* ide-disk_proc.c */ +extern ide_proc_entry_t ide_disk_proc[]; +extern const struct ide_proc_devset ide_disk_settings[]; +#endif /* __IDE_DISK_H */
drivers/ide/ide-disk_proc.c new file +131 -0
131 lines not on this page · raw message
Hello.
Quoted 11 lines · Bartlomiej Zolnierkiewicz
Set
IDE_AFLAG_DRQ_INTERRUPTindo_identify()instead of ATAPI device drivers*_setup()methods.While at it:
- useata_id_cdb_intr()There should be no functional changes caused by this patch.
Cc Borislav Petkov <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
[...]
drivers/ide/ide-cd.c static int ide_cdrom_setup(ide_drive_t * · line 1890
Quoted 12 lines
Index:
b/drivers/ide/ide-cd.c
===================================================================drivers/ide/ide-cd.c +0
-3@@ -1887,9 +1887,6 @@ static int ide_cdrom_setup(ide_drive_t * drive->atapi_flags =IDE_AFLAG_MEDIA_CHANGED |IDE_AFLAG_NO_EJECT |ide_cd_flags (id); -if ((id[ATA_ID_CONFIG ] &0x0060 ) ==0x20 ) - drive->atapi_flags |=IDE_AFLAG_DRQ_INTERRUPT ; -
Wait, this needs to be fixed first -- 0x20 does *not* mean CDB INTRQ!
drivers/scsi/ide-scsi.c static const struct ide_proc_devset ides · line 388
Quoted 10 lines
Index:
b/drivers/scsi/ide-scsi.c
===================================================================drivers/scsi/ide-scsi.c +0
-1@@ -385,8 +385,6 @@ static const struct ide_proc_devset ides*/ static void idescsi_setup (ide_drive_t *drive,idescsi_scsi_t *scsi) { -if ((drive->id[ATA_ID_CONFIG ] &0x0060 ) ==0x20 )
This one is wrong too...
WBR, Sergei
Quoted 20 lines · Hello, I wrote:
Quoted 11 lines
Set
IDE_AFLAG_DRQ_INTERRUPTindo_identify()instead of ATAPI device drivers*_setup()methods.While at it:
- useata_id_cdb_intr()There should be no functional changes caused by this patch.
Cc Borislav Petkov <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>[...]
Quoted 8 lines
Index:
b/drivers/ide/ide-cd.c
===================================================================drivers/ide/ide-cd.c +0
-0@@ -1887,9 +1887,6 @@ static int ide_cdrom_setup(ide_drive_t * drive->atapi_flags =IDE_AFLAG_MEDIA_CHANGED |IDE_AFLAG_NO_EJECT |ide_cd_flags (id);
Quoted 6 lines
drivers/ide/ide-cd.c static int ide_cdrom_setup(ide_drive_t *
Quoted 4 lines
drivers/ide/ide-cd.c +0
-3-if ((id[ATA_ID_CONFIG ] &0x0060 ) ==0x20 ) - drive->atapi_flags |=IDE_AFLAG_DRQ_INTERRUPT ; -Wait, this needs to be fixed first --
0x20does *not* mean CDB INTRQ!
Ignore me -- it's not my day. :-]
WBR, Sergei