ide: remove PIO "downgrade" quirk
PATCH 1/5 ide: remove PIO "downgrade" quirk
No need for it nowadays so remove quirk code from ide_get_best_pio_mode() and IDE_HFLAG_PIO_DOWNGRADE host flag.
--- drivers/ide/ide-lib.c | 10 ---------- drivers/ide/pci/amd74xx.c | 1 - drivers/ide/pci/via82cxxx.c | 1 - drivers/ide/ppc/pmac.c | 1 - include/linux/ide.h | 2 -- 5 files changed, 15 deletions(-)
drivers/ide/ide-lib.c +0 -10
@@ -284,16 +284,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *dif (overridden)printk (KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n" , drive->name); - -/* -* Conservative "downgrade" for all pre-ATA2 drives -*/ -if ((drive->hwif->host_flags &IDE_HFLAG_PIO_NO_DOWNGRADE ) ==0 && - pio_mode && pio_mode <4 ) { - pio_mode--; -printk (KERN_INFO "%s: applying conservative " -"PIO \"downgrade\"\n" , drive->name); - } }if (pio_mode > max_mode)
drivers/ide/pci/amd74xx.c +0 -1
@@ -219,7 +219,6 @@ static void __devinit init_hwif_amd74xx(#define IDE_HFLAGS_AMD \ (IDE_HFLAG_PIO_NO_BLACKLIST | \ - IDE_HFLAG_PIO_NO_DOWNGRADE | \ IDE_HFLAG_ABUSE_SET_DMA_MODE | \ IDE_HFLAG_POST_SET_MODE | \ IDE_HFLAG_IO_32BIT | \
drivers/ide/pci/via82cxxx.c +0 -1
@@ -429,7 +429,6 @@ static const struct ide_port_info via82c .init_hwif = init_hwif_via82cxxx, .enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } }, .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST | -IDE_HFLAG_PIO_NO_DOWNGRADE |IDE_HFLAG_ABUSE_SET_DMA_MODE |IDE_HFLAG_POST_SET_MODE | IDE_HFLAG_IO_32BIT,
drivers/ide/ppc/pmac.c +0 -1
@@ -921,7 +921,6 @@ pmac_ide_do_resume(ide_hwif_t *hwif)static const struct ide_port_info pmac_port_info = { .chipset = ide_pmac, .host_flags =IDE_HFLAG_SET_PIO_MODE_KEEP_DMA | -IDE_HFLAG_PIO_NO_DOWNGRADE |IDE_HFLAG_POST_SET_MODE |IDE_HFLAG_NO_DMA |/* no SFF-style DMA */ IDE_HFLAG_UNMASK_IRQS ,
include/linux/ide.h +0 -2
@@ -1031,8 +1031,6 @@ enum {IDE_HFLAG_SINGLE = (1 <<1 ),/* don't use legacy PIO blacklist */ IDE_HFLAG_PIO_NO_BLACKLIST = (1 <<2 ), -/* don't use conservative PIO "downgrade" */ -IDE_HFLAG_PIO_NO_DOWNGRADE = (1 <<3 ),/* use PIO8/9 for prefetch off/on */ IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),/* use PIO6/7 for fast-devsel off/on */
PATCH 2/5 ide: merge ide_match_hwif() and ide_find_port()
* Change ide_match_hwif() argument from 'u8 bootable' to 'struct ide_port_info *d'.
* Move ide_match_hwif() to ide-probe.c from setup-pci.c and rename it to ide_find_port_slot(). Update some comments while at it.
* ide_find_port() can be now just a wrapper for ide_find_port_slot().
There should be no functional changes caused by this patch.
--- drivers/ide/ide-probe.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide.c | 15 --------------- drivers/ide/setup-pci.c | 48 +----------------------------------------------- include/linux/ide.h | 8 +++++++- 4 files changed, 54 insertions(+), 63 deletions(-)
drivers/ide/ide-probe.c +46 -0
@@ -1435,6 +1435,52 @@ static int ide_sysfs_register_port(ide_hreturn rc; } +/** +* ide_find_port_slot - find free ide_hwifs[] slot +* @d: IDE port info +* +* Return the new hwif. If we are out of free slots return NULL. +*/ + +ide_hwif_t *ide_find_port_slot (const struct ide_port_info *d) +{ +ide_hwif_t *hwif; +int i; +u8 bootable = (d && (d->host_flags &IDE_HFLAG_NON_BOOTABLE )) ?0 :1 ; + +/* +* Claim an unassigned slot. +* +* Give preference to claiming other slots before claiming ide0/ide1, +* just in case there's another interface yet-to-be-scanned +* which uses ports 0x1f0/0x170 (the ide0/ide1 defaults). +* +* Unless there is a bootable card that does not use the standard +* ports 0x1f0/0x170 (the ide0/ide1 defaults). +*/ +if (bootable) { +for (i =0 ; i <MAX_HWIFS ; i++) { + hwif = &ide_hwifs[i]; +if (hwif->chipset == ide_unknown) +return hwif; + } + }else { +for (i =2 ; i <MAX_HWIFS ; i++) { + hwif = &ide_hwifs[i]; +if (hwif->chipset == ide_unknown) +return hwif; + } +for (i =0 ; i <2 && i <MAX_HWIFS ; i++) { + hwif = &ide_hwifs[i]; +if (hwif->chipset == ide_unknown) +return hwif; + } + } + +return NULL ; +} +EXPORT_SYMBOL_GPL (ide_find_port_slot); +int ide_device_add_all (u8 *idx,const struct ide_port_info *d) {ide_hwif_t *hwif, *mate =NULL ;
drivers/ide/ide.c +0 -15
@@ -234,21 +234,6 @@ static int ide_system_bus_speed(void)return pci_dev_present (pci_default) ?33 :50 ; } -ide_hwif_t *ide_find_port (void ) -{ -ide_hwif_t *hwif; -int i; - -for (i =0 ; i <MAX_HWIFS ; i++) { - hwif = &ide_hwifs[i]; -if (hwif->chipset == ide_unknown) -return hwif; - } - -return NULL ; -} -EXPORT_SYMBOL_GPL (ide_find_port); -static struct resource *hwif_request_region (ide_hwif_t *hwif,unsigned long addr,int num) {
drivers/ide/setup-pci.c +1 -47
66 lines not on this page · raw message
include/linux/ide.h +7 -1
@@ -171,7 +171,6 @@ typedef struct hw_regs_s {struct device *dev; } hw_regs_t; -struct hwif_s *ide_find_port (void );void ide_init_port_data (struct hwif_s *,unsigned int );void ide_init_port_hw (struct hwif_s *,hw_regs_t *);
@@ -812,6 +811,13 @@ extern ide_hwif_t ide_hwifs[]; /* maste#endif extern int noautodma; +ide_hwif_t *ide_find_port_slot (const struct ide_port_info *); + +static inline ide_hwif_t *ide_find_port (void ) +{ +return ide_find_port_slot (NULL ); +} +extern int ide_end_request (ide_drive_t *drive,int uptodate,int nrsecs);int ide_end_dequeued_request (ide_drive_t *drive,struct request *rq,int uptodate,int nr_sectors);
PATCH 3/5 ide: use ide_find_port() in legacy VLB host drivers
In reply to Bartlomiej Zolnierkiewicz* Add IDE_HFLAG_QD_2ND_PORT host flag to indicate the need of skipping first ide_hwifs[] slot for the second port of QD65xx controller.
* Handle this new host flag in ide_find_port_slot().
* Convert legacy VLB host drivers to use ide_find_port().
While at it:
* Fix couple of printk()-s in qd65xx host driver to not use hwif->name.
--- drivers/ide/ide-probe.c | 4 +- drivers/ide/legacy/ali14xx.c | 19 ++++++++--- drivers/ide/legacy/dtc2278.c | 22 +++++++------ drivers/ide/legacy/ht6560b.c | 31 ++++++++++-------- drivers/ide/legacy/ide-4drives.c | 34 +++++++++++--------- drivers/ide/legacy/qd65xx.c | 66 +++++++++++++++++++++------------------ drivers/ide/legacy/umc8672.c | 19 ++++++++--- include/linux/ide.h | 2 + 8 files changed, 119 insertions(+), 78 deletions(-)
drivers/ide/ide-probe.c +3 -1
@@ -1459,7 +1459,9 @@ ide_hwif_t *ide_find_port_slot(const str* ports 0x1f0/0x170 (the ide0/ide1 defaults). */ if (bootable) { -for (i =0 ; i <MAX_HWIFS ; i++) { + i = (d && (d->host_flags &IDE_HFLAG_QD_2ND_PORT )) ?1 :0 ; + +for (; i <MAX_HWIFS ; i++) { hwif = &ide_hwifs[i];if (hwif->chipset == ide_unknown)return hwif;
drivers/ide/legacy/ali14xx.c +14 -5
@@ -199,7 +199,8 @@ static const struct ide_port_info ali14xstatic int __init ali14xx_probe (void ) { -static u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; +ide_hwif_t *hwif, *mate; +static u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };hw_regs_t hw[2 ]; printk(KERN_DEBUG "ali14xx: base=0x%03x, regOn=0x%02x.\n",
@@ -219,11 +220,19 @@ static int __init ali14xx_probe(void)ide_std_init_ports (&hw[1 ],0x170 ,0x376 ); hw[1 ].irq =15 ; -ide_init_port_hw (&ide_hwifs[0 ], &hw[0 ]); -ide_init_port_hw (&ide_hwifs[1 ], &hw[1 ]); + hwif =ide_find_port (); +if (hwif) { +ide_init_port_hw (hwif, &hw[0 ]); + hwif->set_pio_mode = &ali14xx_set_pio_mode; + idx[0 ] = hwif->index; + } - ide_hwifs[0 ].set_pio_mode = &ali14xx_set_pio_mode; - ide_hwifs[1 ].set_pio_mode = &ali14xx_set_pio_mode; + mate =ide_find_port (); +if (mate) { +ide_init_port_hw (mate, &hw[1 ]); + mate->set_pio_mode = &ali14xx_set_pio_mode; + idx[1 ] = mate->index; + }ide_device_add (idx, &ali14xx_port_info);
drivers/ide/legacy/dtc2278.c +12 -10
@@ -102,15 +102,9 @@ static int __init dtc2278_probe(void) {unsigned long flags;ide_hwif_t *hwif, *mate; -static u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; +static u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };hw_regs_t hw[2 ]; - hwif = &ide_hwifs[0 ]; - mate = &ide_hwifs[1 ]; - -if (hwif->chipset != ide_unknown || mate->chipset != ide_unknown) -return 1 ; -local_irq_save (flags);/* * This enables the second interface
@@ -137,10 +131,18 @@ static int __init dtc2278_probe(void)ide_std_init_ports (&hw[1 ],0x170 ,0x376 ); hw[1 ].irq =15 ; -ide_init_port_hw (hwif, &hw[0 ]); -ide_init_port_hw (mate, &hw[1 ]); + hwif =ide_find_port (); +if (hwif) { +ide_init_port_hw (hwif, &hw[0 ]); + hwif->set_pio_mode = dtc2278_set_pio_mode; + idx[0 ] = hwif->index; + } - hwif->set_pio_mode = &dtc2278_set_pio_mode; + mate =ide_find_port (); +if (mate) { +ide_init_port_hw (mate, &hw[1 ]); + idx[1 ] = mate->index; + }ide_device_add (idx, &dtc2278_port_info);
drivers/ide/legacy/ht6560b.c +17 -14
@@ -331,15 +331,12 @@ static const struct ide_port_info ht6560static int __init ht6560b_init (void ) {ide_hwif_t *hwif, *mate; -static u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; +static u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };hw_regs_t hw[2 ];if (probe_ht6560b ==0 )return -ENODEV ; - hwif = &ide_hwifs[0 ]; - mate = &ide_hwifs[1 ]; -if (!request_region (HT_CONFIG_PORT ,1 ,DRV_NAME )) {printk (KERN_NOTICE "%s: HT_CONFIG_PORT not found\n" , __FUNCTION__);
@@ -359,17 +356,23 @@ static int __init ht6560b_init(void)ide_std_init_ports (&hw[1 ],0x170 ,0x376 ); hw[1 ].irq =15 ; -ide_init_port_hw (hwif, &hw[0 ]); -ide_init_port_hw (mate, &hw[1 ]); - - hwif->selectproc = &ht6560b_selectproc; - hwif->set_pio_mode = &ht6560b_set_pio_mode; - - mate->selectproc = &ht6560b_selectproc; - mate->set_pio_mode = &ht6560b_set_pio_mode; + hwif =ide_find_port (); +if (hwif) { +ide_init_port_hw (hwif, &hw[0 ]); + hwif->selectproc = ht6560b_selectproc; + hwif->set_pio_mode = ht6560b_set_pio_mode; + hwif->port_init_devs = ht6560b_port_init_devs; + idx[0 ] = hwif->index; + } - hwif->port_init_devs = ht6560b_port_init_devs; - mate->port_init_devs = ht6560b_port_init_devs; + mate =ide_find_port (); +if (mate) { +ide_init_port_hw (mate, &hw[1 ]); + mate->selectproc = ht6560b_selectproc; + mate->set_pio_mode = ht6560b_set_pio_mode; + mate->port_init_devs = ht6560b_port_init_devs; + idx[1 ] = mate->index; + }ide_device_add (idx, &ht6560b_port_info);
drivers/ide/legacy/ide-4drives.c +20 -14
@@ -12,31 +12,37 @@ MODULE_PARM_DESC(probe, "probe for generstatic int __init ide_4drives_init (void ) {ide_hwif_t *hwif, *mate; -u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; +u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };hw_regs_t hw;if (probe_4drives ==0 )return -ENODEV ; - hwif = &ide_hwifs[0 ]; - mate = &ide_hwifs[1 ]; -memset (&hw,0 ,sizeof (hw));ide_std_init_ports (&hw,0x1f0 ,0x3f6 ); hw.irq =14 ; hw.chipset = ide_4drives; -ide_init_port_hw (hwif, &hw); -ide_init_port_hw (mate, &hw); - - mate->drives[0 ].select.all ^=0x20 ; - mate->drives[1 ].select.all ^=0x20 ; - - hwif->mate = mate; - mate->mate = hwif; - - hwif->serialized = mate->serialized =1 ; + hwif =ide_find_port (); +if (hwif) { +ide_init_port_hw (hwif, &hw); + idx[0 ] = hwif->index; + } + + mate =ide_find_port (); +if (mate) { +ide_init_port_hw (mate, &hw); + mate->drives[0 ].select.all ^=0x20 ; + mate->drives[1 ].select.all ^=0x20 ; + idx[1 ] = mate->index; + +if (hwif) { + hwif->mate = mate; + mate->mate = hwif; + hwif->serialized = mate->serialized =1 ; + } + }ide_device_add (idx,NULL );
drivers/ide/legacy/qd65xx.c +37 -29
115 lines not on this page · raw message
drivers/ide/legacy/umc8672.c +14 -5
@@ -128,8 +128,9 @@ static const struct ide_port_info umc867static int __init umc8672_probe (void ) { +ide_hwif_t *hwif, *mate;unsigned long flags; -static u8 idx[4 ] = {0 ,1 ,0xff ,0xff }; +static u8 idx[4 ] = {0xff ,0xff ,0xff ,0xff };hw_regs_t hw[2 ];if (!request_region (0x108 ,2 ,"umc8672" )) {
@@ -157,11 +158,19 @@ static int __init umc8672_probe(void)ide_std_init_ports (&hw[1 ],0x170 ,0x376 ); hw[1 ].irq =15 ; -ide_init_port_hw (&ide_hwifs[0 ], &hw[0 ]); -ide_init_port_hw (&ide_hwifs[1 ], &hw[1 ]); + hwif =ide_find_port (); +if (hwif) { +ide_init_port_hw (hwif, &hw[0 ]); + hwif->set_pio_mode = umc_set_pio_mode; + idx[0 ] = hwif->index; + } - ide_hwifs[0 ].set_pio_mode = &umc_set_pio_mode; - ide_hwifs[1 ].set_pio_mode = &umc_set_pio_mode; + mate =ide_find_port (); +if (mate) { +ide_init_port_hw (mate, &hw[1 ]); + mate->set_pio_mode = umc_set_pio_mode; + idx[1 ] = mate->index; + }ide_device_add (idx, &umc8672_port_info);
include/linux/ide.h +2 -0
@@ -1037,6 +1037,8 @@ enum {IDE_HFLAG_SINGLE = (1 <<1 ),/* don't use legacy PIO blacklist */ IDE_HFLAG_PIO_NO_BLACKLIST = (1 <<2 ), +/* set for the second port of QD65xx */ +IDE_HFLAG_QD_2ND_PORT = (1 <<3 ),/* use PIO8/9 for prefetch off/on */ IDE_HFLAG_ABUSE_PREFETCH = (1 << 4),/* use PIO6/7 for fast-devsel off/on */
PATCH 4/5 ide-generic: use ide_find_port()
In reply to Bartlomiej ZolnierkiewiczThere should be no functional changes caused by this patch.
--- drivers/ide/ide-generic.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/ide/ide-generic.c +13 -4
@@ -90,18 +90,27 @@ static int __init ide_generic_init(void)int i;for (i =0 ; i <MAX_HWIFS ; i++) { -ide_hwif_t *hwif = &ide_hwifs[i]; +ide_hwif_t *hwif;unsigned long io_addr =ide_default_io_base (i);hw_regs_t hw; -if (hwif->chipset == ide_unknown && io_addr) { -u8 oldnoprobe = hwif->noprobe; +if (io_addr) { +u8 oldnoprobe; + +/* +* Skip probing if the corresponding +* slot entry is already occupied. +*/ + hwif =ide_find_port (); +if (hwif ==NULL || hwif->index != i) +continue ;memset (&hw,0 ,sizeof (hw));ide_std_init_ports (&hw, io_addr, io_addr +0x206 ); hw.irq =ide_default_irq (io_addr); -ide_init_port_hw (hwif, &hw); + oldnoprobe = hwif->noprobe; +ide_init_port_hw (hwif, &hw); hwif->noprobe = oldnoprobe; idx[i] = i;
Re: [PATCH 4/5] ide-generic: use ide_find_port()
Quoted 3 lines · Bartlomiej Zolnierkiewicz
There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Quoted 11 lines
Index:
b/drivers/ide/ide-generic.c
===================================================================drivers/ide/ide-generic.c +1
-1@@ -90,18 +90,27 @@ static int __init ide_generic_init(void)int i;for (i =0 ; i <MAX_HWIFS ; i++) { -ide_hwif_t *hwif = &ide_hwifs[i]; +ide_hwif_t *hwif;unsigned long io_addr =ide_default_io_base (i);
drivers/ide/ide-generic.c static int __init ide_generic_init(void) · line 102
Quoted 10 lines
drivers/ide/ide-generic.c +6
-2hw_regs_t hw; -if (hwif->chipset == ide_unknown && io_addr) { -u8 oldnoprobe = hwif->noprobe; +if (io_addr) { +u8 oldnoprobe; + +/* +* Skip probing if the corresponding +* slot entry is already occupied.
IMHO, it's either "slot" or "entry", else it sounds superfluous. :-)
MBR, Sergei
Re: [PATCH 4/5] ide-generic: use ide_find_port()
Quoted 21 lines · Sergei Shtylyov
Quoted 3 lines · Bartlomiej Zolnierkiewicz
There should be no functional changes caused by this patch.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Acked-by Sergei Shtylyov <[email protected]>Quoted 13 lines
Index:
b/drivers/ide/ide-generic.c
===================================================================drivers/ide/ide-generic.c +1
-1@@ -90,18 +90,27 @@ static int __init ide_generic_init(void)int i;for (i =0 ; i <MAX_HWIFS ; i++) { -ide_hwif_t *hwif = &ide_hwifs[i]; +ide_hwif_t *hwif;unsigned long io_addr =ide_default_io_base (i);hw_regs_t hw;
Quoted 10 lines
drivers/ide/ide-generic.c static int __init ide_generic_init(void) · line 102
Quoted 8 lines
drivers/ide/ide-generic.c +6
-2-if (hwif->chipset == ide_unknown && io_addr) { -u8 oldnoprobe = hwif->noprobe; +if (io_addr) { +u8 oldnoprobe; + +/* +* Skip probing if the corresponding +* slot entry is already occupied. IMHO, it's either "slot" or "entry", else it sounds superfluous. :-)
I made 'take 2' with "entry" removed, thanks.
PATCH 5/5 ide: unexport ide_hwifs[]
In reply to Bartlomiej ZolnierkiewiczAll modular users have been fixed to not reference ide_hwifs[] directly.
--- drivers/ide/ide.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/ide/ide.c +0 -5
@@ -102,13 +102,8 @@ int ide_noacpitfs = 1;int ide_noacpionboot =1 ;#endif -/* -* This is declared extern in ide.h, for access by other IDE modules: -*/ ide_hwif_t ide_hwifs[MAX_HWIFS ];/* master data repository */ -EXPORT_SYMBOL (ide_hwifs); -static void ide_port_init_devices_data (ide_hwif_t *);/*
Quoted 1 line · Bartlomiej Zolnierkiewicz
No need for it nowadays
Since which moment, could you elaborate
Quoted 4 lines
so remove quirk code from
ide_get_best_pio_mode()
andIDE_HFLAG_PIO_DOWNGRADEhost flag.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
MBR, Sergei
Hi Sergei,
Quoted 5 lines · Sergei Shtylyov
Quoted 1 line · Bartlomiej Zolnierkiewicz
No need for it nowadays
Since which moment, could you elaborate
We fixed:
- PIO auto-tuning in core code
- PIO programming in host drivers
- IORDY handling in core code and in host drivers (it could be that the incorrect IORDY handling was the main reason behind the "downgrade")
and
- lack of corresponding "quirk" in libata hasn't been problematic so far
so IMO there is no longer a valid reason to punish PIO performance and the said "quirk" should be removed (in 2.6.26 after long time in -mm).
Quoted 4 lines
Quoted 4 lines
so remove quirk code from
ide_get_best_pio_mode()
andIDE_HFLAG_PIO_DOWNGRADEhost flag.Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>