ide: driver updates
Subsystems (2)
cover ide: driver updates
Hello, B. Zolnierkiewicz.
These patches are various fixes/improvements to the ide driver. They
are against the 2.6 bk tree as of today (20050202).
01_ide_remove_adma100.patch
Removes drivers/ide/pci/adma100.[hc]. The driver isn't compilable (missing functions) and no Kconfig actually enables CONFIG_BLK_DEV_ADMA100.
02_ide_cleanup_it8172.patch
In drivers/ide/pci/it8172.h, it8172_ratefilter() and init_setup_it8172() are declared and the latter is referenced in it8172_chipsets. Both functions are not defined or used anywhere. This patch removes the prototypes and reference. it8172 should be compilable now.
03_ide_cleanup_opti621.patch
In drivers/ide/pci/opti612.[hc], init_setup_opt621() is declared, defined and referenced but never actullay used. Thie patch removes the function.
04_ide_cleanup_piix.patch
In drivers/ide/pci/piix.[hc], init_setup_piix() is defined and used but only one init_setup function is defined and no demultiplexing is done using init_setup callback. As other drivers call ide_setup_pci_device() directly in such cases, this patch removes init_setup_piix() and makes piix_init_one() call ide_setup_pci_device() directly.
05_ide_merge_pci_driver_hc.patch
Merges drivers/ide/pci/*.h files into their corresponding *.c files. Rationales are
1. There's no reason to separate pci drivers into header and body. No header file is shared and they're simple enough.
2. struct pde_pci_device_t *_chipsets[] are _defined_ in the header files. That isn't the custom and there's no good reason to do differently in these drivers.
3. Tracking changelogs shows that the bugs fixed by 00 and 01 are introduced during mass-updating ide pci drivers by forgetting to update *.h files.
06_ide_start_request_IDE_CONTROL_REG.patch
Replaced HWIF(drive)->io_ports[IDE_CONTROL_OFFSET] with equivalent IDE_CONTROL_REG in ide-io.c.
07_ide_reg_valid_t_endian_fix.patch
ide_reg_valid_t contains bitfield flags but doesn't reverse bit orders using __*_ENDIAN_BITFIELD macros. And constants for ide_reg_valid_t, IDE_{TASKFILE|HOB}_STD_{IN|OUT}_FLAGS, are defined as byte values which are correct only on little-endian machines. This patch defines reversed constants and .h byte union structure to make things correct on big endian machines. The only code which uses above macros is in flagged_taskfile() and the code is currently unused, so this patch doesn't change any behavior. (The code will get used in later patches.)
08_ide_do_identify_model_string_termination.patch
Terminates id->model string before invoking strstr() in do_identify().
09_ide_do_rw_disk_lba48_dma_check_fix.patch
In __ide_do_rw_disk(), the shifted block, instead of the original rq->sector, should be used when checking range for lba48 dma.
10_ide_do_rw_disk_pre_task_out_intr_return_fix.patch
In __ide_do_rw_disk(), ide_started used to be returned blindly after issusing PIO write. This can cause hang if pre_task_out_intr() returns ide_stopped due to failed ide_wait_stat() test. Fixed to pass the return value of pre_task_out_intr().
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
12_ide_hwgroup_t_polling.patch
ide_hwgroup_t.polling field added. 0 in poll_timeout field used to indicate inactive polling but because 0 is a valid jiffy value, though slim, there's a chance that something weird can happen.
13_ide_tape_time_after.patch
Explicit jiffy comparision converted to time_after() macro.
14_ide_error_remove_NULL_test.patch
In ide_error(), drive cannot be NULL. ide_dump_status() can't handle NULL drive.
15_ide_flagged_taskfile_data_byte_order_fix.patch
In flagged_taskfile(), when writing data register, taskfile->data goes to the lower byte and hobfile->data goes to the upper byte on little endian machines and the opposite happens on big endian machines. This patch make taskfile->data always go to the lower byte regardless of endianess.
16_ide_flagged_taskfile_select_dev_bit_masking.patch
In flagged_taskfile(), make off DEV bit before OR'ing it with drive->select.all when writing to IDE_SELECT_REG.
17_ide_flagged_taskfile_select_check.patch
In flagged_taskfile(), tf_out_flags.b.select should be checked before using bits inside taskfile->device_head. When user haven't specified the select register, the default drive->select.all value should be used.
18_ide_comment_fixes.patch
Comment fixes.
19_ide_diag_taskfile_use_init_drive_cmd.patch
In ide_diag_taskfile(), when initializing taskfile rq, ref_count wasn't initialized properly. Modified to use ide_init_drive_cmd(). This doesn't really change any behavior as the request isn't managed via the block layer.
20_ide_task_end_request_fix.patch
task_end_request() modified and made global. ide_dma_intr() modified to use task_end_request(). These changes enable TASKFILE ioctls to get valid register outputs on successful completion. No in-kernel usage should be affected.
21_ide_do_taskfile.patch
Merged do_rw_taskfile() and flagged_taskfile() into do_taskfile(). During the merge, the following changes took place.
1. flagged taskfile now honors HOB feature register. (do_rw_taskfile() did write to HOB feature.)
2. No do_rw_taskfile() HIHI check on select register. Except for the DEV bit, all bits are honored.
3. Uses taskfile->data_phase to determine if dma trasfer is requested. (do_rw_taskfile() directly switched on taskfile->command for all dma commands)
22_ide_taskfile_flush.patch
All REQ_DRIVE_TASK users except ide_task_ioctl() converted to use REQ_DRIVE_TASKFILE.
1. idedisk_issue_flush() converted to use REQ_DRIVE_TASKFILE. This and the changes in ide_get_error_location() remove a possible race condition between ide_get_error_location() and other requests.
2. ide_queue_flush_cmd() converted to use REQ_DRIVE_TASKFILE.
23_ide_taskfile_task_ioctl.patch
ide_task_ioctl() modified to map to ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_TASK.
24_ide_remove_task.patch
Unused REQ_DRIVE_TASK handling removed.
25_ide_taskfile_cmd.patch
All in-kernel REQ_DRIVE_CMD users except for ide_cmd_ioctl() converted to use REQ_DRIVE_TASKFILE.
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl() converted to use ide_taskfile_ioctl(). This is the last user of REQ_DRIVE_CMD.
27_ide_remove_cmd.patch
Removed unused REQ_DRIVE_CMD handling.
28_ide_taskfile_init_drive_cmd.patch
ide_init_drive_cmd() now initializes rq->flags to REQ_DRIVE_TASKFILE.
29_ide_explicit_TASKFILE_NO_DATA.patch
Make data_phase explicit in NO_DATA cases.
Thanks.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 01/29] ide: remove adma100
Quoted 5 lines
01_ide_remove_adma100.patch
Removes drivers/ide/pci/adma100.[hc]. The driver isn't compilable (missing functions) and no
Kconfigactually enablesCONFIG_BLK_DEV_ADMA100.
drivers/ide/pci/Makefile +0 -1
@@ -1,5 +1,4 @@ -obj-$(CONFIG_BLK_DEV_ADMA100) += adma100.o obj-$(CONFIG_BLK_DEV_AEC62XX) += aec62xx.o obj-$(CONFIG_BLK_DEV_ALI15X3) += alim15x3.o obj-$(CONFIG_BLK_DEV_AMD74XX) += amd74xx.o
drivers/ide/pci/adma100.c deleted +0 -30
@@ -1,30 +0,0 @@ -/* -* linux/drivers/ide/pci/adma100.c -- basic support for Pacific Digital ADMA-100 boards -* -* Created 09 Apr 2002 by Mark Lord -* -* This file is subject to the terms and conditions of the GNU General Public -* License. See the file COPYING in the main directory of this archive for -* more details. -*/ - -#include <linux/mm.h> -#include <linux/blkdev.h> -#include <linux/hdreg.h> -#include <linux/ide.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <asm/io.h> - -void __init ide_init_adma100 (ide_hwif_t *hwif) -{ -unsigned long phy_admctl =pci_resource_start (hwif->pci_dev,4 ) +0x80 + (hwif->channel *0x20 ); -void *v_admctl; - - hwif->autodma =0 ;// not compatible with normal IDE DMA transfers - hwif->dma_base =0 ;// disable DMA completely - hwif->io_ports[IDE_CONTROL_OFFSET ] +=4 ;// chip needs offset of 6 instead of 2 - v_admctl =ioremap_nocache (phy_admctl,1024 );// map config regs, so we can turn on drive IRQs - *((unsigned short *)v_admctl) &=3 ;// enable aIEN; preserve PIO mode -iounmap (v_admctl);// all done; unmap config regs -}
drivers/ide/pci/adma100.h deleted +0 -28
@@ -1,28 +0,0 @@ -#ifndef ADMA_100_H -#define ADMA_100_H - -#include <linux/config.h> -#include <linux/pci.h> -#include <linux/ide.h> - -extern void init_setup_pdcadma (struct pci_dev *,ide_pci_device_t *); -extern unsigned int init_chipset_pdcadma (struct pci_dev *,const char *); -extern void init_hwif_pdcadma (ide_hwif_t *); -extern void init_dma_pdcadma (ide_hwif_t *,unsigned long ); - -static ide_pci_device_t pdcadma_chipsets[]__devinitdata = { - { - .vendor =PCI_VENDOR_ID_PDC , - .device =PCI_DEVICE_ID_PDC_1841 , - .name ="ADMA100" , - .init_setup = init_setup_pdcadma, - .init_chipset = init_chipset_pdcadma, - .init_hwif = init_hwif_pdcadma, - .init_dma = init_dma_pdcadma, - .channels =2 , - .autodma =NODMA , - .bootable =OFF_BOARD , - } -} - -#endif /* ADMA_100_H */
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 01/29] ide: remove adma100
Quoted 7 lines · Tejun Heo
Quoted 5 lines
01_ide_remove_adma100.patch
Removes drivers/ide/pci/adma100.[hc]. The driver isn't compilable (missing functions) and no
Kconfigactually enablesCONFIG_BLK_DEV_ADMA100.Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 02/29] ide: cleanup it8172
In reply to Tejun HeoQuoted 7 lines
02_ide_cleanup_it8172.patch
In
drivers/ide/pci/it8172.h,it8172_ratefilter()andinit_setup_it8172()are declared and the latter is referenced init8172_chipsets. Both functions are not defined or used anywhere. This patch removes the prototypes and reference. it8172 should be compilable now.
drivers/ide/pci/it8172.h +0 -3
@@ -6,7 +6,6 @@#include <linux/ide.h> static u8 it8172_ratemask (ide_drive_t *drive); -static u8 it8172_ratefilter (ide_drive_t *drive,u8 speed);static void it8172_tune_drive (ide_drive_t *drive,u8 pio);static u8 it8172_dma_2_pio (u8 xfer_rate);static int it8172_tune_chipset (ide_drive_t *drive,u8 xferspeed);
@@ -14,14 +13,12 @@ static int it8172_tune_chipset(ide_drivestatic int it8172_config_chipset_for_dma (ide_drive_t *drive);#endif -static void init_setup_it8172 (struct pci_dev *,ide_pci_device_t *);static unsigned int init_chipset_it8172 (struct pci_dev *,const char *);static void init_hwif_it8172 (ide_hwif_t *);static ide_pci_device_t it8172_chipsets[]__devinitdata = { {/* 0 */ .name ="IT8172G" , - .init_setup = init_setup_it8172, .init_chipset = init_chipset_it8172, .init_hwif = init_hwif_it8172, .channels =2 ,
Re: [PATCH 2.6.11-rc2 02/29] ide: cleanup it8172
Quoted 9 lines · Tejun Heo
Quoted 7 lines
02_ide_cleanup_it8172.patch
In
drivers/ide/pci/it8172.h,it8172_ratefilter()andinit_setup_it8172()are declared and the latter is referenced init8172_chipsets. Both functions are not defined or used anywhere. This patch removes the prototypes and reference. it8172 should be compilable now.Signed-off-by Tejun Heo <[email protected]>
applied, also this trivial patch is needed to fix it8172 build:
drivers/ide/pci/it8172.c +2 -2
@@ -56,7 +56,7 @@ {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev; -int is_slave = (hwif->drives[1 ] == drive); +int is_slave = (&hwif->drives[1 ] == drive);unsigned long flags;u16 drive_enables;u32 drive_timing;
@@ -94,7 +94,7 @@ }pci_write_config_word (dev,0x40 , drive_enables); - spin_unlock_irqrestore(&ide_lock, flags) +spin_unlock_irqrestore (&ide_lock, flags); }static u8 it8172_dma_2_pio (u8 xfer_rate)
Re: [PATCH 2.6.11-rc2 03/29] ide: cleanup opti621
In reply to Tejun HeoQuoted 5 lines
03_ide_cleanup_opti621.patch
In drivers/ide/pci/opti612.[hc],
init_setup_opt621()is declared, defined and referenced but never actullay used. Thie patch removes the function.
drivers/ide/pci/opti621.c +0 -5
@@ -348,11 +348,6 @@ static void __init init_hwif_opti621 (id hwif->drives[1 ].autodma = hwif->autodma; } -static int __init init_setup_opti621 (struct pci_dev *dev,ide_pci_device_t *d) -{ -return ide_setup_pci_device (dev, d); -} -static int __devinit opti621_init_one (struct pci_dev *dev,const struct pci_device_id *id) {return ide_setup_pci_device (dev, &opti621_chipsets[id->driver_data]);
drivers/ide/pci/opti621.h +0 -3
@@ -5,13 +5,11 @@#include <linux/pci.h> #include <linux/ide.h> -static int init_setup_opti621 (struct pci_dev *,ide_pci_device_t *);static void init_hwif_opti621 (ide_hwif_t *);static ide_pci_device_t opti621_chipsets[]__devinitdata = { {/* 0 */ .name ="OPTI621" , - .init_setup = init_setup_opti621, .init_hwif = init_hwif_opti621, .channels =2 , .autodma =AUTODMA ,
@@ -19,7 +17,6 @@ static ide_pci_device_t opti621_chipsets .bootable = ON_BOARD, },{ /* 1 */ .name = "OPTI621X", - .init_setup = init_setup_opti621, .init_hwif = init_hwif_opti621, .channels = 2, .autodma = AUTODMA,
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 03/29] ide: cleanup opti621
Quoted 7 lines · Tejun Heo
Quoted 5 lines
03_ide_cleanup_opti621.patch
In drivers/ide/pci/opti612.[hc],
init_setup_opt621()is declared, defined and referenced but never actullay used. Thie patch removes the function.Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 04/29] ide: cleanup piix
In reply to Tejun HeoQuoted 8 lines
04_ide_cleanup_piix.patch
In drivers/ide/pci/piix.[hc],
init_setup_piix()is defined and used but only oneinit_setupfunction is defined and no demultiplexing is done usinginit_setupcallback. As other drivers callide_setup_pci_device()directly in such cases, this patch removesinit_setup_piix()and makespiix_init_one()callide_setup_pci_device()directly.
drivers/ide/pci/piix.c +1 -15
@@ -531,20 +531,6 @@ static void __devinit init_hwif_piix(ide }/** -* init_setup_piix - callback for IDE initialize -* @dev: PIIX PCI device -* @d: IDE pci info -* -* Enable the xp fixup for the PIIX controller and then perform -* a standard ide PCI setup -*/ - -static int __devinit init_setup_piix (struct pci_dev *dev,ide_pci_device_t *d) -{ -return ide_setup_pci_device (dev, d); -} - -/** * piix_init_one - called when a PIIX is found * @dev: the piix device * @id: the matching pci id
@@ -557,7 +543,7 @@ static int __devinit piix_init_one(struc {ide_pci_device_t *d = &piix_pci_info[id->driver_data]; -return d->init_setup (dev, d); +return ide_setup_pci_device (dev, d); }/**
drivers/ide/pci/piix.h +0 -3
@@ -5,14 +5,12 @@#include <linux/pci.h> #include <linux/ide.h> -static int init_setup_piix (struct pci_dev *,ide_pci_device_t *);static unsigned int __devinit init_chipset_piix (struct pci_dev *,const char *);static void init_hwif_piix (ide_hwif_t *);#define DECLARE_PIIX_DEV (name_str) \ { \ .name = name_str, \ - .init_setup = init_setup_piix, \ .init_chipset = init_chipset_piix, \ .init_hwif = init_hwif_piix, \ .channels = 2, \
@@ -32,7 +30,6 @@ static ide_pci_device_t piix_pci_info[] {/* 2 */ .name = "MPIIX", - .init_setup = init_setup_piix, .init_hwif = init_hwif_piix, .channels = 2, .autodma = NODMA,
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 04/29] ide: cleanup piix
Quoted 10 lines · Tejun Heo
Quoted 8 lines
04_ide_cleanup_piix.patch
In drivers/ide/pci/piix.[hc],
init_setup_piix()is defined and used but only oneinit_setupfunction is defined and no demultiplexing is done usinginit_setupcallback. As other drivers callide_setup_pci_device()directly in such cases, this patch removesinit_setup_piix()and makespiix_init_one()callide_setup_pci_device()directly.Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 05/29] ide: merge pci driver .h's into .c's
In reply to Tejun HeoQuoted 12 lines
05_ide_merge_pci_driver_hc.patch
Merges
drivers/ide/pci/*.hfiles into their corresponding *.c files. Rationales are
1. There's no reason to separate pci drivers into header and body. No header file is shared and they're simple enough.
2. structpde_pci_device_t*_chipsets[] are _defined_ in the header files. That isn't the custom and there's no good reason to do differently in these drivers.
3. Tracking changelogs shows that the bugs fixed by 00 and 01 are introduced during mass-updating ide pci drivers by forgetting to update *.h files.
drivers/ide/pci/aec62xx.c +107 -1
@@ -16,7 +16,61 @@#include <asm/io.h> -#include "aec62xx.h" +struct chipset_bus_clock_list_entry { +byte xfer_speed; +byte chipset_settings; +byte ultra_settings; +}; + +static struct chipset_bus_clock_list_entry aec6xxx_33_base [] = { + {XFER_UDMA_6 ,0x31 ,0x07 }, + {XFER_UDMA_5 ,0x31 ,0x06 }, + {XFER_UDMA_4 ,0x31 ,0x05 }, + {XFER_UDMA_3 ,0x31 ,0x04 }, + {XFER_UDMA_2 ,0x31 ,0x03 }, + {XFER_UDMA_1 ,0x31 ,0x02 }, + {XFER_UDMA_0 ,0x31 ,0x01 }, + + {XFER_MW_DMA_2 ,0x31 ,0x00 }, + {XFER_MW_DMA_1 ,0x31 ,0x00 }, + {XFER_MW_DMA_0 ,0x0a ,0x00 }, + {XFER_PIO_4 ,0x31 ,0x00 }, + {XFER_PIO_3 ,0x33 ,0x00 }, + {XFER_PIO_2 ,0x08 ,0x00 }, + {XFER_PIO_1 ,0x0a ,0x00 }, + {XFER_PIO_0 ,0x00 ,0x00 }, + {0 ,0x00 ,0x00 } +}; + +static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { + {XFER_UDMA_6 ,0x41 ,0x06 }, + {XFER_UDMA_5 ,0x41 ,0x05 }, + {XFER_UDMA_4 ,0x41 ,0x04 }, + {XFER_UDMA_3 ,0x41 ,0x03 }, + {XFER_UDMA_2 ,0x41 ,0x02 }, + {XFER_UDMA_1 ,0x41 ,0x01 }, + {XFER_UDMA_0 ,0x41 ,0x01 }, + + {XFER_MW_DMA_2 ,0x41 ,0x00 }, + {XFER_MW_DMA_1 ,0x42 ,0x00 }, + {XFER_MW_DMA_0 ,0x7a ,0x00 }, + {XFER_PIO_4 ,0x41 ,0x00 }, + {XFER_PIO_3 ,0x43 ,0x00 }, + {XFER_PIO_2 ,0x78 ,0x00 }, + {XFER_PIO_1 ,0x7a ,0x00 }, + {XFER_PIO_0 ,0x70 ,0x00 }, + {0 ,0x00 ,0x00 } +}; + +#ifndef SPLIT_BYTE +#define SPLIT_BYTE (B ,H ,L ) ((H)=(B>>4), (L)=(B-((B>>4)<<4))) +#endif +#ifndef MAKE_WORD +#define MAKE_WORD (W ,HB ,LB ) ((W)=((HB<<8)+LB)) +#endif + +#define BUSCLOCK (D ) \ + ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D)))#if 0 if (dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) {
@@ -343,6 +397,58 @@ static int __devinit init_setup_aec6x80(return ide_setup_pci_device (dev, d); } +static ide_pci_device_t aec62xx_chipsets[]__devinitdata = { + {/* 0 */ + .name ="AEC6210" , + .init_setup = init_setup_aec62xx, + .init_chipset = init_chipset_aec62xx, + .init_hwif = init_hwif_aec62xx, + .init_dma = init_dma_aec62xx, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x4a ,0x02 ,0x02 }, {0x4a ,0x04 ,0x04 }}, + .bootable =OFF_BOARD , + },{/* 1 */ + .name ="AEC6260" , + .init_setup = init_setup_aec62xx, + .init_chipset = init_chipset_aec62xx, + .init_hwif = init_hwif_aec62xx, + .init_dma = init_dma_aec62xx, + .channels =2 , + .autodma =NOAUTODMA , + .bootable =OFF_BOARD , + },{/* 2 */ + .name ="AEC6260R" , + .init_setup = init_setup_aec62xx, + .init_chipset = init_chipset_aec62xx, + .init_hwif = init_hwif_aec62xx, + .init_dma = init_dma_aec62xx, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x4a ,0x02 ,0x02 }, {0x4a ,0x04 ,0x04 }}, + .bootable =NEVER_BOARD , + },{/* 3 */ + .name ="AEC6X80" , + .init_setup = init_setup_aec6x80, + .init_chipset = init_chipset_aec62xx, + .init_hwif = init_hwif_aec62xx, + .init_dma = init_dma_aec62xx, + .channels =2 , + .autodma =AUTODMA , + .bootable =OFF_BOARD , + },{/* 4 */ + .name ="AEC6X80R" , + .init_setup = init_setup_aec6x80, + .init_chipset = init_chipset_aec62xx, + .init_hwif = init_hwif_aec62xx, + .init_dma = init_dma_aec62xx, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x4a ,0x02 ,0x02 }, {0x4a ,0x04 ,0x04 }}, + .bootable =OFF_BOARD , + } +}; +/** * aec62xx_init_one - called when a AEC is found * @dev: the aec62xx device
drivers/ide/pci/aec62xx.h deleted +0 -122
122 lines not on this page · raw message
drivers/ide/pci/cmd64x.c +83 -1
96 lines not on this page · raw message
drivers/ide/pci/cmd64x.h deleted +0 -95
95 lines not on this page · raw message
drivers/ide/pci/cy82c693.c +70 -1
83 lines not on this page · raw message
drivers/ide/pci/cy82c693.h deleted +0 -83
83 lines not on this page · raw message
drivers/ide/pci/generic.c +109 -2
123 lines not on this page · raw message
drivers/ide/pci/generic.h deleted +0 -120
120 lines not on this page · raw message
drivers/ide/pci/hpt366.c +466 -1
479 lines not on this page · raw message
drivers/ide/pci/hpt366.h deleted +0 -483
483 lines not on this page · raw message
drivers/ide/pci/it8172.c +12 -2
@@ -42,8 +42,6 @@#include <asm/io.h> #include <asm/it8172/it8172_int.h> -#include "it8172.h" -/* * Prototypes */
@@ -266,6 +264,18 @@ static void __init init_hwif_it8172 (ide hwif->drives[1 ].autodma = hwif->autodma; } +static ide_pci_device_t it8172_chipsets[]__devinitdata = { + {/* 0 */ + .name ="IT8172G" , + .init_chipset = init_chipset_it8172, + .init_hwif = init_hwif_it8172, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x00 ,0x00 ,0x00 }, {0x40 ,0x00 ,0x01 }}, + .bootable =ON_BOARD , + } +}; +static int __devinit it8172_init_one (struct pci_dev *dev,const struct pci_device_id *id) { if ((!(PCI_FUNC(dev->devfn) & 1) ||
drivers/ide/pci/it8172.h deleted +0 -31
@@ -1,31 +0,0 @@ -#ifndef ITE8172G_H -#define ITE8172G_H - -#include <linux/config.h> -#include <linux/pci.h> -#include <linux/ide.h> - -static u8 it8172_ratemask (ide_drive_t *drive); -static void it8172_tune_drive (ide_drive_t *drive,u8 pio); -static u8 it8172_dma_2_pio (u8 xfer_rate); -static int it8172_tune_chipset (ide_drive_t *drive,u8 xferspeed); -#ifdef CONFIG_BLK_DEV_IDEDMA -static int it8172_config_chipset_for_dma (ide_drive_t *drive); -#endif - -static unsigned int init_chipset_it8172 (struct pci_dev *,const char *); -static void init_hwif_it8172 (ide_hwif_t *); - -static ide_pci_device_t it8172_chipsets[]__devinitdata = { - {/* 0 */ - .name ="IT8172G" , - .init_chipset = init_chipset_it8172, - .init_hwif = init_hwif_it8172, - .channels =2 , - .autodma =AUTODMA , - .enablebits = {{0x00 ,0x00 ,0x00 }, {0x40 ,0x00 ,0x01 }}, - .bootable =ON_BOARD , - } -}; - -#endif /* ITE8172G_H */
drivers/ide/pci/opti621.c +18 -2
@@ -104,8 +104,6 @@#include <asm/io.h> -#include "opti621.h" -#define OPTI621_MAX_PIO 3/* In fact, I do not have any PIO 4 drive * (address: 25 ns, data: 70 ns, recovery: 35 ns),
@@ -348,6 +346,24 @@ static void __init init_hwif_opti621 (id hwif->drives[1 ].autodma = hwif->autodma; } +static ide_pci_device_t opti621_chipsets[]__devinitdata = { + {/* 0 */ + .name ="OPTI621" , + .init_hwif = init_hwif_opti621, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x45 ,0x80 ,0x00 }, {0x40 ,0x08 ,0x00 }}, + .bootable =ON_BOARD , + },{/* 1 */ + .name ="OPTI621X" , + .init_hwif = init_hwif_opti621, + .channels =2 , + .autodma =AUTODMA , + .enablebits = {{0x45 ,0x80 ,0x00 }, {0x40 ,0x08 ,0x00 }}, + .bootable =ON_BOARD , + } +}; +static int __devinit opti621_init_one (struct pci_dev *dev,const struct pci_device_id *id) {return ide_setup_pci_device (dev, &opti621_chipsets[id->driver_data]);
drivers/ide/pci/opti621.h deleted +0 -28
@@ -1,28 +0,0 @@ -#ifndef OPTI621_H -#define OPTI621_H - -#include <linux/config.h> -#include <linux/pci.h> -#include <linux/ide.h> - -static void init_hwif_opti621 (ide_hwif_t *); - -static ide_pci_device_t opti621_chipsets[]__devinitdata = { - {/* 0 */ - .name ="OPTI621" , - .init_hwif = init_hwif_opti621, - .channels =2 , - .autodma =AUTODMA , - .enablebits = {{0x45 ,0x80 ,0x00 }, {0x40 ,0x08 ,0x00 }}, - .bootable =ON_BOARD , - },{/* 1 */ - .name ="OPTI621X" , - .init_hwif = init_hwif_opti621, - .channels =2 , - .autodma =AUTODMA , - .enablebits = {{0x45 ,0x80 ,0x00 }, {0x40 ,0x08 ,0x00 }}, - .bootable =ON_BOARD , - } -}; - -#endif /* OPTI621_H */
drivers/ide/pci/pdc202xx_new.c +104 -2
120 lines not on this page · raw message
drivers/ide/pci/pdc202xx_new.h deleted +0 -118
118 lines not on this page · raw message
drivers/ide/pci/pdc202xx_old.c +128 -2
143 lines not on this page · raw message
drivers/ide/pci/pdc202xx_old.h deleted +0 -144
144 lines not on this page · raw message
drivers/ide/pci/piix.c +50 -2
64 lines not on this page · raw message
drivers/ide/pci/piix.h deleted +0 -62
62 lines not on this page · raw message
drivers/ide/pci/serverworks.c +56 -1
69 lines not on this page · raw message
drivers/ide/pci/serverworks.h deleted +0 -69
69 lines not on this page · raw message
Re: [PATCH 2.6.11-rc2 05/29] ide: merge pci driver .h's into .c's
Quoted 13 lines · Tejun Heo
Quoted 12 lines
05_ide_merge_pci_driver_hc.patch
Merges
drivers/ide/pci/*.hfiles into their corresponding *.c files. Rationales are
1. There's no reason to separate pci drivers into header and body. No header file is shared and they're simple enough.
2. structpde_pci_device_t*_chipsets[] are _defined_ in the header files. That isn't the custom and there's no good reason to do differently in these drivers.
3. Tracking changelogs shows that the bugs fixed by 00 and 01 are introduced during mass-updating ide pci drivers by forgetting to update *.h files.
Quoted 1 line
Signed-off-by Tejun Heo <[email protected]>
Please kill crap in these .h files before mering them with .c files, also split this patch on per driver changes.
crap example looks like this: ;)
Quoted 6 lines
drivers/ide/pci/aec62xx.c +6
-0+#ifndef SPLIT_BYTE +#define SPLIT_BYTE (B ,H ,L ) ((H)=(B>>4), (L)=(B-((B>>4)<<4))) +#endif +#ifndef MAKE_WORD +#define MAKE_WORD (W ,HB ,LB ) ((W)=((HB<<8)+LB)) +#endif
Re: [PATCH 2.6.11-rc2 06/29] ide: IDE_CONTROL_REG cleanup
In reply to Tejun HeoQuoted 4 lines
06_ide_start_request_IDE_CONTROL_REG.patch
Replaced HWIF(drive)->io_ports[IDE_CONTROL_OFFSET] with equivalent IDE_CONTROL_REG in ide-io.c.
drivers/ide/ide-io.c +1 -1
@@ -884,7 +884,7 @@ static ide_startstop_t start_request (idif (rc)printk (KERN_WARNING "%s: bus not ready on wakeup\n" , drive->name);SELECT_DRIVE (drive); -HWIF (drive)->OUTB (8 ,HWIF (drive)->io_ports[IDE_CONTROL_OFFSET ]); +HWIF (drive)->OUTB (8 ,IDE_CONTROL_REG ); rc =ide_wait_not_busy (HWIF (drive),10000 );if (rc)printk (KERN_WARNING "%s: drive not ready on wakeup\n" , drive->name);
Re: [PATCH 2.6.11-rc2 06/29] ide: IDE_CONTROL_REG cleanup
Quoted 12 lines · Tejun Heo
Quoted 4 lines
06_ide_start_request_IDE_CONTROL_REG.patch
Replaced HWIF(drive)->io_ports[IDE_CONTROL_OFFSET] with equivalent
IDE_CONTROL_REGinide-io.c.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-io.c
===================================================================
drivers/ide/ide-io.c 2005-02-02 10:28:03.340503581 +0900 static ide_startstop_t start_request (id · line 890
Quoted 8 lines
drivers/ide/ide-io.c 2005-02-02 10:28:03.340503581 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:27:15.996184821 +0900 +1
-1@@ -884,7 +884,7 @@ static ide_startstop_t start_request (id if (rc) printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); SELECT_DRIVE(drive); - HWIF(drive)->OUTB(8, HWIF(drive)->io_ports[IDE_CONTROL_OFFSET]); + HWIF(drive)->OUTB(8, IDE_CONTROL_REG); rc = ide_wait_not_busy(HWIF(drive), 10000); if (rc) printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
IDE_CONTROL_REG macro and co. are obfuscations and should die...
Re: [PATCH 2.6.11-rc2 07/29] ide: ide_reg_valid_t endian fix
In reply to Tejun HeoQuoted 12 lines
07_ide_reg_valid_t_endian_fix.patch
ide_reg_valid_tcontains bitfield flags but doesn't reverse bit orders using __*_ENDIAN_BITFIELD macros. And constants foride_reg_valid_t, IDE_{TASKFILE|HOB}_STD_{IN|OUT}_FLAGS, are defined as byte values which are correct only on little-endian machines. This patch defines reversed constants and .h byte union structure to make things correct on big endian machines. The only code which uses above macros is inflagged_taskfile()and the code is currently unused, so this patch doesn't change any behavior. (The code will get used in later patches.)
drivers/ide/ide-taskfile.c +4 -4
@@ -794,15 +794,15 @@ ide_startstop_t flagged_taskfile (ide_dr* write and read the hob registers (sector,nsector,lcyl,hcyl) */ if (task->tf_out_flags.all ==0 ) { - task->tf_out_flags.all =IDE_TASKFILE_STD_OUT_FLAGS ; + task->tf_out_flags.h.taskfile =IDE_TASKFILE_STD_OUT_FLAGS ;if (drive->addressing ==1 ) - task->tf_out_flags.all |= (IDE_HOB_STD_OUT_FLAGS <<8 ); + task->tf_out_flags.h.hob =IDE_HOB_STD_OUT_FLAGS ; }if (task->tf_in_flags.all ==0 ) { - task->tf_in_flags.all =IDE_TASKFILE_STD_IN_FLAGS ; + task->tf_in_flags.h.taskfile =IDE_TASKFILE_STD_IN_FLAGS ;if (drive->addressing ==1 ) - task->tf_in_flags.all |= (IDE_HOB_STD_IN_FLAGS <<8 ); + task->tf_in_flags.h.hob =IDE_HOB_STD_IN_FLAGS ; }/* ALL Command Block Executions SHALL clear nIEN, unless otherwise */
include/linux/hdreg.h +21 -0
@@ -1,6 +1,8 @@#ifndef _LINUX_HDREG_H#define _LINUX_HDREG_H +#include <asm/byteorder.h> +#ifdef __KERNEL__#include <linux/ata.h>
@@ -79,11 +81,26 @@/* * Define standard taskfile in/out register +* +* ide_reg_valid_t should have been defined conditionally using +* __*_ENDIAN_BITFIELD macros. But ide_reg_valid_t and the following +* macros are already out in the wild. Defining reversed constants on +* big endian machines and adding .h.{taskfile|hob} to ide_reg_valid_t +* seem to be the least disrupting solution. - tj */ +#if defined(__LITTLE_ENDIAN_BITFIELD)#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE#define IDE_TASKFILE_STD_IN_FLAGS 0xFE#define IDE_HOB_STD_OUT_FLAGS 0x3C#define IDE_HOB_STD_IN_FLAGS 0x3C +#elif defined(__BIG_ENDIAN_BITFIELD) +#define IDE_TASKFILE_STD_OUT_FLAGS 0x7F +#define IDE_TASKFILE_STD_IN_FLAGS 0x7F +#define IDE_HOB_STD_OUT_FLAGS 0x3C +#define IDE_HOB_STD_IN_FLAGS 0x3C +#else +#error "Please fix <asm/byteorder.h>" +#endif typedef unsigned char task_ioreg_t ;typedef unsigned long sata_ioreg_t ;
@@ -91,6 +108,10 @@ typedef unsigned long sata_ioreg_t; typedef union ide_reg_valid_s { unsigned all : 16; struct { + unsigned taskfile : 8; + unsigned hob : 8; + } h; + struct { unsigned data : 1; unsigned error_feature : 1; unsigned sector : 1;
Quoted 4 lines
08_ide_do_identify_model_string_termination.patch
Terminates id->model string before invoking strstr() in do_identify().
drivers/ide/ide-probe.c +3 -2
@@ -165,11 +165,12 @@ static inline void do_identify (ide_drivide_fixstring (id->fw_rev,sizeof (id->fw_rev), bswap);ide_fixstring (id->serial_no,sizeof (id->serial_no), bswap); +/* we depend on this a lot! */ + id->model[sizeof (id->model)-1 ] ='\0' ; +if (strstr (id->model,"E X A B Y T E N E S T" )) goto err_misc; -/* we depend on this a lot! */ - id->model[sizeof (id->model)-1 ] ='\0' ;printk ("%s: %s, " , drive->name, id->model); drive->present =1 ; drive->dead =0 ;
Re: [PATCH 2.6.11-rc2 08/29] ide: do_identify() string termination fix
Sorry, this is the same 08 patch with the correct subject line.
Quoted 4 lines
08_ide_do_identify_model_string_termination.patch
Terminates id->model string before invoking strstr() in do_identify().
drivers/ide/ide-probe.c +3 -2
@@ -165,11 +165,12 @@ static inline void do_identify (ide_drivide_fixstring (id->fw_rev,sizeof (id->fw_rev), bswap);ide_fixstring (id->serial_no,sizeof (id->serial_no), bswap); +/* we depend on this a lot! */ + id->model[sizeof (id->model)-1 ] ='\0' ; +if (strstr (id->model,"E X A B Y T E N E S T" )) goto err_misc; -/* we depend on this a lot! */ - id->model[sizeof (id->model)-1 ] ='\0' ;printk ("%s: %s, " , drive->name, id->model); drive->present =1 ; drive->dead =0 ;
Re: [PATCH 2.6.11-rc2 09/29] ide: __ide_do_rw_disk() lba48 dma check fix
In reply to Tejun HeoQuoted 5 lines
09_ide_do_rw_disk_lba48_dma_check_fix.patch
In __ide_do_rw_disk(), the shifted block, instead of the original rq->sector, should be used when checking range for lba48 dma.
drivers/ide/ide-disk.c +1 -1
@@ -132,7 +132,7 @@ ide_startstop_t __ide_do_rw_disk (ide_dr nsectors.all = (u16 ) rq->nr_sectors;if (hwif->no_lba48_dma && lba48 && dma) { -if (rq->sector + rq->nr_sectors >1ULL <<28 ) +if (block + rq->nr_sectors >1ULL <<28 ) dma =0 ; }
Re: [PATCH 2.6.11-rc2 09/29] ide: __ide_do_rw_disk() lba48 dma check fix
Quoted 7 lines · Tejun Heo
Quoted 5 lines
09_ide_do_rw_disk_lba48_dma_check_fix.patch
In __ide_do_rw_disk(), the shifted block, instead of the original rq->sector, should be used when checking range for lba48 dma.Signed-off-by Tejun Heo <[email protected]>
good catch! applied
Re: [PATCH 2.6.11-rc2 10/29] ide: __ide_do_rw_disk() return value fix
In reply to Tejun HeoQuoted 7 lines
10_ide_do_rw_disk_pre_task_out_intr_return_fix.patch
In
__ide_do_rw_disk(),ide_startedused to be returned blindly after issusing PIO write. This can cause hang ifpre_task_out_intr()returnside_stoppeddue to failedide_wait_stat()test. Fixed to pass the return value ofpre_task_out_intr().
drivers/ide/ide-disk.c +1 -2
@@ -253,8 +253,7 @@ ide_startstop_t __ide_do_rw_disk (ide_dr/* FIXME: ->OUTBSYNC ? */ hwif->OUTB (command,IDE_COMMAND_REG ); -pre_task_out_intr (drive, rq); -return ide_started; +return pre_task_out_intr (drive, rq); } }EXPORT_SYMBOL_GPL (__ide_do_rw_disk);
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 10/29] ide: __ide_do_rw_disk() return value fix
Quoted 9 lines · Tejun Heo
Quoted 7 lines
10_ide_do_rw_disk_pre_task_out_intr_return_fix.patch
In
__ide_do_rw_disk(),ide_startedused to be returned blindly after issusing PIO write. This can cause hang ifpre_task_out_intr()returnside_stoppeddue to failedide_wait_stat()test. Fixed to pass the return value ofpre_task_out_intr().Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
In reply to Tejun HeoQuoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
drivers/ide/ide-io.c +15 -12
@@ -933,6 +933,7 @@ void ide_stall_queue (ide_drive_t *driveif (timeout >WAIT_WORSTCASE ) timeout =WAIT_WORSTCASE ; drive->sleep = timeout + jiffies; + drive->sleeping =1 ; }EXPORT_SYMBOL (ide_stall_queue);
@@ -972,18 +973,18 @@ repeat: }do { -if ((!drive->sleep ||time_after_eq (jiffies, drive->sleep)) +if ((!drive->sleeping ||time_after_eq (jiffies, drive->sleep)) && !elv_queue_empty (drive->queue)) {if (!best - || (drive->sleep && (!best->sleep ||0 < (signed long )(best->sleep - drive->sleep))) - || (!best->sleep &&0 < (signed long )(WAKEUP (best) -WAKEUP (drive)))) + || (drive->sleeping && (!best->sleeping ||time_before (drive->sleep, best->sleep))) + || (!best->sleeping &&time_before (WAKEUP (drive),WAKEUP (best)))) {if (!blk_queue_plugged (drive->queue)) best = drive; } } }while ((drive = drive->next) != hwgroup->drive); -if (best && best->nice1 && !best->sleep && best != hwgroup->drive && best->service_time >WAIT_MIN_SLEEP ) { +if (best && best->nice1 && !best->sleeping && best != hwgroup->drive && best->service_time >WAIT_MIN_SLEEP ) {long t = (signed long )(WAKEUP (best) - jiffies);if (t >=WAIT_MIN_SLEEP ) {/*
@@ -992,10 +993,9 @@ repeat:*/ drive = best->next; do { - if (!drive->sleep - /* FIXME: use time_before */ - && 0 < (signed long)(WAKEUP(drive) - (jiffies - best->service_time)) - && 0 < (signed long)((jiffies + t) - WAKEUP(drive))) + if (!drive->sleeping + && time_before(jiffies - best->service_time, WAKEUP(drive)) + && time_before(WAKEUP(drive), jiffies + t)) { ide_stall_queue(best, min_t(long, t, 10 * WAIT_MIN_SLEEP)); goto repeat;
@@ -1058,14 +1058,17 @@ static void ide_do_request (ide_hwgroup_ hwgroup->busy =1 ; drive =choose_drive (hwgroup);if (drive ==NULL ) { -unsigned long sleep =0 ; +int sleeping =0 ; +unsigned long sleep =0 ;/* shut up, gcc */ hwgroup->rq =NULL ; drive = hwgroup->drive;do { -if (drive->sleep && (!sleep ||0 < (signed long )(sleep - drive->sleep))) +if (drive->sleeping && (!sleeping ||time_before (drive->sleep, sleep))) { + sleeping =1 ; sleep = drive->sleep; + } }while ((drive = drive->next) != hwgroup->drive); -if (sleep) { +if (sleeping) {/* * Take a short snooze, and then wake up this hwgroup again. * This gives other hwgroups on the same a chance to
@@ -1105,7 +1108,7 @@ static void ide_do_request (ide_hwgroup_ } hwgroup->hwif = hwif; hwgroup->drive = drive; - drive->sleep =0 ; + drive->sleeping =0 ; drive->service_start = jiffies;if (blk_queue_plugged (drive->queue)) {
include/linux/ide.h +1 -0
@@ -721,6 +721,7 @@ typedef struct ide_drive_s {* 3=64-bit */ unsigned scsi : 1; /* 0=default, 1=ide-scsi emulation */ + unsigned sleeping : 1; /* 1=sleeping & sleep field valid */u8 quirk_list;/* considered quirky, set for a specific host */ u8 init_speed;/* transfer rate set at boot */
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS drive->sleep is either '0' or 'timeout + jiffies' (always > 0)
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 11 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)
Hmm, what if jiffies + timeout == 0?
Signature · 1 line
Jens Axboe
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 10 lines · Jens Axboe
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Quoted 4 lines
Quoted 2 lines
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)Hmm, what if jiffies + timeout == 0?
Hm, jiffies is unsigned and timeout is always > 0 but this is still possible if jiffies + timeout wraps, right?
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 11 lines · Bartlomiej Zolnierkiewicz
Quoted 10 lines · Jens Axboe
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)Hmm, what if jiffies + timeout == 0?
Hm, jiffies is unsigned and timeout is always > 0 but this is still possible if jiffies + timeout wraps, right?
Precisely, if jiffies is exactly 'timeout' away from wrapping to 0 it could happen. So I think the fix looks sane.
Signature · 1 line
Jens Axboe
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 15 lines · Jens Axboe
Quoted 14 lines · Bartlomiej Zolnierkiewicz
Quoted 13 lines · Jens Axboe
Quoted 11 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Hmm, what if jiffies + timeout == 0?
Hm, jiffies is unsigned and timeout is always > 0 but this is still possible if jiffies + timeout wraps, right?
Precisely, if jiffies is exactly 'timeout' away from wrapping to 0 it could happen. So I think the fix looks sane.
agreed
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 23 lines · Bartlomiej Zolnierkiewicz
Quoted 21 lines · Jens Axboe
Quoted 19 lines · Bartlomiej Zolnierkiewicz
Quoted 16 lines · Jens Axboe
Quoted 4 lines · Bartlomiej Zolnierkiewicz
Quoted 2 lines · Tejun Heo
Quoted 2 lines
11_ide_drive_sleeping_fix.patch
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)Hmm, what if jiffies + timeout == 0?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Hm, jiffies is unsigned and timeout is always > 0 but this is still possible if jiffies + timeout wraps, right?
Precisely, if jiffies is exactly 'timeout' away from wrapping to 0 it could happen. So I think the fix looks sane.
agreed
Actually, jiffies is initialized to INITIAL_JIFFIES which is defined in such a way that it overflows after 5 min after boot to help finding bugs related to jiffies wrap. So, the chance of something weird happening in the bugs fixed in patches 11 and 12 isn't that exteremely slim. :-)
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
Quoted 31 lines · Tejun Heo
Quoted 30 lines · Bartlomiej Zolnierkiewicz
Quoted 26 lines · Jens Axboe
Quoted 14 lines · Bartlomiej Zolnierkiewicz
Quoted 12 lines · Jens Axboe
Quoted 10 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Same question as for "add ide_hwgroup_t.polling" patch. AFAICS
drive->sleepis either '0' or 'timeout + jiffies' (always > 0)Hmm, what if jiffies + timeout == 0?
Hm, jiffies is unsigned and timeout is always > 0 but this is still possible if jiffies + timeout wraps, right?
Precisely, if jiffies is exactly 'timeout' away from wrapping to 0 it could happen. So I think the fix looks sane.
Quoted 6 lines
Quoted 1 line
agreed
Actually, jiffies is initialized to
INITIAL_JIFFIESwhich is defined in such a way that it overflows after 5 min after boot to help finding bugs related to jiffies wrap. So, the chance of something weird happening in the bugs fixed in patches 11 and 12 isn't that exteremely slim. :-)
And repeat after 49 days, sure. But the odds of it triggering are still extremely slim :)
Signature · 1 line
Jens Axboe
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 11/29] ide: add ide_drive_t.sleeping
In reply to Tejun HeoQuoted 9 lines · Tejun Heo
Quoted 7 lines
11_ide_drive_sleeping_fix.patch
ide_drive_t.sleeping field added. 0 in sleep field used to indicate inactive sleeping but because 0 is a valid jiffy value, though slim, there's a chance that something can go weird. And while at it, explicit jiffy comparisons are converted to use time_{after|before} macros.
Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 12/29] ide: add ide_hwgroup_t.polling
In reply to Tejun HeoQuoted 6 lines
12_ide_hwgroup_t_polling.patch
ide_hwgroup_t.polling field added. 0 in
poll_timeoutfield used to indicate inactive polling but because 0 is a valid jiffy value, though slim, there's a chance that something weird can happen.
drivers/ide/ide-io.c +2 -3
@@ -1314,7 +1314,7 @@ void ide_timer_expiry (unsigned long dat/* local CPU only, * as if we were handling an interrupt */ local_irq_disable (); -if (hwgroup->poll_timeout !=0 ) { +if (hwgroup->polling) { startstop =handler (drive); }else if (drive_is_ready (drive)) {if (drive->waiting_for_dma)
@@ -1442,8 +1442,7 @@ irqreturn_t ide_intr (int irq, void *devreturn IRQ_NONE ; } -if ((handler = hwgroup->handler) ==NULL || - hwgroup->poll_timeout !=0 ) { +if ((handler = hwgroup->handler) ==NULL || hwgroup->polling) {/* * Not expecting an interrupt from this drive. * That means this could be:
drivers/ide/ide-iops.c +5 -3
@@ -1028,14 +1028,14 @@ static ide_startstop_t atapi_reset_pollfreturn ide_started; }/* end of polling */ - hwgroup->poll_timeout =0 ; + hwgroup->polling =0 ;printk ("%s: ATAPI reset timed-out, status=0x%02x\n" , drive->name, stat);/* do it the old fashioned way */ return do_reset1 (drive,1 ); }/* done polling */ - hwgroup->poll_timeout =0 ; + hwgroup->polling =0 ;return ide_stopped; }
@@ -1095,7 +1095,7 @@ static ide_startstop_t reset_pollfunc (iprintk ("\n" ); } } - hwgroup->poll_timeout =0 ;/* done polling */ + hwgroup->polling =0 ;/* done polling */ return ide_stopped; }
@@ -1170,6 +1170,7 @@ static ide_startstop_t do_reset1 (ide_drudelay (20 ); hwif->OUTB (WIN_SRST ,IDE_COMMAND_REG ); hwgroup->poll_timeout = jiffies +WAIT_WORSTCASE ; + hwgroup->polling =1 ;__ide_set_handler (drive, &atapi_reset_pollfunc,HZ /20 ,NULL );spin_unlock_irqrestore (&ide_lock, flags);return ide_started;
@@ -1210,6 +1211,7 @@ static ide_startstop_t do_reset1 (ide_dr/* more than enough time */ udelay (10 ); hwgroup->poll_timeout = jiffies +WAIT_WORSTCASE ; + hwgroup->polling =1 ;__ide_set_handler (drive, &reset_pollfunc,HZ /20 ,NULL );/*
drivers/ide/pci/siimage.c +1 -1
@@ -590,7 +590,7 @@ static int siimage_reset_poll (ide_driveif ((hwif->INL (SATA_STATUS_REG ) &0x03 ) !=0x03 ) {printk (KERN_WARNING "%s: reset phy dead, status=0x%08x\n" , hwif->name, hwif->INL (SATA_STATUS_REG )); -HWGROUP (drive)->poll_timeout =0 ; +HWGROUP (drive)->polling =0 ;return ide_started; }return 0 ;
include/linux/ide.h +3 -1
@@ -938,7 +938,9 @@ typedef struct hwgroup_s {/* BOOL: protects all fields below */ volatile int busy;/* BOOL: wake us up on timer expiry */ -int sleeping; + int sleeping : 1; +/* BOOL: polling active & poll_timeout field valid */ + int polling : 1;/* current drive */ ide_drive_t *drive;/* ptr to current hwif in linked-list */
Re: [PATCH 2.6.11-rc2 12/29] ide: add ide_hwgroup_t.polling
Quoted 6 lines · Tejun Heo
Quoted 6 lines
12_ide_hwgroup_t_polling.patch
ide_hwgroup_t.polling field added. 0 in
poll_timeoutfield used to indicate inactive polling but because 0 is a valid jiffy value, though slim, there's a chance that something weird can happen.
Is there really a possibility of something weird?
I'm not claiming that I like this way of coding but poll_timeout is assigned either to '0' or to 'jiffies + WAIT_WORSTCASE'.
Bartlomiej
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 12/29] ide: add ide_hwgroup_t.polling
In reply to Tejun HeoQuoted 8 lines · Tejun Heo
Quoted 6 lines
12_ide_hwgroup_t_polling.patch
ide_hwgroup_t.polling field added. 0 in
poll_timeoutfield used to indicate inactive polling but because 0 is a valid jiffy value, though slim, there's a chance that something weird can happen.Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 13/29] ide: use time_after() macro
In reply to Tejun HeoQuoted 3 lines
13_ide_tape_time_after.patch
Explicit jiffy comparision converted to
time_after()macro.
drivers/ide/ide-tape.c +1 -1
@@ -2439,7 +2439,7 @@ static ide_startstop_t idetape_do_reques tape->dsc_polling_start = jiffies; tape->dsc_polling_frequency = tape->best_dsc_rw_frequency; tape->dsc_timeout = jiffies +IDETAPE_DSC_RW_TIMEOUT ; - }else if ((signed long ) (jiffies - tape->dsc_timeout) >0 ) { + }else if (time_after (jiffies, tape->dsc_timeout)) {printk (KERN_ERR "ide-tape: %s: DSC timeout\n" , tape->name);if (rq->cmd[0 ] &REQ_IDETAPE_PC2 ) {
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 13/29] ide: use time_after() macro
Quoted 5 lines · Tejun Heo
Quoted 3 lines
13_ide_tape_time_after.patch
Explicit jiffy comparision converted to
time_after()macro.Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 14/29] ide: remove NULL checking in ide_error()
In reply to Tejun HeoQuoted 4 lines
14_ide_error_remove_NULL_test.patch
In
ide_error(), drive cannot be NULL.ide_dump_status()can't handle NULL drive.
drivers/ide/ide-io.c +1 -1
@@ -555,7 +555,7 @@ ide_startstop_t ide_error (ide_drive_t * err =ide_dump_status (drive, msg, stat); -if (drive ==NULL || (rq =HWGROUP (drive)->rq) ==NULL ) +if ((rq =HWGROUP (drive)->rq) ==NULL )return ide_stopped;/* retry only "normal" I/O: */
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 14/29] ide: remove NULL checking in ide_error()
Quoted 4 lines · Tejun Heo
Quoted 4 lines
14_ide_error_remove_NULL_test.patch
In
ide_error(), drive cannot be NULL.ide_dump_status()can't handle NULL drive.
applied, you missed Signed-off-by line
Re: [PATCH 2.6.11-rc2 15/29] ide: flagged_taskfile() data byte order fix
In reply to Tejun HeoQuoted 8 lines
15_ide_flagged_taskfile_data_byte_order_fix.patch
In
flagged_taskfile(), when writing data register,taskfile->datagoes to the lower byte andhobfile->datagoes to the upper byte on little endian machines and the opposite happens on big endian machines. This patch maketaskfile->dataalways go to the lower byte regardless of endianess.
drivers/ide/ide-taskfile.c +3 -1
@@ -823,7 +823,9 @@ ide_startstop_t flagged_taskfile (ide_drif (task->tf_out_flags.b.data) {u16 data = taskfile->data + (hobfile->data <<8 ); - hwif->OUTW (data,IDE_DATA_REG ); +/* We want hobfile->data to go to the upper address, +so the cpu_to_le16(). - tj */ + hwif->OUTW (cpu_to_le16 (data),IDE_DATA_REG ); }/* (ks) send hob registers first */
Re: [PATCH 2.6.11-rc2 16/29] ide: flagged_taskfile select register dev bit masking
In reply to Tejun HeoQuoted 4 lines
16_ide_flagged_taskfile_select_dev_bit_masking.patch
In flagged_taskfile(), make off DEV bit before OR'ing it with drive->select.all when writing to IDE_SELECT_REG.
drivers/ide/ide-taskfile.c +2 -1
@@ -858,7 +858,8 @@ ide_startstop_t flagged_taskfile (ide_dr* select bit (master/slave) in the drive_head register. We must make * sure that the desired drive is selected. */ - hwif->OUTB (taskfile->device_head | drive->select.all,IDE_SELECT_REG ); + hwif->OUTB ((taskfile->device_head & ~0x10 ) | drive->select.all, +IDE_SELECT_REG );switch (task->data_phase) {case TASKFILE_OUT_DMAQ :
Re: [PATCH 2.6.11-rc2 17/29] ide: flagged_taskfile() tf_out_flags.b.select check
In reply to Tejun HeoQuoted 6 lines
17_ide_flagged_taskfile_select_check.patch
In flagged_taskfile(), tf_out_flags.b.select should be checked before using bits inside taskfile->device_head. When user haven't specified the select register, the default drive->select.all value should be used.
drivers/ide/ide-taskfile.c +6 -2
@@ -858,8 +858,12 @@ ide_startstop_t flagged_taskfile (ide_dr* select bit (master/slave) in the drive_head register. We must make * sure that the desired drive is selected. */ - hwif->OUTB ((taskfile->device_head & ~0x10 ) | drive->select.all, -IDE_SELECT_REG ); +if (task->tf_out_flags.b.select) + hwif->OUTB ((taskfile->device_head & ~0x10 ) | drive->select.all, +IDE_SELECT_REG ); +else + hwif->OUTB (drive->select.all,IDE_SELECT_REG ); +switch (task->data_phase) {case TASKFILE_OUT_DMAQ :
Re: [PATCH 2.6.11-rc2 18/29] ide: comment fixes
In reply to Tejun HeoQuoted 3 lines
18_ide_comment_fixes.patch
Comment fixes.
drivers/ide/ide-dma.c +3 -1
@@ -227,7 +227,9 @@ EXPORT_SYMBOL_GPL(ide_build_sglist);* the PRD table that the IDE layer wants to be fed. The code * knows about the 64K wrap bug in the CS5530. * -* Returns 0 if all went okay, returns 1 otherwise. +* Returns the number of built PRD entries if all went okay, +* returns 0 otherwise. +* * May also be invoked from trm290.c */
drivers/ide/ide-taskfile.c +2 -2
@@ -853,8 +853,8 @@ ide_startstop_t flagged_taskfile (ide_dr hwif->OUTB (taskfile->high_cylinder,IDE_HCYL_REG );/* -* (ks) In the flagged taskfile approch, we will used all specified -* registers and the register value will not be changed. Except the +* (ks) In the flagged taskfile approch, we will use all specified +* registers and the register value will not be changed, except the * select bit (master/slave) in the drive_head register. We must make * sure that the desired drive is selected. */
Bartlomiej Zolnierkiewicz
AppliedRe: [PATCH 2.6.11-rc2 18/29] ide: comment fixes
Quoted 5 lines · Tejun Heo
Quoted 3 lines
18_ide_comment_fixes.patch
Comment fixes.
Signed-off-by Tejun Heo <[email protected]>
applied
Re: [PATCH 2.6.11-rc2 19/29] ide: ide_diag_taskfile() rq initialization fix
In reply to Tejun HeoQuoted 6 lines
19_ide_diag_taskfile_use_init_drive_cmd.patch
In
ide_diag_taskfile(), when initializing taskfile rq,ref_countwasn't initialized properly. Modified to useide_init_drive_cmd(). This doesn't really change any behavior as the request isn't managed via the block layer.
drivers/ide/ide-taskfile.c +1 -1
@@ -471,7 +471,7 @@ static int ide_diag_taskfile(ide_drive_t {struct request rq; -memset (&rq,0 ,sizeof (rq)); +ide_init_drive_cmd (&rq); rq.flags =REQ_DRIVE_TASKFILE ; rq.buffer = buf;
Re: [PATCH 2.6.11-rc2 20/29] ide: task_end_request() fix
In reply to Tejun HeoQuoted 6 lines
20_ide_task_end_request_fix.patch
task_end_request()modified and made global.ide_dma_intr()modified to usetask_end_request(). These changes enable TASKFILE ioctls to get valid register outputs on successful completion. No in-kernel usage should be affected.
drivers/ide/ide-dma.c +1 -2
@@ -175,8 +175,7 @@ ide_startstop_t ide_dma_intr (ide_drive_if (OK_STAT (stat,DRIVE_READY ,drive->bad_wstat|DRQ_STAT )) {if (!dma_stat) {struct request *rq =HWGROUP (drive)->rq; - -DRIVER (drive)->end_request (drive,1 , rq->nr_sectors); +task_end_request (drive, rq, stat);return ide_stopped; } printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
drivers/ide/ide-taskfile.c +5 -10
@@ -366,18 +366,13 @@ static ide_startstop_t task_error(ide_drreturn ide_error (drive, s, stat); } -static void task_end_request (ide_drive_t *drive,struct request *rq,u8 stat) +void task_end_request (ide_drive_t *drive,struct request *rq,u8 stat) {if (rq->flags &REQ_DRIVE_TASKFILE ) { -ide_task_t *task = rq->special; - -if (task->tf_out_flags.all) { -u8 err = drive->hwif->INB (IDE_ERROR_REG ); -ide_end_drive_cmd (drive, stat, err); -return ; - } - } - drive->driver->end_request (drive,1 , rq->hard_nr_sectors); +u8 err = drive->hwif->INB (IDE_ERROR_REG ); +ide_end_drive_cmd (drive, stat, err); + }else + drive->driver->end_request (drive,1 , rq->hard_nr_sectors); }/*
include/linux/ide.h +1 -0
@@ -1318,6 +1318,7 @@ extern ide_startstop_t do_rw_taskfile(id*/ extern ide_startstop_t flagged_taskfile (ide_drive_t *,ide_task_t *); +extern void task_end_request (ide_drive_t *,struct request *,u8 );extern ide_startstop_t set_multmode_intr (ide_drive_t *);extern ide_startstop_t set_geometry_intr (ide_drive_t *);extern ide_startstop_t recal_intr (ide_drive_t *);
Re: [PATCH 2.6.11-rc2 21/29] ide: Merge do_rw_taskfile() and flagged_taskfile().
In reply to Tejun HeoQuoted 12 lines
21_ide_do_taskfile.patch
Merged
do_rw_taskfile()andflagged_taskfile()intodo_taskfile(). During the merge, the following changes took place.
1. flagged taskfile now honors HOB feature register. (do_rw_taskfile()did write to HOB feature.)
2. Nodo_rw_taskfile()HIHI check on select register. Except for the DEV bit, all bits are honored.
3. Usestaskfile->data_phaseto determine if dma trasfer is requested. (do_rw_taskfile()directly switched ontaskfile->commandfor all dma commands)
drivers/ide/ide-disk.c +6 -6
@@ -535,7 +535,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SPECIFY ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; args.handler = &set_geometry_intr; -do_rw_taskfile (drive, &args); +do_taskfile (drive, &args); } }else if (s->b.recalibrate) { s->b.recalibrate =0 ;
@@ -546,7 +546,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_RESTORE ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; args.handler = &recal_intr; -do_rw_taskfile (drive, &args); +do_taskfile (drive, &args); } }else if (s->b.set_multmode) { s->b.set_multmode =0 ;
@@ -559,7 +559,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETMULT ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; args.handler = &set_multmode_intr; -do_rw_taskfile (drive, &args); +do_taskfile (drive, &args); } }else if (s->all) {int special = s->all;
@@ -905,19 +905,19 @@ static ide_startstop_t idedisk_start_pow args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; args->handler = &task_no_data_intr; -return do_rw_taskfile (drive, args); +return do_taskfile (drive, args);case idedisk_pm_standby:/* Suspend step 2 (standby) */ args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_STANDBYNOW1 ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; args->handler = &task_no_data_intr; -return do_rw_taskfile (drive, args); +return do_taskfile (drive, args);case idedisk_pm_idle:/* Resume step 1 (idle) */ args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_IDLEIMMEDIATE ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; args->handler = task_no_data_intr; -return do_rw_taskfile (drive, args); +return do_taskfile (drive, args);case idedisk_pm_restore_dma:/* Resume step 2 (restore DMA) */ /*
drivers/ide/ide-io.c +1 -3
@@ -756,9 +756,7 @@ static ide_startstop_t execute_drive_cmdbreak ; } -if (args->tf_out_flags.all !=0 ) -return flagged_taskfile (drive, args); -return do_rw_taskfile (drive, args); +return do_taskfile (drive, args); }else if (rq->flags &REQ_DRIVE_TASK ) {u8 *args = rq->buffer;u8 sel;
drivers/ide/ide-taskfile.c +84 -164
282 lines not on this page · raw message
include/linux/ide.h +2 -7
@@ -1067,7 +1067,7 @@ static inline void destroy_proc_ide_inte* - ide_started : In this case, the channel is left busy until an * async event (interrupt) occurs. * Typically, start_power_step() will issue a taskfile request with -* do_rw_taskfile(). +* do_taskfile(). * * Upon reception of the interrupt, the core will call complete_power_step() * with the error code if any. This routine should update the step value
@@ -1311,12 +1311,7 @@ extern int wait_for_ready(ide_drive_t *,/* * taskfile io for disks for now...and builds request from ide_ioctl */ -extern ide_startstop_t do_rw_taskfile (ide_drive_t *,ide_task_t *); - -/* -* Special Flagged Register Validation Caller -*/ -extern ide_startstop_t flagged_taskfile (ide_drive_t *,ide_task_t *); +extern ide_startstop_t do_taskfile (ide_drive_t *,ide_task_t *);extern void task_end_request (ide_drive_t *,struct request *,u8 );extern ide_startstop_t set_multmode_intr (ide_drive_t *);
Re: [PATCH 2.6.11-rc2 21/29] ide: Merge do_rw_taskfile() and flagged_taskfile().
Quoted 13 lines · Tejun Heo
Quoted 12 lines
21_ide_do_taskfile.patch
Merged
do_rw_taskfile()andflagged_taskfile()intodo_taskfile(). During the merge, the following changes took place.
1. flagged taskfile now honors HOB feature register. (do_rw_taskfile()did write to HOB feature.)
2. Nodo_rw_taskfile()HIHI check on select register. Except for the DEV bit, all bits are honored.
3. Usestaskfile->data_phaseto determine if dma trasfer is requested. (do_rw_taskfile()directly switched ontaskfile->commandfor all dma commands)
Quoted 1 line
Signed-off-by Tejun Heo <[email protected]>
do_rw_taskfile() is going to be used by fs requests once __ide_do_rw_disk() is converted to taskfile transport.
I don't think that do_rw_taskfile() and flagged_taskfile() merge is a good thing as it adds unnecessary overhead for hot path (fs requests).
Re: [PATCH 2.6.11-rc2 21/29] ide: Merge do_rw_taskfile() and flagged_taskfile().
Hello,
Quoted 18 lines · Bartlomiej Zolnierkiewicz
Quoted 13 lines · Tejun Heo
Quoted 12 lines
21_ide_do_taskfile.patch
Merged
do_rw_taskfile()andflagged_taskfile()intodo_taskfile(). During the merge, the following changes took place.
1. flagged taskfile now honors HOB feature register. (do_rw_taskfile()did write to HOB feature.)
2. Nodo_rw_taskfile()HIHI check on select register. Except for the DEV bit, all bits are honored.
3. Usestaskfile->data_phaseto determine if dma trasfer is requested. (do_rw_taskfile()directly switched ontaskfile->commandfor all dma commands)Quoted 1 line
Signed-off-by Tejun Heo <[email protected]>
Quoted 6 lines
do_rw_taskfile()is going to be used by fs requests once__ide_do_rw_disk()is converted to taskfile transport.I don't think that
do_rw_taskfile()andflagged_taskfile()merge is a good thing as it adds unnecessary overhead for hot path (fs requests).
Yeah, I also thought about that, but here are reasons why I still think merging is better.
1. The added overhead is small. It's just a dozen more if's per every disk io. I don't think it will make any noticeable difference.
2. If hot path optimization is needed, it can be easily done inside one do_taskfile() function with one or two more if's.
3. Currently, do_rw_taskfile() isn't used by __ide_do_rw_disk(). We can think about optimization when actually converting it to use taskfile transport. And IMHO, if hot path optimization is needed, leaving hot path optimization where it is now (inside __ide_do_rw_disk()) is better than moving it to separate taskfile function (do_rw_taskfile()).
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 22/29] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
In reply to Tejun HeoQuoted 9 lines
22_ide_taskfile_flush.patch
All
REQ_DRIVE_TASKusers exceptide_task_ioctl()converted to useREQ_DRIVE_TASKFILE.
1.idedisk_issue_flush()converted to useREQ_DRIVE_TASKFILE. This and the changes inide_get_error_location()remove a possible race condition betweenide_get_error_location()and other requests.
2.ide_queue_flush_cmd()converted to useREQ_DRIVE_TASKFILE.
drivers/ide/ide-disk.c +11 -8
@@ -705,24 +705,26 @@ static int idedisk_issue_flush(request_q {ide_drive_t *drive = q->queuedata;struct request *rq; +ide_task_t args;int ret;if (!drive->wcache)return 0 ; - rq =blk_get_request (q,WRITE , __GFP_WAIT); - -memset (rq->cmd,0 ,sizeof (rq->cmd)); +memset (&args,0 ,sizeof (args));if (ide_id_has_flush_cache_ext (drive->id) && (drive->capacity64 >= (1UL <<28 ))) - rq->cmd[0 ] =WIN_FLUSH_CACHE_EXT ; + args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE_EXT ;else - rq->cmd[0 ] =WIN_FLUSH_CACHE ; + args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE ; + args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.handler = task_no_data_intr; - rq->flags |=REQ_DRIVE_TASK |REQ_SOFTBARRIER ; - rq->buffer = rq->cmd; + rq =blk_get_request (q,WRITE , __GFP_WAIT); + rq->flags |=REQ_DRIVE_TASKFILE |REQ_SOFTBARRIER ; + rq->special = &args; ret =blk_execute_rq (q, disk, rq);
@@ -730,8 +732,9 @@ static int idedisk_issue_flush(request_q* if we failed and caller wants error offset, get it */ if (ret && error_sector) - *error_sector =ide_get_error_location (drive, rq->cmd); + *error_sector =ide_get_error_location (drive, &args); + rq->special =NULL ;/* just in case */ blk_put_request (rq);return ret; }
drivers/ide/ide-io.c +39 -48
135 lines not on this page · raw message
include/linux/ide.h +40 -36
100 lines not on this page · raw message
Re: [PATCH 2.6.11-rc2 22/29] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
Quoted 8 lines · Tejun Heo
Quoted 8 lines
22_ide_taskfile_flush.patch
All
REQ_DRIVE_TASKusers exceptide_task_ioctl()converted to useREQ_DRIVE_TASKFILE.
1.idedisk_issue_flush()converted to useREQ_DRIVE_TASKFILE. This and the changes inide_get_error_location()remove a possible race condition betweenide_get_error_location()and other requests.
What race condition?
Quoted 22 lines
Quoted 1 line
2.
ide_queue_flush_cmd()converted to useREQ_DRIVE_TASKFILE.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +2
-3@@ -705,24 +705,26 @@ static int idedisk_issue_flush(request_q { ide_drive_t *drive = q->queuedata; struct request *rq; + ide_task_t args; int ret; if (!drive->wcache) return 0; - rq = blk_get_request(q, WRITE, __GFP_WAIT); - - memset(rq->cmd, 0, sizeof(rq->cmd)); + memset(&args, 0, sizeof(args));
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 static int idedisk_issue_flush(request_q · line 722
Quoted 10 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +3
-2if (ide_id_has_flush_cache_ext(drive->id) && (drive->capacity64 >= (1UL << 28))) - rq->cmd[0] = WIN_FLUSH_CACHE_EXT; + args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; else - rq->cmd[0] = WIN_FLUSH_CACHE; + args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; + args.command_type = IDE_DRIVE_TASK_NO_DATA;
.data_phase is missed
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 static int idedisk_issue_flush(request_q · line 723
Quoted 1 line
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +1
-0+ args.handler = task_no_data_intr;
Please compare the code above to the code you've added to ide_queue_flush_cmd() - it is identical. It would be nice to add some helper for doing this i.e. ide_init_flush_cmd().
Quoted 49 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +5
-3- rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER; - rq->buffer = rq->cmd; + rq = blk_get_request(q, WRITE, __GFP_WAIT); + rq->flags |= REQ_DRIVE_TASKFILE | REQ_SOFTBARRIER; + rq->special = &args; ret = blk_execute_rq(q, disk, rq);@@ -730,8 +732,9 @@ static int idedisk_issue_flush(request_q * if we failed and caller wants error offset, get it */ if (ret && error_sector) - *error_sector = ide_get_error_location(drive, rq->cmd); + *error_sector = ide_get_error_location(drive, &args); + rq->special = NULL; /* just in case */ blk_put_request(rq); return ret; }Index:
linux-ide-export/drivers/ide/ide-io.c
===================================================================drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +0
-18@@ -55,24 +55,6 @@ #include <asm/io.h> #include <asm/bitops.h> -static void ide_fill_flush_cmd(ide_drive_t *drive, struct request *rq) -{ - char *buf = rq->cmd; - - /* - * reuse cdb space for ata command - */ - memset(buf, 0, sizeof(rq->cmd)); - - rq->flags |= REQ_DRIVE_TASK | REQ_STARTED; - rq->buffer = buf; - rq->buffer[0] = WIN_FLUSH_CACHE; - - if (ide_id_has_flush_cache_ext(drive->id) && - (drive->capacity64 >= (1UL << 28))) - rq->buffer[0] = WIN_FLUSH_CACHE_EXT; -} - /* * preempt pending requests, and store this cache flush for immediate * execution
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static void ide_fill_flush_cmd(ide_drive · line 66
Quoted 6 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +2
-1@@ -80,7 +62,8 @@ static void ide_fill_flush_cmd(ide_drive static struct request *ide_queue_flush_cmd(ide_drive_t *drive, struct request *rq, int post) { - struct request *flush_rq = &HWGROUP(drive)->wrq; + struct request *flush_rq = &HWGROUP(drive)->flush_rq; + ide_task_t *args = &HWGROUP(drive)->flush_args;
please don't use HWGROUP() macro,
just use drive->hwif->hwgroup directly
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static struct request *ide_queue_flush_c · line 81
Quoted 13 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +3
-3/* * write cache disabled, clear the barrier bit and treat it like@@ -92,10 +75,22 @@ static struct request *ide_queue_flush_c } ide_init_drive_cmd(flush_rq); - ide_fill_flush_cmd(drive, flush_rq); - - flush_rq->special = rq; + flush_rq->flags = REQ_DRIVE_TASKFILE | REQ_STARTED; flush_rq->nr_sectors = rq->nr_sectors; + flush_rq->special = args; + HWGROUP(drive)->flush_real_rq = rq;
ditto
Quoted 15 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +11
-0+ memset(args, 0, sizeof(*args)); + + if (ide_id_has_flush_cache_ext(drive->id) && + (drive->capacity64 >= (1UL << 28))) + args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; + else + args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; + + args->command_type = IDE_DRIVE_TASK_NO_DATA; + args->data_phase = TASKFILE_NO_DATA; + args->handler = task_no_data_intr; if (!post) { drive->doing_barrier = 1;
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 int ide_end_request (ide_drive_t *drive, · line 173
Quoted 5 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +1
-1@@ -175,7 +170,7 @@ int ide_end_request (ide_drive_t *drive, if (!blk_barrier_rq(rq) || !drive->wcache) ret = __ide_end_request(drive, rq, uptodate, nr_sectors); else { - struct request *flush_rq = &HWGROUP(drive)->wrq; + struct request *flush_rq = &HWGROUP(drive)->flush_rq;
ditto
Quoted 51 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +18
-22flush_rq->nr_sectors -= nr_sectors; if (!flush_rq->nr_sectors) {@@ -221,41 +216,37 @@ static void ide_complete_pm_request (ide /* * FIXME: probably move this somewhere else, name is bad too :) */ -u64 ide_get_error_location(ide_drive_t *drive, char *args) +u64 ide_get_error_location(ide_drive_t *drive, ide_task_t *args) { u32 high, low; u8 hcyl, lcyl, sect; - u64 sector; - high = 0; - hcyl = args[5]; - lcyl = args[4]; - sect = args[3]; - - if (ide_id_has_flush_cache_ext(drive->id)) { - low = (hcyl << 16) | (lcyl << 8) | sect; - HWIF(drive)->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); - high = ide_read_24(drive); - } else { - u8 cur = HWIF(drive)->INB(IDE_SELECT_REG); - if (cur & 0x40) - low = (hcyl << 16) | (lcyl << 8) | sect; - else { - low = hcyl * drive->head * drive->sect; - low += lcyl * drive->sect; - low += sect - 1; - } - } + if (ide_id_has_flush_cache_ext(drive->id) && + (drive->capacity64 >= (1UL << 28))) + high = (args->hobRegister[IDE_HCYL_OFFSET] << 16) | + (args->hobRegister[IDE_LCYL_OFFSET] << 8 ) | + args->hobRegister[IDE_SECTOR_OFFSET]; + else + high = 0; + + hcyl = args->tfRegister[IDE_HCYL_OFFSET]; + lcyl = args->tfRegister[IDE_LCYL_OFFSET]; + sect = args->tfRegister[IDE_SECTOR_OFFSET]; + + if (args->tfRegister[IDE_SELECT_OFFSET] & 0x40) + low = (hcyl << 16) | (lcyl << 8 ) | sect; + else + low = hcyl * drive->head * drive->sect + + lcyl * drive->sect + sect - 1; - sector = ((u64) high << 24) | low;
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static void ide_complete_pm_request (ide · line 249
Quoted 10 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +2
-2- return sector; + return ((u64)high << 24) | low; } EXPORT_SYMBOL(ide_get_error_location); static void ide_complete_barrier(ide_drive_t *drive, struct request *rq, int error) { - struct request *real_rq = rq->special; + struct request *real_rq = HWGROUP(drive)->flush_real_rq;
ditto
Quoted 28 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +1
-1int good_sectors, bad_sectors; sector_t sector;@@ -302,7 +293,7 @@ static void ide_complete_barrier(ide_dri */ good_sectors = 0; if (blk_barrier_postflush(rq)) { - sector = ide_get_error_location(drive, rq->buffer); + sector = ide_get_error_location(drive, rq->special); if ((sector >= real_rq->hard_sector) && (sector < real_rq->hard_sector + real_rq->hard_nr_sectors))Index:
linux-ide-export/include/linux/ide.h
===================================================================include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +8
-0@@ -930,6 +930,39 @@ typedef ide_startstop_t (ide_pre_handler typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); typedef int (ide_expiry_t)(ide_drive_t *); +typedef struct ide_task_s { +/* + * struct hd_drive_task_hdr tf; + * task_struct_t tf; + * struct hd_drive_hob_hdr hobf; + * hob_struct_t hobf; + */ + task_ioreg_t tfRegister[8];
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 typedef ide_startstop_t (ide_pre_handler · line 950
Quoted 10 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +10
-0+ task_ioreg_t hobRegister[8]; + ide_reg_valid_t tf_out_flags; + ide_reg_valid_t tf_in_flags; + int data_phase; + int command_type; + ide_pre_handler_t *prehandler; + ide_handler_t *handler; + struct request *rq; /* copy of request */ + void *special; /* valid_t generally */ +} ide_task_t;
please don't move this around,
adding struct ide_task_s; should do the trick
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 typedef ide_startstop_t (ide_pre_handler · line 963
Quoted 13 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +13
-0+typedef struct pkt_task_s { +/* + * struct hd_drive_task_hdr pktf; + * task_struct_t pktf; + * u8 pkcdb[12]; + */ + task_ioreg_t tfRegister[8]; + int data_phase; + int command_type; + ide_handler_t *handler; + struct request *rq; /* copy of request */ + void *special; +} pkt_task_t;
there is no need to move pkt_task_t around
(moreover no code uses it currently)
Quoted 19 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +6
-2typedef struct hwgroup_s { /* irq handler, if active */ ide_startstop_t (*handler)(ide_drive_t *);@@ -955,8 +988,12 @@ typedef struct hwgroup_s { struct request *rq; /* failsafe timer */ struct timer_list timer; - /* local copy of current write rq */ - struct request wrq; + /* rq used for flushing */ + struct request flush_rq; + /* task used for flushing */ + ide_task_t flush_args; + /* real_rq for flushing */ + struct request *flush_real_rq; /* timeout value during long polls */ unsigned long poll_timeout; /* queried upon timeouts */
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 extern void ide_init_drive_cmd (struct r · line 1243
Quoted 5 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +1
-1@@ -1203,7 +1240,7 @@ extern void ide_init_drive_cmd (struct r /* * this function returns error location sector offset in case of a write error */ -extern u64 ide_get_error_location(ide_drive_t *, char *); +extern u64 ide_get_error_location(ide_drive_t *, ide_task_t *);
extern is not needed
Quoted 32 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +0
-26/* * "action" parameter type for ide_do_drive_cmd() below.@@ -1260,39 +1297,6 @@ extern void ide_end_drive_cmd(ide_drive_ */ extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); -typedef struct ide_task_s { -/* - * struct hd_drive_task_hdr tf; - * task_struct_t tf; - * struct hd_drive_hob_hdr hobf; - * hob_struct_t hobf; - */ - task_ioreg_t tfRegister[8]; - task_ioreg_t hobRegister[8]; - ide_reg_valid_t tf_out_flags; - ide_reg_valid_t tf_in_flags; - int data_phase; - int command_type; - ide_pre_handler_t *prehandler; - ide_handler_t *handler; - struct request *rq; /* copy of request */ - void *special; /* valid_t generally */ -} ide_task_t; - -typedef struct pkt_task_s { -/* - * struct hd_drive_task_hdr pktf; - * task_struct_t pktf; - * u8 pkcdb[12]; - */ - task_ioreg_t tfRegister[8];
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 extern void ide_end_drive_cmd(ide_drive_ · line 1302
Quoted 10 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +0
-7- int data_phase; - int command_type; - ide_handler_t *handler; - struct request *rq; /* copy of request */ - void *special; -} pkt_task_t; - extern u32 ide_read_24(ide_drive_t *); extern void SELECT_DRIVE(ide_drive_t *);
rest of the patch looks fine
Re: [PATCH 2.6.11-rc2 22/29] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
Hello again, Bartlomiej.
Quoted 12 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Tejun Heo
Quoted 8 lines
22_ide_taskfile_flush.patch
All
REQ_DRIVE_TASKusers exceptide_task_ioctl()converted to useREQ_DRIVE_TASKFILE.
1.idedisk_issue_flush()converted to useREQ_DRIVE_TASKFILE. This and the changes inide_get_error_location()remove a possible race condition betweenide_get_error_location()and other requests.
Quoted 1 line
What race condition?
The old ide_get_error_location() acceses hardware registers after the flush request is finished, so the registers could have been crobbered by other on-going or finished requests.
Quoted 31 lines
Quoted 31 lines
Quoted 1 line
2.
ide_queue_flush_cmd()converted to useREQ_DRIVE_TASKFILE.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +4
-5@@ -705,24 +705,26 @@ static int idedisk_issue_flush(request_q { ide_drive_t *drive = q->queuedata; struct request *rq; + ide_task_t args; int ret; if (!drive->wcache) return 0; - rq = blk_get_request(q, WRITE, __GFP_WAIT); - - memset(rq->cmd, 0, sizeof(rq->cmd)); + memset(&args, 0, sizeof(args)); if (ide_id_has_flush_cache_ext(drive->id) && (drive->capacity64 >= (1UL << 28))) - rq->cmd[0] = WIN_FLUSH_CACHE_EXT; + args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; else - rq->cmd[0] = WIN_FLUSH_CACHE; + args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE;
Quoted 4 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 static int idedisk_issue_flush(request_q · line 722
Quoted 1 line
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +1
-0+ args.command_type = IDE_DRIVE_TASK_NO_DATA;.data_phase is missed
Yeah, it was kind of intentional as all other functions which do IDE_DRIVE_TASK_NO_DATA don't initialize args.data_phase explicitly. patch #29 makes this change for all such cases including this one.
Quoted 8 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 static int idedisk_issue_flush(request_q · line 723
Quoted 2 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +1
-0+ args.handler = task_no_data_intr;Please compare the code above to the code you've added to
ide_queue_flush_cmd()- it is identical. It would be nice to add some helper for doing this i.e.ide_init_flush_cmd().
Sure.
Quoted 52 lines
Quoted 52 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.272027942 +0900 +5
-3- rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER; - rq->buffer = rq->cmd; + rq = blk_get_request(q, WRITE, __GFP_WAIT); + rq->flags |= REQ_DRIVE_TASKFILE | REQ_SOFTBARRIER; + rq->special = &args; ret = blk_execute_rq(q, disk, rq);@@ -730,8 +732,9 @@ static int idedisk_issue_flush(request_q * if we failed and caller wants error offset, get it */ if (ret && error_sector) - *error_sector = ide_get_error_location(drive, rq->cmd); + *error_sector = ide_get_error_location(drive, &args); + rq->special = NULL; /* just in case */ blk_put_request(rq); return ret; }Index:
linux-ide-export/drivers/ide/ide-io.c
===================================================================drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +0
-18@@ -55,24 +55,6 @@ #include <asm/io.h> #include <asm/bitops.h> -static void ide_fill_flush_cmd(ide_drive_t *drive, struct request *rq) -{ - char *buf = rq->cmd; - - /* - * reuse cdb space for ata command - */ - memset(buf, 0, sizeof(rq->cmd)); - - rq->flags |= REQ_DRIVE_TASK | REQ_STARTED; - rq->buffer = buf; - rq->buffer[0] = WIN_FLUSH_CACHE; - - if (ide_id_has_flush_cache_ext(drive->id) && - (drive->capacity64 >= (1UL << 28))) - rq->buffer[0] = WIN_FLUSH_CACHE_EXT; -} - /* * preempt pending requests, and store this cache flush for immediate * execution@@ -80,7 +62,8 @@ static void ide_fill_flush_cmd(ide_drive static struct request *ide_queue_flush_cmd(ide_drive_t *drive, struct request *rq, int post)
Quoted 9 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static void ide_fill_flush_cmd(ide_drive · line 66
Quoted 4 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +2
-1{ - struct request *flush_rq = &HWGROUP(drive)->wrq; + struct request *flush_rq = &HWGROUP(drive)->flush_rq; + ide_task_t *args = &HWGROUP(drive)->flush_args;please don't use
HWGROUP()macro,
just usedrive->hwif->hwgroupdirectly
I think I'll leave the code like above here and make another patch which removes all uses of HWGROUP() and HWGROUP() itself. What do you think about that?
Quoted 144 lines
Quoted 4 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +0
-0/* * write cache disabled, clear the barrier bit and treat it likedrivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static struct request *ide_queue_flush_c · line 81
Quoted 10 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +3
-3@@ -92,10 +75,22 @@ static struct request *ide_queue_flush_c } ide_init_drive_cmd(flush_rq); - ide_fill_flush_cmd(drive, flush_rq); - - flush_rq->special = rq; + flush_rq->flags = REQ_DRIVE_TASKFILE | REQ_STARTED; flush_rq->nr_sectors = rq->nr_sectors; + flush_rq->special = args; + HWGROUP(drive)->flush_real_rq = rq;ditto
Quoted 15 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +11
-0+ memset(args, 0, sizeof(*args)); + + if (ide_id_has_flush_cache_ext(drive->id) && + (drive->capacity64 >= (1UL << 28))) + args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; + else + args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; + + args->command_type = IDE_DRIVE_TASK_NO_DATA; + args->data_phase = TASKFILE_NO_DATA; + args->handler = task_no_data_intr; if (!post) { drive->doing_barrier = 1;drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 int ide_end_request (ide_drive_t *drive, · line 173
Quoted 5 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +1
-1@@ -175,7 +170,7 @@ int ide_end_request (ide_drive_t *drive, if (!blk_barrier_rq(rq) || !drive->wcache) ret = __ide_end_request(drive, rq, uptodate, nr_sectors); else { - struct request *flush_rq = &HWGROUP(drive)->wrq; + struct request *flush_rq = &HWGROUP(drive)->flush_rq;ditto
Quoted 51 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +18
-22flush_rq->nr_sectors -= nr_sectors; if (!flush_rq->nr_sectors) {@@ -221,41 +216,37 @@ static void ide_complete_pm_request (ide /* * FIXME: probably move this somewhere else, name is bad too :) */ -u64 ide_get_error_location(ide_drive_t *drive, char *args) +u64 ide_get_error_location(ide_drive_t *drive, ide_task_t *args) { u32 high, low; u8 hcyl, lcyl, sect; - u64 sector; - high = 0; - hcyl = args[5]; - lcyl = args[4]; - sect = args[3]; - - if (ide_id_has_flush_cache_ext(drive->id)) { - low = (hcyl << 16) | (lcyl << 8) | sect; - HWIF(drive)->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); - high = ide_read_24(drive); - } else { - u8 cur = HWIF(drive)->INB(IDE_SELECT_REG); - if (cur & 0x40) - low = (hcyl << 16) | (lcyl << 8) | sect; - else { - low = hcyl * drive->head * drive->sect; - low += lcyl * drive->sect; - low += sect - 1; - } - } + if (ide_id_has_flush_cache_ext(drive->id) && + (drive->capacity64 >= (1UL << 28))) + high = (args->hobRegister[IDE_HCYL_OFFSET] << 16) | + (args->hobRegister[IDE_LCYL_OFFSET] << 8 ) | + args->hobRegister[IDE_SECTOR_OFFSET]; + else + high = 0; + + hcyl = args->tfRegister[IDE_HCYL_OFFSET]; + lcyl = args->tfRegister[IDE_LCYL_OFFSET]; + sect = args->tfRegister[IDE_SECTOR_OFFSET]; + + if (args->tfRegister[IDE_SELECT_OFFSET] & 0x40) + low = (hcyl << 16) | (lcyl << 8 ) | sect; + else + low = hcyl * drive->head * drive->sect + + lcyl * drive->sect + sect - 1; - sector = ((u64) high << 24) | low;drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 static void ide_complete_pm_request (ide · line 249
Quoted 10 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +2
-2- return sector; + return ((u64)high << 24) | low; } EXPORT_SYMBOL(ide_get_error_location); static void ide_complete_barrier(ide_drive_t *drive, struct request *rq, int error) { - struct request *real_rq = rq->special; + struct request *real_rq = HWGROUP(drive)->flush_real_rq;ditto
Quoted 34 lines
drivers/ide/ide-io.c 2005-02-02 10:28:06.528986250 +0900 renamed from drivers/ide/ide-io.c 2005-02-02 10:28:06.273027780 +0900 +1
-1int good_sectors, bad_sectors; sector_t sector;@@ -302,7 +293,7 @@ static void ide_complete_barrier(ide_dri */ good_sectors = 0; if (blk_barrier_postflush(rq)) { - sector = ide_get_error_location(drive, rq->buffer); + sector = ide_get_error_location(drive, rq->special); if ((sector >= real_rq->hard_sector) && (sector < real_rq->hard_sector + real_rq->hard_nr_sectors))Index:
linux-ide-export/include/linux/ide.h
===================================================================include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +14
-0@@ -930,6 +930,39 @@ typedef ide_startstop_t (ide_pre_handler typedef ide_startstop_t (ide_handler_t)(ide_drive_t *); typedef int (ide_expiry_t)(ide_drive_t *); +typedef struct ide_task_s { +/* + * struct hd_drive_task_hdr tf; + * task_struct_t tf; + * struct hd_drive_hob_hdr hobf; + * hob_struct_t hobf; + */ + task_ioreg_t tfRegister[8]; + task_ioreg_t hobRegister[8]; + ide_reg_valid_t tf_out_flags; + ide_reg_valid_t tf_in_flags; + int data_phase; + int command_type; + ide_pre_handler_t *prehandler;
Quoted 9 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 typedef ide_startstop_t (ide_pre_handler · line 950
Quoted 4 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +4
-0+ ide_handler_t *handler; + struct request *rq; /* copy of request */ + void *special; /* valid_t generally */ +} ide_task_t;please don't move this around,
adding structide_task_s; should do the trick
No, I added ide_task_t flush_args to hwgroup_t not a pointer to ide_task_t, so the definition of ide_task_t has to come before the definition of hwgroup_t.
Quoted 10 lines
Quoted 10 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +9
-0+typedef struct pkt_task_s { +/* + * struct hd_drive_task_hdr pktf; + * task_struct_t pktf; + * u8 pkcdb[12]; + */ + task_ioreg_t tfRegister[8]; + int data_phase; + int command_type;
Quoted 9 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 typedef ide_startstop_t (ide_pre_handler · line 963
Quoted 4 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +4
-0+ ide_handler_t *handler; + struct request *rq; /* copy of request */ + void *special; +} pkt_task_t;there is no need to move
pkt_task_taround
(moreover no code uses it currently)
And it seemd kind of lonely after ide_task_t moved upward. :-) How about modifying this patch such that it moves only the ide_task_t and adding another patch to kill pkt_task_t?
Quoted 20 lines
Quoted 20 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +6
-2typedef struct hwgroup_s { /* irq handler, if active */ ide_startstop_t (*handler)(ide_drive_t *);@@ -955,8 +988,12 @@ typedef struct hwgroup_s { struct request *rq; /* failsafe timer */ struct timer_list timer; - /* local copy of current write rq */ - struct request wrq; + /* rq used for flushing */ + struct request flush_rq; + /* task used for flushing */ + ide_task_t flush_args; + /* real_rq for flushing */ + struct request *flush_real_rq; /* timeout value during long polls */ unsigned long poll_timeout; /* queried upon timeouts */@@ -1203,7 +1240,7 @@ extern void ide_init_drive_cmd (struct r
Quoted 9 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 extern void ide_init_drive_cmd (struct r · line 1243
Quoted 5 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +1
-1/* * this function returns error location sector offset in case of a write error */ -extern u64 ide_get_error_location(ide_drive_t *, char *); +extern u64 ide_get_error_location(ide_drive_t *, ide_task_t *);extern is not needed
Yeah, it isn't needed. I was trying to be conformant with other declarations in the file. I'll leave above line as it is now and write another patch to remove all extern's in front of function prototypes in ide drivers. What do you think?
Quoted 42 lines
Quoted 42 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +0
-33/* * "action" parameter type for ide_do_drive_cmd() below.@@ -1260,39 +1297,6 @@ extern void ide_end_drive_cmd(ide_drive_ */ extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); -typedef struct ide_task_s { -/* - * struct hd_drive_task_hdr tf; - * task_struct_t tf; - * struct hd_drive_hob_hdr hobf; - * hob_struct_t hobf; - */ - task_ioreg_t tfRegister[8]; - task_ioreg_t hobRegister[8]; - ide_reg_valid_t tf_out_flags; - ide_reg_valid_t tf_in_flags; - int data_phase; - int command_type; - ide_pre_handler_t *prehandler; - ide_handler_t *handler; - struct request *rq; /* copy of request */ - void *special; /* valid_t generally */ -} ide_task_t; - -typedef struct pkt_task_s { -/* - * struct hd_drive_task_hdr pktf; - * task_struct_t pktf; - * u8 pkcdb[12]; - */ - task_ioreg_t tfRegister[8]; - int data_phase; - int command_type; - ide_handler_t *handler; - struct request *rq; /* copy of request */ - void *special; -} pkt_task_t; - extern u32 ide_read_24(ide_drive_t *);
Quoted 4 lines
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 extern void ide_end_drive_cmd(ide_drive_ · line 1302
Quoted 1 line
include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.274027617 +0900 +0
-0extern void SELECT_DRIVE(ide_drive_t *);rest of the patch looks fine
Thanks.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 22/29] ide: convert REQ_DRIVE_TASK to REQ_DRIVE_TASKFILE
Quoted 15 lines · Tejun Heo
Hello again, Bartlomiej.
Quoted 12 lines · Bartlomiej Zolnierkiewicz
Quoted 8 lines · Tejun Heo
Quoted 8 lines
22_ide_taskfile_flush.patch
All
REQ_DRIVE_TASKusers exceptide_task_ioctl()converted to useREQ_DRIVE_TASKFILE.
1.idedisk_issue_flush()converted to useREQ_DRIVE_TASKFILE. This and the changes inide_get_error_location()remove a possible race condition betweenide_get_error_location()and other requests.
Quoted 5 lines
Quoted 1 line
What race condition?
The old
ide_get_error_location()acceses hardware registers after the flush request is finished, so the registers could have been crobbered by other on-going or finished requests.
yep, you are right
Quoted 13 lines
Quoted 12 lines
drivers/ide/ide-io.c static void ide_fill_flush_cmd(ide_drive · line 66
Quoted 7 lines
drivers/ide/ide-io.c +2
-1@@ -80,7 +62,8 @@ static void ide_fill_flush_cmd(ide_drivestatic struct request *ide_queue_flush_cmd (ide_drive_t *drive,struct request *rq,int post) { -struct request *flush_rq = &HWGROUP (drive)->wrq; +struct request *flush_rq = &HWGROUP (drive)->flush_rq; +ide_task_t *args = &HWGROUP (drive)->flush_args;please don't use
HWGROUP()macro, just usedrive->hwif->hwgroupdirectly
Quoted 3 lines
I think I'll leave the code like above here and make another patch which removes all uses of
HWGROUP()andHWGROUP()itself. What do you think about that?
I prefer gradual changes because IMHO such global find'n'replace changes have high noise ratio and are bad for maintainability (also most of the code it would touch need some other fixes anyway).
Quoted 28 lines
Quoted 18 lines
Quoted 18 lines
include/linux/ide.h +14
-0@@ -930,6 +930,39 @@ typedef ide_startstop_t (ide_pre_handlertypedef ide_startstop_t (ide_handler_t )(ide_drive_t *);typedef int (ide_expiry_t )(ide_drive_t *); +typedef struct ide_task_s { +/* + * struct hd_drive_task_hdr tf; + * task_struct_t tf; + * struct hd_drive_hob_hdr hobf; + * hob_struct_t hobf; + */ + task_ioreg_t tfRegister[8]; + task_ioreg_t hobRegister[8]; + ide_reg_valid_t tf_out_flags; + ide_reg_valid_t tf_in_flags; + int data_phase; + int command_type; + ide_pre_handler_t *prehandler;Quoted 9 lines
include/linux/ide.h typedef ide_startstop_t (ide_pre_handler · line 950
Quoted 4 lines
include/linux/ide.h +4
-0+ide_handler_t *handler; +struct request *rq;/* copy of request */ +void *special;/* valid_t generally */ +} ide_task_t;please don't move this around,
adding structide_task_s; should do the trick
Quoted 3 lines
No, I added
ide_task_tflush_argstohwgroup_tnot a pointer toide_task_t, so the definition ofide_task_thas to come before the definition ofhwgroup_t.
OK
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
include/linux/ide.h +9
-0+typedef struct pkt_task_s { +/* + * struct hd_drive_task_hdr pktf; + * task_struct_t pktf; + * u8 pkcdb[12]; + */ + task_ioreg_t tfRegister[8]; + int data_phase; + int command_type;Quoted 9 lines
include/linux/ide.h typedef ide_startstop_t (ide_pre_handler · line 964
Quoted 4 lines
include/linux/ide.h +4
-0+ide_handler_t *handler; +struct request *rq;/* copy of request */ +void *special; +} pkt_task_t;there is no need to move
pkt_task_taround (moreover no code uses it currently)
Quoted 3 lines
And it seemd kind of lonely after
ide_task_tmoved upward. :-) How about modifying this patch such that it moves only theide_task_tand adding another patch to killpkt_task_t?
sounds good
Quoted 30 lines
Quoted 20 lines
Quoted 20 lines
include/linux/ide.h +6
-2typedef struct hwgroup_s { /* irq handler, if active */ ide_startstop_t (*handler)(ide_drive_t *);@@ -955,8 +988,12 @@ typedef struct hwgroup_s {struct request *rq;/* failsafe timer */ struct timer_list timer; -/* local copy of current write rq */ -struct request wrq; +/* rq used for flushing */ +struct request flush_rq; +/* task used for flushing */ +ide_task_t flush_args; +/* real_rq for flushing */ +struct request *flush_real_rq;/* timeout value during long polls */ unsigned long poll_timeout;/* queried upon timeouts */ @@ -1203,7 +1240,7 @@ extern void ide_init_drive_cmd (struct rQuoted 9 lines
include/linux/ide.h extern void ide_init_drive_cmd (struct r · line 1243
Quoted 5 lines
include/linux/ide.h +1
-1/* * this function returns error location sector offset in case of a write error */ -extern u64 ide_get_error_location (ide_drive_t *,char *); +extern u64 ide_get_error_location (ide_drive_t *,ide_task_t *);extern is not needed
Quoted 4 lines
Yeah, it isn't needed. I was trying to be conformant with other declarations in the file. I'll leave above line as it is now and write another patch to remove all extern's in front of function prototypes in ide drivers. What do you think?
I think the same as for HWGROUP() change - better to do it gradually.
Re: [PATCH 2.6.11-rc2 23/29] ide: map ide_task_ioctl() to ide_taskfile_ioctl()
In reply to Tejun HeoQuoted 4 lines
23_ide_taskfile_task_ioctl.patch
ide_task_ioctl()modified to map toide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_TASK.
drivers/ide/ide-taskfile.c +41 -20
@@ -778,30 +778,51 @@ abort:return err; } -static int ide_wait_cmd_task (ide_drive_t *drive,u8 *buf) -{ -struct request rq; - -ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASK ; - rq.buffer = buf; -return ide_do_drive_cmd (drive, &rq, ide_wait); -} - -/* -* FIXME : this needs to map into at taskfile. <[email protected]> -*/ int ide_task_ioctl (ide_drive_t *drive,unsigned int cmd,unsigned long arg) {void __user *p = (void __user *)arg; -int err =0 ; -u8 args[7 ], *argbuf = args; -int argsize =7 ; +u8 args[7 ]; +ide_task_request_t task_req; +task_ioreg_t *io_ports; +mm_segment_t orig_fs; +int ret;if (copy_from_user (args, p,7 ))return -EFAULT ; - err =ide_wait_cmd_task (drive, argbuf); -if (copy_to_user (p, argbuf, argsize)) - err = -EFAULT ; -return err; + +memset (&task_req,0 ,sizeof (task_req)); + task_req.out_flags.h.taskfile =IDE_TASKFILE_STD_OUT_FLAGS ; + task_req.in_flags.h.taskfile =IDE_TASKFILE_STD_IN_FLAGS ; + + io_ports = task_req.io_ports; + io_ports[IDE_COMMAND_OFFSET ] = args[0 ]; + io_ports[IDE_FEATURE_OFFSET ] = args[1 ]; + io_ports[IDE_NSECTOR_OFFSET ] = args[2 ]; + io_ports[IDE_SECTOR_OFFSET ] = args[3 ]; + io_ports[IDE_LCYL_OFFSET ] = args[4 ]; + io_ports[IDE_HCYL_OFFSET ] = args[5 ]; + io_ports[IDE_SELECT_OFFSET ] = args[6 ]; + + task_req.req_cmd =IDE_DRIVE_TASK_NO_DATA ; + task_req.data_phase =TASKFILE_NO_DATA ; + + orig_fs =get_fs (); +set_fs (KERNEL_DS ); + + ret =ide_taskfile_ioctl (drive, cmd, (unsigned long )&task_req); + +set_fs (orig_fs); + + args[0 ] = io_ports[IDE_COMMAND_OFFSET ]; + args[1 ] = io_ports[IDE_FEATURE_OFFSET ]; + args[2 ] = io_ports[IDE_NSECTOR_OFFSET ]; + args[3 ] = io_ports[IDE_SECTOR_OFFSET ]; + args[4 ] = io_ports[IDE_LCYL_OFFSET ]; + args[5 ] = io_ports[IDE_HCYL_OFFSET ]; + args[6 ] = io_ports[IDE_SELECT_OFFSET ]; + +if (copy_to_user (p, args,7 )) + ret = -EFAULT ; + +return ret; }
Re: [PATCH 2.6.11-rc2 23/29] ide: map ide_task_ioctl() to ide_taskfile_ioctl()
Quoted 4 lines · Tejun Heo
Quoted 4 lines
23_ide_taskfile_task_ioctl.patch
ide_task_ioctl()modified to map toide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_TASK.
ide_task_ioctl() should map to taskfile transport not ide_taskfile_ioctl()
Quoted 54 lines
Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-taskfile.c
===================================================================drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.273027780 +0900 +18
-20@@ -778,30 +778,51 @@ abort: return err; } -static int ide_wait_cmd_task(ide_drive_t *drive, u8 *buf) -{ - struct request rq; - - ide_init_drive_cmd(&rq); - rq.flags = REQ_DRIVE_TASK; - rq.buffer = buf; - return ide_do_drive_cmd(drive, &rq, ide_wait); -} - -/* - * FIXME : this needs to map into at taskfile. <[email protected]> - */ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { void __user *p = (void __user *)arg; - int err = 0; - u8 args[7], *argbuf = args; - int argsize = 7; + u8 args[7]; + ide_task_request_t task_req; + task_ioreg_t *io_ports; + mm_segment_t orig_fs; + int ret; if (copy_from_user(args, p, 7)) return -EFAULT; - err = ide_wait_cmd_task(drive, argbuf); - if (copy_to_user(p, argbuf, argsize)) - err = -EFAULT; - return err; + + memset(&task_req, 0, sizeof(task_req)); + task_req.out_flags.h.taskfile = IDE_TASKFILE_STD_OUT_FLAGS; + task_req.in_flags.h.taskfile = IDE_TASKFILE_STD_IN_FLAGS; + + io_ports = task_req.io_ports; + io_ports[IDE_COMMAND_OFFSET] = args[0]; + io_ports[IDE_FEATURE_OFFSET] = args[1]; + io_ports[IDE_NSECTOR_OFFSET] = args[2]; + io_ports[IDE_SECTOR_OFFSET] = args[3]; + io_ports[IDE_LCYL_OFFSET] = args[4]; + io_ports[IDE_HCYL_OFFSET] = args[5]; + io_ports[IDE_SELECT_OFFSET] = args[6];
drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 abort: · line 814
Quoted 10 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.273027780 +0900 +10
-0+ + task_req.req_cmd = IDE_DRIVE_TASK_NO_DATA; + task_req.data_phase = TASKFILE_NO_DATA; + + orig_fs = get_fs(); + set_fs(KERNEL_DS); + + ret = ide_taskfile_ioctl(drive, cmd, (unsigned long)&task_req); + + set_fs(orig_fs);
as HDIO_DRIVE_TASKFILE only supports no-data protocol it should be easy to add missing bits here and get rid of calling ide_taskfile_ioctl()
Quoted 13 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.273027780 +0900 +12
-0+ args[0] = io_ports[IDE_COMMAND_OFFSET]; + args[1] = io_ports[IDE_FEATURE_OFFSET]; + args[2] = io_ports[IDE_NSECTOR_OFFSET]; + args[3] = io_ports[IDE_SECTOR_OFFSET]; + args[4] = io_ports[IDE_LCYL_OFFSET]; + args[5] = io_ports[IDE_HCYL_OFFSET]; + args[6] = io_ports[IDE_SELECT_OFFSET]; + + if (copy_to_user(p, args, 7)) + ret = -EFAULT; + + return ret; }
Re: [PATCH 2.6.11-rc2 23/29] ide: map ide_task_ioctl() to ide_taskfile_ioctl()
Quoted 3 lines · Bartlomiej Zolnierkiewicz
as
HDIO_DRIVE_TASKFILEonly supports no-data protocol it should be easy to add missing bits here and get rid of callingide_taskfile_ioctl()
stupid typo: s/HDIO_DRIVE_TASKFILE/HDIO_DRIVE_TASK/
Re: [PATCH 2.6.11-rc2 24/29] ide: remove REQ_DRIVE_TASK handling
In reply to Tejun HeoQuoted 3 lines
24_ide_remove_task.patch
Unused
REQ_DRIVE_TASKhandling removed.
drivers/ide/ide-io.c +4 -44
@@ -350,20 +350,6 @@ void ide_end_drive_cmd (ide_drive_t *dri args[1 ] = err; args[2 ] = hwif->INB (IDE_NSECTOR_REG ); } - }else if (rq->flags &REQ_DRIVE_TASK ) { -u8 *args = (u8 *) rq->buffer; -if (rq->errors ==0 ) - rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT ); - -if (args) { - args[0 ] = stat; - args[1 ] = err; - args[2 ] = hwif->INB (IDE_NSECTOR_REG ); - args[3 ] = hwif->INB (IDE_SECTOR_REG ); - args[4 ] = hwif->INB (IDE_LCYL_REG ); - args[5 ] = hwif->INB (IDE_HCYL_REG ); - args[6 ] = hwif->INB (IDE_SELECT_REG ); - } }else if (rq->flags &REQ_DRIVE_TASKFILE ) {ide_task_t *args = (ide_task_t *) rq->special;if (rq->errors ==0 )
@@ -550,7 +536,7 @@ ide_startstop_t ide_error (ide_drive_t *return ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK |REQ_DRIVE_TASKFILE )) { +if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { rq->errors =1 ;ide_end_drive_cmd (drive, stat, err);return ide_stopped;
@@ -592,7 +578,7 @@ ide_startstop_t ide_abort(ide_drive_t *dreturn ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK |REQ_DRIVE_TASKFILE )) { +if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { rq->errors =1 ;ide_end_drive_cmd (drive,BUSY_STAT ,0 );return ide_stopped;
@@ -748,33 +734,7 @@ static ide_startstop_t execute_drive_cmd }return do_taskfile (drive, args); - }else if (rq->flags &REQ_DRIVE_TASK ) { -u8 *args = rq->buffer; -u8 sel; - -if (!args) - goto done; -#ifdef DEBUG -printk ("%s: DRIVE_TASK_CMD " , drive->name); -printk ("cmd=0x%02x " , args[0 ]); -printk ("fr=0x%02x " , args[1 ]); -printk ("ns=0x%02x " , args[2 ]); -printk ("sc=0x%02x " , args[3 ]); -printk ("lcyl=0x%02x " , args[4 ]); -printk ("hcyl=0x%02x " , args[5 ]); -printk ("sel=0x%02x\n" , args[6 ]); -#endif - hwif->OUTB (args[1 ],IDE_FEATURE_REG ); - hwif->OUTB (args[3 ],IDE_SECTOR_REG ); - hwif->OUTB (args[4 ],IDE_LCYL_REG ); - hwif->OUTB (args[5 ],IDE_HCYL_REG ); - sel = (args[6 ] & ~0x10 ); -if (drive->select.b.unit) - sel |=0x10 ; - hwif->OUTB (sel,IDE_SELECT_REG ); -ide_cmd (drive, args[0 ], args[2 ], &drive_cmd_intr); -return ide_started; - }else if (rq->flags &REQ_DRIVE_CMD ) { + }else if (rq->flags &REQ_DRIVE_CMD ) {u8 *args = rq->buffer;if (!args)
@@ -885,7 +845,7 @@ static ide_startstop_t start_request (idreturn startstop; }if (!drive->special.all) { -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK )) +if (rq->flags &REQ_DRIVE_CMD )return execute_drive_cmd (drive, rq);else if (rq->flags &REQ_DRIVE_TASKFILE )return execute_drive_cmd (drive, rq);
drivers/ide/ide-lib.c +1 -1
@@ -458,7 +458,7 @@ static void ide_dump_opcode(ide_drive_tspin_unlock (&ide_lock);if (!rq)return ; -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASK )) { +if (rq->flags &REQ_DRIVE_CMD ) {char *args = rq->buffer;if (args) { opcode = args[0 ];
include/linux/blkdev.h +1 -1
@@ -202,7 +202,7 @@ enum rq_flag_bits { __REQ_QUIET,/* don't worry about errors */ __REQ_SPECIAL,/* driver suplied command */ __REQ_DRIVE_CMD, - __REQ_DRIVE_TASK, + __REQ_DRIVE_TASK,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASKFILE, __REQ_PREEMPT,/* set for "ide_preempt" requests */ __REQ_PM_SUSPEND, /* suspend request */
Re: [PATCH 2.6.11-rc2 26/29] ide: map ide_cmd_ioctl() to ide_taskfile_ioctl()
In reply to Tejun HeoQuoted 4 lines
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl()converted to useide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_CMD.
drivers/ide/ide-iops.c +8 -8
@@ -648,11 +648,11 @@ u8 eighty_ninty_three (ide_drive_t *drivEXPORT_SYMBOL (eighty_ninty_three); -int ide_ata66_check (ide_drive_t *drive,ide_task_t *args) +int ide_ata66_check (ide_drive_t *drive,task_ioreg_t *regs) { -if ((args->tfRegister[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && - (args->tfRegister[IDE_SECTOR_OFFSET ] >XFER_UDMA_2 ) && - (args->tfRegister[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER )) { +if ((regs[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && + (regs[IDE_SECTOR_OFFSET ] >XFER_UDMA_2 ) && + (regs[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER )) {#ifndef CONFIG_IDEDMA_IVB if ((drive->id->hw_config &0x6000 ) ==0 ) {#else /* !CONFIG_IDEDMA_IVB */
@@ -678,11 +678,11 @@ int ide_ata66_check (ide_drive_t *drive,* 1 : Safe to update drive->id DMA registers. * 0 : OOPs not allowed. */ -int set_transfer (ide_drive_t *drive,ide_task_t *args) +int set_transfer (ide_drive_t *drive,task_ioreg_t *regs) { -if ((args->tfRegister[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && - (args->tfRegister[IDE_SECTOR_OFFSET ] >=XFER_SW_DMA_0 ) && - (args->tfRegister[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER ) && +if ((regs[IDE_COMMAND_OFFSET ] ==WIN_SETFEATURES ) && + (regs[IDE_SECTOR_OFFSET ] >=XFER_SW_DMA_0 ) && + (regs[IDE_FEATURE_OFFSET ] ==SETFEATURES_XFER ) && (drive->id->dma_ultra || drive->id->dma_mword || drive->id->dma_1word))
drivers/ide/ide-taskfile.c +61 -49
139 lines not on this page · raw message
include/linux/ide.h +2 -10
@@ -1289,14 +1289,6 @@ extern int ide_do_drive_cmd(ide_drive_t*/ extern void ide_end_drive_cmd (ide_drive_t *,u8 ,u8 ); -/* -* Issue ATA command and wait for completion. -* Use for implementing commands in kernel -* -* (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) -*/ -extern int ide_wait_cmd (ide_drive_t *,u8 ,u8 ,u8 ,u8 ,u8 *); -extern u32 ide_read_24 (ide_drive_t *);extern void SELECT_DRIVE (ide_drive_t *);
@@ -1334,10 +1326,10 @@ int ide_task_ioctl(ide_drive_t *, unsignextern int system_bus_clock (void );extern int ide_driveid_update (ide_drive_t *); -extern int ide_ata66_check (ide_drive_t *,ide_task_t *); +extern int ide_ata66_check (ide_drive_t *,task_ioreg_t *);extern int ide_config_drive_speed (ide_drive_t *,u8 );extern u8 eighty_ninty_three (ide_drive_t *); -extern int set_transfer (ide_drive_t *,ide_task_t *); +extern int set_transfer (ide_drive_t *,task_ioreg_t *);extern int taskfile_lib_get_identify (ide_drive_t *drive,u8 *);extern int ide_wait_not_busy (ide_hwif_t *hwif,unsigned long timeout);
Re: [PATCH 2.6.11-rc2 26/29] ide: map ide_cmd_ioctl() to ide_taskfile_ioctl()
Quoted 4 lines · Tejun Heo
Quoted 4 lines
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl()converted to useide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_CMD.
ide_cmd_ioctl() needs to map to taskfile transport not ide_taskfile_ioctl()
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 u8 eighty_ninty_three (ide_drive_t *driv · line 651
Quoted 10 lines
Index:
linux-ide-export/drivers/ide/ide-iops.c
===================================================================drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1@@ -648,11 +648,11 @@ u8 eighty_ninty_three (ide_drive_t *driv EXPORT_SYMBOL(eighty_ninty_three); -int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) +int ide_ata66_check (ide_drive_t *drive, task_ioreg_t *regs)
nitpick: int ide_ata66_check()
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 u8 eighty_ninty_three (ide_drive_t *driv · line 655
Quoted 7 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
nitpick: please drop brackets
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 int ide_ata66_check (ide_drive_t *drive, · line 681
Quoted 9 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1#ifndef CONFIG_IDEDMA_IVB if ((drive->id->hw_config & 0x6000) == 0) { #else /* !CONFIG_IDEDMA_IVB */@@ -678,11 +678,11 @@ int ide_ata66_check (ide_drive_t *drive, * 1 : Safe to update drive->id DMA registers. * 0 : OOPs not allowed. */ -int set_transfer (ide_drive_t *drive, ide_task_t *args) +int set_transfer (ide_drive_t *drive, task_ioreg_t *regs)
nitpick: int set_transfer()
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 int ide_ata66_check (ide_drive_t *drive, · line 685
Quoted 7 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) && + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
nitpick: brackets
Quoted 82 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +0
-0(drive->id->dma_ultra || drive->id->dma_mword || drive->id->dma_1word))Index:
linux-ide-export/drivers/ide/ide-taskfile.c
===================================================================drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +19
-40@@ -704,78 +704,90 @@ abort: return err; } -int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) -{ - struct request rq; - u8 buffer[4]; - - if (!buf) - buf = buffer; - memset(buf, 0, 4 + SECTOR_WORDS * 4 * sectors); - ide_init_drive_cmd(&rq); - rq.buffer = buf; - *buf++ = cmd; - *buf++ = nsect; - *buf++ = feature; - *buf++ = sectors; - return ide_do_drive_cmd(drive, &rq, ide_wait); -} - -/* - * FIXME : this needs to map into at taskfile. <[email protected]> - */ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { - int err = 0; - u8 args[4], *argbuf = args; + u8 args[4]; + ide_task_request_t *task_req; + task_ioreg_t *io_ports; u8 xfer_rate = 0; - int argsize = 4; - ide_task_t tfargs; + mm_segment_t orig_fs; + int in_size, ret; - if (NULL == (void *) arg) { + if ((void *)arg == NULL) { struct request rq; ide_init_drive_cmd(&rq); + rq.flags = REQ_DRIVE_TASKFILE; return ide_do_drive_cmd(drive, &rq, ide_wait); } if (copy_from_user(args, (void __user *)arg, 4)) return -EFAULT; - memset(&tfargs, 0, sizeof(ide_task_t)); - tfargs.tfRegister[IDE_FEATURE_OFFSET] = args[2]; - tfargs.tfRegister[IDE_NSECTOR_OFFSET] = args[3]; - tfargs.tfRegister[IDE_SECTOR_OFFSET] = args[1]; - tfargs.tfRegister[IDE_LCYL_OFFSET] = 0x00; - tfargs.tfRegister[IDE_HCYL_OFFSET] = 0x00; - tfargs.tfRegister[IDE_SELECT_OFFSET] = 0x00; - tfargs.tfRegister[IDE_COMMAND_OFFSET] = args[0]; - - if (args[3]) { - argsize = 4 + (SECTOR_WORDS * 4 * args[3]); - argbuf = kmalloc(argsize, GFP_KERNEL); - if (argbuf == NULL) - return -ENOMEM; - memcpy(argbuf, args, 4); + in_size = 4 * SECTOR_WORDS * args[3]; + + task_req = kmalloc(sizeof(*task_req) + in_size, GFP_KERNEL); + if (task_req == NULL) + return -ENOMEM; + + memset(task_req, 0, sizeof(*task_req) + in_size); + + task_req->out_flags.b.status_command = 1; + task_req->out_flags.b.sector = 1; + task_req->out_flags.b.error_feature = 1; + task_req->out_flags.b.nsector = 1;
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 abort: · line 747
Quoted 10 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +10
-0+ + task_req->in_flags.b.status_command = 1; + task_req->in_flags.b.error_feature = 1; + task_req->in_flags.b.nsector = 1; + + io_ports = task_req->io_ports; + io_ports[IDE_COMMAND_OFFSET] = args[0]; + io_ports[IDE_SECTOR_OFFSET] = args[1]; + io_ports[IDE_FEATURE_OFFSET] = args[2]; + io_ports[IDE_NSECTOR_OFFSET] = args[3];
Please handle WIN_SMART hack here (see execute_drive_cmd()), your next patch just kills it - it can break legacy applications.
Quoted 17 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +12
-2+ if (in_size) { + task_req->req_cmd = IDE_DRIVE_TASK_IN; + task_req->data_phase = TASKFILE_IN; + task_req->in_size = in_size; + } else { + task_req->req_cmd = IDE_DRIVE_TASK_NO_DATA; + task_req->data_phase = TASKFILE_NO_DATA; } - if (set_transfer(drive, &tfargs)) { + + if (set_transfer(drive, io_ports)) { xfer_rate = args[1]; - if (ide_ata66_check(drive, &tfargs)) + if (ide_ata66_check(drive, io_ports)) { + ret = -EIO; goto abort; + }
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 abort: · line 770
Quoted 10 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +5
-2} - err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf); + orig_fs = get_fs(); + set_fs(KERNEL_DS); - if (!err && xfer_rate) { + ret = ide_taskfile_ioctl(drive, cmd, (unsigned long)task_req); + + set_fs(orig_fs);
as ide_cmd_ioctl() only handles no-data and PIO-in protocols it should be easy to add missing bits here and get rid of calling ide_taskfile_ioctl()
Quoted 46 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +13
-5+ if (!ret && xfer_rate) { /* active-retuning-calls future */ ide_set_xfer_rate(drive, xfer_rate); ide_driveid_update(drive); } + + args[0] = io_ports[IDE_STATUS_OFFSET]; + args[1] = io_ports[IDE_ERROR_OFFSET]; + args[2] = io_ports[IDE_NSECTOR_OFFSET]; + args[3] = 0; + + if (copy_to_user((void __user *)arg, args, 4) || + copy_to_user((void __user *)arg + 4, + (void *)task_req + sizeof(*task_req), in_size)) + ret = -EFAULT; abort: - if (copy_to_user((void __user *)arg, argbuf, argsize)) - err = -EFAULT; - if (argsize > 4) - kfree(argbuf); - return err; + kfree(task_req); + return ret; } int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)Index:
linux-ide-export/include/linux/ide.h
===================================================================include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +0
-8@@ -1289,14 +1289,6 @@ extern int ide_do_drive_cmd(ide_drive_t */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); -/* - * Issue ATA command and wait for completion. - * Use for implementing commands in kernel - * - * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) - */ -extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); - extern u32 ide_read_24(ide_drive_t *); extern void SELECT_DRIVE(ide_drive_t *);
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 int ide_task_ioctl(ide_drive_t *, unsign · line 1333
Quoted 10 lines
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +2
-2@@ -1334,10 +1326,10 @@ int ide_task_ioctl(ide_drive_t *, unsign extern int system_bus_clock(void); extern int ide_driveid_update(ide_drive_t *); -extern int ide_ata66_check(ide_drive_t *, ide_task_t *); +extern int ide_ata66_check(ide_drive_t *, task_ioreg_t *); extern int ide_config_drive_speed(ide_drive_t *, u8); extern u8 eighty_ninty_three (ide_drive_t *); -extern int set_transfer(ide_drive_t *, ide_task_t *); +extern int set_transfer(ide_drive_t *, task_ioreg_t *); extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);
extern-s are not needed
Quoted 1 line
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +0
-0extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
Re: [PATCH 2.6.11-rc2 26/29] ide: map ide_cmd_ioctl() to ide_taskfile_ioctl()
Quoted 17 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · Tejun Heo
Quoted 4 lines
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl()converted to useide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_CMD.
ide_cmd_ioctl()needs to map to taskfile transport notide_taskfile_ioctl()Quoted 6 lines
Index:
linux-ide-export/drivers/ide/ide-iops.c
===================================================================drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +0
-0@@ -648,11 +648,11 @@ u8 eighty_ninty_three (ide_drive_t *driv
Quoted 8 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 u8 eighty_ninty_three (ide_drive_t *driv · line 651
Quoted 4 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1EXPORT_SYMBOL(eighty_ninty_three); -int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) +int ide_ata66_check (ide_drive_t *drive, task_ioreg_t *regs)nitpick: int
ide_ata66_check()
meaning...?
Quoted 10 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 u8 eighty_ninty_three (ide_drive_t *driv · line 655
Quoted 8 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
Quoted 2 lines
nitpick: please drop brackets
Parenthese?
Quoted 14 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 int ide_ata66_check (ide_drive_t *drive, · line 681
Quoted 10 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1#ifndef CONFIG_IDEDMA_IVB if ((drive->id->hw_config & 0x6000) == 0) { #else /* !CONFIG_IDEDMA_IVB */@@ -678,11 +678,11 @@ int ide_ata66_check (ide_drive_t *drive, * 1 : Safe to update drive->id DMA registers. * 0 : OOPs not allowed. */ -int set_transfer (ide_drive_t *drive, ide_task_t *args) +int set_transfer (ide_drive_t *drive, task_ioreg_t *regs)nitpick: int
set_transfer()
??
Quoted 10 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 int ide_ata66_check (ide_drive_t *drive, · line 685
Quoted 8 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) && + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
Quoted 2 lines
nitpick: brackets
Parentheses?
Quoted 89 lines
Quoted 89 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +0
-0(drive->id->dma_ultra || drive->id->dma_mword || drive->id->dma_1word))Index:
linux-ide-export/drivers/ide/ide-taskfile.c
===================================================================drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +25
-40@@ -704,78 +704,90 @@ abort: return err; } -int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) -{ - struct request rq; - u8 buffer[4]; - - if (!buf) - buf = buffer; - memset(buf, 0, 4 + SECTOR_WORDS * 4 * sectors); - ide_init_drive_cmd(&rq); - rq.buffer = buf; - *buf++ = cmd; - *buf++ = nsect; - *buf++ = feature; - *buf++ = sectors; - return ide_do_drive_cmd(drive, &rq, ide_wait); -} - -/* - * FIXME : this needs to map into at taskfile. <[email protected]> - */ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { - int err = 0; - u8 args[4], *argbuf = args; + u8 args[4]; + ide_task_request_t *task_req; + task_ioreg_t *io_ports; u8 xfer_rate = 0; - int argsize = 4; - ide_task_t tfargs; + mm_segment_t orig_fs; + int in_size, ret; - if (NULL == (void *) arg) { + if ((void *)arg == NULL) { struct request rq; ide_init_drive_cmd(&rq); + rq.flags = REQ_DRIVE_TASKFILE; return ide_do_drive_cmd(drive, &rq, ide_wait); } if (copy_from_user(args, (void __user *)arg, 4)) return -EFAULT; - memset(&tfargs, 0, sizeof(ide_task_t)); - tfargs.tfRegister[IDE_FEATURE_OFFSET] = args[2]; - tfargs.tfRegister[IDE_NSECTOR_OFFSET] = args[3]; - tfargs.tfRegister[IDE_SECTOR_OFFSET] = args[1]; - tfargs.tfRegister[IDE_LCYL_OFFSET] = 0x00; - tfargs.tfRegister[IDE_HCYL_OFFSET] = 0x00; - tfargs.tfRegister[IDE_SELECT_OFFSET] = 0x00; - tfargs.tfRegister[IDE_COMMAND_OFFSET] = args[0]; - - if (args[3]) { - argsize = 4 + (SECTOR_WORDS * 4 * args[3]); - argbuf = kmalloc(argsize, GFP_KERNEL); - if (argbuf == NULL) - return -ENOMEM; - memcpy(argbuf, args, 4); + in_size = 4 * SECTOR_WORDS * args[3]; + + task_req = kmalloc(sizeof(*task_req) + in_size, GFP_KERNEL); + if (task_req == NULL) + return -ENOMEM; + + memset(task_req, 0, sizeof(*task_req) + in_size); + + task_req->out_flags.b.status_command = 1; + task_req->out_flags.b.sector = 1; + task_req->out_flags.b.error_feature = 1; + task_req->out_flags.b.nsector = 1; + + task_req->in_flags.b.status_command = 1; + task_req->in_flags.b.error_feature = 1; + task_req->in_flags.b.nsector = 1; + + io_ports = task_req->io_ports;
Quoted 9 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 abort: · line 747
Quoted 4 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +4
-0+ io_ports[IDE_COMMAND_OFFSET] = args[0]; + io_ports[IDE_SECTOR_OFFSET] = args[1]; + io_ports[IDE_FEATURE_OFFSET] = args[2]; + io_ports[IDE_NSECTOR_OFFSET] = args[3];Please handle
WIN_SMARThack here (seeexecute_drive_cmd()), your next patch just kills it - it can break legacy applications.
Thanks, I missed that.
Quoted 24 lines
Quoted 24 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +14
-3+ if (in_size) { + task_req->req_cmd = IDE_DRIVE_TASK_IN; + task_req->data_phase = TASKFILE_IN; + task_req->in_size = in_size; + } else { + task_req->req_cmd = IDE_DRIVE_TASK_NO_DATA; + task_req->data_phase = TASKFILE_NO_DATA; } - if (set_transfer(drive, &tfargs)) { + + if (set_transfer(drive, io_ports)) { xfer_rate = args[1]; - if (ide_ata66_check(drive, &tfargs)) + if (ide_ata66_check(drive, io_ports)) { + ret = -EIO; goto abort; + } } - err = ide_wait_cmd(drive, args[0], args[1], args[2], args[3], argbuf); + orig_fs = get_fs(); + set_fs(KERNEL_DS);
Quoted 9 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 abort: · line 770
Quoted 4 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +3
-1- if (!err && xfer_rate) { + ret = ide_taskfile_ioctl(drive, cmd, (unsigned long)task_req); + + set_fs(orig_fs);as
ide_cmd_ioctl()only handles no-data and PIO-in protocols it should be easy to add missing bits here and get rid of callingide_taskfile_ioctl()
Okay.
Quoted 49 lines
Quoted 49 lines
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +11
-0+ if (!ret && xfer_rate) { /* active-retuning-calls future */ ide_set_xfer_rate(drive, xfer_rate); ide_driveid_update(drive); } + + args[0] = io_ports[IDE_STATUS_OFFSET]; + args[1] = io_ports[IDE_ERROR_OFFSET]; + args[2] = io_ports[IDE_NSECTOR_OFFSET]; + args[3] = 0; + + if (copy_to_user((void __user *)arg, args, 4) || + copy_to_user((void __user *)arg + 4, + (void *)task_req + sizeof(*task_req), in_size)) + ret = -EFAULT;abort:
drivers/ide/ide-taskfile.c 2005-02-02 10:28:07.407843655 +0900 renamed from drivers/ide/ide-taskfile.c 2005-02-02 10:28:06.751950074 +0900 +2
-5- if (copy_to_user((void __user *)arg, argbuf, argsize)) - err = -EFAULT; - if (argsize > 4) - kfree(argbuf); - return err; + kfree(task_req); + return ret;}
int
ide_task_ioctl(ide_drive_t*drive, unsigned int cmd, unsigned long arg)
Index:linux-ide-export/include/linux/ide.h
===================================================================include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +0
-8@@ -1289,14 +1289,6 @@ extern int ide_do_drive_cmd(ide_drive_t */ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8); -/* - * Issue ATA command and wait for completion. - * Use for implementing commands in kernel - * - * (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) - */ -extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); - extern u32 ide_read_24(ide_drive_t *); extern void SELECT_DRIVE(ide_drive_t *);@@ -1334,10 +1326,10 @@ int ide_task_ioctl(ide_drive_t *, unsign extern int system_bus_clock(void);
Quoted 14 lines
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 int ide_task_ioctl(ide_drive_t *, unsign · line 1333
Quoted 8 lines
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +2
-2extern int ide_driveid_update(ide_drive_t *); -extern int ide_ata66_check(ide_drive_t *, ide_task_t *); +extern int ide_ata66_check(ide_drive_t *, task_ioreg_t *); extern int ide_config_drive_speed(ide_drive_t *, u8); extern u8 eighty_ninty_three (ide_drive_t *); -extern int set_transfer(ide_drive_t *, ide_task_t *); +extern int set_transfer(ide_drive_t *, task_ioreg_t *); extern int taskfile_lib_get_identify(ide_drive_t *drive, u8 *);extern-s are not needed
Quoted 1 line
include/linux/ide.h 2005-02-02 10:28:07.408843493 +0900 renamed from include/linux/ide.h 2005-02-02 10:28:06.529986088 +0900 +0
-0extern int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout);
Okay.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 26/29] ide: map ide_cmd_ioctl() to ide_taskfile_ioctl()
Quoted 20 lines · Tejun Heo
Quoted 19 lines · Bartlomiej Zolnierkiewicz
Quoted 4 lines · Tejun Heo
Quoted 4 lines
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl()converted to useide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_CMD.
ide_cmd_ioctl()needs to map to taskfile transport notide_taskfile_ioctl()Quoted 8 lines
Index:
linux-ide-export/drivers/ide/ide-iops.c
===================================================================drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +0
-0@@ -648,11 +648,11 @@ u8 eighty_ninty_three (ide_drive_t *driv EXPORT_SYMBOL(eighty_ninty_three);
Quoted 8 lines
Quoted 6 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 u8 eighty_ninty_three (ide_drive_t *driv · line 651
Quoted 2 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1-int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) +int ide_ata66_check (ide_drive_t *drive, task_ioreg_t *regs)nitpick: int
ide_ata66_check()meaning...?
silly minor nitpick - please drop extra space while at it:
int ide_ata66_check(ide_drive_t *drive, task_ioreg_t *regs)
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) {
Quoted 4 lines
Quoted 2 lines
nitpick: please drop brackets
Parenthese?
doh, yes
Quoted 15 lines
Quoted 14 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 int ide_ata66_check (ide_drive_t *drive, · line 681
Quoted 10 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +1
-1#ifndef CONFIG_IDEDMA_IVB if ((drive->id->hw_config & 0x6000) == 0) { #else /* !CONFIG_IDEDMA_IVB */@@ -678,11 +678,11 @@ int ide_ata66_check (ide_drive_t *drive, * 1 : Safe to update drive->id DMA registers. * 0 : OOPs not allowed. */ -int set_transfer (ide_drive_t *drive, ide_task_t *args) +int set_transfer (ide_drive_t *drive, task_ioreg_t *regs)nitpick: int
set_transfer()
Quoted 1 line
??
extra space
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
drivers/ide/ide-iops.c 2005-02-02 10:28:07.406843817 +0900 renamed from drivers/ide/ide-iops.c 2005-02-02 10:28:04.466320918 +0900 +3
-3{ - if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && - (args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && - (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) && + if ((regs[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && + (regs[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && + (regs[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) &&
Quoted 4 lines
Quoted 2 lines
nitpick: brackets
Parentheses?
yep
Re: [PATCH 2.6.11-rc2 27/29] ide: remove REQ_DRIVE_CMD handling
In reply to Tejun HeoQuoted 3 lines
27_ide_remove_cmd.patch
Removed unused
REQ_DRIVE_CMDhandling.
drivers/ide/ide-io.c +39 -136
@@ -340,17 +340,7 @@ void ide_end_drive_cmd (ide_drive_t *dri rq =HWGROUP (drive)->rq;spin_unlock_irqrestore (&ide_lock, flags); -if (rq->flags &REQ_DRIVE_CMD ) { -u8 *args = (u8 *) rq->buffer; -if (rq->errors ==0 ) - rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT ); - -if (args) { - args[0 ] = stat; - args[1 ] = err; - args[2 ] = hwif->INB (IDE_NSECTOR_REG ); - } - }else if (rq->flags &REQ_DRIVE_TASKFILE ) { +if (rq->flags &REQ_DRIVE_TASKFILE ) {ide_task_t *args = (ide_task_t *) rq->special;if (rq->errors ==0 ) rq->errors = !OK_STAT (stat,READY_STAT ,BAD_STAT );
@@ -536,7 +526,7 @@ ide_startstop_t ide_error (ide_drive_t *return ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { +if (rq->flags &REQ_DRIVE_TASKFILE ) { rq->errors =1 ;ide_end_drive_cmd (drive, stat, err);return ide_stopped;
@@ -578,7 +568,7 @@ ide_startstop_t ide_abort(ide_drive_t *dreturn ide_stopped;/* retry only "normal" I/O: */ -if (rq->flags & (REQ_DRIVE_CMD |REQ_DRIVE_TASKFILE )) { +if (rq->flags &REQ_DRIVE_TASKFILE ) { rq->errors =1 ;ide_end_drive_cmd (drive,BUSY_STAT ,0 );return ide_stopped;
@@ -588,63 +578,6 @@ ide_startstop_t ide_abort(ide_drive_t *d }/** -* ide_cmd - issue a simple drive command -* @drive: drive the command is for -* @cmd: command byte -* @nsect: sector byte -* @handler: handler for the command completion -* -* Issue a simple drive command with interrupts. -* The drive must be selected beforehand. -*/ - -static void ide_cmd (ide_drive_t *drive,u8 cmd,u8 nsect, -ide_handler_t *handler) -{ -ide_hwif_t *hwif =HWIF (drive); -if (IDE_CONTROL_REG ) - hwif->OUTB (drive->ctl,IDE_CONTROL_REG );/* clear nIEN */ -SELECT_MASK (drive,0 ); - hwif->OUTB (nsect,IDE_NSECTOR_REG ); -ide_execute_command (drive, cmd, handler,WAIT_CMD ,NULL ); -} - -/** -* drive_cmd_intr - drive command completion interrupt -* @drive: drive the completion interrupt occurred on -* -* drive_cmd_intr() is invoked on completion of a special DRIVE_CMD. -* We do any necessary daya reading and then wait for the drive to -* go non busy. At that point we may read the error data and complete -* the request -*/ - -static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) -{ -struct request *rq =HWGROUP (drive)->rq; -ide_hwif_t *hwif =HWIF (drive); -u8 *args = (u8 *) rq->buffer; -u8 stat = hwif->INB (IDE_STATUS_REG ); -int retries =10 ; - -local_irq_enable (); -if ((stat &DRQ_STAT ) && args && args[3 ]) { -u8 io_32bit = drive->io_32bit; - drive->io_32bit =0 ; - hwif->ata_input_data (drive, &args[4 ], args[3 ] *SECTOR_WORDS ); - drive->io_32bit = io_32bit; -while (((stat = hwif->INB (IDE_STATUS_REG )) &BUSY_STAT ) && retries--) -udelay (100 ); - } - -if (!OK_STAT (stat,READY_STAT ,BAD_STAT ) &&DRIVER (drive) !=NULL ) -return ide_error (drive,"drive_cmd" , stat); -/* calls ide_end_drive_cmd */ -ide_end_drive_cmd (drive, stat, hwif->INB (IDE_ERROR_REG )); -return ide_stopped; -} - -/** * do_special - issue some special commands * @drive: drive the command is for *
@@ -699,78 +632,50 @@ void ide_init_sg_cmd(ide_drive_t *drive,EXPORT_SYMBOL_GPL (ide_init_sg_cmd);/** -* execute_drive_command - issue special drive command +* execute_drive_taskfile - issue special drive command * @drive: the drive to issue th command on * @rq: the request structure holding the command * -* execute_drive_cmd() issues a special drive command, usually -* initiated by ioctl() from the external hdparm program. The -* command can be a drive command, drive task or taskfile -* operation. Weirdly you can call it with NULL to wait for -* all commands to finish. Don't do this as that is due to change +* execute_drive_taskfile() issues a special drive command, +* usually initiated by ioctl() from the external hdparm program. +* Weirdly you can call it with NULL to wait for all commands to +* finish. Don't do this as that is due to change */ -static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, -struct request *rq) +static ide_startstop_t execute_drive_taskfile (ide_drive_t *drive, +struct request *rq) {ide_hwif_t *hwif =HWIF (drive); -if (rq->flags &REQ_DRIVE_TASKFILE ) { -ide_task_t *args = rq->special; - -if (!args) - goto done; - - hwif->data_phase = args->data_phase; - -switch (hwif->data_phase) { -case TASKFILE_MULTI_OUT : -case TASKFILE_OUT : -case TASKFILE_MULTI_IN : -case TASKFILE_IN : -ide_init_sg_cmd (drive, rq); -ide_map_sg (drive, rq); -default : -break ; - } +ide_task_t *args = rq->special; -return do_taskfile (drive, args); - }else if (rq->flags &REQ_DRIVE_CMD ) { -u8 *args = rq->buffer; - -if (!args) - goto done; -#ifdef DEBUG -printk ("%s: DRIVE_CMD " , drive->name); -printk ("cmd=0x%02x " , args[0 ]); -printk ("sc=0x%02x " , args[1 ]); -printk ("fr=0x%02x " , args[2 ]); -printk ("xx=0x%02x\n" , args[3 ]); -#endif -if (args[0 ] ==WIN_SMART ) { - hwif->OUTB (0x4f ,IDE_LCYL_REG ); - hwif->OUTB (0xc2 ,IDE_HCYL_REG ); - hwif->OUTB (args[2 ],IDE_FEATURE_REG ); - hwif->OUTB (args[1 ],IDE_SECTOR_REG ); -ide_cmd (drive, args[0 ], args[3 ], &drive_cmd_intr); -return ide_started; - } - hwif->OUTB (args[2 ],IDE_FEATURE_REG ); -ide_cmd (drive, args[0 ], args[1 ], &drive_cmd_intr); -return ide_started; - } - -done: -/* -* NULL is actually a valid way of waiting for -* all current requests to be flushed from the queue. - */ +if (!args) { +/* +* NULL is actually a valid way of waiting for +* all current requests to be flushed from the queue. +*/ #ifdef DEBUG -printk ("%s: DRIVE_CMD (null)\n" , drive->name); +printk ("%s: DRIVE_TASKFILE (null)\n" , drive->name);#endif -ide_end_drive_cmd (drive, - hwif->INB (IDE_STATUS_REG ), - hwif->INB (IDE_ERROR_REG )); -return ide_stopped; +ide_end_drive_cmd (drive, + hwif->INB (IDE_STATUS_REG ), + hwif->INB (IDE_ERROR_REG )); +return ide_stopped; + } + + hwif->data_phase = args->data_phase; + +switch (hwif->data_phase) { +case TASKFILE_MULTI_OUT : +case TASKFILE_OUT : +case TASKFILE_MULTI_IN : +case TASKFILE_IN : +ide_init_sg_cmd (drive, rq); +ide_map_sg (drive, rq); +default : +break ; + } + +return do_taskfile (drive, args); }/**
@@ -845,10 +750,8 @@ static ide_startstop_t start_request (idreturn startstop; }if (!drive->special.all) { -if (rq->flags &REQ_DRIVE_CMD ) -return execute_drive_cmd (drive, rq); -else if (rq->flags &REQ_DRIVE_TASKFILE ) -return execute_drive_cmd (drive, rq); +if (rq->flags &REQ_DRIVE_TASKFILE ) +return execute_drive_taskfile (drive, rq);else if (blk_pm_request (rq)) {#ifdef DEBUG_PM printk("%s: start_power_step(step: %d)\n",
include/linux/blkdev.h +1 -1
@@ -201,7 +201,7 @@ enum rq_flag_bits { __REQ_FAILED,/* set if the request failed */ __REQ_QUIET,/* don't worry about errors */ __REQ_SPECIAL,/* driver suplied command */ - __REQ_DRIVE_CMD, + __REQ_DRIVE_CMD,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASK,/* obsolete, unused anymore - tj */ __REQ_DRIVE_TASKFILE, __REQ_PREEMPT, /* set for "ide_preempt" requests */
Re: [PATCH 2.6.11-rc2 28/29] ide: ide_init_drive_cmd() now defaults to REQ_DRIVE_TASKFILE
In reply to Tejun HeoQuoted 4 lines
28_ide_taskfile_init_drive_cmd.patch
ide_init_drive_cmd() now initializes rq->flags to REQ_DRIVE_TASKFILE.
drivers/ide/ide-disk.c +0 -1
@@ -750,7 +750,6 @@ static int set_multcount(ide_drive_t *drif (drive->special.b.set_multmode)return -EBUSY ;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASKFILE ; drive->mult_req = arg; drive->special.b.set_multmode =1 ; (void )ide_do_drive_cmd (drive, &rq, ide_wait);
drivers/ide/ide-io.c +2 -2
@@ -75,7 +75,7 @@ static struct request *ide_queue_flush_c }ide_init_drive_cmd (flush_rq); - flush_rq->flags =REQ_DRIVE_TASKFILE |REQ_STARTED ; + flush_rq->flags |=REQ_STARTED ; flush_rq->nr_sectors = rq->nr_sectors; flush_rq->special = args;HWGROUP (drive)->flush_real_rq = rq;
@@ -1401,7 +1401,7 @@ irqreturn_t ide_intr (int irq, void *devvoid ide_init_drive_cmd (struct request *rq) {memset (rq,0 ,sizeof (*rq)); - rq->flags =REQ_DRIVE_CMD ; + rq->flags =REQ_DRIVE_TASKFILE ; rq->ref_count =1 ; }
drivers/ide/ide-taskfile.c +0 -2
@@ -515,7 +515,6 @@ static int ide_diag_taskfile(ide_drive_tstruct request rq;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASKFILE ; rq.buffer = buf;/*
@@ -716,7 +715,6 @@ int ide_cmd_ioctl (ide_drive_t *drive, uif ((void *)arg ==NULL ) {struct request rq;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASKFILE ;return ide_do_drive_cmd (drive, &rq, ide_wait); }
drivers/ide/ide.c +0 -1
@@ -1255,7 +1255,6 @@ static int set_pio_mode (ide_drive_t *drif (drive->special.b.set_tune)return -EBUSY ;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_TASKFILE ; drive->tune_req = (u8 ) arg; drive->special.b.set_tune =1 ; (void )ide_do_drive_cmd (drive, &rq, ide_wait);
Re: [PATCH 2.6.11-rc2 29/29] ide: make data_phase explicit in NO_DATA cases
In reply to Tejun HeoQuoted 3 lines
29_ide_explicit_TASKFILE_NO_DATA.patch
Make
data_phaseexplicit inNO_DATAcases.
drivers/ide/ide-disk.c +18 -1
@@ -300,6 +300,7 @@ static unsigned long idedisk_read_native args.tfRegister[IDE_SELECT_OFFSET ] =0x40 ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_READ_NATIVE_MAX ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;/* submit command request */ ide_raw_taskfile (drive, &args,NULL );
@@ -326,6 +327,7 @@ static unsigned long long idedisk_read_n args.tfRegister[IDE_SELECT_OFFSET ] =0x40 ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_READ_NATIVE_MAX_EXT ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;/* submit command request */ ide_raw_taskfile (drive, &args,NULL );
@@ -362,6 +364,7 @@ static unsigned long idedisk_set_max_add args.tfRegister[IDE_SELECT_OFFSET ] = ((addr_req >>24 ) &0x0f ) |0x40 ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SET_MAX ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;/* submit command request */ ide_raw_taskfile (drive, &args,NULL );
@@ -395,6 +398,7 @@ static unsigned long long idedisk_set_ma args.hobRegister[IDE_SELECT_OFFSET ] =0x40 ; args.hobRegister[IDE_CONTROL_OFFSET_HOB ]= (drive->ctl|0x80 ); args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;/* submit command request */ ide_raw_taskfile (drive, &args,NULL );
@@ -534,6 +538,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_SELECT_OFFSET ] = ((drive->head-1 )|drive->select.all)&0xBF ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SPECIFY ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &set_geometry_intr;do_taskfile (drive, &args); }
@@ -545,6 +550,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_NSECTOR_OFFSET ] = drive->sect; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_RESTORE ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &recal_intr;do_taskfile (drive, &args); }
@@ -558,6 +564,7 @@ static ide_startstop_t idedisk_special ( args.tfRegister[IDE_NSECTOR_OFFSET ] = drive->mult_req; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETMULT ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &set_multmode_intr;do_taskfile (drive, &args); }
@@ -597,6 +604,7 @@ static int smart_enable(ide_drive_t *dri args.tfRegister[IDE_HCYL_OFFSET ] =SMART_HCYL_PASS ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SMART ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;return ide_raw_taskfile (drive, &args,NULL ); }
@@ -720,6 +728,7 @@ static int idedisk_issue_flush(request_q args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = task_no_data_intr; rq =blk_get_request (q,WRITE , __GFP_WAIT);
@@ -779,6 +788,7 @@ static int write_cache(ide_drive_t *driv SETFEATURES_EN_WCACHE :SETFEATURES_DIS_WCACHE ; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETFEATURES ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr; err =ide_raw_taskfile (drive, &args,NULL );
@@ -799,6 +809,7 @@ static int do_idedisk_flushcache (ide_drelse args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;return ide_raw_taskfile (drive, &args,NULL ); }
@@ -813,6 +824,7 @@ static int set_acoustic (ide_drive_t *dr args.tfRegister[IDE_NSECTOR_OFFSET ] = arg; args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETFEATURES ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;ide_raw_taskfile (drive, &args,NULL ); drive->acoustic = arg;
@@ -906,19 +918,22 @@ static ide_startstop_t idedisk_start_powelse args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_FLUSH_CACHE ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; + args->data_phase =TASKFILE_NO_DATA ; args->handler = &task_no_data_intr;return do_taskfile (drive, args);case idedisk_pm_standby:/* Suspend step 2 (standby) */ args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_STANDBYNOW1 ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; + args->data_phase =TASKFILE_NO_DATA ; args->handler = &task_no_data_intr;return do_taskfile (drive, args);case idedisk_pm_idle:/* Resume step 1 (idle) */ args->tfRegister[IDE_COMMAND_OFFSET ] =WIN_IDLEIMMEDIATE ; args->command_type =IDE_DRIVE_TASK_NO_DATA ; - args->handler = task_no_data_intr; + args->data_phase =TASKFILE_NO_DATA ; + args->handler = task_no_data_intr;return do_taskfile (drive, args);case idedisk_pm_restore_dma:/* Resume step 2 (restore DMA) */
@@ -1195,6 +1210,7 @@ static int idedisk_open(struct inode *inmemset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORLOCK ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;check_disk_change (inode->i_bdev);/*
@@ -1218,6 +1234,7 @@ static int idedisk_release(struct inodememset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORUNLOCK ; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = &task_no_data_intr;if (drive->doorlocking &&ide_raw_taskfile (drive, &args,NULL )) drive->doorlocking =0 ;
drivers/ide/ide.c +1 -0
@@ -1271,6 +1271,7 @@ static int set_xfer_rate (ide_drive_t *d args.tfRegister[IDE_FEATURE_OFFSET ] =SETFEATURES_XFER ; args.tfRegister[IDE_NSECTOR_OFFSET ] = arg; args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.data_phase =TASKFILE_NO_DATA ; args.handler = task_no_data_intr; err =ide_raw_taskfile (drive, &args,NULL );
Re: [PATCH 2.6.11-rc2 29/29] ide: make data_phase explicit in NO_DATA cases
Quoted 11 lines · Tejun Heo
Quoted 3 lines
29_ide_explicit_TASKFILE_NO_DATA.patch
Make
data_phaseexplicit inNO_DATAcases.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================
drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 static unsigned long idedisk_read_native · line 304
Quoted 5 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:07.852771465 +0900 +1
-0@@ -300,6 +300,7 @@ static unsigned long idedisk_read_native args.tfRegister[IDE_SELECT_OFFSET] = 0x40; args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX; args.command_type = IDE_DRIVE_TASK_NO_DATA; + args.data_phase = TASKFILE_NO_DATA; args.handler = &task_no_data_intr;
Could you add small helper to ide.h for doing this?
static inline void ide_prep_no_data_cmd(ide_task_t *task)
{
task->command_type = IDE_DRIVE_TASK_NO_DATA;
task->data_phase = TASKFILE_NO_DATA;
task->handler = &task_no_data_intr;
}Also please move this patch earlier in the series
so I can merge it quickly.
Thanks.
Re: [PATCH 2.6.11-rc2 29/29] ide: make data_phase explicit in NO_DATA cases
Quoted 22 lines · Bartlomiej Zolnierkiewicz
Quoted 11 lines · Tejun Heo
Quoted 3 lines
29_ide_explicit_TASKFILE_NO_DATA.patch
Make
data_phaseexplicit inNO_DATAcases.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 static unsigned long idedisk_read_native · line 304
Quoted 5 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:07.852771465 +0900 +1
-0@@ -300,6 +300,7 @@ static unsigned long idedisk_read_native args.tfRegister[IDE_SELECT_OFFSET] = 0x40; args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX; args.command_type = IDE_DRIVE_TASK_NO_DATA; + args.data_phase = TASKFILE_NO_DATA; args.handler = &task_no_data_intr;Could you add small helper to
ide.hfor doing this?
Quoted 6 lines
static inline void
ide_prep_no_data_cmd(ide_task_t *task){ task->command_type = IDE_DRIVE_TASK_NO_DATA; task->data_phase = TASKFILE_NO_DATA; task->handler = &task_no_data_intr; }
I am thinking about removing task->handler initialization. Such that it defaults to task_no_data_intr if data_phase == TASKFILE_NO_DATA and so on for all other data_phases. Currently, the same information is specified repeatedly. What do you think?
Quoted 4 lines
Also please move this patch earlier in the series
so I can merge it quickly.Thanks.
Sure.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 29/29] ide: make data_phase explicit in NO_DATA cases
Quoted 30 lines · Tejun Heo
Quoted 22 lines · Bartlomiej Zolnierkiewicz
Quoted 11 lines · Tejun Heo
Quoted 3 lines
29_ide_explicit_TASKFILE_NO_DATA.patch
Make
data_phaseexplicit inNO_DATAcases.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 static unsigned long idedisk_read_native · line 304
Quoted 5 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:08.121727827 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:07.852771465 +0900 +1
-0@@ -300,6 +300,7 @@ static unsigned long idedisk_read_native args.tfRegister[IDE_SELECT_OFFSET] = 0x40; args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX; args.command_type = IDE_DRIVE_TASK_NO_DATA; + args.data_phase = TASKFILE_NO_DATA; args.handler = &task_no_data_intr;Could you add small helper to
ide.hfor doing this?Quoted 6 lines
static inline void
ide_prep_no_data_cmd(ide_task_t *task){ task->command_type = IDE_DRIVE_TASK_NO_DATA; task->data_phase = TASKFILE_NO_DATA; task->handler = &task_no_data_intr; }
Quoted 4 lines
I am thinking about removing
task->handlerinitialization. Such that it defaults totask_no_data_intrifdata_phase==TASKFILE_NO_DATAand so on for all otherdata_phases. Currently, the same information is specified repeatedly. What do you think?
Please do it.
Re: [PATCH 2.6.11-rc2 25/29] ide: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
In reply to Tejun HeoQuoted 4 lines
25_ide_taskfile_cmd.patch
All in-kernel
REQ_DRIVE_CMDusers except foride_cmd_ioctl()converted to useREQ_DRIVE_TASKFILE.
drivers/ide/ide-disk.c +1 -1
@@ -750,7 +750,7 @@ static int set_multcount(ide_drive_t *drif (drive->special.b.set_multmode)return -EBUSY ;ide_init_drive_cmd (&rq); - rq.flags =REQ_DRIVE_CMD ; + rq.flags =REQ_DRIVE_TASKFILE ; drive->mult_req = arg; drive->special.b.set_multmode =1 ; (void )ide_do_drive_cmd (drive, &rq, ide_wait);
drivers/ide/ide.c +12 -3
@@ -1255,6 +1255,7 @@ static int set_pio_mode (ide_drive_t *drif (drive->special.b.set_tune)return -EBUSY ;ide_init_drive_cmd (&rq); + rq.flags =REQ_DRIVE_TASKFILE ; drive->tune_req = (u8 ) arg; drive->special.b.set_tune =1 ; (void )ide_do_drive_cmd (drive, &rq, ide_wait);
@@ -1263,9 +1264,17 @@ static int set_pio_mode (ide_drive_t *drstatic int set_xfer_rate (ide_drive_t *drive,int arg) { -int err =ide_wait_cmd (drive, -WIN_SETFEATURES , (u8 ) arg, -SETFEATURES_XFER ,0 ,NULL ); +ide_task_t args; +int err; + +memset (&args,0 ,sizeof (args)); + args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_SETFEATURES ; + args.tfRegister[IDE_FEATURE_OFFSET ] =SETFEATURES_XFER ; + args.tfRegister[IDE_NSECTOR_OFFSET ] = arg; + args.command_type =IDE_DRIVE_TASK_NO_DATA ; + args.handler = task_no_data_intr; + + err =ide_raw_taskfile (drive, &args,NULL );if (!err && arg) {ide_set_xfer_rate (drive, (u8 ) arg);
Re: [PATCH 2.6.11-rc2 25/29] ide: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
Quoted 12 lines · Tejun Heo
Quoted 4 lines
25_ide_taskfile_cmd.patch
All in-kernel
REQ_DRIVE_CMDusers except foride_cmd_ioctl()converted to useREQ_DRIVE_TASKFILE.Signed-off-by Tejun Heo <[email protected]>Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 static int set_multcount(ide_drive_t *dr · line 753
Quoted 5 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 +1
-1@@ -750,7 +750,7 @@ static int set_multcount(ide_drive_t *dr if (drive->special.b.set_multmode) return -EBUSY; ide_init_drive_cmd (&rq); - rq.flags = REQ_DRIVE_CMD; + rq.flags = REQ_DRIVE_TASKFILE;
Please instead fix ide_init_drive_cmd() to set REQ_DRIVE_TASKFILE and add set REQ_DRIVE_CMD only in ide_cmd_ioctl().
Quoted 15 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 +0
-0drive->mult_req = arg; drive->special.b.set_multmode = 1; (void) ide_do_drive_cmd (drive, &rq, ide_wait);Index:
linux-ide-export/drivers/ide/ide.c
===================================================================drivers/ide/ide.c 2005-02-02 10:28:07.205876425 +0900 renamed from drivers/ide/ide.c 2005-02-02 10:27:14.652402828 +0900 +1
-0@@ -1255,6 +1255,7 @@ static int set_pio_mode (ide_drive_t *dr if (drive->special.b.set_tune) return -EBUSY; ide_init_drive_cmd(&rq); + rq.flags = REQ_DRIVE_TASKFILE; drive->tune_req = (u8) arg; drive->special.b.set_tune = 1; (void) ide_do_drive_cmd(drive, &rq, ide_wait);
Re: [PATCH 2.6.11-rc2 25/29] ide: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
Hello,
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 4 lines
25_ide_taskfile_cmd.patch
All in-kernel
REQ_DRIVE_CMDusers except foride_cmd_ioctl()converted to useREQ_DRIVE_TASKFILE.Signed-off-by Tejun Heo <[email protected]>
Quoted 15 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 static int set_multcount(ide_drive_t *dr · line 753
Quoted 10 lines
Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 +1
-1@@ -750,7 +750,7 @@ static int set_multcount(ide_drive_t *dr if (drive->special.b.set_multmode) return -EBUSY; ide_init_drive_cmd (&rq); - rq.flags = REQ_DRIVE_CMD; + rq.flags = REQ_DRIVE_TASKFILE;Please instead fix
ide_init_drive_cmd()to setREQ_DRIVE_TASKFILEand add setREQ_DRIVE_CMDonly inide_cmd_ioctl().
This is done in patch #28. If you don't like the ordering of the patches, I can change the orders but I don't think that improves anything. This order is as good as the other order.
Quoted 16 lines
Quoted 9 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 +0
-0drive->mult_req = arg; drive->special.b.set_multmode = 1; (void) ide_do_drive_cmd (drive, &rq, ide_wait);Index:
linux-ide-export/drivers/ide/ide.c
===================================================================drivers/ide/ide.c 2005-02-02 10:28:07.205876425 +0900 static int set_pio_mode (ide_drive_t *dr · line 1261
Quoted 7 lines
drivers/ide/ide.c 2005-02-02 10:28:07.205876425 +0900 renamed from drivers/ide/ide.c 2005-02-02 10:27:14.652402828 +0900 +1
-0@@ -1255,6 +1255,7 @@ static int set_pio_mode (ide_drive_t *dr if (drive->special.b.set_tune) return -EBUSY; ide_init_drive_cmd(&rq); + rq.flags = REQ_DRIVE_TASKFILE; drive->tune_req = (u8) arg; drive->special.b.set_tune = 1; (void) ide_do_drive_cmd(drive, &rq, ide_wait);
Thanks.
Signature · 1 line
tejun
Re: [PATCH 2.6.11-rc2 25/29] ide: convert REQ_DRIVE_CMD to REQ_DRIVE_TASKFILE
Quoted 28 lines · Tejun Heo
Hello,
Quoted 9 lines · Bartlomiej Zolnierkiewicz
Quoted 7 lines · Tejun Heo
Quoted 4 lines
25_ide_taskfile_cmd.patch
All in-kernel
REQ_DRIVE_CMDusers except foride_cmd_ioctl()converted to useREQ_DRIVE_TASKFILE.Signed-off-by Tejun Heo <[email protected]>Quoted 15 lines
drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 static int set_multcount(ide_drive_t *dr · line 753
Quoted 10 lines
Index:
linux-ide-export/drivers/ide/ide-disk.c
===================================================================drivers/ide/ide-disk.c 2005-02-02 10:28:07.204876587 +0900 renamed from drivers/ide/ide-disk.c 2005-02-02 10:28:06.527986413 +0900 +1
-1@@ -750,7 +750,7 @@ static int set_multcount(ide_drive_t *dr if (drive->special.b.set_multmode) return -EBUSY; ide_init_drive_cmd (&rq); - rq.flags = REQ_DRIVE_CMD; + rq.flags = REQ_DRIVE_TASKFILE;Please instead fix
ide_init_drive_cmd()to setREQ_DRIVE_TASKFILEand add setREQ_DRIVE_CMDonly inide_cmd_ioctl().
Quoted 3 lines
This is done in patch #28. If you don't like the ordering of the patches, I can change the orders but I don't think that improves anything. This order is as good as the other order.
Actually no - if you change this then patch #28 becomes NOP.
So please do it, thanks.
Quoted 10 lines · Tejun Heo
Hello, B. Zolnierkiewicz.
These patches are various fixes/improvements to the ide driver. They
are against the 2.6 bk tree as of today (20050202).01_ide_remove_adma100.patch
Removes drivers/ide/pci/adma100.[hc]. The driver isn't compilable (missing functions) and no
Kconfigactually enablesCONFIG_BLK_DEV_ADMA100.
Also, the libata-dev-2.6 tree has an "ata_adma" driver which is complete, but needs some testing (and I have h/w).
Quoted 12 lines
05_ide_merge_pci_driver_hc.patch
Merges
drivers/ide/pci/*.hfiles into their corresponding *.c files. Rationales are
1. There's no reason to separate pci drivers into header and body. No header file is shared and they're simple enough.
2. structpde_pci_device_t*_chipsets[] are _defined_ in the header files. That isn't the custom and there's no good reason to do differently in these drivers.
3. Tracking changelogs shows that the bugs fixed by 00 and 01 are introduced during mass-updating ide pci drivers by forgetting to update *.h files.
Personally, I agree. However, I would ask Alan for his rationale before applying this...
Quoted 12 lines
07_ide_reg_valid_t_endian_fix.patch
ide_reg_valid_tcontains bitfield flags but doesn't reverse bit orders using __*_ENDIAN_BITFIELD macros. And constants foride_reg_valid_t, IDE_{TASKFILE|HOB}_STD_{IN|OUT}_FLAGS, are defined as byte values which are correct only on little-endian machines. This patch defines reversed constants and .h byte union structure to make things correct on big endian machines. The only code which uses above macros is inflagged_taskfile()and the code is currently unused, so this patch doesn't change any behavior. (The code will get used in later patches.)
doesn't this "fix" change behavior on existing big endian machines?
Quoted 8 lines
15_ide_flagged_taskfile_data_byte_order_fix.patch
In
flagged_taskfile(), when writing data register,taskfile->datagoes to the lower byte andhobfile->datagoes to the upper byte on little endian machines and the opposite happens on big endian machines. This patch maketaskfile->dataalways go to the lower byte regardless of endianess.
ditto
Quoted 4 lines
16_ide_flagged_taskfile_select_dev_bit_masking.patch
In flagged_taskfile(), make off DEV bit before OR'ing it with drive->select.all when writing to IDE_SELECT_REG.
Probably the right thing to do, but be very very careful you have audited all uses...
Quoted 12 lines
21_ide_do_taskfile.patch
Merged
do_rw_taskfile()andflagged_taskfile()intodo_taskfile(). During the merge, the following changes took place.
1. flagged taskfile now honors HOB feature register. (do_rw_taskfile()did write to HOB feature.)
2. Nodo_rw_taskfile()HIHI check on select register. Except for the DEV bit, all bits are honored.
3. Usestaskfile->data_phaseto determine if dma trasfer is requested. (do_rw_taskfile()directly switched ontaskfile->commandfor all dma commands)
I think Bart already had plans for this (similar to your patch)?
Quoted 4 lines
22_ide_taskfile_flush.patch
All
REQ_DRIVE_TASKusers exceptide_task_ioctl()converted to useREQ_DRIVE_TASKFILE.
Rationale?
Quoted 3 lines
24_ide_remove_task.patch
Unused
REQ_DRIVE_TASKhandling removed.
this series is nice.
Quoted 8 lines
25_ide_taskfile_cmd.patch
All in-kernel
REQ_DRIVE_CMDusers except foride_cmd_ioctl()converted to useREQ_DRIVE_TASKFILE.
26_ide_taskfile_cmd_ioctl.patch
ide_cmd_ioctl()converted to useide_taskfile_ioctl(). This is the last user ofREQ_DRIVE_CMD.
ditto
Quoted 4 lines
27_ide_remove_cmd.patch
Removed unused
REQ_DRIVE_CMDhandling.
Quoted 8 lines
28_ide_taskfile_init_drive_cmd.patch
ide_init_drive_cmd() now initializes rq->flags to REQ_DRIVE_TASKFILE.29_ide_explicit_TASKFILE_NO_DATA.patch
Make
data_phaseexplicit inNO_DATAcases.
I would make sure this series gets some amount of testing in -mm before pushing upstream, though...
Jeff
Quoted 11 lines · Jeff Garzik
Quoted 10 lines
Merges
drivers/ide/pci/*.hfiles into their corresponding *.c files. Rationales are
1. There's no reason to separate pci drivers into header and body. No header file is shared and they're simple enough.
2. structpde_pci_device_t*_chipsets[] are _defined_ in the header files. That isn't the custom and there's no good reason to do differently in these drivers.
3. Tracking changelogs shows that the bugs fixed by 00 and 01 are introduced during mass-updating ide pci drivers by forgetting to update *.h files.
Quoted 2 lines
Personally, I agree. However, I would ask Alan for his rationale before applying this...
Historically they were split so they stayed split. SCSI has mostly (c/o hch) switched away from that and it seems sensible for IDE to do so.
Quoted 14 lines
Quoted 13 lines
07_ide_reg_valid_t_endian_fix.patch
ide_reg_valid_tcontains bitfield flags but doesn't reverse bit orders using __*_ENDIAN_BITFIELD macros. And constants foride_reg_valid_t, IDE_{TASKFILE|HOB}_STD_{IN|OUT}_FLAGS, are defined as byte values which are correct only on little-endian machines. This patch defines reversed constants and .h byte union structure to make things correct on big endian machines. The only code which uses above macros is inflagged_taskfile()and the code is currently unused, so this patch doesn't change any behavior. (The code will get used in later patches.)
Quoted 1 line
doesn't this "fix" change behavior on existing big endian machines?
My question too, remember that there is I/O byte order swizzling afoot in
the I/O macros.
Generally looks good IMHO.
Quoted 1 line · Tejun Heo
Hello, B. Zolnierkiewicz.
Hi,
Quoted 2 lines
These patches are various fixes/improvements to the ide driver. They
are against the 2.6 bk tree as of today (20050202).
Nice series. As you probably already know I merged most of the easy stuff. I will comment on the real stuff soon.
Thanks,
Bartlomiej