IDE updates part 1
Inside:
* Fix for IDE ACPI regression breaking suspend on some machines (kernel.org bug #12279).
* tx493[89]ide host drivers fixes (from Atsushi Nemoto).
* Locking sanitizations/improvements.
* Replacement of global ide_lock by per-hwgroup locks (based on previous patch from Ravikiran G Thirumalai).
* Misc fixes and housekeeping patches...
All patches have been in linux-next tree for few weeks now (except regression fix and tx493[89] fixes but they're all obviously correct).
Linus, please pull from:
master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/
to receive the following updates:
drivers/ide/Kconfig | 8 ++ drivers/ide/Makefile | 3 +- drivers/ide/cmd64x.c | 4 +- drivers/ide/cy82c693.c | 1 - drivers/ide/gayle.c | 6 +- drivers/ide/hpt366.c | 8 +- drivers/ide/ide-acpi.c | 4 +- drivers/ide/ide-cd.c | 142 ++++----------------- drivers/ide/ide-cd.h | 2 - drivers/ide/ide-dma-sff.c | 54 ++++----- drivers/ide/ide-io.c | 292 ++++++++------------------------------------ drivers/ide/ide-ioctls.c | 5 +- drivers/ide/ide-iops.c | 48 ++++---- drivers/ide/ide-legacy.c | 58 +++++++++ drivers/ide/ide-lib.c | 105 ++++++++-------- drivers/ide/ide-park.c | 16 ++-- drivers/ide/ide-pm.c | 235 +++++++++++++++++++++++++++++++++++ drivers/ide/ide-probe.c | 166 +++++-------------------- drivers/ide/ide-proc.c | 29 +---- drivers/ide/ide.c | 89 +------------- drivers/ide/pdc202xx_old.c | 9 +- drivers/ide/rz1000.c | 36 ++++-- drivers/ide/trm290.c | 4 +- drivers/ide/tx4938ide.c | 4 +- drivers/ide/tx4939ide.c | 10 ++- drivers/ide/umc8672.c | 11 +- drivers/scsi/ide-scsi.c | 32 +++-- include/linux/ide.h | 37 +++--- 28 files changed, 635 insertions(+), 783 deletions(-) create mode 100644 drivers/ide/ide-legacy.c create mode 100644 drivers/ide/ide-pm.c
Atsushi Nemoto (2):
tx4939ide: Do not use zero count PRD entry tx493[89]ide: Fix length for __ide_flush_dcache_range
Bartlomiej Zolnierkiewicz (30):
ide: fix IDE ACPI regression breaking suspend
ide: unify ide_intr()'s exit points
ide: IDE settings don't need an ide_lock held
ide: __ide_port_unregister_devices() doesn't need an ide_lock held
ide: ide_hwgroup_t.rq doesn't need an ide_lock held
ide: push ide_lock to __ide_end_request()
ide: ide_lock + __blk_end_request() -> blk_end_request()
ide: use queue lock instead of ide_lock when possible
ide: replace the global ide_lock spinlock by per-hwgroup spinlocks (v2)
ide: cleanup ide_do_request()
ide-cd: remove obsolete seek optimization
ali14xx: doesn't use shared IRQs
cmd64x: set IDE_HFLAG_SERIALIZE explictly for CMD646
gayle: set IDE_HFLAG_SERIALIZE explictly
ide: fix ->quirk_list checking in ide_do_request()
ide: always set nIEN on idle devices
rz1000: apply chipset quirks early (v2)
ide: add ->max_sectors field to struct ide_port_info
trm290: add IDE_HFLAG_TRM290 host flag
cy82c693: remove superfluous ide_cy82c693 chipset type
ide: rework handling of serialized ports (v2)
ide: remove redundant code from ide_end_drive_cmd()
ide: remove inline tags from ide-probe.c
ide: checkpatch.pl fixes for ide-lib.c
ide: use ATA_DMA_* defines in ide-dma-sff.c
ide: move Power Management support to ide-pm.c
ide: move legacy ISA/VLB ports handling to ide-legacy.c (v2)
ide: remove superfluous local_irq_{save,restore}() from ide_dump_status()
ide: push local_irq_{save,restore}() to do_identify()
ide-cd: remove dead dsc_overlap setting
Kay Sievers (1):
ide: struct device - replace bus_id with dev_name(), dev_set_name()
drivers/ide/Kconfig +8 -0
@@ -62,6 +62,9 @@ config IDE_TIMINGS config IDE_ATAPI bool +config IDE_LEGACY + bool + config BLK_DEV_IDE_SATA bool "Support for SATA (deprecated; conflicts with libata SATA driver)" default n
@@ -856,6 +859,7 @@ config BLK_DEV_4DRIVES config BLK_DEV_ALI14XX tristate "ALI M14xx support" select IDE_TIMINGS + select IDE_LEGACY help This driver is enabled at runtime using the "ali14xx.probe" kernel boot parameter. It enables support for the secondary IDE interface
@@ -866,6 +870,7 @@ config BLK_DEV_ALI14XX config BLK_DEV_DTC2278 tristate "DTC-2278 support" + select IDE_LEGACY help This driver is enabled at runtime using the "dtc2278.probe" kernel boot parameter. It enables support for the secondary IDE interface
@@ -876,6 +881,7 @@ config BLK_DEV_DTC2278 config BLK_DEV_HT6560B tristate "Holtek HT6560B support" select IDE_TIMINGS + select IDE_LEGACY help This driver is enabled at runtime using the "ht6560b.probe" kernel boot parameter. It enables support for the secondary IDE interface
@@ -886,6 +892,7 @@ config BLK_DEV_HT6560B config BLK_DEV_QD65XX tristate "QDI QD65xx support" select IDE_TIMINGS + select IDE_LEGACY help This driver is enabled at runtime using the "qd65xx.probe" kernel boot parameter. It permits faster I/O speeds to be set. See the
@@ -894,6 +901,7 @@ config BLK_DEV_QD65XX config BLK_DEV_UMC8672 tristate "UMC-8672 support" + select IDE_LEGACY help This driver is enabled at runtime using the "umc8672.probe" kernel boot parameter. It enables support for the secondary IDE interface
drivers/ide/Makefile +2 -1
@@ -5,7 +5,7 @@ EXTRA_CFLAGS += -Idrivers/ide ide-core-y += ide.o ide-ioctls.o ide-io.o ide-iops.o ide-lib.o ide-probe.o \ - ide-taskfile.o ide-park.o ide-pio-blacklist.o + ide-taskfile.o ide-pm.o ide-park.o ide-pio-blacklist.o # core IDE code ide-core-$(CONFIG_IDE_TIMINGS) += ide-timings.o
@@ -15,6 +15,7 @@ ide-core-$(CONFIG_BLK_DEV_IDEDMA) += ide-dma.o ide-core-$(CONFIG_BLK_DEV_IDEDMA_SFF) += ide-dma-sff.o ide-core-$(CONFIG_IDE_PROC_FS) += ide-proc.o ide-core-$(CONFIG_BLK_DEV_IDEACPI) += ide-acpi.o +ide-core-$(CONFIG_IDE_LEGACY) += ide-legacy.o obj-$(CONFIG_IDE) += ide-core.o
drivers/ide/cmd64x.c +2 -2
@@ -424,10 +424,10 @@ static const struct ide_port_info cmd64x_chipsets[] __devinitdata = { .name = DRV_NAME, .init_chipset = init_chipset_cmd64x, .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, - .chipset = ide_cmd646, .port_ops = &cmd64x_port_ops, .dma_ops = &cmd648_dma_ops, - .host_flags = IDE_HFLAG_ABUSE_PREFETCH, + .host_flags =IDE_HFLAG_SERIALIZE | + IDE_HFLAG_ABUSE_PREFETCH, .pio_mask = ATA_PIO5, .mwdma_mask = ATA_MWDMA2, .udma_mask = ATA_UDMA2,
drivers/ide/cy82c693.c +0 -1
@@ -292,7 +292,6 @@ static const struct ide_port_info cy82c693_chipset __devinitdata = { .name = DRV_NAME, .init_iops = init_iops_cy82c693, .port_ops = &cy82c693_port_ops, - .chipset = ide_cy82c693, .host_flags = IDE_HFLAG_SINGLE, .pio_mask = ATA_PIO4, .swdma_mask = ATA_SWDMA2,
drivers/ide/gayle.c +5 -1
@@ -117,6 +117,10 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, hw->chipset = ide_generic; } +static const struct ide_port_info gayle_port_info = { + .host_flags =IDE_HFLAG_SERIALIZE |IDE_HFLAG_NO_DMA , +}; +/* * Probe for a Gayle IDE interface (and optionally for an IDE doubler) */
@@ -178,7 +182,7 @@ found: hws[i] = &hw[i]; } - rc =ide_host_add (NULL , hws,NULL ); + rc =ide_host_add (&gayle_port_info, hws,NULL );if (rc)release_mem_region (res_start, res_n);
drivers/ide/hpt366.c +1 -7
@@ -135,7 +135,6 @@/* various tuning parameters */ #define HPT_RESET_STATE_ENGINE #undef HPT_DELAY_INTERRUPT -#define HPT_SERIALIZE_IO 0static const char *quirk_drives[] = {"QUANTUM FIREBALLlct08 08" ,
@@ -1288,7 +1287,6 @@ static u8 hpt3xx_cable_detect(ide_hwif_t *hwif)static void __devinit init_hwif_hpt366 (ide_hwif_t *hwif) {struct hpt_info *info =hpt3xx_get_info (hwif->dev); -int serialize =HPT_SERIALIZE_IO ;u8 chip_type = info->chip_type;/* Cache the channel's MISC. control registers' offset */
@@ -1305,13 +1303,9 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)* Clock is shared between the channels, * so we'll have to serialize them... :-( */ - serialize =1 ; + hwif->host->host_flags |=IDE_HFLAG_SERIALIZE ; hwif->rw_disk = &hpt3xxn_rw_disk; } - -/* Serialize access to this device if needed */ -if (serialize && hwif->mate) - hwif->serialized = hwif->mate->serialized =1 ; } static int __devinit init_dma_hpt366(ide_hwif_t *hwif,
drivers/ide/ide-acpi.c +2 -2
@@ -615,10 +615,10 @@ void ide_acpi_push_timing(ide_hwif_t *hwif) in_params[0 ].buffer.length =sizeof (struct GTM_buffer ); in_params[0 ].buffer.pointer = (u8 *)&hwif->acpidata->gtm; in_params[1 ].type =ACPI_TYPE_BUFFER ; - in_params[1 ].buffer.length =sizeof (ATA_ID_WORDS *2 ); + in_params[1 ].buffer.length =ATA_ID_WORDS *2 ; in_params[1 ].buffer.pointer = (u8 *)&master->idbuff; in_params[2 ].type =ACPI_TYPE_BUFFER ; - in_params[2 ].buffer.length =sizeof (ATA_ID_WORDS *2 ); + in_params[2 ].buffer.length =ATA_ID_WORDS *2 ; in_params[2 ].buffer.pointer = (u8 *)&slave->idbuff;/* Output buffer: _STM has no output */
drivers/ide/ide-cd.c +26 -116
244 lines not on this page · raw message
drivers/ide/ide-cd.h +0 -2
@@ -88,8 +88,6 @@ struct cdrom_info {struct request_sense sense_data;struct request request_sense_request; -unsigned long last_block; -unsigned long start_seek;u8 max_speed;/* Max speed of the drive. */ u8 current_speed;/* Current speed of the drive. */
drivers/ide/ide-dma-sff.c +24 -30
131 lines not on this page · raw message
drivers/ide/ide-io.c +53 -239
488 lines not on this page · raw message
drivers/ide/ide-ioctls.c +1 -4
@@ -19,7 +19,6 @@ int ide_setting_ioctl(ide_drive_t *drive, struct block_device *bdev, const struct ide_ioctl_devset *s) {const struct ide_devset *ds; -unsigned long flags;int err = -EOPNOTSUPP ;for (; (ds = s->setting); s++) {
@@ -33,9 +32,7 @@ int ide_setting_ioctl(ide_drive_t *drive, struct block_device *bdev, read_val:mutex_lock (&ide_setting_mtx); -spin_lock_irqsave (&ide_lock, flags); err = ds->get (drive); -spin_unlock_irqrestore (&ide_lock, flags);mutex_unlock (&ide_setting_mtx);return err >=0 ?put_user (err, (long __user *)arg) : err;
@@ -98,7 +95,7 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg)return -EPERM ;if (((arg >>IDE_NICE_DSC_OVERLAP ) &1 ) && - (drive->media == ide_disk || drive->media == ide_floppy || + (drive->media != ide_tape || (drive->dev_flags &IDE_DFLAG_SCSI )))return -EPERM ;
drivers/ide/ide-iops.c +23 -25
114 lines not on this page · raw message
drivers/ide/ide-legacy.c new file +58 -0
58 lines not on this page · raw message
drivers/ide/ide-lib.c +55 -50
203 lines not on this page · raw message
drivers/ide/ide-park.c +8 -8
@@ -7,17 +7,16 @@ DECLARE_WAIT_QUEUE_HEAD(ide_park_wq);static void issue_park_cmd (ide_drive_t *drive,unsigned long timeout) { +ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;struct request_queue *q = drive->queue;struct request *rq;int rc; timeout += jiffies; -spin_lock_irq (&ide_lock); +spin_lock_irq (&hwgroup->lock);if (drive->dev_flags &IDE_DFLAG_PARKED ) { -ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; -int reset_timer; +int reset_timer =time_before (timeout, drive->sleep); - reset_timer =time_before (timeout, drive->sleep); drive->sleep = timeout;wake_up_all (&ide_park_wq); if (reset_timer && hwgroup->sleeping &&
@@ -26,10 +25,10 @@ static void issue_park_cmd(ide_drive_t *drive, unsigned long timeout) hwgroup->busy =0 ;blk_start_queueing (q); } -spin_unlock_irq (&ide_lock); +spin_unlock_irq (&hwgroup->lock);return ; } -spin_unlock_irq (&ide_lock); +spin_unlock_irq (&hwgroup->lock); rq =blk_get_request (q,READ , __GFP_WAIT); rq->cmd[0 ] =REQ_PARK_HEADS ;
@@ -62,20 +61,21 @@ ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, char *buf) {ide_drive_t *drive =to_ide_device (dev); +ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;unsigned long now;unsigned int msecs;if (drive->dev_flags &IDE_DFLAG_NO_UNLOAD )return -EOPNOTSUPP ; -spin_lock_irq (&ide_lock); +spin_lock_irq (&hwgroup->lock); now = jiffies;if (drive->dev_flags &IDE_DFLAG_PARKED &&time_after (drive->sleep, now)) msecs =jiffies_to_msecs (drive->sleep - now);else msecs =0 ; -spin_unlock_irq (&ide_lock); +spin_unlock_irq (&hwgroup->lock);return snprintf (buf,20 ,"%u\n" , msecs); }
drivers/ide/ide-pm.c new file +235 -0
235 lines not on this page · raw message
drivers/ide/ide-probe.c +34 -132
311 lines not on this page · raw message
drivers/ide/ide-proc.c +4 -25
@@ -46,10 +46,6 @@ static int proc_ide_read_imodelcase ide_qd65xx: name ="qd65xx" ;break ;case ide_umc8672: name ="umc8672" ;break ;case ide_ht6560b: name ="ht6560b" ;break ; -case ide_rz1000: name ="rz1000" ;break ; -case ide_trm290: name ="trm290" ;break ; -case ide_cmd646: name ="cmd646" ;break ; -case ide_cy82c693: name ="cy82c693" ;break ;case ide_4drives: name ="4drives" ;break ;case ide_pmac: name ="mac-io" ;break ;case ide_au1xxx: name ="au1xxx" ;break ;
@@ -155,13 +151,8 @@ static int ide_read_setting(ide_drive_t *drive,const struct ide_devset *ds = setting->setting;int val = -EINVAL ; -if (ds->get) { -unsigned long flags; - -spin_lock_irqsave (&ide_lock, flags); +if (ds->get) val = ds->get (drive); -spin_unlock_irqrestore (&ide_lock, flags); - }return val; }
@@ -583,31 +574,19 @@ EXPORT_SYMBOL(ide_proc_register_driver);* Clean up the driver specific /proc files and IDE settings * for a given drive. * -* Takes ide_setting_mtx and ide_lock. -* Caller must hold none of the locks. +* Takes ide_setting_mtx. */ void ide_proc_unregister_driver (ide_drive_t *drive,ide_driver_t *driver) { -unsigned long flags; -ide_remove_proc_entries (drive->proc, driver->proc_entries (drive));mutex_lock (&ide_setting_mtx); -spin_lock_irqsave (&ide_lock, flags);/* -* ide_setting_mtx protects the settings list -* ide_lock protects the use of settings -* -* so we need to hold both, ide_settings_sem because we want to -* modify the settings list, and ide_lock because we cannot take -* a setting out that is being used. -* -* OTOH both ide_{read,write}_setting are only ever used under -* ide_setting_mtx. +* ide_setting_mtx protects both the settings list and the use +* of settings (we cannot take a setting out that is being used). */ drive->settings =NULL ; -spin_unlock_irqrestore (&ide_lock, flags);mutex_unlock (&ide_setting_mtx); }EXPORT_SYMBOL (ide_proc_unregister_driver);
drivers/ide/ide.c +3 -86
147 lines not on this page · raw message
drivers/ide/pdc202xx_old.c +5 -4
@@ -350,16 +350,17 @@ static const struct ide_dma_ops pdc2026x_dma_ops = { .dma_timeout = pdc202xx_dma_timeout, }; -#define DECLARE_PDC2026X_DEV (udma, extra_flags) \ +#define DECLARE_PDC2026X_DEV (udma, sectors) \ { \ .name = DRV_NAME, \ .init_chipset = init_chipset_pdc202xx, \ .port_ops = &pdc2026x_port_ops, \ .dma_ops = &pdc2026x_dma_ops, \ - .host_flags = IDE_HFLAGS_PDC202XX | extra_flags, \ + .host_flags = IDE_HFLAGS_PDC202XX, \ .pio_mask = ATA_PIO4, \ .mwdma_mask = ATA_MWDMA2, \ .udma_mask = udma, \ + .max_sectors = sectors, \ }static const struct ide_port_info pdc202xx_chipsets[]__devinitdata = {
@@ -376,8 +377,8 @@ static const struct ide_port_info pdc202xx_chipsets[] __devinitdata = {/* 1: PDC2026{2,3} */ DECLARE_PDC2026X_DEV (ATA_UDMA4 ,0 ), -/* 2: PDC2026{5,7} */ - DECLARE_PDC2026X_DEV(ATA_UDMA5, IDE_HFLAG_RQSIZE_256), +/* 2: PDC2026{5,7}: UDMA5, limit LBA48 requests to 256 sectors */ + DECLARE_PDC2026X_DEV(ATA_UDMA5, 256), };/**
drivers/ide/rz1000.c +25 -11
@@ -22,34 +22,48 @@#define DRV_NAME "rz1000" -static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif) +static int __devinit rz1000_disable_readahead (struct pci_dev *dev) { -struct pci_dev *dev =to_pci_dev (hwif->dev);u16 reg;if (!pci_read_config_word (dev,0x40 , ®) && !pci_write_config_word (dev,0x40 , reg &0xdfff )) {printk (KERN_INFO "%s: disabled chipset read-ahead " -"(buggy RZ1000/RZ1001)\n" , hwif->name); +"(buggy RZ1000/RZ1001)\n" ,pci_name (dev)); +return 0 ; }else { -if (hwif->mate) - hwif->mate->serialized = hwif->serialized =1 ; - hwif->host_flags |=IDE_HFLAG_NO_UNMASK_IRQS ;printk (KERN_INFO "%s: serialized, disabled unmasking " -"(buggy RZ1000/RZ1001)\n" , hwif->name); +"(buggy RZ1000/RZ1001)\n" ,pci_name (dev)); +return 1 ; } }static const struct ide_port_info rz1000_chipset__devinitdata = { .name =DRV_NAME , - .init_hwif = init_hwif_rz1000, - .chipset = ide_rz1000, .host_flags =IDE_HFLAG_NO_DMA , };static int __devinit rz1000_init_one (struct pci_dev *dev,const struct pci_device_id *id) { -return ide_pci_init_one (dev, &rz1000_chipset,NULL ); +struct ide_port_info d = rz1000_chipset; +int rc; + + rc =pci_enable_device (dev); +if (rc) +return rc; + +if (rz1000_disable_readahead (dev)) { + d.host_flags |=IDE_HFLAG_SERIALIZE ; + d.host_flags |=IDE_HFLAG_NO_UNMASK_IRQS ; + } + +return ide_pci_init_one (dev, &d,NULL ); +} + +static void rz1000_remove (struct pci_dev *dev) +{ +ide_pci_remove (dev); +pci_disable_device (dev); }static const struct pci_device_id rz1000_pci_tbl[] = {
@@ -63,7 +77,7 @@ static struct pci_driver rz1000_pci_driver = { .name = "RZ1000_IDE", .id_table = rz1000_pci_tbl, .probe = rz1000_init_one, - .remove = ide_pci_remove, + .remove = rz1000_remove, };static int __init rz1000_ide_init (void )
drivers/ide/trm290.c +2 -2
@@ -328,10 +328,10 @@ static struct ide_dma_ops trm290_dma_ops = {static const struct ide_port_info trm290_chipset__devinitdata = { .name =DRV_NAME , .init_hwif = init_hwif_trm290, - .chipset = ide_trm290, .port_ops = &trm290_port_ops, .dma_ops = &trm290_dma_ops, - .host_flags =IDE_HFLAG_NO_ATAPI_DMA | + .host_flags =IDE_HFLAG_TRM290 | +IDE_HFLAG_NO_ATAPI_DMA | #if 0 /* play it safe for now */ IDE_HFLAG_TRUST_BIOS_FOR_DMA | #endif
drivers/ide/tx4938ide.c +2 -2
@@ -181,7 +181,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq,while (count--) *ptr++ =cpu_to_le16 (__raw_readw ((void __iomem *)port)); -__ide_flush_dcache_range ((unsigned long )buf, count *2 ); +__ide_flush_dcache_range ((unsigned long )buf,roundup (len,2 )); } static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq,
@@ -195,7 +195,7 @@ static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq,__raw_writew (le16_to_cpu (*ptr), (void __iomem *)port); ptr++; } -__ide_flush_dcache_range ((unsigned long )buf, count *2 ); +__ide_flush_dcache_range ((unsigned long )buf,roundup (len,2 )); }static const struct ide_tp_ops tx4938ide_tp_ops = {
drivers/ide/tx4939ide.c +8 -2
@@ -259,6 +259,12 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) bcount =0x10000 - (cur_addr &0xffff );if (bcount > cur_len) bcount = cur_len; +/* +* This workaround for zero count seems required. +* (standard ide_build_dmatable do it too) +*/ +if ((bcount &0xffff ) ==0x0000 ) + bcount =0x8000 ; *table++ = bcount &0xffff ; *table++ = cur_addr; cur_addr += bcount;
@@ -558,7 +564,7 @@ static void tx4939ide_input_data_swap(ide_drive_t *drive, struct request *rq,while (count--) *ptr++ =cpu_to_le16 (__raw_readw ((void __iomem *)port)); -__ide_flush_dcache_range ((unsigned long )buf, count *2 ); +__ide_flush_dcache_range ((unsigned long )buf,roundup (len,2 )); } static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq,
@@ -572,7 +578,7 @@ static void tx4939ide_output_data_swap(ide_drive_t *drive, struct request *rq,__raw_writew (le16_to_cpu (*ptr), (void __iomem *)port); ptr++; } -__ide_flush_dcache_range ((unsigned long )buf, count *2 ); +__ide_flush_dcache_range ((unsigned long )buf,roundup (len,2 )); }static const struct ide_tp_ops tx4939ide_tp_ops = {
drivers/ide/umc8672.c +7 -4
@@ -107,18 +107,21 @@ static void umc_set_speeds(u8 speeds[])static void umc_set_pio_mode (ide_drive_t *drive,const u8 pio) {ide_hwif_t *hwif = drive->hwif; -unsigned long flags; +ide_hwgroup_t *mate_hwgroup = hwif->mate ? hwif->mate->hwgroup :NULL ; +unsigned long uninitialized_var (flags );printk ("%s: setting umc8672 to PIO mode%d (speed %d)\n" , drive->name, pio, pio_to_umc[pio]); -spin_lock_irqsave (&ide_lock, flags); -if (hwif->mate && hwif->mate->hwgroup->handler) { +if (mate_hwgroup) +spin_lock_irqsave (&mate_hwgroup->lock, flags); +if (mate_hwgroup && mate_hwgroup->handler) {printk (KERN_ERR "umc8672: other interface is busy: exiting tune_umc()\n" ); }else { current_speeds[drive->name[2 ] -'a' ] = pio_to_umc[pio];umc_set_speeds (current_speeds); } -spin_unlock_irqrestore (&ide_lock, flags); +if (mate_hwgroup) +spin_unlock_irqrestore (&mate_hwgroup->lock, flags); }static const struct ide_port_ops umc8672_port_ops = {
drivers/scsi/ide-scsi.c +21 -11
@@ -578,6 +578,8 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) {idescsi_scsi_t *scsi =scsihost_to_idescsi (cmd->device->host);ide_drive_t *drive = scsi->drive; +ide_hwif_t *hwif; +ide_hwgroup_t *hwgroup;int busy;int ret =FAILED ;
@@ -594,13 +596,16 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) goto no_drive; } -/* First give it some more time, how much is "right" is hard to say :-( */ + hwif = drive->hwif; + hwgroup = hwif->hwgroup; - busy =ide_wait_not_busy (HWIF (drive),100 );/* FIXME - uses mdelay which causes latency? */ +/* First give it some more time, how much is "right" is hard to say :-( +FIXME - uses mdelay which causes latency? */ + busy =ide_wait_not_busy (hwif,100 );if (test_bit (IDESCSI_LOG_CMD , &scsi->log))printk (KERN_WARNING "ide-scsi: drive did%s become ready\n" , busy?" not" :"" ); -spin_lock_irq (&ide_lock); +spin_lock_irq (&hwgroup->lock);/* If there is no pc running we're done (our interrupt took care of it) */ pc = drive->pc;
@@ -629,7 +634,7 @@ static int idescsi_eh_abort (struct scsi_cmnd *cmd) } ide_unlock: -spin_unlock_irq (&ide_lock); +spin_unlock_irq (&hwgroup->lock); no_drive:if (test_bit (IDESCSI_LOG_CMD , &scsi->log))printk (KERN_WARNING "ide-scsi: abort returns %s\n" , ret ==SUCCESS ?"success" :"failed" );
@@ -642,6 +647,7 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd)struct request *req;idescsi_scsi_t *scsi =scsihost_to_idescsi (cmd->device->host);ide_drive_t *drive = scsi->drive; +ide_hwgroup_t *hwgroup;int ready =0 ;int ret =SUCCESS ;
@@ -658,14 +664,18 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd)return FAILED ; } + hwgroup = drive->hwif->hwgroup; +spin_lock_irq (cmd->device->host->host_lock); -spin_lock (&ide_lock); +spin_lock (&hwgroup->lock); pc = drive->pc; +if (pc) + req = pc->rq; -if (pc ==NULL || (req = pc->rq) !=HWGROUP (drive)->rq || !HWGROUP (drive)->handler) { +if (pc ==NULL || req != hwgroup->rq || hwgroup->handler ==NULL ) {printk (KERN_WARNING "ide-scsi: No active request in idescsi_eh_reset\n" ); -spin_unlock (&ide_lock); +spin_unlock (&hwgroup->lock);spin_unlock_irq (cmd->device->host->host_lock);return FAILED ; }
@@ -685,10 +695,10 @@ static int idescsi_eh_reset (struct scsi_cmnd *cmd)BUG (); } -HWGROUP (drive)->rq =NULL ; -HWGROUP (drive)->handler =NULL ; -HWGROUP (drive)->busy =1 ;/* will set this to zero when ide reset finished */ -spin_unlock (&ide_lock); + hwgroup->rq =NULL ; + hwgroup->handler =NULL ; + hwgroup->busy =1 ;/* will set this to zero when ide reset finished */ +spin_unlock (&hwgroup->lock);ide_do_reset (drive);
include/linux/ide.h +21 -16
@@ -122,8 +122,6 @@ struct ide_io_ports {#define MAX_DRIVES 2/* per interface; 2 assumed by lots of code */ #define SECTOR_SIZE 512 -#define IDE_LARGE_SEEK (b1,b2,t) (((b1) > (b2) + (t)) || ((b2) > (b1) + (t))) -/* * Timeouts for various operations: */
@@ -172,9 +170,7 @@ typedef int (ide_ack_intr_t)(struct hwif_s *);enum { ide_unknown, ide_generic, ide_pci, ide_cmd640, ide_dtc2278, ide_ali14xx, ide_qd65xx, ide_umc8672, ide_ht6560b, - ide_rz1000, ide_trm290, - ide_cmd646, ide_cy82c693, ide_4drives, - ide_pmac, ide_acorn, + ide_4drives, ide_pmac, ide_acorn, ide_au1xxx, ide_palm3710 };
@@ -496,8 +492,6 @@ enum {* when more than one interrupt is needed. */ IDE_AFLAG_LIMIT_NFRAMES = (1 <<7 ), -/* Seeking in progress. */ -IDE_AFLAG_SEEKING = (1 <<8 ),/* Saved TOC information is current. */ IDE_AFLAG_TOC_VALID = (1 << 9),/* We think that the drive door is locked. */
@@ -845,8 +839,6 @@ typedef struct hwif_s {unsigned extra_ports;/* number of extra dma ports */ unsigned present : 1; /* this interface exists */ - unsigned serialized : 1; /* serialized all channel operation */ - unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */ unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */struct device gendev;
@@ -909,6 +901,8 @@ typedef struct hwgroup_s {int req_gen;int req_gen_timer; + +spinlock_t lock; } ide_hwgroup_t;typedef struct ide_driver_s ide_driver_t ;
@@ -1122,6 +1116,14 @@ enum { IDE_PM_COMPLETED, }; +int generic_ide_suspend (struct device *,pm_message_t ); +int generic_ide_resume (struct device *); + +void ide_complete_power_step (ide_drive_t *,struct request *); +ide_startstop_t ide_start_power_step (ide_drive_t *,struct request *); +void ide_complete_pm_request (ide_drive_t *,struct request *); +void ide_check_pm_state (ide_drive_t *,struct request *); +/* * Subdrivers support. *
@@ -1376,8 +1378,8 @@ enum {IDE_HFLAG_LEGACY_IRQS = (1 <<21 ),/* force use of legacy IRQs */ IDE_HFLAG_FORCE_LEGACY_IRQS = (1 <<22 ), -/* limit LBA48 requests to 256 sectors */ -IDE_HFLAG_RQSIZE_256 = (1 <<23 ), +/* host is TRM290 */ +IDE_HFLAG_TRM290 = (1 <<23 ),/* use 32-bit I/O ops */ IDE_HFLAG_IO_32BIT = (1 << 24),/* unmask IRQs */
@@ -1415,6 +1417,9 @@ struct ide_port_info {ide_pci_enablebit_t enablebits[2 ];hwif_chipset_t chipset; + +u16 max_sectors;/* if < than the default one */ +u32 host_flags;u8 pio_mask;u8 swdma_mask;
@@ -1610,13 +1615,13 @@ extern struct mutex ide_cfg_mtx;/* * Structure locking: * -* ide_cfg_mtx and ide_lock together protect changes to -* ide_hwif_t->{next,hwgroup} +* ide_cfg_mtx and hwgroup->lock together protect changes to +* ide_hwif_t->next * ide_drive_t->next * -* ide_hwgroup_t->busy: ide_lock -* ide_hwgroup_t->hwif: ide_lock -* ide_hwif_t->mate: constant, no locking +* ide_hwgroup_t->busy: hwgroup->lock +* ide_hwgroup_t->hwif: hwgroup->lock +* ide_hwif_t->{hwgroup,mate}: constant, no locking * ide_drive_t->hwif: constant, no locking */