ide: add it8213 driver
PATCH 2/19 ide: add it8213 driver
[PATCH] ide: add it8213 driver
From: Jack Lee <[email protected]>
From: Alan Cox <[email protected]>
---
drivers/ide/Kconfig | 5 drivers/ide/pci/Makefile | 2 drivers/ide/pci/it8213.c | 402 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 408 insertions(+), 1 deletion(-)
drivers/ide/Kconfig +5 -0
@@ -606,6 +606,11 @@ config BLK_DEV_PIIX the kernel to change PIO, DMA and UDMA speeds and to configure the chip to optimum performance. +config BLK_DEV_IT8213 + tristate "IT8213 IDE support" + help + This driver adds support for the ITE 8213 IDE controller. + config BLK_DEV_IT821X tristate "IT821X IDE support" help
drivers/ide/pci/Makefile +1 -1
@@ -11,7 +11,7 @@ obj-$(CONFIG_BLK_DEV_SC1200) += sc1200. obj-$(CONFIG_BLK_DEV_CY82C693) += cy82c693.o obj-$(CONFIG_BLK_DEV_HPT34X) += hpt34x.o obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o -#obj-$(CONFIG_BLK_DEV_HPT37X) += hpt37x.o +obj-$(CONFIG_BLK_DEV_IT8213) += it8213.o obj-$(CONFIG_BLK_DEV_IT821X) += it821x.o obj-$(CONFIG_BLK_DEV_JMICRON) += jmicron.o obj-$(CONFIG_BLK_DEV_NS87415) += ns87415.o
drivers/ide/pci/it8213.c new file +402 -0
402 lines not on this page · raw message
PATCH 3/19 ide: it8213 driver update
[PATCH] ide: it8213 driver update
* set ATAPI/IORDY/TIME bits correctly in it8213_tuneproc()
* fix UDMA/MWDMA/SWDMA masks in it8213_init_hwif()
* in it8213_tune_chipset() SWDMA2 mode should be used instead of MWDMA0
* backport various fixes from piix/slc90e66 drivers:
- in it8213_tuneproc() the highest possible PIO mode is PIO4 (not PIO5)
- clear ATAPI/IORDY/TIME bits before setting them also for slave device
- use ->speedproc in it8213_config_drive_for_dma()
- don't try to tune PIO in config_chipset_for_pio()
- simplify is_slave calculation in it8213_tuneproc()
- misc cleanups
* fix it8213_ratemask() and it8213_tuneproc() comments
* simplify it8213_init_hwif()
* remove init_chipset_it8213()
* add missing Copyrights and update MODULE_AUTHOR()
* CodingStyle cleanups
* remove dead code
--- drivers/ide/pci/it8213.c | 172 ++++++++++++++++++----------------------------- 1 file changed, 66 insertions(+), 106 deletions(-)
drivers/ide/pci/it8213.c +66 -106
@@ -1,3 +1,11 @@ +/* +* ITE 8213 IDE driver +* +* Copyright (C) 2006 Jack Lee +* Copyright (C) 2006 Alan Cox +* Copyright (C) 2007 Bartlomiej Zolnierkiewicz +*/ +#include <linux/kernel.h> #include <linux/types.h> #include <linux/module.h>
@@ -14,14 +22,14 @@* @drive: IDE drive * * Compute the available speeds for the devices on the interface. This -* is all modes to ATA100 clipped by drive cable setup. +* is all modes to ATA133 clipped by drive cable setup. */ static u8 it8213_ratemask (ide_drive_t *drive) {u8 mode =4 ;if (!eighty_ninty_three (drive)) - mode =min (mode, (u8 )1 ); + mode =min_t (u8, mode,1 );return mode; }
@@ -62,55 +70,57 @@ static u8 it8213_dma_2_pio (u8 xfer_rate } } -static spinlock_t tune_lock =SPIN_LOCK_UNLOCKED ; -/* * it8213_tuneproc - tune a drive * @drive: drive to tune -* @mode_wanted: the target operating mode -* -* Load the timing settings for this device mode into the -* controller. By the time we are called the mode has been -* modified as neccessary to handle the absence of seperate -* master/slave timers for MWDMA/PIO. +* @pio: desired PIO mode * -* This code is only used in pass through mode. +* Set the interface PIO mode. */ -static void it8213_tuneproc (ide_drive_t *drive,u8 pio) +static void it8213_tuneproc (ide_drive_t *drive,u8 pio) {ide_hwif_t *hwif =HWIF (drive);struct pci_dev *dev = hwif->pci_dev; -int is_slave = (&hwif->drives[1 ] == drive); +int is_slave = drive->dn &1 ;int master_port =0x40 ;int slave_port =0x44 ;unsigned long flags;u16 master_data;u8 slave_data; +static DEFINE_SPINLOCK (tune_lock); +int control =0 ; -u8 timings[][2 ] = { {0 ,0 }, - {0 ,0 }, - {1 ,0 }, - {2 ,1 }, - {2 ,3 }, }; +static const u8 timings[][2 ]= { + {0 ,0 }, + {0 ,0 }, + {1 ,0 }, + {2 ,1 }, + {2 ,3 }, }; - pio =ide_get_best_pio_mode (drive, pio,5 ,NULL ); + pio =ide_get_best_pio_mode (drive, pio,4 ,NULL );spin_lock_irqsave (&tune_lock, flags);pci_read_config_word (dev, master_port, &master_data); + +if (pio >1 ) + control |=1 ;/* Programmable timing on */ +if (drive->media != ide_disk) + control |=4 ;/* ATAPI */ +if (pio >2 ) + control |=2 ;/* IORDY */ if (is_slave) { - master_data = master_data |0x4000 ; + master_data |=0x4000 ; + master_data &= ~0x0070 ;if (pio >1 ) - - master_data = master_data |0x0070 ; + master_data = master_data | (control <<4 );pci_read_config_byte (dev, slave_port, &slave_data); slave_data = slave_data &0xf0 ; - slave_data = slave_data | (((timings[pio][0 ] <<2 ) | (timings[pio][1 ]) <<0 )); + slave_data = slave_data | (timings[pio][0 ] <<2 ) | timings[pio][1 ]; }else { - master_data = master_data &0xccf8 ; + master_data &= ~0x3307 ;if (pio >1 ) - - master_data = master_data |0x0007 ; + master_data = master_data | control; master_data = master_data | (timings[pio][0 ] <<12 ) | (timings[pio][1 ] <<8 ); }pci_write_config_word (dev, master_port, master_data);
@@ -119,7 +129,6 @@ static void it8213_tuneproc (ide_drive_tspin_unlock_irqrestore (&tune_lock, flags); } -/** * it8213_tune_chipset - set controller timings * @drive: Drive to set up
@@ -130,7 +139,7 @@ static void it8213_tuneproc (ide_drive_t* make the thing work. */ -static int it8213_tune_chipset (ide_drive_t *drive,byte xferspeed) +static int it8213_tune_chipset (ide_drive_t *drive,u8 xferspeed) {ide_hwif_t *hwif =HWIF (drive);
@@ -154,15 +163,15 @@ static int it8213_tune_chipset (ide_drivswitch (speed) {case XFER_UDMA_6 :case XFER_UDMA_4 : -case XFER_UDMA_2 :u_speed =2 << (drive->dn *4 );break ; +case XFER_UDMA_2 : u_speed =2 << (drive->dn *4 );break ;case XFER_UDMA_5 :case XFER_UDMA_3 : -case XFER_UDMA_1 :u_speed =1 << (drive->dn *4 );break ; -case XFER_UDMA_0 :u_speed =0 << (drive->dn *4 );break ; +case XFER_UDMA_1 : u_speed =1 << (drive->dn *4 );break ; +case XFER_UDMA_0 : u_speed =0 << (drive->dn *4 );break ;break ;case XFER_MW_DMA_2 :case XFER_MW_DMA_1 : -case XFER_MW_DMA_0 : +case XFER_SW_DMA_2 :break ;case XFER_PIO_4 :case XFER_PIO_3 :
@@ -174,8 +183,7 @@ static int it8213_tune_chipset (ide_drivreturn -1 ; } -if (speed >=XFER_UDMA_0 ) - { +if (speed >=XFER_UDMA_0 ) {if (!(reg48 & u_flag))pci_write_config_byte (dev,0x48 , reg48 | u_flag);if (speed >=XFER_UDMA_5 ) {
@@ -186,14 +194,12 @@ static int it8213_tune_chipset (ide_drivif ((reg4a & a_speed) != u_speed)pci_write_config_word (dev,0x4a , (reg4a & ~a_speed) | u_speed); -if (speed >XFER_UDMA_2 ) - { +if (speed >XFER_UDMA_2 ) {if (!(reg54 & v_flag))pci_write_config_byte (dev,0x54 , reg54 | v_flag); }else pci_write_config_byte (dev,0x54 , reg54 & ~v_flag); - }else /*if(speed >= XFER_UDMA_0)*/ - { + }else {if (reg48 & u_flag)pci_write_config_byte (dev,0x48 , reg48 & ~u_flag);if (reg4a & a_speed)
@@ -202,11 +208,10 @@ static int it8213_tune_chipset (ide_drivpci_write_config_byte (dev,0x54 , reg54 & ~v_flag);if (reg55 & w_flag)pci_write_config_byte (dev,0x55 , (u8 ) reg55 & ~w_flag); - } + }it8213_tuneproc (drive,it8213_dma_2_pio (speed));return ide_config_drive_speed (drive, speed); - } - +}/* * config_chipset_for_dma - configure for DMA
@@ -217,48 +222,17 @@ static int it8213_tune_chipset (ide_drivstatic int config_chipset_for_dma (ide_drive_t *drive) { -u8 speed =ide_dma_speed (drive,it8213_ratemask (drive)); +u8 speed =ide_dma_speed (drive,it8213_ratemask (drive)); +if (!speed) - { -u8 tspeed =ide_get_best_pio_mode (drive,255 ,5 ,NULL ); - speed =it8213_dma_2_pio (XFER_PIO_0 + tspeed); - } -// config_it8213_chipset_for_pio(drive, !speed); +return 0 ; +it8213_tune_chipset (drive, speed); +return ide_dma_enable (drive); }/** -* config_it8213_chipset_for_pio - set drive timings -* @drive: drive to tune -* @speed we want -* -* Compute the best pio mode we can for a given device. We must -* pick a speed that does not cause problems with the other device -* on the cable. -*/ -/* -static void config_it8213_chipset_for_pio (ide_drive_t *drive, byte set_speed) -{ -ide_hwif_t *hwif = HWIF(drive); -// u8 unit = drive->select.b.unit; -ide_hwif_t *hwif = drive->hwif; -ide_drive_t *pair = &hwif->drives[1-unit]; -u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 255, 5, NULL); -u8 pair_pio; - -if(pair != NULL) { -pair_pio = ide_get_best_pio_mode(pair, 255, 5, NULL); -if(pair_pio < set_pio) -set_pio = pair_pio; -} -it8213_tuneproc(drive, set_pio); -speed = XFER_PIO_0 + set_pio; -if (set_speed) -(void) ide_config_drive_speed(drive, speed); -} -*/ -/** * it8213_configure_drive_for_dma - set up for DMA transfers * @drive: drive we are going to set up *
@@ -270,26 +244,19 @@ static void config_it8213_chipset_for_pistatic int it8213_config_drive_for_dma (ide_drive_t *drive) { -// ide_hwif_t *hwif = drive->hwif; -// struct hd_driveid *id = drive->id; -ide_hwif_t *hwif =HWIF (drive); +ide_hwif_t *hwif = drive->hwif; +if (ide_use_dma (drive)) {if (config_chipset_for_dma (drive))return hwif->ide_dma_on (drive); } -// config_it8213_chipset_for_pio(drive, 1); - hwif->tuneproc (drive,255 ); -return hwif->ide_dma_off_quietly (drive); -} + hwif->speedproc (drive,XFER_PIO_0 + +ide_get_best_pio_mode (drive,255 ,4 ,NULL )); -static unsigned int __devinit init_chipset_it8213 (struct pci_dev *dev,const char *name) -{ -printk (KERN_INFO "it8213: controller in IDE mode.\n" ); -return 0 ; +return hwif->ide_dma_off_quietly (drive); } -/** * init_hwif_it8213 - set up hwif structs * @hwif: interface to set up
@@ -302,9 +269,6 @@ static unsigned int __devinit init_chipsstatic void __devinit init_hwif_it8213 (ide_hwif_t *hwif) {u8 reg42h =0 , ata66 =0 ; -u8 mask =0x02 ; - - hwif->atapi_dma =1 ; hwif->speedproc = &it8213_tune_chipset; hwif->tuneproc = &it8213_tuneproc;
@@ -315,19 +279,19 @@ static void __devinit init_hwif_it8213(i hwif->drives[1 ].autotune =1 ;if (!hwif->dma_base) - goto fallback; +return ; + hwif->atapi_dma =1 ; - hwif->ultra_mask =0x7f ; - hwif->mwdma_mask =0x07 ; - hwif->swdma_mask =0x07 ; + hwif->ultra_mask =0x3f ; + hwif->mwdma_mask =0x06 ; + hwif->swdma_mask =0x04 ;pci_read_config_byte (hwif->pci_dev,0x42 , ®42h); - ata66 = (reg42h & mask) ?0 :1 ; + ata66 = (reg42h &0x02 ) ?0 :1 ; hwif->ide_dma_check = &it8213_config_drive_for_dma;if (!(hwif->udma_four)) hwif->udma_four = ata66; -// hwif->udma_four = 0; /* * The BIOS often doesn't set up DMA on this controller
@@ -338,20 +302,15 @@ static void __devinit init_hwif_it8213(i hwif->drives[0 ].autodma = hwif->autodma; hwif->drives[1 ].autodma = hwif->autodma; -return ; -fallback: - hwif->autodma =0 ; -return ; }#define DECLARE_ITE_DEV (name_str) \ { \ .name = name_str, \ - .init_chipset = init_chipset_it8213, \ .init_hwif = init_hwif_it8213, \ .channels = 1, \ - .autodma = AUTODMA, \ + .autodma = AUTODMA, \ .enablebits = {{0x41,0x80,0x80}}, \ .bootable = ON_BOARD, \ }
@@ -393,10 +352,11 @@ static struct pci_driver driver = {static int __init it8213_ide_init (void ) { -return ide_pci_register_driver (&driver); } +return ide_pci_register_driver (&driver); +}module_init (it8213_ide_init); -MODULE_AUTHOR ("Jack and Alan Cox" );/* Update this */ +MODULE_AUTHOR ("Jack Lee, Alan Cox" );MODULE_DESCRIPTION ("PCI driver module for the ITE 8213" );MODULE_LICENSE ("GPL" );
PATCH 4/19 ia64: add pci_get_legacy_ide_irq()
In reply to Bartlomiej Zolnierkiewicz[PATCH] ia64: add pci_get_legacy_ide_irq()
Add pci_get_legacy_ide_irq() identical to the one used by i386/x86_64. Fixes amd74xx driver build on ia64 (bugzilla bug #6644).
--- include/asm-ia64/pci.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/asm-ia64/pci.h +6 -0
@@ -167,4 +167,10 @@ pcibios_select_root(struct pci_dev *pdev#define pcibios_scan_all_fns (a, b) 0 +#define HAVE_ARCH_PCI_GET_LEGACY_IDE_IRQ +static inline int pci_get_legacy_ide_irq (struct pci_dev *dev,int channel) +{ +return channel ?15 :14 ; +} +#endif /* _ASM_IA64_PCI_H */
PATCH 5/19 ide: add missing __init tags to IDE PCI host drivers
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: add missing __init tags to IDE PCI host drivers
also change __devinit tag for sgiioc4.c:ioc4_ide_init() to __init
--- drivers/ide/pci/aec62xx.c | 2 +- drivers/ide/pci/alim15x3.c | 2 +- drivers/ide/pci/amd74xx.c | 2 +- drivers/ide/pci/atiixp.c | 2 +- drivers/ide/pci/cmd64x.c | 2 +- drivers/ide/pci/cs5520.c | 2 +- drivers/ide/pci/cs5530.c | 2 +- drivers/ide/pci/cy82c693.c | 2 +- drivers/ide/pci/generic.c | 2 +- drivers/ide/pci/hpt34x.c | 2 +- drivers/ide/pci/hpt366.c | 2 +- drivers/ide/pci/ns87415.c | 2 +- drivers/ide/pci/opti621.c | 2 +- drivers/ide/pci/pdc202xx_new.c | 2 +- drivers/ide/pci/pdc202xx_old.c | 2 +- drivers/ide/pci/rz1000.c | 2 +- drivers/ide/pci/sc1200.c | 2 +- drivers/ide/pci/serverworks.c | 2 +- drivers/ide/pci/sgiioc4.c | 3 +-- drivers/ide/pci/siimage.c | 2 +- drivers/ide/pci/sis5513.c | 2 +- drivers/ide/pci/sl82c105.c | 2 +- drivers/ide/pci/slc90e66.c | 2 +- drivers/ide/pci/tc86c001.c | 2 +- drivers/ide/pci/triflex.c | 2 +- drivers/ide/pci/trm290.c | 2 +- drivers/ide/pci/via82cxxx.c | 2 +- 27 files changed, 27 insertions(+), 28 deletions(-)
drivers/ide/pci/aec62xx.c +1 -1
@@ -441,7 +441,7 @@ static struct pci_driver driver = { .probe = aec62xx_init_one, }; -static int aec62xx_ide_init (void ) +static int __init aec62xx_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/alim15x3.c +1 -1
@@ -907,7 +907,7 @@ static struct pci_driver driver = { .probe = alim15x3_init_one, }; -static int ali15x3_ide_init (void ) +static int __init ali15x3_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/amd74xx.c +1 -1
@@ -544,7 +544,7 @@ static struct pci_driver driver = { .probe = amd74xx_probe, }; -static int amd74xx_ide_init (void ) +static int __init amd74xx_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/atiixp.c +1 -1
@@ -376,7 +376,7 @@ static struct pci_driver driver = { .probe = atiixp_init_one, }; -static int atiixp_ide_init (void ) +static int __init atiixp_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/cmd64x.c +1 -1
@@ -793,7 +793,7 @@ static struct pci_driver driver = { .probe = cmd64x_init_one, }; -static int cmd64x_ide_init (void ) +static int __init cmd64x_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/cs5520.c +1 -1
@@ -260,7 +260,7 @@ static struct pci_driver driver = { .probe = cs5520_init_one, }; -static int cs5520_ide_init (void ) +static int __init cs5520_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/cs5530.c +1 -1
@@ -374,7 +374,7 @@ static struct pci_driver driver = { .probe = cs5530_init_one, }; -static int cs5530_ide_init (void ) +static int __init cs5530_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/cy82c693.c +1 -1
@@ -519,7 +519,7 @@ static struct pci_driver driver = { .probe = cy82c693_init_one, }; -static int cy82c693_ide_init (void ) +static int __init cy82c693_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/generic.c +1 -1
@@ -263,7 +263,7 @@ static struct pci_driver driver = { .probe = generic_init_one, }; -static int generic_ide_init (void ) +static int __init generic_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/hpt34x.c +1 -1
@@ -265,7 +265,7 @@ static struct pci_driver driver = { .probe = hpt34x_init_one, }; -static int hpt34x_ide_init (void ) +static int __init hpt34x_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/hpt366.c +1 -1
@@ -1668,7 +1668,7 @@ static struct pci_driver driver = { .probe = hpt366_init_one, }; -static int hpt366_ide_init (void ) +static int __init hpt366_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/ns87415.c +1 -1
@@ -302,7 +302,7 @@ static struct pci_driver driver = { .probe = ns87415_init_one, }; -static int ns87415_ide_init (void ) +static int __init ns87415_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/opti621.c +1 -1
@@ -382,7 +382,7 @@ static struct pci_driver driver = { .probe = opti621_init_one, }; -static int opti621_ide_init (void ) +static int __init opti621_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/pdc202xx_new.c +1 -1
@@ -716,7 +716,7 @@ static struct pci_driver driver = { .probe = pdc202new_init_one, }; -static int pdc202new_ide_init (void ) +static int __init pdc202new_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/pdc202xx_old.c +1 -1
@@ -704,7 +704,7 @@ static struct pci_driver driver = { .probe = pdc202xx_init_one, }; -static int pdc202xx_ide_init (void ) +static int __init pdc202xx_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/rz1000.c +1 -1
@@ -77,7 +77,7 @@ static struct pci_driver driver = { .probe = rz1000_init_one, }; -static int rz1000_ide_init (void ) +static int __init rz1000_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/sc1200.c +1 -1
@@ -507,7 +507,7 @@ static struct pci_driver driver = {#endif }; -static int sc1200_ide_init (void ) +static int __init sc1200_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/serverworks.c +1 -1
@@ -666,7 +666,7 @@ static struct pci_driver driver = { .probe = svwks_init_one, }; -static int svwks_ide_init (void ) +static int __init svwks_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/sgiioc4.c +1 -2
@@ -762,8 +762,7 @@ static struct ioc4_submodule ioc4_ide_su/* .is_remove = ioc4_ide_remove_one, */ }; -static int __devinit -ioc4_ide_init (void ) +static int __init ioc4_ide_init (void ) {return ioc4_register_submodule (&ioc4_ide_submodule); }
drivers/ide/pci/siimage.c +1 -1
@@ -1096,7 +1096,7 @@ static struct pci_driver driver = { .probe = siimage_init_one, }; -static int siimage_ide_init (void ) +static int __init siimage_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/sis5513.c +1 -1
@@ -968,7 +968,7 @@ static struct pci_driver driver = { .probe = sis5513_init_one, }; -static int sis5513_ide_init (void ) +static int __init sis5513_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/sl82c105.c +1 -1
@@ -492,7 +492,7 @@ static struct pci_driver driver = { .probe = sl82c105_init_one, }; -static int sl82c105_ide_init (void ) +static int __init sl82c105_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/slc90e66.c +1 -1
@@ -266,7 +266,7 @@ static struct pci_driver driver = { .probe = slc90e66_init_one, }; -static int slc90e66_ide_init (void ) +static int __init slc90e66_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/tc86c001.c +1 -1
@@ -298,7 +298,7 @@ static struct pci_driver driver = { .probe = tc86c001_init_one }; -static int tc86c001_ide_init (void ) +static int __init tc86c001_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/triflex.c +1 -1
@@ -173,7 +173,7 @@ static struct pci_driver driver = { .probe = triflex_init_one, }; -static int triflex_ide_init (void ) +static int __init triflex_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/trm290.c +1 -1
@@ -355,7 +355,7 @@ static struct pci_driver driver = { .probe = trm290_init_one, }; -static int trm290_ide_init (void ) +static int __init trm290_ide_init (void ) {return ide_pci_register_driver (&driver); }
drivers/ide/pci/via82cxxx.c +1 -1
@@ -514,7 +514,7 @@ static struct pci_driver driver = { .probe = via_init_one, }; -static int via_ide_init (void ) +static int __init via_ide_init (void ) {return ide_pci_register_driver (&driver); }
PATCH 6/19 pdc202xx_old: remove dead code
In reply to Bartlomiej Zolnierkiewicz[PATCH] pdc202xx_old: remove dead code
CONFIG_PDC202XX_MASTER config option doesn't exist
--- drivers/ide/pci/pdc202xx_old.c | 19 ------------------- 1 file changed, 19 deletions(-)
drivers/ide/pci/pdc202xx_old.c +0 -19
@@ -557,25 +557,6 @@ static void __devinit init_dma_pdc202xx( (hwif->INB(dmabase|0x1f)&1) ? "":"IN"); }#endif /* CONFIG_PDC202XX_BURST */ -#ifdef CONFIG_PDC202XX_MASTER -if (!(primary_mode &1 )) { -printk (KERN_INFO "%s: FORCING PRIMARY MODE BIT " -"0x%02x -> 0x%02x " , hwif->cds->name, - primary_mode, (primary_mode|1 )); - hwif->OUTB (primary_mode|1 , (dmabase|0x1a )); -printk ("%s\n" , - (hwif->INB ((dmabase|0x1a )) &1 ) ?"MASTER" :"PCI" ); - } - -if (!(secondary_mode &1 )) { -printk (KERN_INFO "%s: FORCING SECONDARY MODE BIT " -"0x%02x -> 0x%02x " , hwif->cds->name, - secondary_mode, (secondary_mode|1 )); - hwif->OUTB (secondary_mode|1 , (dmabase|0x1b )); -printk ("%s\n" , - (hwif->INB ((dmabase|0x1b )) &1 ) ?"MASTER" :"PCI" ); - } -#endif /* CONFIG_PDC202XX_MASTER */ ide_setup_dma (hwif, dmabase,8 ); }
PATCH 7/19 au1xxx-ide: remove dead code
In reply to Bartlomiej Zolnierkiewicz[PATCH] au1xxx-ide: remove dead code
'speed' is always equal to 'mode' when ide_config_drive_speed() is called
--- drivers/ide/mips/au1xxx-ide.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/ide/mips/au1xxx-ide.c +3 -12
@@ -181,12 +181,6 @@ static int auide_tune_chipset (ide_drive {int mem_sttime;int mem_stcfg; -unsigned long mode; - -#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -if (ide_use_dma (drive)) - mode =ide_dma_speed (drive,0 ); -#endif mem_sttime =0 ; mem_stcfg =au_readl (MEM_STCFG2 );
@@ -195,7 +189,7 @@ static int auide_tune_chipset (ide_driveauide_tune_drive (drive, speed -XFER_PIO_0 );return 0 ; } - +switch (speed) {#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA case XFER_MW_DMA_2 :
@@ -207,7 +201,6 @@ static int auide_tune_chipset (ide_drive mem_stcfg &= ~TOECS_MASK ; mem_stcfg |=SBC_IDE_MDMA2_TCSOE |SBC_IDE_MDMA2_TOECS ; - mode =XFER_MW_DMA_2 ;break ;case XFER_MW_DMA_1 : mem_sttime =SBC_IDE_TIMING (MDMA1 );
@@ -218,7 +211,6 @@ static int auide_tune_chipset (ide_drive mem_stcfg &= ~TOECS_MASK ; mem_stcfg |=SBC_IDE_MDMA1_TCSOE |SBC_IDE_MDMA1_TOECS ; - mode =XFER_MW_DMA_1 ;break ;case XFER_MW_DMA_0 : mem_sttime =SBC_IDE_TIMING (MDMA0 );
@@ -229,14 +221,13 @@ static int auide_tune_chipset (ide_drive mem_stcfg &= ~TOECS_MASK ; mem_stcfg |=SBC_IDE_MDMA0_TCSOE |SBC_IDE_MDMA0_TOECS ; - mode =XFER_MW_DMA_0 ;break ;#endif default :return 1 ; } - -if (ide_config_drive_speed (drive, mode)) + +if (ide_config_drive_speed (drive, speed))return 1 ;au_writel (mem_sttime,MEM_STTIME2 );
PATCH 8/19 ide: remove write-only ide_pio_data_t.blacklisted
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: remove write-only ide_pio_data_t.blacklisted
--- drivers/ide/ide-lib.c | 3 --- include/linux/ide.h | 1 - 2 files changed, 4 deletions(-)
drivers/ide/ide-lib.c +0 -3
@@ -349,7 +349,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *dint use_iordy =0 ;struct hd_driveid * id = drive->id;int overridden =0 ; -int blacklisted =0 ;if (mode_wanted !=255 ) { pio_mode = mode_wanted;
@@ -357,7 +356,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *d pio_mode =0 ; }else if ((pio_mode =ide_scan_pio_blacklist (id->model)) !=-1 ) { overridden =1 ; - blacklisted =1 ; use_iordy = (pio_mode >2 ); }else { pio_mode = id->tPIO;
@@ -409,7 +407,6 @@ u8 ide_get_best_pio_mode (ide_drive_t *d d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; d->use_iordy = use_iordy; d->overridden = overridden; - d->blacklisted = blacklisted; }return pio_mode; }
include/linux/ide.h +0 -1
@@ -1340,7 +1340,6 @@ typedef struct ide_pio_data_s {u8 pio_mode;u8 use_iordy;u8 overridden; -u8 blacklisted;unsigned int cycle_time; } ide_pio_data_t;
PATCH 9/19 ide: remove write-only ide_hwif_t.no_dsc flag
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: remove write-only ide_hwif_t.no_dsc flag
--- drivers/ide/ide-cd.c | 8 -------- drivers/ide/ide.c | 1 - drivers/ide/pci/aec62xx.c | 4 +--- drivers/ide/pci/hpt34x.c | 1 - include/linux/ide.h | 1 - 5 files changed, 1 insertion(+), 14 deletions(-)
drivers/ide/ide-cd.c +0 -8
@@ -3247,14 +3247,6 @@ int ide_cdrom_setup (ide_drive_t *drive)if (drive->autotune ==IDE_TUNE_DEFAULT || drive->autotune ==IDE_TUNE_AUTO ) drive->dsc_overlap = (drive->next != drive); -#if 0 - drive->dsc_overlap = (HWIF (drive)->no_dsc) ?0 :1 ; -if (HWIF (drive)->no_dsc) { -printk (KERN_INFO "ide-cd: %s: disabling DSC overlap\n" , - drive->name); - drive->dsc_overlap =0 ; - } -#endif if (ide_cdrom_register (drive, nslots)) {printk (KERN_ERR "%s: ide_cdrom_setup failed to register device with the cdrom driver.\n" , drive->name);
drivers/ide/ide.c +0 -1
@@ -545,7 +545,6 @@ static void ide_hwif_restore(ide_hwif_t hwif->extra_ports = tmp_hwif->extra_ports; hwif->autodma = tmp_hwif->autodma; hwif->udma_four = tmp_hwif->udma_four; - hwif->no_dsc = tmp_hwif->no_dsc; hwif->hwif_data = tmp_hwif->hwif_data; }
drivers/ide/pci/aec62xx.c +1 -3
@@ -286,10 +286,8 @@ static void __devinit init_hwif_aec62xx( hwif->tuneproc = &aec62xx_tune_drive; hwif->speedproc = &aec62xx_tune_chipset; -if (hwif->pci_dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) { +if (hwif->pci_dev->device ==PCI_DEVICE_ID_ARTOP_ATP850UF ) hwif->serialized = hwif->channel; - hwif->no_dsc =1 ; - }if (hwif->mate) hwif->mate->serialized = hwif->serialized;
drivers/ide/pci/hpt34x.c +0 -1
@@ -209,7 +209,6 @@ static void __devinit init_hwif_hpt34x(i hwif->tuneproc = &hpt34x_tune_drive; hwif->speedproc = &hpt34x_tune_chipset; - hwif->no_dsc =1 ; hwif->drives[0 ].autotune =1 ; hwif->drives[1 ].autotune =1 ;
include/linux/ide.h +0 -1
@@ -791,7 +791,6 @@ typedef struct hwif_s { unsigned udma_four : 1; /* 1=ATA-66 capable, 0=default */ unsigned no_lba48 : 1; /* 1 = cannot do LBA48 */ unsigned no_lba48_dma : 1; /* 1 = cannot do LBA48 DMA */ - unsigned no_dsc : 1; /* 0 default, 1 dsc_overlap disabled */ unsigned auto_poll : 1; /* supports nop auto-poll */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */ unsigned no_io_32bit : 1; /* 1 = can not do 32-bit IO ops */
PATCH 10/19 trm290: remove redundant CONFIG_BLK_DEV_IDEDMA
In reply to Bartlomiej Zolnierkiewicz[PATCH] trm290: remove redundant CONFIG_BLK_DEV_IDEDMA #ifdef-s
In drivers/ide/Kconfig BLK_DEV_TRM290 depends on BLK_DEV_IDEDMA_PCI (on which is BLK_DEV_IDEDMA dependant on).
--- drivers/ide/pci/trm290.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/ide/pci/trm290.c +0 -4
@@ -177,7 +177,6 @@ static void trm290_selectproc (ide_drivetrm290_prepare_drive (drive, drive->using_dma); } -#ifdef CONFIG_BLK_DEV_IDEDMA static void trm290_ide_dma_exec_cmd (ide_drive_t *drive,u8 command) {ide_hwif_t *hwif =HWIF (drive);
@@ -242,7 +241,6 @@ static int trm290_ide_dma_test_irq (ide_ status = hwif->INW (hwif->dma_status);return (status ==0x00ff ); } -#endif /* CONFIG_BLK_DEV_IDEDMA */ /* * Invoked from ide-dma.c at boot time.
@@ -289,13 +287,11 @@ static void __devinit init_hwif_trm290(iide_setup_dma (hwif, (hwif->config_data +4 ) ^ (hwif->channel ?0x0080 :0x0000 ),3 ); -#ifdef CONFIG_BLK_DEV_IDEDMA hwif->dma_setup = &trm290_ide_dma_setup; hwif->dma_exec_cmd = &trm290_ide_dma_exec_cmd; hwif->dma_start = &trm290_ide_dma_start; hwif->ide_dma_end = &trm290_ide_dma_end; hwif->ide_dma_test_irq = &trm290_ide_dma_test_irq; -#endif /* CONFIG_BLK_DEV_IDEDMA */ hwif->selectproc = &trm290_selectproc; hwif->autodma =0 ;/* play it safe for now */
Re: [PATCH 10/19] trm290: remove redundant CONFIG_BLK_DEV_IDEDMA
Hello.
Quoted 1 line · Bartlomiej Zolnierkiewicz
[PATCH] trm290: remove redundant
CONFIG_BLK_DEV_IDEDMA#ifdef-s
Nice to see you riding again. :-)
Quoted 2 lines
In
drivers/ide/KconfigBLK_DEV_TRM290depends onBLK_DEV_IDEDMA_PCI(on which isBLK_DEV_IDEDMAdependant on).
I also remember you urging me to get rid of ide_setup_dma() call there. ;-)
MBR, Sergei
Re: [PATCH 10/19] trm290: remove redundant CONFIG_BLK_DEV_IDEDMA
Hi,
Quoted 7 lines · Sergei Shtylyov
Hello.
Quoted 1 line · Bartlomiej Zolnierkiewicz
[PATCH] trm290: remove redundant
CONFIG_BLK_DEV_IDEDMA#ifdef-sNice to see you riding again. :-)
Thanks!
Quoted 4 lines
Quoted 2 lines
In
drivers/ide/KconfigBLK_DEV_TRM290depends onBLK_DEV_IDEDMA_PCI(on which isBLK_DEV_IDEDMAdependant on).I also remember you urging me to get rid of
ide_setup_dma()call there. ;-)
Hmm, I seem to have a patch doing this but it depends on unfinished "struct ide_dma_ops" patch (which folds individual hwif->[ide_]dma* methods into nice structure)...
Bart
PATCH 11/19 ide: remove ide_pci_device_t tables with only one entry
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: remove ide_pci_device_t tables with only one entry
--- drivers/ide/pci/cy82c693.c | 21 +++++++++------------ drivers/ide/pci/sgiioc4.c | 7 ++----- 2 files changed, 11 insertions(+), 17 deletions(-)
drivers/ide/pci/cy82c693.c +9 -12
@@ -478,21 +478,18 @@ static void __devinit init_iops_cy82c693 } } -static ide_pci_device_t cy82c693_chipsets[]__devinitdata = { - {/* 0 */ - .name ="CY82C693" , - .init_chipset = init_chipset_cy82c693, - .init_iops = init_iops_cy82c693, - .init_hwif = init_hwif_cy82c693, - .channels =1 , - .autodma =AUTODMA , - .bootable =ON_BOARD , - } +static ide_pci_device_t cy82c693_chipset__devinitdata = { + .name ="CY82C693" , + .init_chipset = init_chipset_cy82c693, + .init_iops = init_iops_cy82c693, + .init_hwif = init_hwif_cy82c693, + .channels =1 , + .autodma =AUTODMA , + .bootable =ON_BOARD , };static int __devinit cy82c693_init_one (struct pci_dev *dev,const struct pci_device_id *id) { -ide_pci_device_t *d = &cy82c693_chipsets[id->driver_data];struct pci_dev *dev2;int ret = -ENODEV ;
@@ -501,7 +498,7 @@ static int __devinit cy82c693_init_one(sif ((dev->class >>8 ) ==PCI_CLASS_STORAGE_IDE &&PCI_FUNC (dev->devfn) ==1 ) { dev2 =pci_get_slot (dev->bus, dev->devfn +1 ); - ret =ide_setup_pci_devices (dev, dev2, d); + ret =ide_setup_pci_devices (dev, dev2, &cy82c693_chipset);/* We leak pci refs here but thats ok - we can't be unloaded */ }return ret;
drivers/ide/pci/sgiioc4.c +2 -5
@@ -729,8 +729,7 @@ out:return ret; } -static ide_pci_device_t sgiioc4_chipsets[]__devinitdata = { - { +static ide_pci_device_t sgiioc4_chipset__devinitdata = {/* Channel 0 */ .name ="SGIIOC4" , .init_hwif = ide_init_sgiioc4,
@@ -739,7 +738,6 @@ static ide_pci_device_t sgiioc4_chipsets .autodma = AUTODMA, /* SGI IOC4 doesn't have enablebits. */ .bootable = ON_BOARD, - } };int
@@ -751,8 +749,7 @@ ioc4_ide_attach_one(struct ioc4_driver_dif (idd->idd_variant ==IOC4_VARIANT_PCI_RT )return 0 ; -return pci_init_sgiioc4 (idd->idd_pdev, - &sgiioc4_chipsets[idd->idd_pci_id->driver_data]); +return pci_init_sgiioc4 (idd->idd_pdev, &sgiioc4_chipset); }static struct ioc4_submodule ioc4_ide_submodule = {
PATCH 12/19 ide: remove ide_drive_t.usage
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: remove ide_drive_t.usage
This field is no longer used by the core IDE code so fix ide-{disk,floppy} drivers to keep openers count in the driver specific objects and remove it from ide-{cd,scsi,tape} drivers (it was write-only).
--- drivers/ide/ide-cd.c | 15 ++++----------- drivers/ide/ide-disk.c | 14 +++++++++----- drivers/ide/ide-floppy.c | 18 +++++++++--------- drivers/ide/ide-tape.c | 8 -------- drivers/scsi/ide-scsi.c | 8 -------- include/linux/ide.h | 1 - 6 files changed, 22 insertions(+), 42 deletions(-)
drivers/ide/ide-cd.c +4 -11
@@ -3345,21 +3345,16 @@ static int idecd_open(struct inode * ino {struct gendisk *disk = inode->i_bdev->bd_disk;struct cdrom_info *info; -ide_drive_t *drive;int rc = -ENOMEM ;if (!(info =ide_cd_get (disk)))return -ENXIO ; - drive = info->drive; - - drive->usage++; -if (!info->buffer) - info->buffer =kmalloc (SECTOR_BUFFER_SIZE , -GFP_KERNEL |__GFP_REPEAT); -if (!info->buffer || (rc =cdrom_open (&info->devinfo, inode, file))) - drive->usage--; + info->buffer =kmalloc (SECTOR_BUFFER_SIZE ,GFP_KERNEL |__GFP_REPEAT); + +if (info->buffer) + rc =cdrom_open (&info->devinfo, inode, file);if (rc <0 )ide_cd_put (info);
@@ -3371,10 +3366,8 @@ static int idecd_release(struct inode * {struct gendisk *disk = inode->i_bdev->bd_disk;struct cdrom_info *info =ide_cd_g (disk); -ide_drive_t *drive = info->drive;cdrom_release (&info->devinfo, file); - drive->usage--;ide_cd_put (info);
drivers/ide/ide-disk.c +9 -5
@@ -77,6 +77,7 @@ struct ide_disk_obj {ide_driver_t *driver;struct gendisk *disk;struct kref kref; +unsigned int openers;/* protected by BKL for now */ };static DEFINE_MUTEX (idedisk_ref_mutex);
@@ -1081,8 +1082,9 @@ static int idedisk_open(struct inode *in drive = idkp->drive; - drive->usage++; -if (drive->removable && drive->usage ==1 ) { + idkp->openers++; + +if (drive->removable && idkp->openers ==1 ) {ide_task_t args;memset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORLOCK ;
@@ -1106,9 +1108,10 @@ static int idedisk_release(struct inodestruct ide_disk_obj *idkp =ide_disk_g (disk);ide_drive_t *drive = idkp->drive; -if (drive->usage ==1 ) +if (idkp->openers ==1 )ide_cacheflush_p (drive); -if (drive->removable && drive->usage ==1 ) { + +if (drive->removable && idkp->openers ==1 ) {ide_task_t args;memset (&args,0 ,sizeof (ide_task_t)); args.tfRegister[IDE_COMMAND_OFFSET ] =WIN_DOORUNLOCK ;
@@ -1117,7 +1120,8 @@ static int idedisk_release(struct inodeif (drive->doorlocking &&ide_raw_taskfile (drive, &args,NULL )) drive->doorlocking =0 ; } - drive->usage--; + + idkp->openers--;ide_disk_put (idkp);
drivers/ide/ide-floppy.c +9 -9
@@ -279,6 +279,7 @@ typedef struct ide_floppy_obj {ide_driver_t *driver;struct gendisk *disk;struct kref kref; +unsigned int openers;/* protected by BKL for now */ /* Current packet command */ idefloppy_pc_t *pc;
@@ -1949,9 +1950,9 @@ static int idefloppy_open(struct inode * drive = floppy->drive; - drive->usage++; + floppy->openers++; -if (drive->usage ==1 ) { +if (floppy->openers ==1 ) {clear_bit (IDEFLOPPY_FORMAT_IN_PROGRESS , &floppy->flags);/* Just in case */
@@ -1969,13 +1970,11 @@ static int idefloppy_open(struct inode *** capacity of the drive or begin the format - Sam */ ) { - drive->usage--; ret = -EIO ; goto out_put_floppy; }if (floppy->wp && (filp->f_mode &2 )) { - drive->usage--; ret = -EROFS ; goto out_put_floppy; }
@@ -1987,13 +1986,13 @@ static int idefloppy_open(struct inode * }check_disk_change (inode->i_bdev); }else if (test_bit (IDEFLOPPY_FORMAT_IN_PROGRESS , &floppy->flags)) { - drive->usage--; ret = -EBUSY ; goto out_put_floppy; }return 0 ; out_put_floppy: + floppy->openers--;ide_floppy_put (floppy);return ret; }
@@ -2007,7 +2006,7 @@ static int idefloppy_release(struct inoddebug_log (KERN_INFO "Reached idefloppy_release\n" ); -if (drive->usage ==1 ) { +if (floppy->openers ==1 ) {/* IOMEGA Clik! drives do not support lock/unlock commands */ if (!test_bit (IDEFLOPPY_CLIK_DRIVE , &floppy->flags)) {idefloppy_create_prevent_cmd (&pc,0 );
@@ -2016,7 +2015,8 @@ static int idefloppy_release(struct inodclear_bit (IDEFLOPPY_FORMAT_IN_PROGRESS , &floppy->flags); } - drive->usage--; + + floppy->openers--;ide_floppy_put (floppy);
@@ -2050,7 +2050,7 @@ static int idefloppy_ioctl(struct inode prevent =0 ;/* fall through */ case CDROM_LOCKDOOR : -if (drive->usage >1 ) +if (floppy->openers >1 )return -EBUSY ;/* The IOMEGA Clik! Drive doesn't support this command - no room for an eject mechanism */
@@ -2072,7 +2072,7 @@ static int idefloppy_ioctl(struct inodeif (!(file->f_mode &2 ))return -EPERM ; -if (drive->usage >1 ) { +if (floppy->openers >1 ) {/* Don't format if someone is using the disk */ clear_bit(IDEFLOPPY_FORMAT_IN_PROGRESS,
drivers/ide/ide-tape.c +0 -8
@@ -4792,15 +4792,10 @@ static int idetape_open(struct inode *in {struct gendisk *disk = inode->i_bdev->bd_disk;struct ide_tape_obj *tape; -ide_drive_t *drive;if (!(tape =ide_tape_get (disk)))return -ENXIO ; - drive = tape->drive; - - drive->usage++; -return 0 ; }
@@ -4808,9 +4803,6 @@ static int idetape_release(struct inode {struct gendisk *disk = inode->i_bdev->bd_disk;struct ide_tape_obj *tape =ide_tape_g (disk); -ide_drive_t *drive = tape->drive; - - drive->usage--;ide_tape_put (tape);
drivers/scsi/ide-scsi.c +0 -8
@@ -801,15 +801,10 @@ static int idescsi_ide_open(struct inode {struct gendisk *disk = inode->i_bdev->bd_disk;struct ide_scsi_obj *scsi; -ide_drive_t *drive;if (!(scsi =ide_scsi_get (disk)))return -ENXIO ; - drive = scsi->drive; - - drive->usage++; -return 0 ; }
@@ -817,9 +812,6 @@ static int idescsi_ide_release(struct in {struct gendisk *disk = inode->i_bdev->bd_disk;struct ide_scsi_obj *scsi =ide_scsi_g (disk); -ide_drive_t *drive = scsi->drive; - - drive->usage--;ide_scsi_put (scsi);
include/linux/ide.h +0 -1
@@ -628,7 +628,6 @@ typedef struct ide_drive_s {unsigned int bios_cyl;/* BIOS/fdisk/LILO number of cyls */ unsigned int cyl;/* "real" number of cyls */ unsigned int drive_data;/* use by tuneproc/selectproc */ -unsigned int usage;/* current "open()" count for drive */ unsigned int failures;/* current failure count */ unsigned int max_failures;/* maximum allowed failure count */ u64 probed_capacity;/* initial reported media capacity (ide-cd only currently) */
PATCH 13/19 hpt366: remove redundant check from init_dma_hpt366()
In reply to Bartlomiej Zolnierkiewicz[PATCH] hpt366: remove redundant check from init_dma_hpt366()
->init_dma() cannot be called with dmabase == 0
(see drivers/ide/setup-pci.c)
--- drivers/ide/pci/hpt366.c | 3 --- 1 file changed, 3 deletions(-)
drivers/ide/pci/hpt366.c +0 -3
@@ -1391,9 +1391,6 @@ static void __devinit init_dma_hpt366(idu8 dma_new =0 , dma_old =0 ;unsigned long flags; -if (!dmabase) -return ; - dma_old = hwif->INB (dmabase +2 );local_irq_save (flags);
PATCH 14/19 cs5530: small cleanup
In reply to Bartlomiej Zolnierkiewicz[PATCH] cs5530: small cleanup
* BUG() on unknown DMA mode in cs5530_config_dma()
* there is no need to call hwif->ide_dma_host_{off,on}() in cs5530_config_dma() because hwif->ide_dma_host_{off,on}() is called by hwif->ide_dma_off_{quietly,on}()
--- drivers/ide/pci/cs5530.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/ide/pci/cs5530.c +3 -9
@@ -103,16 +103,13 @@ static int cs5530_config_dma (ide_drive_int unit = drive->select.b.unit;ide_drive_t *mate = &hwif->drives[unit^1 ];struct hd_driveid *id = drive->id; -unsigned int reg, timings; +unsigned int reg, timings =0 ;unsigned long basereg;/* * Default to DMA-off in case we run into trouble here. */ hwif->ide_dma_off_quietly (drive); -/* turn off DMA while we fiddle */ - hwif->ide_dma_host_off (drive); -/* clear DMA_capable bit */ /* * The CS5530 specifies that two drives sharing a cable cannot
@@ -182,9 +179,8 @@ static int cs5530_config_dma (ide_drive_case XFER_MW_DMA_1 : timings =0x00012121 ;break ;case XFER_MW_DMA_2 : timings =0x00002020 ;break ;default : -printk (KERN_ERR "%s: cs5530_config_dma: huh? mode=%02x\n" , - drive->name, mode); -return 1 ;/* failure */ +BUG (); +break ; } basereg =CS5530_BASEREG (hwif); reg = hwif->INL (basereg+4 );/* get drive0 config register */
@@ -199,8 +195,6 @@ static int cs5530_config_dma (ide_drive_ hwif->OUTL (reg, basereg+4 );/* write drive0 config register */ hwif->OUTL (timings, basereg+12 );/* write drive1 config register */ } - (void ) hwif->ide_dma_host_on (drive); -/* set DMA_capable bit */ /* * Finally, turn DMA on in software, and exit.
PATCH 15/19 svwks: small cleanup
In reply to Bartlomiej Zolnierkiewicz[PATCH] svwks: small cleanup
* remove redundant svwks_ide_dma_end() [ __ide_dma_end() is used by default ]
* remove init_dma_svwks() so the default ide_setup_dma() function is used [ init_setup_csb6() takes care of not initializing disabled channels ]
--- drivers/ide/pci/serverworks.c | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-)
drivers/ide/pci/serverworks.c +4 -30
@@ -339,13 +339,6 @@ fast_ata_pio:return 0 ; } -/* This can go soon */ - -static int svwks_ide_dma_end (ide_drive_t *drive) -{ -return __ide_dma_end (drive); -} -static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev,const char *name) {unsigned int reg;
@@ -537,10 +530,10 @@ static void __devinit init_hwif_svwks (i } hwif->ide_dma_check = &svwks_config_drive_xfer_rate; -if (hwif->pci_dev->device ==PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ) - hwif->ide_dma_end = &svwks_ide_dma_end; -else if (!(hwif->udma_four)) - hwif->udma_four =ata66_svwks (hwif); +if (hwif->pci_dev->device !=PCI_DEVICE_ID_SERVERWORKS_OSB4IDE ) { +if (!hwif->udma_four) + hwif->udma_four =ata66_svwks (hwif); + }if (!noautodma) hwif->autodma =1 ;
@@ -551,21 +544,6 @@ static void __devinit init_hwif_svwks (i hwif->drives[1 ].autotune = (!(dma_stat &0x40 )); } -/* -* We allow the BM-DMA driver to only work on enabled interfaces. -*/ -static void __devinit init_dma_svwks (ide_hwif_t *hwif,unsigned long dmabase) -{ -struct pci_dev *dev = hwif->pci_dev; - -if (((dev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ) || - (dev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 )) && - (!(PCI_FUNC (dev->devfn) &1 )) && (hwif->channel)) -return ; - -ide_setup_dma (hwif, dmabase,8 ); -} -static int __devinit init_setup_svwks (struct pci_dev *dev,ide_pci_device_t *d) {return ide_setup_pci_device (dev, d);
@@ -600,7 +578,6 @@ static ide_pci_device_t serverworks_chip .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .init_dma = init_dma_svwks, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD,
@@ -609,7 +586,6 @@ static ide_pci_device_t serverworks_chip .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .init_dma = init_dma_svwks, .channels = 2, .autodma = AUTODMA, .bootable = ON_BOARD,
@@ -618,7 +594,6 @@ static ide_pci_device_t serverworks_chip .init_setup = init_setup_csb6, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .init_dma = init_dma_svwks, .channels = 1, /* 2 */ .autodma = AUTODMA, .bootable = ON_BOARD,
@@ -627,7 +602,6 @@ static ide_pci_device_t serverworks_chip .init_setup = init_setup_svwks, .init_chipset = init_chipset_svwks, .init_hwif = init_hwif_svwks, - .init_dma = init_dma_svwks, .channels = 1, /* 2 */ .autodma = AUTODMA, .bootable = ON_BOARD,
PATCH 16/19 sis5513: sis5513_config_xfer_rate() cleanup
In reply to Bartlomiej Zolnierkiewicz[PATCH] sis5513: sis5513_config_xfer_rate() cleanup
* remove bogus comment for sis5513_config_xfer_rate()
* there is no need to call config_drive_art_rwp() because it is called by config_art_rwp_pio()
* remove needless wrapper
* remove stale "TODO" comment
(IDE core should provide generic tuning code)
--- drivers/ide/pci/sis5513.c | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-)
drivers/ide/pci/sis5513.c +3 -38
@@ -667,11 +667,13 @@ static int config_chipset_for_dma (ide_dreturn ide_dma_enable (drive); } -static int sis5513_config_drive_xfer_rate (ide_drive_t *drive) +static int sis5513_config_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive);struct hd_driveid *id = drive->id; +config_art_rwp_pio (drive,5 ); + drive->init_speed =0 ;if (id && (id->capability &1 ) && drive->autodma) {
@@ -692,43 +694,6 @@ fast_ata_pio:return 0 ; } -/* initiates/aborts (U)DMA read/write operations on a drive. */ -static int sis5513_config_xfer_rate (ide_drive_t *drive) -{ -config_drive_art_rwp (drive); -config_art_rwp_pio (drive,5 ); -return sis5513_config_drive_xfer_rate (drive); -} - -/* -Future simpler config_xfer_rate : -When ide_find_best_mode is made bad-drive aware -- remove config_drive_xfer_rate and config_chipset_for_dma, -- replace config_xfer_rate with the following - -static int sis5513_config_xfer_rate (ide_drive_t *drive) -{ -u16 w80 = HWIF(drive)->udma_four; -u16 speed; - -config_drive_art_rwp(drive); -config_art_rwp_pio(drive, 5); - -speed = ide_find_best_mode(drive, -XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | -(chipset_family >= ATA_33 ? XFER_UDMA : 0) | -(w80 && chipset_family >= ATA_66 ? XFER_UDMA_66 : 0) | -(w80 && chipset_family >= ATA_100a ? XFER_UDMA_100 : 0) | -(w80 && chipset_family >= ATA_133a ? XFER_UDMA_133 : 0)); - -sis5513_tune_chipset(drive, speed); - -if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) -return HWIF(drive)->ide_dma_on(drive); -return HWIF(drive)->ide_dma_off_quietly(drive); -} -*/ -/* Chip detection and general config */ static unsigned int __devinit init_chipset_sis5513 (struct pci_dev *dev,const char *name) {
PATCH 17/19 ide: unexport ide_set_xfer_rate()
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: unexport ide_set_xfer_rate()
In cmd64x and siimage drivers:
* don't set drive->init_speed as it should be already set by successful execution of ide_set_xfer_rate()
* use hwif->speedproc functions directly
Above changes allows removal of EXPORT_SYMBOL_GPL(ide_set_xfer_rate).
--- drivers/ide/ide-lib.c | 2 -- drivers/ide/pci/cmd64x.c | 7 ++----- drivers/ide/pci/siimage.c | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-)
drivers/ide/ide-lib.c +0 -2
@@ -459,8 +459,6 @@ int ide_set_xfer_rate(ide_drive_t *drivereturn -1 ; } -EXPORT_SYMBOL_GPL (ide_set_xfer_rate); -static void ide_dump_opcode (ide_drive_t *drive) {struct request *rq;
drivers/ide/pci/cmd64x.c +2 -5
@@ -466,11 +466,8 @@ static int config_chipset_for_dma (ide_dif (!speed)return 0 ; -if (ide_set_xfer_rate (drive, speed)) -return 0 ; - -if (!drive->init_speed) - drive->init_speed = speed; +if (cmd64x_tune_chipset (drive, speed)) +return 0 ;return ide_dma_enable (drive); }
drivers/ide/pci/siimage.c +1 -4
@@ -397,12 +397,9 @@ static int config_chipset_for_dma (ide_dif (!speed)return 0 ; -if (ide_set_xfer_rate (drive, speed)) +if (siimage_tune_chipset (drive, speed))return 0 ; -if (!drive->init_speed) - drive->init_speed = speed; -return ide_dma_enable (drive); }
PATCH 18/19 ide: add ide_use_fast_pio() helper
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: add ide_use_fast_pio() helper
* add ide_use_fast_pio() helper for use by host drivers
* add DMA capability and autodma checks to ide_use_dma()
- au1xxx-ide/it8213/it821x drivers didn't check for (id->capability & 1)
- ide-cris driver didn't set ->autodma
--- drivers/ide/cris/ide-cris.c | 12 +++++------- drivers/ide/ide-dma.c | 3 +++ drivers/ide/ide-lib.c | 15 +++++++++++++++ drivers/ide/pci/aec62xx.c | 14 +++----------- drivers/ide/pci/atiixp.c | 14 +++----------- drivers/ide/pci/cmd64x.c | 14 +++----------- drivers/ide/pci/cs5535.c | 13 +++---------- drivers/ide/pci/hpt34x.c | 16 ++++------------ drivers/ide/pci/hpt366.c | 11 +++-------- drivers/ide/pci/pdc202xx_new.c | 12 +++--------- drivers/ide/pci/pdc202xx_old.c | 14 +++----------- drivers/ide/pci/piix.c | 12 +++--------- drivers/ide/pci/serverworks.c | 14 +++----------- drivers/ide/pci/siimage.c | 14 +++----------- drivers/ide/pci/sis5513.c | 14 +++----------- drivers/ide/pci/slc90e66.c | 12 +++--------- drivers/ide/pci/tc86c001.c | 12 +++--------- drivers/ide/pci/triflex.c | 9 ++------- include/linux/ide.h | 1 + 19 files changed, 69 insertions(+), 157 deletions(-)
drivers/ide/cris/ide-cris.c +5 -7
@@ -821,6 +821,9 @@ init_e100_ide (void) hwif->ultra_mask = cris_ultra_mask; hwif->mwdma_mask =0x07 ;/* Multiword DMA 0-2 */ hwif->swdma_mask =0x07 ;/* Singleword DMA 0-2 */ + hwif->autodma =1 ; + hwif->drives[0 ].autodma =1 ; + hwif->drives[1 ].autodma =1 ; }/* Reset pulse */
@@ -1046,14 +1049,9 @@ static ide_startstop_t cris_dma_intr (idstatic int cris_dma_check (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif; -struct hd_driveid * id = drive->id; -if (id && (id->capability &1 )) { -if (ide_use_dma (drive)) { -if (cris_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - } +if (ide_use_dma (drive) &&cris_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive);return hwif->ide_dma_off_quietly (drive); }
drivers/ide/ide-dma.c +3 -0
@@ -680,6 +680,9 @@ int ide_use_dma(ide_drive_t *drive)struct hd_driveid *id = drive->id;ide_hwif_t *hwif = drive->hwif; +if ((id->capability &1 ) ==0 || drive->autodma ==0 ) +return 0 ; +/* consult the list of known "bad" drives */ if (__ide_dma_bad_drive (drive))return 0 ;
drivers/ide/ide-lib.c +15 -0
@@ -205,6 +205,21 @@ int ide_dma_enable (ide_drive_t *drive)EXPORT_SYMBOL (ide_dma_enable); +int ide_use_fast_pio (ide_drive_t *drive) +{ +struct hd_driveid *id = drive->id; + +if ((id->capability &1 ) && drive->autodma) +return 1 ; + +if ((id->capability &8 ) || (id->field_valid &2 )) +return 1 ; + +return 0 ; +} + +EXPORT_SYMBOL_GPL (ide_use_fast_pio); +/* * Standard (generic) timings for PIO modes, from ATA2 specification. * These timings are for access to the IDE data port register *only*.
drivers/ide/pci/aec62xx.c +3 -11
@@ -210,19 +210,11 @@ static void aec62xx_tune_drive (ide_drivstatic int aec62xx_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {aec62xx_tune_drive (drive,5 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/atiixp.c +3 -11
@@ -256,22 +256,14 @@ static int atiixp_config_drive_for_dma(istatic int atiixp_dma_check (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id;u8 tspeed, speed; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&atiixp_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (atiixp_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) { tspeed =ide_get_best_pio_mode (drive,255 ,5 ,NULL ); speed =atiixp_dma_2_pio (XFER_PIO_0 + tspeed) +XFER_PIO_0 ; hwif->speedproc (drive, speed);
drivers/ide/pci/cmd64x.c +3 -11
@@ -475,19 +475,11 @@ static int config_chipset_for_dma (ide_dstatic int cmd64x_config_drive_for_dma (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; -if ((id !=NULL ) && ((id->capability &1 ) !=0 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {config_chipset_for_pio (drive,1 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/cs5535.c +3 -10
@@ -196,21 +196,14 @@ static int cs5535_config_drive_for_dma(istatic int cs5535_dma_check (ide_drive_t *drive) {ide_hwif_t *hwif = drive->hwif; -struct hd_driveid *id = drive->id;u8 speed; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { -if (ide_use_dma (drive)) { -if (cs5535_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - } +if (ide_use_dma (drive) &&cs5535_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive); - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) { speed =ide_get_best_pio_mode (drive,255 ,4 ,NULL );cs5535_set_drive (drive, speed);return hwif->ide_dma_off_quietly (drive);
drivers/ide/pci/hpt34x.c +4 -12
@@ -125,25 +125,17 @@ static int config_chipset_for_dma (ide_dstatic int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if (id && (id->capability &1 ) && drive->autodma) { - -if (ide_use_dma (drive)) { - if (config_chipset_for_dma(drive)) + if (ide_use_dma(drive) && config_chipset_for_dma(drive))#ifndef CONFIG_HPT34X_AUTODMA -return hwif->ide_dma_off_quietly (drive); +return hwif->ide_dma_off_quietly (drive);#else -return hwif->ide_dma_on (drive); +return hwif->ide_dma_on (drive);#endif - } - - goto fast_ata_pio; - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {hpt34x_tune_drive (drive,255 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/hpt366.c +3 -8
@@ -737,18 +737,13 @@ static void hpt3xx_maskproc(ide_drive_tstatic int hpt366_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { -if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {hpt3xx_tune_drive (drive,255 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/pdc202xx_new.c +3 -9
@@ -282,19 +282,13 @@ static int config_chipset_for_dma(ide_drstatic int pdcnew_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) { hwif->tuneproc (drive,255 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/pdc202xx_old.c +3 -11
@@ -333,21 +333,13 @@ chipset_is_set:static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if (id && (id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) { hwif->tuneproc (drive,5 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/piix.c +3 -9
@@ -387,19 +387,13 @@ static int piix_config_drive_for_dma (idstatic int piix_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&piix_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive) &&piix_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {/* Find best PIO mode. */ (void ) hwif->speedproc (drive,XFER_PIO_0 +ide_get_best_pio_mode (drive,255 ,4 ,NULL ));
drivers/ide/pci/serverworks.c +3 -11
@@ -316,21 +316,13 @@ static int config_chipset_for_dma (ide_dstatic int svwks_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {config_chipset_for_pio (drive);// hwif->tuneproc(drive, 5); return hwif->ide_dma_off_quietly (drive);
drivers/ide/pci/siimage.c +3 -11
@@ -416,19 +416,11 @@ static int config_chipset_for_dma (ide_dstatic int siimage_config_drive_for_dma (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; -if ((id->capability &1 ) !=0 && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {config_chipset_for_pio (drive,1 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/sis5513.c +3 -11
@@ -670,23 +670,15 @@ static int config_chipset_for_dma (ide_dstatic int sis5513_config_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id;config_art_rwp_pio (drive,5 ); drive->init_speed =0 ; -if (id && (id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive)) { -if (config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {sis5513_tune_drive (drive,5 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/slc90e66.c +3 -9
@@ -180,19 +180,13 @@ static int slc90e66_config_drive_for_dmastatic int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; drive->init_speed =0 ; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&slc90e66_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive) &&slc90e66_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) { (void ) hwif->speedproc (drive,XFER_PIO_0 +ide_get_best_pio_mode (drive,255 ,4 ,NULL ));return hwif->ide_dma_off_quietly (drive);
drivers/ide/pci/tc86c001.c +3 -9
@@ -186,17 +186,11 @@ static int config_chipset_for_dma(ide_drstatic int tc86c001_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; -if ((id->capability &1 ) && drive->autodma) { +if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) +return hwif->ide_dma_on (drive); -if (ide_use_dma (drive) &&config_chipset_for_dma (drive)) -return hwif->ide_dma_on (drive); - - goto fast_ata_pio; - - }else if ((id->capability &8 ) || (id->field_valid &2 )) { -fast_ata_pio: +if (ide_use_fast_pio (drive)) {tc86c001_tune_drive (drive,255 );return hwif->ide_dma_off_quietly (drive); }
drivers/ide/pci/triflex.c +2 -7
@@ -116,14 +116,9 @@ static int triflex_config_drive_for_dma(static int triflex_config_drive_xfer_rate (ide_drive_t *drive) {ide_hwif_t *hwif =HWIF (drive); -struct hd_driveid *id = drive->id; -if ((id->capability &1 ) && drive->autodma) { -if (ide_use_dma (drive)) { -if (triflex_config_drive_for_dma (drive)) -return hwif->ide_dma_on (drive); - } - } +if (ide_use_dma (drive) &&triflex_config_drive_for_dma (drive)) +return hwif->ide_dma_on (drive); hwif->tuneproc (drive,255 );return hwif->ide_dma_off_quietly (drive);
include/linux/ide.h +1 -0
@@ -1325,6 +1325,7 @@ extern int ide_dma_enable(ide_drive_t *dextern char *ide_xfer_verbose (u8 xfer_rate);extern void ide_toggle_bounce (ide_drive_t *drive,int on);extern int ide_set_xfer_rate (ide_drive_t *drive,u8 rate); +int ide_use_fast_pio (ide_drive_t *);u8 ide_dump_status (ide_drive_t *,const char *,u8 );
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 5 lines · On Fri, 12 Jan 2007 05:28:00 +0100 Bartlomiej Zolnierkiewicz…
[PATCH] ide: add
ide_use_fast_pio()helper* add
ide_use_fast_pio()helper for use by host drivers
* add DMA capability and autodma checks toide_use_dma()
- au1xxx-ide/it8213/it821x drivers didn't check for (id->capability& 1)
For the IT8211/2 in SMART this check shouldn't be made.
Quoted 1 line
- ide-cris driver didn't set ->autodma
You've changed the behaviour there. Should the default be autodma=0 ?
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 10 lines · Alan
Quoted 5 lines · On Fri, 12 Jan 2007 05:28:00 +0100 Bartlomiej Zolnierkiewicz…
[PATCH] ide: add
ide_use_fast_pio()helper* add
ide_use_fast_pio()helper for use by host drivers
* add DMA capability and autodma checks toide_use_dma()
- au1xxx-ide/it8213/it821x drivers didn't check for (id->capability& 1)For the IT8211/2 in SMART this check shouldn't be made.
It is OK since in it821x_fixups() we set it explicitly:
if(strstr(id->model, "Integrated Technology Express")) {
/* In raid mode the ident block is slightly buggy
We need to set the bits so that the IDE layer knows
LBA28. LBA48 and DMA ar valid */
id->capability |= 3; /* LBA28, DMA */and we are better off using generic helper if we can (which may later allow us to use generic tuning code).
Quoted 3 lines
Quoted 1 line
- ide-cris driver didn't set ->autodma
You've changed the behaviour there. Should the default be autodma=0 ?
Before my patch hwif->autodma was only checked in the chipset specific hwif->ide_dma_check implementations. For ide-cris it is cris_dma_check()
function so there no behavior change here.
Sorry for not explaining changes in detail in the patch description (I will update it).
Bart
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 8 lines
if(strstr(id->model, "Integrated Technology Express")) { /* In raid mode the ident block is slightly buggy We need to set the bits so that the IDE layer knows LBA28. LBA48 and DMA ar valid */ id->capability |= 3; /* LBA28, DMA */and we are better off using generic helper if we can (which may later allow us to use generic tuning code).
IT8212 in smart mode has no tuning at all, the real modes are hidden by the controller. Some firmware versions don't seem to be like being fed set features commands either hence the total lack of tuning.
Quoted 5 lines
Before my patch
hwif->autodmawas only checked in the chipset specifichwif->ide_dma_checkimplementations. For ide-cris it iscris_dma_check()
function so there no behavior change here.
Ok
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 6 lines · Alan
Quoted 6 lines
if(strstr(id->model, "Integrated Technology Express")) { /* In raid mode the ident block is slightly buggy We need to set the bits so that the IDE layer knows LBA28. LBA48 and DMA ar valid */ id->capability |= 3; /* LBA28, DMA */
Quoted 6 lines
Quoted 2 lines
and we are better off using generic helper if we can (which may later allow us to use generic tuning code).
IT8212 in smart mode has no tuning at all, the real modes are hidden by the controller. Some firmware versions don't seem to be like being fed set features commands either hence the total lack of tuning.
[ The discussed "ide: add ide_use_fast_pio() helper" patch doesn't fix it
but it doesn't break anything either (it doesn't change the current
behavior). ]
It seems that it821x_tune_chipset() is buggy since it sends SET FEATURES command even when in smart mode. Shouldn't there be "don't tune" flag in it812x_fixups() to tell it821x_tune_chipset() to not send SET FEATURES commands?
Bart
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 4 lines
It seems that
it821x_tune_chipset()is buggy since it sends SET FEATURES command even when in smart mode. Shouldn't there be "don't tune" flag init812x_fixups()to tellit821x_tune_chipset()to not send SET FEATURES commands?
It's itdev->smart but falls through to ide_config_drive_speed while it should probably just copy bits of the code from it. Thats all fixed in the libata driver which allows chip specific mode setup.
Re: [PATCH 18/19] ide: add ide_use_fast_pio() helper
Quoted 8 lines · Alan
Quoted 4 lines
It seems that
it821x_tune_chipset()is buggy since it sends SET FEATURES command even when in smart mode. Shouldn't there be "don't tune" flag init812x_fixups()to tellit821x_tune_chipset()to not send SET FEATURES commands?It's
itdev->smartbut falls through toide_config_drive_speedwhile it should probably just copy bits of the code from it. Thats all fixed in the libata driver which allows chip specific mode setup.
ide_config_drive_speed() does the following things:
1. disables host DMA
2. sends SET FEATURES command (in polling mode)
3. re-enables host DMA (only if DMA mode was set)
4. updates drive->id->dma_{ultra,mword,1word}
5. updates drive->{current,init}_speed
1. and 2. should really go to higher layers
3. obviously shouldn't be done for itdev->smart
4. also shouldn't be done for itdev>smart
(we are not changing speed mode)
5. should be done once outside of it821x_tune_chipset()
Therefore current TODO looks like:
* moving DMA fiddling code out of ide_config_drive_speed()
* setting drive->{current,init} speed in it821x_fixups()
* fixing it821x not to call ide_config_drive_speed() for itdev->smart
Fixing user space generated requests requires more work (i.e. adding ->set_mode method)...
I'll try to cook up some patches later unless somebody beats me to it.
Thanks,
Bart
PATCH 19/19 ide: use PIO/MMIO operations directly where possible
In reply to Bartlomiej Zolnierkiewicz[PATCH] ide: use PIO/MMIO operations directly where possible
This results in smaller/faster/simpler code and allows future optimizations. Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
--- drivers/ide/h8300/ide-h8300.c | 2 - drivers/ide/ide-dma.c | 5 ++- drivers/ide/ide-iops.c | 24 -------------- drivers/ide/ide.c | 2 - drivers/ide/legacy/ht6560b.c | 14 ++++---- drivers/ide/pci/aec62xx.c | 6 +-- drivers/ide/pci/alim15x3.c | 4 +- drivers/ide/pci/cmd64x.c | 18 +++++------ drivers/ide/pci/cs5530.c | 22 ++++++------- drivers/ide/pci/cy82c693.c | 12 +++---- drivers/ide/pci/hpt366.c | 2 - drivers/ide/pci/ns87415.c | 10 +++--- drivers/ide/pci/opti621.c | 63 +++++++++++++++++++------------------- drivers/ide/pci/pdc202xx_new.c | 8 ++-- drivers/ide/pci/pdc202xx_old.c | 41 ++++++++++++------------- drivers/ide/pci/serverworks.c | 4 +- drivers/ide/pci/sgiioc4.c | 67 +++++++++++++++++++++-------------------- drivers/ide/pci/siimage.c | 24 +++++++------- drivers/ide/pci/sl82c105.c | 6 +-- drivers/ide/pci/tc86c001.c | 26 +++++++-------- drivers/ide/pci/trm290.c | 38 +++++++++++------------ include/linux/ide.h | 2 - 22 files changed, 188 insertions(+), 212 deletions(-)
drivers/ide/h8300/ide-h8300.c +0 -2
@@ -81,8 +81,6 @@ static inline void hwif_setup(ide_hwif_t hwif->OUTSW = mm_outsw; hwif->INW = mm_inw; hwif->INSW = mm_insw; - hwif->OUTL =NULL ; - hwif->INL =NULL ; hwif->OUTSL =NULL ; hwif->INSL =NULL ; }
drivers/ide/ide-dma.c +4 -1
@@ -565,7 +565,10 @@ int ide_dma_setup(ide_drive_t *drive) }/* PRD table */ - hwif->OUTL (hwif->dmatable_dma, hwif->dma_prdtable); +if (hwif->mmio ==2 ) +writel (hwif->dmatable_dma, (void __iomem *)hwif->dma_prdtable); +else +outl (hwif->dmatable_dma, hwif->dma_prdtable);/* specify r/w */ hwif->OUTB (reading, hwif->dma_command);
drivers/ide/ide-iops.c +0 -24
@@ -49,11 +49,6 @@ static void ide_insw (unsigned long portinsw (port, addr, count); } -static u32 ide_inl (unsigned long port) -{ -return (u32 )inl (port); -} -static void ide_insl (unsigned long port,void *addr,u32 count) {insl (port, addr, count);
@@ -79,11 +74,6 @@ static void ide_outsw (unsigned long poroutsw (port, addr, count); } -static void ide_outl (u32 val,unsigned long port) -{ -outl (val, port); -} -static void ide_outsl (unsigned long port,void *addr,u32 count) {outsl (port, addr, count);
@@ -94,12 +84,10 @@ void default_hwif_iops (ide_hwif_t *hwif hwif->OUTB = ide_outb; hwif->OUTBSYNC = ide_outbsync; hwif->OUTW = ide_outw; - hwif->OUTL = ide_outl; hwif->OUTSW = ide_outsw; hwif->OUTSL = ide_outsl; hwif->INB = ide_inb; hwif->INW = ide_inw; - hwif->INL = ide_inl; hwif->INSW = ide_insw; hwif->INSL = ide_insl; }
@@ -123,11 +111,6 @@ static void ide_mm_insw (unsigned long p__ide_mm_insw ((void __iomem *) port, addr, count); } -static u32 ide_mm_inl (unsigned long port) -{ -return (u32 )readl ((void __iomem *) port); -} -static void ide_mm_insl (unsigned long port,void *addr,u32 count) {__ide_mm_insl ((void __iomem *) port, addr, count);
@@ -153,11 +136,6 @@ static void ide_mm_outsw (unsigned long__ide_mm_outsw ((void __iomem *) port, addr, count); } -static void ide_mm_outl (u32 value,unsigned long port) -{ -writel (value, (void __iomem *) port); -} -static void ide_mm_outsl (unsigned long port,void *addr,u32 count) {__ide_mm_outsl ((void __iomem *) port, addr, count);
@@ -170,12 +148,10 @@ void default_hwif_mmiops (ide_hwif_t *hwthis one is controller specific! */ hwif->OUTBSYNC = ide_mm_outbsync; hwif->OUTW = ide_mm_outw; - hwif->OUTL = ide_mm_outl; hwif->OUTSW = ide_mm_outsw; hwif->OUTSL = ide_mm_outsl; hwif->INB = ide_mm_inb; hwif->INW = ide_mm_inw; - hwif->INL = ide_mm_inl; hwif->INSW = ide_mm_insw; hwif->INSL = ide_mm_insl; }
drivers/ide/ide.c +0 -2
@@ -511,13 +511,11 @@ static void ide_hwif_restore(ide_hwif_t hwif->OUTB = tmp_hwif->OUTB; hwif->OUTBSYNC = tmp_hwif->OUTBSYNC; hwif->OUTW = tmp_hwif->OUTW; - hwif->OUTL = tmp_hwif->OUTL; hwif->OUTSW = tmp_hwif->OUTSW; hwif->OUTSL = tmp_hwif->OUTSL; hwif->INB = tmp_hwif->INB; hwif->INW = tmp_hwif->INW; - hwif->INL = tmp_hwif->INL; hwif->INSW = tmp_hwif->INSW; hwif->INSL = tmp_hwif->INSL;
drivers/ide/legacy/ht6560b.c +7 -7
@@ -143,16 +143,16 @@ static void ht6560b_selectproc (ide_driv current_timing = timing;if (drive->media != ide_disk || !drive->present) select |=HT_PREFETCH_MODE ; - (void )HWIF (drive)->INB (HT_CONFIG_PORT ); - (void )HWIF (drive)->INB (HT_CONFIG_PORT ); - (void )HWIF (drive)->INB (HT_CONFIG_PORT ); - (void )HWIF (drive)->INB (HT_CONFIG_PORT ); -HWIF (drive)->OUTB (select,HT_CONFIG_PORT ); + (void )inb (HT_CONFIG_PORT ); + (void )inb (HT_CONFIG_PORT ); + (void )inb (HT_CONFIG_PORT ); + (void )inb (HT_CONFIG_PORT ); +outb (select,HT_CONFIG_PORT );/* * Set timing for this drive: */ -HWIF (drive)->OUTB (timing,IDE_SELECT_REG ); - (void )HWIF (drive)->INB (IDE_STATUS_REG ); +outb (timing,IDE_SELECT_REG ); + (void )inb (IDE_STATUS_REG );#ifdef DEBUG printk ("ht6560b: %s: select=%#x timing=%#x\n" , drive->name, select, timing);
drivers/ide/pci/aec62xx.c +3 -3
@@ -94,9 +94,9 @@ static u8 aec62xx_ratemask (ide_drive_tswitch (hwif->pci_dev->device) {case PCI_DEVICE_ID_ARTOP_ATP865 :case PCI_DEVICE_ID_ARTOP_ATP865R : - mode = (hwif->INB (((hwif->channel) ? - hwif->mate->dma_status : - hwif->dma_status)) &0x10 ) ?4 :3 ; + mode = (inb (hwif->channel ? + hwif->mate->dma_status : + hwif->dma_status) &0x10 ) ?4 :3 ;break ;case PCI_DEVICE_ID_ARTOP_ATP860 :case PCI_DEVICE_ID_ARTOP_ATP860R :
drivers/ide/pci/alim15x3.c +2 -2
@@ -852,8 +852,8 @@ static void __devinit init_dma_ali15x3 ( {if (m5229_revision <0x20 )return ; -if (!(hwif->channel)) - hwif->OUTB (hwif->INB (dmabase+2 ) &0x60 , dmabase+2 ); +if (!hwif->channel) +outb (inb (dmabase +2 ) &0x60 , dmabase +2 );ide_setup_dma (hwif, dmabase,8 ); }
drivers/ide/pci/cmd64x.c +9 -9
@@ -507,13 +507,13 @@ static int cmd64x_ide_dma_end (ide_drive drive->waiting_for_dma =0 ;/* read DMA command state */ - dma_cmd = hwif->INB (hwif->dma_command); + dma_cmd =inb (hwif->dma_command);/* stop DMA */ - hwif->OUTB ((dma_cmd & ~1 ), hwif->dma_command); +outb (dma_cmd & ~1 , hwif->dma_command);/* get DMA status */ - dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status);/* clear the INTR & ERROR bits */ - hwif->OUTB (dma_stat|6 , hwif->dma_status); +outb (dma_stat |6 , hwif->dma_status);if (cmd64x_alt_dma_status (dev)) {u8 dma_intr =0 ; u8 dma_mask = (hwif->channel) ? ARTTIM23_INTR_CH1 :
@@ -535,7 +535,7 @@ static int cmd64x_ide_dma_test_irq (ide_struct pci_dev *dev = hwif->pci_dev;u8 dma_alt_stat =0 , mask = (hwif->channel) ?MRDMODE_INTR_CH1 :MRDMODE_INTR_CH0 ; -u8 dma_stat = hwif->INB (hwif->dma_status); +u8 dma_stat =inb (hwif->dma_status); (void )pci_read_config_byte (dev,MRDMODE , &dma_alt_stat);#ifdef DEBUG
@@ -565,13 +565,13 @@ static int cmd646_1_ide_dma_end (ide_dri drive->waiting_for_dma =0 ;/* get DMA status */ - dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status);/* read DMA command state */ - dma_cmd = hwif->INB (hwif->dma_command); + dma_cmd =inb (hwif->dma_command);/* stop DMA */ - hwif->OUTB ((dma_cmd & ~1 ), hwif->dma_command); +outb (dma_cmd & ~1 , hwif->dma_command);/* clear the INTR & ERROR bits */ - hwif->OUTB (dma_stat|6 , hwif->dma_status); +outb (dma_stat |6 , hwif->dma_status);/* and free any DMA resources */ ide_destroy_dmatable (drive);/* verify good DMA status */
drivers/ide/pci/cs5530.c +11 -11
@@ -81,8 +81,8 @@ static void cs5530_tuneproc (ide_drive_t pio =ide_get_best_pio_mode (drive, pio,4 ,NULL );if (!cs5530_set_xfer_mode (drive, modes[pio])) { - format = (hwif->INL (basereg+4 ) >>31 ) &1 ; - hwif->OUTL (cs5530_pio_timings[format][pio], + format = (inl (basereg +4 ) >>31 ) &1 ; +outl (cs5530_pio_timings[format][pio], basereg+(drive->select.b.unit<<3 )); } }
@@ -183,17 +183,17 @@ static int cs5530_config_dma (ide_drive_break ; } basereg =CS5530_BASEREG (hwif); - reg = hwif->INL (basereg+4 );/* get drive0 config register */ + reg =inl (basereg +4 );/* get drive0 config register */ timings |= reg &0x80000000 ;/* preserve PIO format bit */ if (unit ==0 ) {/* are we configuring drive0? */ - hwif->OUTL (timings, basereg+4 );/* write drive0 config register */ +outl (timings, basereg +4 );/* write drive0 config register */ }else {if (timings &0x00100000 ) reg |=0x00100000 ;/* enable UDMA timings for both drives */ else reg &= ~0x00100000 ;/* disable UDMA timings for both drives */ - hwif->OUTL (reg, basereg+4 );/* write drive0 config register */ - hwif->OUTL (timings, basereg+12 );/* write drive1 config register */ +outl (reg, basereg +4 );/* write drive0 config register */ +outl (timings, basereg +12 );/* write drive1 config register */ }/*
@@ -315,17 +315,17 @@ static void __devinit init_hwif_cs5530 ( hwif->tuneproc = &cs5530_tuneproc; basereg =CS5530_BASEREG (hwif); - d0_timings = hwif->INL (basereg+0 ); + d0_timings =inl (basereg +0 );if (CS5530_BAD_PIO (d0_timings)) {/* PIO timings not initialized? */ - hwif->OUTL (cs5530_pio_timings[(d0_timings>>31 )&1 ][0 ], basereg+0 ); +outl (cs5530_pio_timings[(d0_timings >>31 ) &1 ][0 ], basereg +0 );if (!hwif->drives[0 ].autotune) hwif->drives[0 ].autotune =1 ;/* needs autotuning later */ } -if (CS5530_BAD_PIO (hwif->INL (basereg+8 ))) { -/* PIO timings not initialized? */ - hwif->OUTL (cs5530_pio_timings[(d0_timings>>31 )&1 ][0 ], basereg+8 ); +if (CS5530_BAD_PIO (inl (basereg +8 ))) { +/* PIO timings not initialized? */ +outl (cs5530_pio_timings[(d0_timings >>31 ) &1 ][0 ], basereg +8 );if (!hwif->drives[1 ].autotune) hwif->drives[1 ].autotune =1 ;/* needs autotuning later */
drivers/ide/pci/cy82c693.c +6 -6
@@ -197,8 +197,8 @@ static void cy82c693_dma_enable (ide_dri#if CY82C693_DEBUG_LOGS /* for debug let's show the previous values */ -HWIF (drive)->OUTB (index,CY82_INDEX_PORT ); - data =HWIF (drive)->INB (CY82_DATA_PORT ); +outb (index,CY82_INDEX_PORT ); + data =inb (CY82_DATA_PORT ); printk (KERN_INFO "%s (ch=%d, dev=%d): DMA mode is %d (single=%d)\n", drive->name, HWIF(drive)->channel, drive->select.b.unit,
@@ -207,8 +207,8 @@ static void cy82c693_dma_enable (ide_dri data = (u8 )mode|(u8)(single<<2 ); -HWIF (drive)->OUTB (index,CY82_INDEX_PORT ); -HWIF (drive)->OUTB (data,CY82_DATA_PORT ); +outb (index,CY82_INDEX_PORT ); +outb (data,CY82_DATA_PORT );#if CY82C693_DEBUG_INFO printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n",
@@ -227,8 +227,8 @@ static void cy82c693_dma_enable (ide_dri*/ data =BUSMASTER_TIMEOUT ; -HWIF (drive)->OUTB (CY82_INDEX_TIMEOUT ,CY82_INDEX_PORT ); -HWIF (drive)->OUTB (data,CY82_DATA_PORT ); +outb (CY82_INDEX_TIMEOUT ,CY82_INDEX_PORT ); +outb (data,CY82_DATA_PORT );#if CY82C693_DEBUG_INFO printk (KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n",
drivers/ide/pci/hpt366.c +1 -1
@@ -836,7 +836,7 @@ static int hpt374_ide_dma_test_irq(ide_dreturn 0 ; } - dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status);/* return 1 if INTR asserted */ if (dma_stat &4 )return 1 ;
drivers/ide/pci/ns87415.c +5 -5
@@ -166,10 +166,10 @@ static int ns87415_ide_dma_end (ide_driv/* get dma command mode */ dma_cmd = hwif->INB (hwif->dma_command);/* stop DMA */ - hwif->OUTB (dma_cmd & ~1 , hwif->dma_command); +outb (dma_cmd & ~1 , hwif->dma_command);/* from ERRATA: clear the INTR & ERROR bits */ dma_cmd = hwif->INB (hwif->dma_command); - hwif->OUTB (dma_cmd|6 , hwif->dma_command); +outb (dma_cmd |6 , hwif->dma_command);/* and free any DMA resources */ ide_destroy_dmatable (drive);/* verify good DMA status */
@@ -243,9 +243,9 @@ static void __devinit init_hwif_ns87415* to SELECT_DRIVE() properly during first probe_hwif(). */ timeout =10000 ; - hwif->OUTB (12 , hwif->io_ports[IDE_CONTROL_OFFSET ]); +outb (12 , hwif->io_ports[IDE_CONTROL_OFFSET ]);udelay (10 ); - hwif->OUTB (8 , hwif->io_ports[IDE_CONTROL_OFFSET ]); +outb (8 , hwif->io_ports[IDE_CONTROL_OFFSET ]); do { udelay(50); stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]);
@@ -263,7 +263,7 @@ static void __devinit init_hwif_ns87415if (!hwif->dma_base)return ; - hwif->OUTB (0x60 , hwif->dma_status); +outb (0x60 , hwif->dma_status); hwif->dma_setup = &ns87415_ide_dma_setup; hwif->ide_dma_check = &ns87415_ide_dma_check; hwif->ide_dma_end = &ns87415_ide_dma_end;
drivers/ide/pci/opti621.c +32 -31
105 lines not on this page · raw message
drivers/ide/pci/pdc202xx_new.c +4 -4
@@ -101,8 +101,8 @@ static u8 get_indexed_reg(ide_hwif_t *hw {u8 value; - hwif->OUTB (index, hwif->dma_vendor1); - value = hwif->INB (hwif->dma_vendor3); +outb (index, hwif->dma_vendor1); + value =inb (hwif->dma_vendor3);DBG ("index[%02X] value[%02X]\n" , index, value);return value;
@@ -115,8 +115,8 @@ static u8 get_indexed_reg(ide_hwif_t *hw*/ static void set_indexed_reg (ide_hwif_t *hwif,u8 index,u8 value) { - hwif->OUTB (index, hwif->dma_vendor1); - hwif->OUTB (value, hwif->dma_vendor3); +outb (index, hwif->dma_vendor1); +outb (value, hwif->dma_vendor3);DBG ("index[%02X] value[%02X]\n" , index, value); }
drivers/ide/pci/pdc202xx_old.c +20 -21
97 lines not on this page · raw message
drivers/ide/pci/serverworks.c +2 -2
@@ -160,7 +160,7 @@ static int svwks_tune_chipset (ide_driveif ((dev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB6IDE ) || (dev->device ==PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 )) {if (!drive->init_speed) { -u8 dma_stat = hwif->INB (hwif->dma_status); +u8 dma_stat =inb (hwif->dma_status); dma_pio: if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) &&
@@ -529,7 +529,7 @@ static void __devinit init_hwif_svwks (iif (!noautodma) hwif->autodma =1 ; - dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status); hwif->drives[0 ].autodma = (dma_stat &0x20 ); hwif->drives[1 ].autodma = (dma_stat &0x40 ); hwif->drives[0 ].autotune = (!(dma_stat &0x20 ));
drivers/ide/pci/sgiioc4.c +35 -32
190 lines not on this page · raw message
drivers/ide/pci/siimage.c +13 -11
@@ -461,11 +461,11 @@ static int siimage_mmio_ide_dma_test_irqunsigned long addr =siimage_selreg (hwif,0x1 );if (SATA_ERROR_REG ) { -u32 ext_stat = hwif->INL (base +0x10 ); +u32 ext_stat =readl ((void __iomem *)(base +0x10 ));u8 watchdog =0 ;if (ext_stat & ((hwif->channel) ?0x40 :0x10 )) { -u32 sata_error = hwif->INL (SATA_ERROR_REG ); - hwif->OUTL (sata_error,SATA_ERROR_REG ); +u32 sata_error =readl ((void __iomem *)SATA_ERROR_REG ); +writel (sata_error, (void __iomem *)SATA_ERROR_REG ); watchdog = (sata_error &0x00680000 ) ?1 :0 ; printk(KERN_WARNING "%s: sata_error = 0x%08x, " "watchdog = %d, %s\n",
@@ -482,11 +482,11 @@ static int siimage_mmio_ide_dma_test_irq }/* return 1 if INTR asserted */ -if ((hwif->INB (hwif->dma_status) &0x04 ) ==0x04 ) +if ((readb ((void __iomem *)hwif->dma_status) &0x04 ) ==0x04 )return 1 ;/* return 1 if Device INTR asserted */ -if ((hwif->INB (addr) &8 ) ==8 ) +if ((readb ((void __iomem *)addr) &8 ) ==8 )return 0 ;//return 1; return 0 ;
@@ -508,9 +508,9 @@ static int siimage_busproc (ide_drive_tu32 stat_config =0 ;unsigned long addr =siimage_selreg (hwif,0 ); -if (hwif->mmio) { - stat_config = hwif->INL (addr); - }else +if (hwif->mmio) + stat_config =readl ((void __iomem *)addr); +else pci_read_config_dword (hwif->pci_dev, addr, &stat_config);switch (state) {
@@ -546,9 +546,10 @@ static int siimage_reset_poll (ide_driveif (SATA_STATUS_REG ) {ide_hwif_t *hwif =HWIF (drive); -if ((hwif->INL (SATA_STATUS_REG ) &0x03 ) !=0x03 ) { +/* SATA_STATUS_REG is valid only when in MMIO mode */ +if ((readl ((void __iomem *)SATA_STATUS_REG ) &0x03 ) !=0x03 ) {printk (KERN_WARNING "%s: reset phy dead, status=0x%08x\n" , - hwif->name, hwif->INL (SATA_STATUS_REG )); + hwif->name,readl ((void __iomem *)SATA_STATUS_REG ));HWGROUP (drive)->polling =0 ;return ide_started; }
@@ -608,7 +609,8 @@ static void siimage_reset (ide_drive_t * }if (SATA_STATUS_REG ) { -u32 sata_stat = hwif->INL (SATA_STATUS_REG ); +/* SATA_STATUS_REG is valid only when in MMIO mode */ +u32 sata_stat =readl ((void __iomem *)SATA_STATUS_REG );printk (KERN_WARNING "%s: reset phy, status=0x%08x, %s\n" , hwif->name, sata_stat, __FUNCTION__);if (!(sata_stat)) {
drivers/ide/pci/sl82c105.c +3 -3
@@ -215,7 +215,7 @@ static int sl82c105_ide_dma_lost_irq(ide* Was DMA enabled? If so, disable it - we're resetting the * host. The IDE layer will be handling the drive for us. */ - val = hwif->INB (dma_base); + val =inb (dma_base);if (val &1 ) {outb (val & ~1 , dma_base);printk ("sl82c105: DMA was enabled\n" );
@@ -431,7 +431,7 @@ static void __devinit init_hwif_sl82c105if (!hwif->dma_base)return ; - dma_state = hwif->INB (hwif->dma_base +2 ) & ~0x60 ; + dma_state =inb (hwif->dma_base +2 ) & ~0x60 ; rev =sl82c105_bridge_revision (hwif->pci_dev);if (rev <=5 ) {/*
@@ -462,7 +462,7 @@ static void __devinit init_hwif_sl82c105if (hwif->mate) hwif->serialized = hwif->mate->serialized =1 ; } - hwif->OUTB (dma_state, hwif->dma_base +2 ); +outb (dma_state, hwif->dma_base +2 ); }static ide_pci_device_t sl82c105_chipset__devinitdata = {
drivers/ide/pci/tc86c001.c +13 -13
@@ -45,7 +45,7 @@ static int tc86c001_tune_chipset(ide_dri scr &= (speed <XFER_MW_DMA_0 ) ?0xf8ff :0xff0f ; scr |= mode; - hwif->OUTW (scr, scr_port); +outw (scr, scr_port);return ide_config_drive_speed (drive, speed); }
@@ -89,15 +89,15 @@ static int tc86c001_timer_expiry(ide_dri "attempting recovery...\n", drive->name);/* Stop DMA */ - hwif->OUTB (dma_cmd & ~0x01 , hwif->dma_command); +outb (dma_cmd & ~0x01 , hwif->dma_command);/* Setup the dummy DMA transfer */ - hwif->OUTW (0 , sc_base +0x0a );/* Sector Count */ - hwif->OUTW (0 , twcr_port);/* Transfer Word Count 1 or 2 */ +outw (0 , sc_base +0x0a );/* Sector Count */ +outw (0 , twcr_port);/* Transfer Word Count 1 or 2 */ /* Start the dummy DMA transfer */ - hwif->OUTB (0x00 , hwif->dma_command);/* clear R_OR_WCTR for write */ - hwif->OUTB (0x01 , hwif->dma_command);/* set START_STOPBM */ +outb (0x00 , hwif->dma_command);/* clear R_OR_WCTR for write */ +outb (0x01 , hwif->dma_command);/* set START_STOPBM */ /* * If an interrupt was pending, it should come thru shortly.
@@ -128,8 +128,8 @@ static void tc86c001_dma_start(ide_drive* the appropriate system control registers for DMA to work * with LBA48 and ATAPI devices... */ - hwif->OUTW (nsectors, sc_base +0x0a );/* Sector Count */ - hwif->OUTW (SECTOR_SIZE /2 , twcr_port);/* Transfer Word Count 1/2 */ +outw (nsectors, sc_base +0x0a );/* Sector Count */ +outw (SECTOR_SIZE /2 , twcr_port);/* Transfer Word Count 1/2 */ /* Install our timeout expiry hook, saving the current handler... */ ide_set_hwifdata (hwif, hwgroup->expiry);
@@ -168,7 +168,7 @@ static int tc86c001_busproc(ide_drive_t }/* System Control 1 Register bit 11 (ATA Hard Reset) write */ - hwif->OUTW (scr1, sc_base +0x00 ); +outw (scr1, sc_base +0x00 );return 0 ; }
@@ -204,13 +204,13 @@ static void __devinit init_hwif_tc86c001u16 scr1 = hwif->INW (sc_base +0x00 );;/* System Control 1 Register bit 15 (Soft Reset) set */ - hwif->OUTW (scr1 |0x8000 , sc_base +0x00 ); +outw (scr1 |0x8000 , sc_base +0x00 );/* System Control 1 Register bit 14 (FIFO Reset) set */ - hwif->OUTW (scr1 |0x4000 , sc_base +0x00 ); +outw (scr1 |0x4000 , sc_base +0x00 );/* System Control 1 Register: reset clear */ - hwif->OUTW (scr1 & ~0xc000 , sc_base +0x00 ); +outw (scr1 & ~0xc000 , sc_base +0x00 );/* Store the system control register base for convenience... */ hwif->config_data = sc_base;
@@ -228,7 +228,7 @@ static void __devinit init_hwif_tc86c001* Sector Count Control Register bits 0 and 1 set: * software sets Sector Count Register for master and slave device */ - hwif->OUTW (0x0003 , sc_base +0x0c ); +outw (0x0003 , sc_base +0x0c );/* Sector Count Register limit */ hwif->rqsize =0xffff ;
drivers/ide/pci/trm290.c +18 -20
@@ -157,16 +157,16 @@ static void trm290_prepare_drive (ide_drif (reg != hwif->select_data) { hwif->select_data = reg;/* set PIO/DMA */ - hwif->OUTB (0x51 |(hwif->channel<<3 ), hwif->config_data+1 ); - hwif->OUTW (reg &0xff , hwif->config_data); +outb (0x51 | (hwif->channel <<3 ), hwif->config_data +1 ); +outw (reg &0xff , hwif->config_data); }/* enable IRQ if not probing */ if (drive->present) { - reg = hwif->INW (hwif->config_data +3 ); + reg =inw (hwif->config_data +3 ); reg &=0x13 ; reg &= ~(1 << hwif->channel); - hwif->OUTW (reg, hwif->config_data+3 ); +outw (reg, hwif->config_data +3 ); }local_irq_restore (flags);
@@ -179,12 +179,10 @@ static void trm290_selectproc (ide_drivestatic void trm290_ide_dma_exec_cmd (ide_drive_t *drive,u8 command) { -ide_hwif_t *hwif =HWIF (drive); -BUG_ON (HWGROUP (drive)->handler !=NULL );/* paranoia check */ ide_set_handler (drive, &ide_dma_intr,WAIT_CMD ,NULL );/* issue cmd to drive */ - hwif->OUTB (command,IDE_COMMAND_REG ); +outb (command,IDE_COMMAND_REG ); }static int trm290_ide_dma_setup (ide_drive_t *drive)
@@ -210,10 +208,10 @@ static int trm290_ide_dma_setup(ide_driv }/* select DMA xfer */ trm290_prepare_drive (drive,1 ); - hwif->OUTL (hwif->dmatable_dma|rw, hwif->dma_command); +outl (hwif->dmatable_dma | rw, hwif->dma_command); drive->waiting_for_dma =1 ;/* start DMA */ - hwif->OUTW ((count *2 ) -1 , hwif->dma_status); +outw ((count *2 ) -1 , hwif->dma_status);return 0 ; }
@@ -229,7 +227,7 @@ static int trm290_ide_dma_end (ide_drive drive->waiting_for_dma =0 ;/* purge DMA mappings */ ide_destroy_dmatable (drive); - status = hwif->INW (hwif->dma_status); + status =inw (hwif->dma_status);return (status !=0x00ff ); }
@@ -238,7 +236,7 @@ static int trm290_ide_dma_test_irq (ide_ide_hwif_t *hwif =HWIF (drive);u16 status =0 ; - status = hwif->INW (hwif->dma_status); + status =inw (hwif->dma_status);return (status ==0x00ff ); }
@@ -267,15 +265,15 @@ static void __devinit init_hwif_trm290(ilocal_irq_save (flags);/* put config reg into first byte of hwif->select_data */ - hwif->OUTB (0x51 |(hwif->channel<<3 ), hwif->config_data+1 ); +outb (0x51 | (hwif->channel <<3 ), hwif->config_data +1 );/* select PIO as default */ hwif->select_data =0x21 ; - hwif->OUTB (hwif->select_data, hwif->config_data); +outb (hwif->select_data, hwif->config_data);/* get IRQ info */ - reg = hwif->INB (hwif->config_data+3 ); + reg =inb (hwif->config_data +3 );/* mask IRQs for both ports */ reg = (reg &0x10 ) |0x03 ; - hwif->OUTB (reg, hwif->config_data+3 ); +outb (reg, hwif->config_data +3 );local_irq_restore (flags);if ((reg &0x10 ))
@@ -308,16 +306,16 @@ static void __devinit init_hwif_trm290(istatic u16 next_offset =0 ;u8 old_mask; - hwif->OUTB (0x54 |(hwif->channel<<3 ), hwif->config_data+1 ); - old = hwif->INW (hwif->config_data); +outb (0x54 | (hwif->channel <<3 ), hwif->config_data +1 ); + old =inw (hwif->config_data); old &= ~1 ; - old_mask = hwif->INB (old+2 ); + old_mask =inb (old +2 );if (old != compat && old_mask ==0xff ) {/* leave lower 10 bits untouched */ compat += (next_offset +=0x400 ); hwif->io_ports[IDE_CONTROL_OFFSET ] = compat +2 ; - hwif->OUTW (compat|1 , hwif->config_data); - new = hwif->INW (hwif->config_data); +outw (compat |1 , hwif->config_data); + new =inw (hwif->config_data);printk (KERN_INFO "%s: control basereg workaround: " "old=0x%04x, new=0x%04x\n" , hwif->name, old, new & ~1 );
include/linux/ide.h +0 -2
@@ -734,13 +734,11 @@ typedef struct hwif_s {void (*OUTB )(u8 addr,unsigned long port);void (*OUTBSYNC )(ide_drive_t *drive,u8 addr,unsigned long port);void (*OUTW )(u16 addr,unsigned long port); -void (*OUTL )(u32 addr,unsigned long port);void (*OUTSW )(unsigned long port,void *addr,u32 count);void (*OUTSL )(unsigned long port,void *addr,u32 count);u8 (*INB )(unsigned long port);u16 (*INW )(unsigned long port); -u32 (*INL )(unsigned long port);void (*INSW )(unsigned long port,void *addr,u32 count);void (*INSL )(unsigned long port,void *addr,u32 count);
Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible
Quoted 10 lines · On Fri, 12 Jan 2007 05:28:07 +0100 Bartlomiej Zolnierkiewicz…
[PATCH] ide: use PIO/MMIO operations directly where possible
This results in smaller/faster/simpler code and allows future optimizations. Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
drivers/ide/ide-dma.c int ide_dma_setup(ide_drive_t *drive) · line 571
Quoted 8 lines
drivers/ide/ide-dma.c +4
-1@@ -565,7 +565,10 @@ int ide_dma_setup(ide_drive_t *drive) }/* PRD table */ - hwif->OUTL (hwif->dmatable_dma, hwif->dma_prdtable); +if (hwif->mmio ==2 ) +writel (hwif->dmatable_dma, (void __iomem *)hwif->dma_prdtable); +else +outl (hwif->dmatable_dma, hwif->dma_prdtable);
This should simply be if (hwif->mmio)
mmio = 1 is still used by some amiga and other oddments and indicates mmio in old form. I don't think this causes a bug as they don't use the DMA layer, but its a bug waiting to happen if the mmio==1 case doesn't get handled correctly or BUG()
Alan
Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible
Quoted 25 lines · Alan
Quoted 10 lines · On Fri, 12 Jan 2007 05:28:07 +0100 Bartlomiej Zolnierkiewicz…
[PATCH] ide: use PIO/MMIO operations directly where possible
This results in smaller/faster/simpler code and allows future optimizations. Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>drivers/ide/ide-dma.c int ide_dma_setup(ide_drive_t *drive) · line 571
Quoted 8 lines
drivers/ide/ide-dma.c +4
-1@@ -565,7 +565,10 @@ int ide_dma_setup(ide_drive_t *drive) }/* PRD table */ - hwif->OUTL (hwif->dmatable_dma, hwif->dma_prdtable); +if (hwif->mmio ==2 ) +writel (hwif->dmatable_dma, (void __iomem *)hwif->dma_prdtable); +else +outl (hwif->dmatable_dma, hwif->dma_prdtable);This should simply be if (
hwif->mmio)
Quoted 4 lines
mmio = 1 is still used by some amiga and other oddments and indicates mmio in old form. I don't think this causes a bug as they don't use the DMA layer, but its a bug waiting to happen if the mmio==1 case doesn't get handled correctly or
BUG()
mmio = 1 isn't used in the current IDE code and we have BUG_ON() for it in ide.c:ide_hwif_request_regions() so the above change is safe.
Anyway thanks for bringing mmio = 1 issue - it can be converted to flag now (will let us avoid similar confusions in the future).
Bart
Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible
In reply to Bartlomiej ZolnierkiewiczHello.
Quoted 12 lines · Bartlomiej Zolnierkiewicz
[PATCH] ide: use PIO/MMIO operations directly where possible
This results in smaller/faster/simpler code and allows future optimizations. Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Index:
a/drivers/ide/pci/hpt366.c
===================================================================
drivers/ide/pci/hpt366.c static int hpt374_ide_dma_test_irq(ide_d · line 842
Quoted 8 lines
drivers/ide/pci/hpt366.c +1
-1@@ -836,7 +836,7 @@ static int hpt374_ide_dma_test_irq(ide_dreturn 0 ; } - dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status);/* return 1 if INTR asserted */ if (dma_stat &4 )return 1 ;
Hmm... this driver *still* has a lot more indirect I/O accessors -- I
wonder why only this one had been converted then?
MBR, Sergei
Re: [PATCH 19/19] ide: use PIO/MMIO operations directly where possible
Hi Sergei,
Quoted 18 lines · Sergei Shtylyov
Hello.
Quoted 15 lines · Bartlomiej Zolnierkiewicz
[PATCH] ide: use PIO/MMIO operations directly where possible
This results in smaller/faster/simpler code and allows future optimizations. Also remove no longer needed ide[_mm]_{inl,outl}() and ide_hwif_t.{INL,OUTL}.
Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>Index:
a/drivers/ide/pci/hpt366.c
===================================================================drivers/ide/pci/hpt366.c +0
-0@@ -836,7 +836,7 @@ static int hpt374_ide_dma_test_irq(ide_dreturn 0 ; }
Quoted 8 lines
drivers/ide/pci/hpt366.c static int hpt374_ide_dma_test_irq(ide_d · line 842
Quoted 5 lines
drivers/ide/pci/hpt366.c +1
-1- dma_stat = hwif->INB (hwif->dma_status); + dma_stat =inb (hwif->dma_status);/* return 1 if INTR asserted */ if (dma_stat &4 )return 1 ;Hmm... this driver *still* has a lot more indirect I/O accessors -- I
wonder why only this one had been converted then?
The reason for this is that my patch was done before some of your patches for HPT IDE driver and I never really got to doing follow-up patch.
IIRC piix.c and and tc86c100.c may also want an update.
Thanks,
Bart