From 33050ec7a2b83bc048b2322c79af25df6fdcb879 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:17 +0100 Subject: icside: use struct ide_port_info also for PCB version 5 (v2) This fixes hwif->channel and drive->dn assignments. v2: Fix v5/v6 mismatch noticed by Russell. Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/icside.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 415d7e24f2b..0cf47e6e979 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -419,6 +419,10 @@ static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, hw->chipset = ide_acorn; } +static const struct ide_port_info icside_v5_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + static int __devinit icside_register_v5(struct icside_state *state, struct expansion_card *ec) { @@ -445,7 +449,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); - host = ide_host_alloc(NULL, hws); + host = ide_host_alloc(&icside_v5_port_info, hws); if (host == NULL) return -ENODEV; @@ -453,7 +457,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) ecard_set_drvdata(ec, state); - ret = ide_host_register(host, NULL, hws); + ret = ide_host_register(host, &icside_v5_port_info, hws); if (ret) goto err_free; -- cgit v1.2.3 From 9804657ec488380637226d08c808b29ede566908 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:17 +0100 Subject: ide_arm: use struct ide_port_info This fixes hwif->channel and drive->dn assignments. Cc: Russell King Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide_arm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide_arm.c b/drivers/ide/ide_arm.c index bdcac94d7c1..cf6385446ec 100644 --- a/drivers/ide/ide_arm.c +++ b/drivers/ide/ide_arm.c @@ -18,6 +18,10 @@ #define IDE_ARM_IO 0x1f0 #define IDE_ARM_IRQ IRQ_HARDDISK +static const struct ide_port_info ide_arm_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + static int __init ide_arm_init(void) { unsigned long base = IDE_ARM_IO, ctl = IDE_ARM_IO + 0x206; @@ -41,7 +45,7 @@ static int __init ide_arm_init(void) hw.irq = IDE_ARM_IRQ; hw.chipset = ide_generic; - return ide_host_add(NULL, hws, NULL); + return ide_host_add(&ide_arm_port_info, hws, NULL); } module_init(ide_arm_init); -- cgit v1.2.3 From e518e58779d946f01bf93428be8791d5f07b4984 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:17 +0100 Subject: ide-generic: use struct ide_port_info This fixes hwif->channel and drive->dn assignments. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-generic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 81a5282ce1e..9d03e821153 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c @@ -32,6 +32,10 @@ static int probe_mask; module_param(probe_mask, int, 0); MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports"); +static const struct ide_port_info ide_generic_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + static ssize_t store_add(struct class *cls, const char *buf, size_t n) { unsigned int base, ctl; @@ -46,7 +50,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n) hw.irq = irq; hw.chipset = ide_generic; - rc = ide_host_add(NULL, hws, NULL); + rc = ide_host_add(&ide_generic_port_info, hws, NULL); if (rc) return rc; @@ -184,7 +188,7 @@ static int __init ide_generic_init(void) #endif hw.chipset = ide_generic; - rc = ide_host_add(NULL, hws, NULL); + rc = ide_host_add(&ide_generic_port_info, hws, NULL); if (rc) { release_region(io_addr + 0x206, 1); release_region(io_addr, 8); -- cgit v1.2.3 From ee1464a4e8883304d6408ddceb4e966068afa2be Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:18 +0100 Subject: ide-pnp: use struct ide_port_info This fixes hwif->channel and drive->dn assignments. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-pnp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide-pnp.c b/drivers/ide/ide-pnp.c index bac9b392b68..6e80b774e88 100644 --- a/drivers/ide/ide-pnp.c +++ b/drivers/ide/ide-pnp.c @@ -27,6 +27,10 @@ static struct pnp_device_id idepnp_devices[] = { {.id = ""} }; +static const struct ide_port_info ide_pnp_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) { struct ide_host *host; @@ -60,7 +64,7 @@ static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) hw.irq = pnp_irq(dev, 0); hw.chipset = ide_generic; - rc = ide_host_add(NULL, hws, &host); + rc = ide_host_add(&ide_pnp_port_info, hws, &host); if (rc) goto out; -- cgit v1.2.3 From 0e78a54fbd574be9da7a49190f7927a656a936c0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:18 +0100 Subject: buddha: use struct ide_port_info This fixes hwif->channel and drive->dn assignments. Cc: Geert Uytterhoeven Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/buddha.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index c5a3c9ef6a5..c0fa76148d4 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c @@ -143,6 +143,10 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, hw->chipset = ide_generic; } +static const struct ide_port_info buddha_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + /* * Probe for a Buddha or Catweasel IDE interface */ @@ -224,7 +228,7 @@ fail_base2: hws[i] = &hw[i]; } - ide_host_add(NULL, hws, NULL); + ide_host_add(&buddha_port_info, hws, NULL); } return 0; -- cgit v1.2.3 From 211176ccebd2fac1af198eb14308f6cbd7d844e1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:18 +0100 Subject: macide: use struct ide_port_info This fixes hwif->channel and drive->dn assignments. Cc: Geert Uytterhoeven Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/macide.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c index 3c60064f1d4..e9f965e795f 100644 --- a/drivers/ide/macide.c +++ b/drivers/ide/macide.c @@ -80,6 +80,10 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base, hw->chipset = ide_generic; } +static const struct ide_port_info macide_port_info = { + .host_flags = IDE_HFLAG_NO_DMA, +}; + static const char *mac_ide_name[] = { "Quadra", "Powerbook", "Powerbook Baboon" }; @@ -122,7 +126,7 @@ static int __init macide_init(void) macide_setup_ports(&hw, base, irq, ack_intr); - return ide_host_add(NULL, hws, NULL); + return ide_host_add(&macide_port_info, hws, NULL); } module_init(macide_init); -- cgit v1.2.3 From 70775e9c627d7094189b96d73fffced6dab30b30 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:18 +0100 Subject: ide: move ->rqsize init from init_irq() to ide_init_port() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 974067043fb..b0510b033d7 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -861,14 +861,6 @@ static int init_irq (ide_hwif_t *hwif) if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif)) goto out_up; - if (!hwif->rqsize) { - if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || - (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) - hwif->rqsize = 256; - else - hwif->rqsize = 65536; - } - #if !defined(__mc68000__) printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, io_ports->data_addr, io_ports->status_addr, @@ -1114,6 +1106,13 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, if (d->max_sectors) hwif->rqsize = d->max_sectors; + else { + if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) || + (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA)) + hwif->rqsize = 256; + else + hwif->rqsize = 65536; + } /* call chipset specific routine for each enabled port */ if (d->init_hwif) -- cgit v1.2.3 From 088b1b88609ce89b6ab19d114cdbec94a44aa22c Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Fri, 2 Jan 2009 13:34:47 +0100 Subject: ide: improve debugging scheme and more specifically, push __func__ into debug macro thus making ide_debug_log() calls shorter and more readable. Signed-off-by: Borislav Petkov --- drivers/ide/ide-cd.c | 124 ++++++++++++++++++++++------------------------- drivers/ide/ide-cd.h | 2 +- drivers/ide/ide-floppy.c | 35 ++++++------- drivers/ide/ide-gd.c | 4 +- drivers/ide/ide-gd.h | 2 +- 5 files changed, 78 insertions(+), 89 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 2177cd11664..d163e6571e0 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -100,8 +100,7 @@ static int cdrom_log_sense(ide_drive_t *drive, struct request *rq, { int log = 0; - ide_debug_log(IDE_DBG_SENSE, "Call %s, sense_key: 0x%x\n", __func__, - sense->sense_key); + ide_debug_log(IDE_DBG_SENSE, "sense_key: 0x%x", sense->sense_key); if (!sense || !rq || (rq->cmd_flags & REQ_QUIET)) return 0; @@ -151,13 +150,12 @@ static void cdrom_analyze_sense_data(ide_drive_t *drive, unsigned long bio_sectors; struct cdrom_info *info = drive->driver_data; - ide_debug_log(IDE_DBG_SENSE, "Call %s, error_code: 0x%x, " - "sense_key: 0x%x\n", __func__, sense->error_code, - sense->sense_key); + ide_debug_log(IDE_DBG_SENSE, "error_code: 0x%x, sense_key: 0x%x", + sense->error_code, sense->sense_key); if (failed_command) - ide_debug_log(IDE_DBG_SENSE, "%s: failed cmd: 0x%x\n", - __func__, failed_command->cmd[0]); + ide_debug_log(IDE_DBG_SENSE, "failed cmd: 0x%x", + failed_command->cmd[0]); if (!cdrom_log_sense(drive, failed_command, sense)) return; @@ -217,7 +215,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, struct cdrom_info *info = drive->driver_data; struct request *rq = &info->request_sense_request; - ide_debug_log(IDE_DBG_SENSE, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_SENSE, "enter"); if (sense == NULL) sense = &info->sense_data; @@ -239,8 +237,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, rq->buffer = (void *) failed_command; if (failed_command) - ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x\n", - failed_command->cmd[0]); + ide_debug_log(IDE_DBG_SENSE, "failed_cmd: 0x%x", + failed_command->cmd[0]); drive->hwif->rq = NULL; @@ -252,9 +250,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) struct request *rq = drive->hwif->rq; int nsectors = rq->hard_cur_sectors; - ide_debug_log(IDE_DBG_FUNC, "Call %s, cmd: 0x%x, uptodate: 0x%x, " - "nsectors: %d\n", __func__, rq->cmd[0], uptodate, - nsectors); + ide_debug_log(IDE_DBG_FUNC, "cmd: 0x%x, uptodate: 0x%x, nsectors: %d", + rq->cmd[0], uptodate, nsectors); if (blk_sense_request(rq) && uptodate) { /* @@ -295,8 +292,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) if (!nsectors) nsectors = 1; - ide_debug_log(IDE_DBG_FUNC, "Exit %s, uptodate: 0x%x, nsectors: %d\n", - __func__, uptodate, nsectors); + ide_debug_log(IDE_DBG_FUNC, "uptodate: 0x%x, nsectors: %d", + uptodate, nsectors); ide_end_request(drive, uptodate, nsectors); } @@ -338,9 +335,10 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) return 1; } - ide_debug_log(IDE_DBG_RQ, "%s: stat: 0x%x, good_stat: 0x%x, " - "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x, err: 0x%x\n", - __func__, stat, good_stat, rq->cmd[0], rq->cmd_type, err); + ide_debug_log(IDE_DBG_RQ, "stat: 0x%x, good_stat: 0x%x, cmd[0]: 0x%x, " + "rq->cmd_type: 0x%x, err: 0x%x", + stat, good_stat, rq->cmd[0], rq->cmd_type, + err); if (blk_sense_request(rq)) { /* @@ -530,8 +528,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, { ide_hwif_t *hwif = drive->hwif; - ide_debug_log(IDE_DBG_FUNC, "Call %s, ireason: 0x%x, rw: 0x%x\n", - __func__, ireason, rw); + ide_debug_log(IDE_DBG_FUNC, "ireason: 0x%x, rw: 0x%x", ireason, rw); /* * ireason == 0: the drive wants to receive data from us @@ -572,7 +569,7 @@ static int ide_cd_check_ireason(ide_drive_t *drive, struct request *rq, */ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) { - ide_debug_log(IDE_DBG_FUNC, "Call %s, len: %d\n", __func__, len); + ide_debug_log(IDE_DBG_FUNC, "len: %d", len); if ((len % SECTOR_SIZE) == 0) return 0; @@ -594,8 +591,7 @@ static int ide_cd_check_transfer_size(ide_drive_t *drive, int len) static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, struct request *rq) { - ide_debug_log(IDE_DBG_RQ, "Call %s: rq->cmd_flags: 0x%x\n", __func__, - rq->cmd_flags); + ide_debug_log(IDE_DBG_RQ, "rq->cmd_flags: 0x%x", rq->cmd_flags); if (rq_data_dir(rq) == READ) { unsigned short sectors_per_frame = @@ -639,7 +635,7 @@ static ide_startstop_t ide_cd_prepare_rw_request(ide_drive_t *drive, static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq) { - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if (rq->buffer != bio_data(rq->bio)) { sector_t n = @@ -658,8 +654,7 @@ static void ide_cd_restore_request(ide_drive_t *drive, struct request *rq) static void ide_cd_request_sense_fixup(ide_drive_t *drive, struct request *rq) { - ide_debug_log(IDE_DBG_FUNC, "Call %s, rq->cmd[0]: 0x%x\n", - __func__, rq->cmd[0]); + ide_debug_log(IDE_DBG_FUNC, "rq->cmd[0]: 0x%x", rq->cmd[0]); /* * Some of the trailing request sense fields are optional, @@ -686,9 +681,9 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd, if (!sense) sense = &local_sense; - ide_debug_log(IDE_DBG_PC, "Call %s, cmd[0]: 0x%x, write: 0x%x, " - "timeout: %d, cmd_flags: 0x%x\n", __func__, cmd[0], write, - timeout, cmd_flags); + ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x, timeout: %d, " + "cmd_flags: 0x%x", + cmd[0], write, timeout, cmd_flags); /* start of retry loop */ do { @@ -772,8 +767,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) u16 len; u8 ireason; - ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x\n", - __func__, rq->cmd[0], write); + ide_debug_log(IDE_DBG_PC, "cmd[0]: 0x%x, write: 0x%x", + rq->cmd[0], write); /* check for errors */ dma = drive->dma; @@ -810,8 +805,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) if (thislen > len) thislen = len; - ide_debug_log(IDE_DBG_PC, "%s: DRQ: stat: 0x%x, thislen: %d\n", - __func__, stat, thislen); + ide_debug_log(IDE_DBG_PC, "DRQ: stat: 0x%x, thislen: %d", + stat, thislen); /* If DRQ is clear, the command has completed. */ if ((stat & ATA_DRQ) == 0) { @@ -876,8 +871,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) xferfunc = hwif->tp_ops->input_data; } - ide_debug_log(IDE_DBG_PC, "%s: data transfer, rq->cmd_type: 0x%x, " - "ireason: 0x%x\n", __func__, rq->cmd_type, ireason); + ide_debug_log(IDE_DBG_PC, "data transfer, rq->cmd_type: 0x%x, " + "ireason: 0x%x", + rq->cmd_type, ireason); /* transfer data */ while (thislen > 0) { @@ -988,9 +984,9 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) unsigned short sectors_per_frame = queue_hardsect_size(drive->queue) >> SECTOR_BITS; - ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, write: 0x%x, " - "secs_per_frame: %u\n", - __func__, rq->cmd[0], write, sectors_per_frame); + ide_debug_log(IDE_DBG_RQ, "rq->cmd[0]: 0x%x, write: 0x%x, " + "secs_per_frame: %u", + rq->cmd[0], write, sectors_per_frame); if (write) { /* disk has become write protected */ @@ -1026,9 +1022,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq) static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) { - ide_debug_log(IDE_DBG_PC, "Call %s, rq->cmd[0]: 0x%x, " - "rq->cmd_type: 0x%x\n", __func__, rq->cmd[0], - rq->cmd_type); + ide_debug_log(IDE_DBG_PC, "rq->cmd[0]: 0x%x, rq->cmd_type: 0x%x", + rq->cmd[0], rq->cmd_type); if (blk_pc_request(rq)) rq->cmd_flags |= REQ_QUIET; @@ -1067,10 +1062,11 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, sector_t block) { - ide_debug_log(IDE_DBG_RQ, "Call %s, rq->cmd[0]: 0x%x, " - "rq->cmd_type: 0x%x, block: %llu\n", - __func__, rq->cmd[0], rq->cmd_type, - (unsigned long long)block); + ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", + rq->cmd[0], (unsigned long long)block); + + if (drive->debug_mask & IDE_DBG_RQ) + blk_dump_rq_flags(rq, "ide_cd_do_request"); if (blk_fs_request(rq)) { if (cdrom_start_rw(drive, rq) == ide_stopped) @@ -1119,7 +1115,7 @@ int cdrom_check_status(ide_drive_t *drive, struct request_sense *sense) struct cdrom_device_info *cdi = &info->devinfo; unsigned char cmd[BLK_MAX_CDB]; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); memset(cmd, 0, BLK_MAX_CDB); cmd[0] = GPCMD_TEST_UNIT_READY; @@ -1147,7 +1143,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, unsigned len = sizeof(capbuf); u32 blocklen; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); memset(cmd, 0, BLK_MAX_CDB); cmd[0] = GPCMD_READ_CDVD_CAPACITY; @@ -1179,8 +1175,8 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, *capacity = 1 + be32_to_cpu(capbuf.lba); *sectors_per_frame = blocklen >> SECTOR_BITS; - ide_debug_log(IDE_DBG_PROBE, "%s: cap: %lu, sectors_per_frame: %lu\n", - __func__, *capacity, *sectors_per_frame); + ide_debug_log(IDE_DBG_PROBE, "cap: %lu, sectors_per_frame: %lu", + *capacity, *sectors_per_frame); return 0; } @@ -1191,7 +1187,7 @@ static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag, { unsigned char cmd[BLK_MAX_CDB]; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); memset(cmd, 0, BLK_MAX_CDB); @@ -1221,7 +1217,7 @@ int ide_cd_read_toc(ide_drive_t *drive, struct request_sense *sense) long last_written; unsigned long sectors_per_frame = SECTORS_PER_FRAME; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if (toc == NULL) { /* try to allocate space */ @@ -1383,7 +1379,7 @@ int ide_cdrom_get_capabilities(ide_drive_t *drive, u8 *buf) struct packet_command cgc; int stat, attempts = 3, size = ATAPI_CAPABILITIES_PAGE_SIZE; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if ((drive->atapi_flags & IDE_AFLAG_FULL_CAPS_PAGE) == 0) size -= ATAPI_CAPABILITIES_PAGE_PAD_SIZE; @@ -1403,7 +1399,7 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) struct cdrom_info *cd = drive->driver_data; u16 curspeed, maxspeed; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if (drive->atapi_flags & IDE_AFLAG_LE_SPEED_FIELDS) { curspeed = le16_to_cpup((__le16 *)&buf[8 + 14]); @@ -1413,8 +1409,8 @@ void ide_cdrom_update_speed(ide_drive_t *drive, u8 *buf) maxspeed = be16_to_cpup((__be16 *)&buf[8 + 8]); } - ide_debug_log(IDE_DBG_PROBE, "%s: curspeed: %u, maxspeed: %u\n", - __func__, curspeed, maxspeed); + ide_debug_log(IDE_DBG_PROBE, "curspeed: %u, maxspeed: %u", + curspeed, maxspeed); cd->current_speed = (curspeed + (176/2)) / 176; cd->max_speed = (maxspeed + (176/2)) / 176; @@ -1448,7 +1444,7 @@ static int ide_cdrom_register(ide_drive_t *drive, int nslots) struct cdrom_info *info = drive->driver_data; struct cdrom_device_info *devinfo = &info->devinfo; - ide_debug_log(IDE_DBG_PROBE, "Call %s, nslots: %d\n", __func__, nslots); + ide_debug_log(IDE_DBG_PROBE, "nslots: %d", nslots); devinfo->ops = &ide_cdrom_dops; devinfo->speed = info->current_speed; @@ -1471,9 +1467,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) mechtype_t mechtype; int nslots = 1; - ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->media: 0x%x, " - "drive->atapi_flags: 0x%lx\n", __func__, drive->media, - drive->atapi_flags); + ide_debug_log(IDE_DBG_PROBE, "media: 0x%x, atapi_flags: 0x%lx", + drive->media, drive->atapi_flags); cdi->mask = (CDC_CD_R | CDC_CD_RW | CDC_DVD | CDC_DVD_R | CDC_DVD_RAM | CDC_SELECT_DISC | CDC_PLAY_AUDIO | @@ -1754,7 +1749,7 @@ static int ide_cdrom_setup(ide_drive_t *drive) char *fw_rev = (char *)&id[ATA_ID_FW_REV]; int nslots; - ide_debug_log(IDE_DBG_PROBE, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_PROBE, "enter"); blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn); blk_queue_dma_alignment(drive->queue, 31); @@ -1797,7 +1792,7 @@ static void ide_cd_remove(ide_drive_t *drive) { struct cdrom_info *info = drive->driver_data; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); ide_proc_unregister_driver(drive, info->driver); device_del(&info->dev); @@ -1815,7 +1810,7 @@ static void ide_cd_release(struct device *dev) ide_drive_t *drive = info->drive; struct gendisk *g = info->disk; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); kfree(info->toc); if (devinfo->handle == drive) @@ -1974,9 +1969,8 @@ static int ide_cd_probe(ide_drive_t *drive) struct gendisk *g; struct request_sense sense; - ide_debug_log(IDE_DBG_PROBE, "Call %s, drive->driver_req: %s, " - "drive->media: 0x%x\n", __func__, drive->driver_req, - drive->media); + ide_debug_log(IDE_DBG_PROBE, "driver_req: %s, media: 0x%x", + drive->driver_req, drive->media); if (!strstr("ide-cdrom", drive->driver_req)) goto failed; diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index c878bfcf111..3b77dd73508 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -11,7 +11,7 @@ #define IDECD_DEBUG_LOG 0 #if IDECD_DEBUG_LOG -#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args) +#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) #else #define ide_debug_log(lvl, fmt, args...) do {} while (0) #endif diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 317ec62c33d..d1a79e8e0d6 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -74,7 +74,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) struct request *rq = drive->hwif->rq; int error; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); switch (uptodate) { case 0: @@ -121,7 +121,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) struct ide_atapi_pc *pc = drive->pc; int uptodate = pc->error ? 0 : 1; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if (floppy->failed_pc == pc) floppy->failed_pc = NULL; @@ -140,11 +140,11 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; if (floppy->failed_pc) - ide_debug_log(IDE_DBG_PC, "pc = %x, ", + ide_debug_log(IDE_DBG_PC, "pc = %x", floppy->failed_pc->c[0]); ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x," - "ascq = %x\n", floppy->sense_key, + "ascq = %x", floppy->sense_key, floppy->asc, floppy->ascq); } else printk(KERN_ERR PFX "Error in REQUEST SENSE itself - " @@ -193,7 +193,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, return ide_stopped; } - ide_debug_log(IDE_DBG_FUNC, "%s: Retry #%d\n", __func__, pc->retries); + ide_debug_log(IDE_DBG_FUNC, "retry #%d", pc->retries); pc->retries++; @@ -242,8 +242,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive, int blocks = rq->nr_sectors / floppy->bs_factor; int cmd = rq_data_dir(rq); - ide_debug_log(IDE_DBG_FUNC, "%s: block: %d, blocks: %d\n", __func__, - block, blocks); + ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks); ide_init_pc(pc); pc->c[0] = cmd == READ ? GPCMD_READ_10 : GPCMD_WRITE_10; @@ -287,15 +286,10 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, ide_hwif_t *hwif = drive->hwif; struct ide_atapi_pc *pc; - ide_debug_log(IDE_DBG_FUNC, "%s: dev: %s, cmd: 0x%x, cmd_type: %x, " - "errors: %d\n", - __func__, rq->rq_disk ? rq->rq_disk->disk_name : "?", - rq->cmd[0], rq->cmd_type, rq->errors); - - ide_debug_log(IDE_DBG_FUNC, "%s: sector: %ld, nr_sectors: %ld, " - "current_nr_sectors: %d\n", - __func__, (long)rq->sector, rq->nr_sectors, - rq->current_nr_sectors); + if (drive->debug_mask & IDE_DBG_RQ) + blk_dump_rq_flags(rq, (rq->rq_disk + ? rq->rq_disk->disk_name + : "dev?")); if (rq->errors >= ERROR_MAX) { if (floppy->failed_pc) @@ -438,8 +432,9 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); ide_debug_log(IDE_DBG_PROBE, "Descriptor %d: %dkB, %d blocks, " - "%d sector size\n", - i, blocks * length / 1024, blocks, length); + "%d sector size", + i, blocks * length / 1024, + blocks, length); if (i) continue; @@ -495,8 +490,8 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) "in drive\n", drive->name); break; } - ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d\n", - pc.buf[desc_start + 4] & 0x03); + ide_debug_log(IDE_DBG_PROBE, "Descriptor 0 Code: %d", + pc.buf[desc_start + 4] & 0x03); } /* Clik! disk does not support get_flexible_disk_page */ diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 04710941990..c51a35093ae 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c @@ -182,7 +182,7 @@ static int ide_gd_open(struct block_device *bdev, fmode_t mode) drive = idkp->drive; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); idkp->openers++; @@ -232,7 +232,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); ide_drive_t *drive = idkp->drive; - ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); + ide_debug_log(IDE_DBG_FUNC, "enter"); if (idkp->openers == 1) drive->disk_ops->flush(drive); diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h index b604bdd318a..70b43765327 100644 --- a/drivers/ide/ide-gd.h +++ b/drivers/ide/ide-gd.h @@ -8,7 +8,7 @@ #define IDE_GD_DEBUG_LOG 0 #if IDE_GD_DEBUG_LOG -#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args) +#define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, ## args) #else #define ide_debug_log(lvl, fmt, args...) do {} while (0) #endif -- cgit v1.2.3 From d15a613ba01ff2b209ecad7a38ccbb23b3b06c92 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:21 +0100 Subject: ide: remove IDE_ARCH_INTR (v2) This micro-optimization is not worth it. Just always check for existence of ->ack_intr method in ide_intr() and ide_timer_expiry(). v2: Fix brown-paper-bag bug spotted by David D. Kilzer. Cc: Geert Uytterhoeven Cc: Michael Schmitz Cc: "David D. Kilzer" Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2e92497b58a..e8506016420 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -739,7 +739,8 @@ void ide_timer_expiry (unsigned long data) } else if (drive_is_ready(drive)) { if (drive->waiting_for_dma) hwif->dma_ops->dma_lost_irq(drive); - (void)ide_ack_intr(hwif); + if (hwif->ack_intr) + hwif->ack_intr(hwif); printk(KERN_WARNING "%s: lost interrupt\n", drive->name); startstop = handler(drive); @@ -854,7 +855,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) spin_lock_irqsave(&hwif->lock, flags); - if (!ide_ack_intr(hwif)) + if (hwif->ack_intr && hwif->ack_intr(hwif) == 0) goto out; handler = hwif->handler; -- cgit v1.2.3 From e354c1d8033d97a97a38a1b2cffa1bc285b92ad4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:22 +0100 Subject: ide: remove IDE_ARCH_LOCK (v2) * Add ->{get,release}_lock methods to struct ide_port_info and struct ide_host. * Convert core IDE code, m68k IDE code and falconide support to use ->{get,release}_lock methods instead of ide_{get,release}_lock(). * Remove IDE_ARCH_LOCK. v2: * Build fix from Geert updating ide_{get,release}_lock() callers in falconide.c. Cc: Geert Uytterhoeven Cc: Michael Schmitz Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/falconide.c | 29 +++++++++++++++++++++++++---- drivers/ide/ide-io.c | 8 ++++---- drivers/ide/ide-probe.c | 2 ++ 3 files changed, 31 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index a638e952d67..d4d7ff1a351 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -40,8 +40,27 @@ * which is shared between several drivers. */ -int falconide_intr_lock; -EXPORT_SYMBOL(falconide_intr_lock); +static int falconide_intr_lock; + +static void falconide_release_lock(void) +{ + if (falconide_intr_lock == 0) { + printk(KERN_ERR "%s: bug\n", __func__); + return; + } + falconide_intr_lock = 0; + stdma_release(); +} + +static void falconide_get_lock(irq_handler_t handler, void *data) +{ + if (falconide_intr_lock == 0) { + if (in_interrupt() > 0) + panic("Falcon IDE hasn't ST-DMA lock in interrupt"); + stdma_lock(handler, data); + falconide_intr_lock = 1; + } +} static void falconide_input_data(ide_drive_t *drive, struct request *rq, void *buf, unsigned int len) @@ -81,6 +100,8 @@ static const struct ide_tp_ops falconide_tp_ops = { }; static const struct ide_port_info falconide_port_info = { + .get_lock = falconide_get_lock, + .release_lock = falconide_release_lock, .tp_ops = &falconide_tp_ops, .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, }; @@ -132,9 +153,9 @@ static int __init falconide_init(void) goto err; } - ide_get_lock(NULL, NULL); + falconide_get_lock(NULL, NULL); rc = ide_host_register(host, &falconide_port_info, hws); - ide_release_lock(); + falconide_release_lock(); if (rc) goto err_free; diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e8506016420..030b0ea1a1e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -501,8 +501,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) if (host->host_flags & IDE_HFLAG_SERIALIZE) { rc = test_and_set_bit_lock(IDE_HOST_BUSY, &host->host_busy); if (rc == 0) { - /* for atari only */ - ide_get_lock(ide_intr, hwif); + if (host->get_lock) + host->get_lock(ide_intr, hwif); } } return rc; @@ -511,8 +511,8 @@ static inline int ide_lock_host(struct ide_host *host, ide_hwif_t *hwif) static inline void ide_unlock_host(struct ide_host *host) { if (host->host_flags & IDE_HFLAG_SERIALIZE) { - /* for atari only */ - ide_release_lock(); + if (host->release_lock) + host->release_lock(); clear_bit_unlock(IDE_HOST_BUSY, &host->host_busy); } } diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index b0510b033d7..a3edbb5d045 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1325,6 +1325,8 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws) if (d) { host->init_chipset = d->init_chipset; + host->get_lock = d->get_lock; + host->release_lock = d->release_lock; host->host_flags = d->host_flags; } -- cgit v1.2.3 From 09a3e79187c56842d509430267ece5b82216baee Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:23 +0100 Subject: ide: make m68k host drivers use IDE_HFLAG_MMIO Cc: Geert Uytterhoeven Cc: Michael Schmitz Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/buddha.c | 6 +----- drivers/ide/falconide.c | 3 ++- drivers/ide/gayle.c | 6 ++---- drivers/ide/macide.c | 2 +- drivers/ide/q40ide.c | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index c0fa76148d4..606c3320fa5 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c @@ -144,7 +144,7 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, } static const struct ide_port_info buddha_port_info = { - .host_flags = IDE_HFLAG_NO_DMA, + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, }; /* @@ -176,10 +176,6 @@ static int __init buddha_init(void) board = z->resource.start; -/* - * FIXME: we now have selectable mmio v/s iomio transports. - */ - if(type != BOARD_XSURF) { if (!request_mem_region(board+BUDDHA_BASE1, 0x800, "IDE")) continue; diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index d4d7ff1a351..27a56952074 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -103,7 +103,8 @@ static const struct ide_port_info falconide_port_info = { .get_lock = falconide_get_lock, .release_lock = falconide_release_lock, .tp_ops = &falconide_tp_ops, - .host_flags = IDE_HFLAG_NO_DMA | IDE_HFLAG_SERIALIZE, + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | + IDE_HFLAG_NO_DMA, }; static void __init falconide_setup_ports(hw_regs_t *hw) diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c index 59bd0be9dcb..dce01765adb 100644 --- a/drivers/ide/gayle.c +++ b/drivers/ide/gayle.c @@ -118,7 +118,8 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, } static const struct ide_port_info gayle_port_info = { - .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | + IDE_HFLAG_NO_DMA, }; /* @@ -163,9 +164,6 @@ found: irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); ack_intr = gayle_ack_intr_a1200; } -/* - * FIXME: we now have selectable modes between mmio v/s iomio - */ res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1); res_n = GAYLE_IDEREG_SIZE; diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c index e9f965e795f..56112ee9f5a 100644 --- a/drivers/ide/macide.c +++ b/drivers/ide/macide.c @@ -81,7 +81,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base, } static const struct ide_port_info macide_port_info = { - .host_flags = IDE_HFLAG_NO_DMA, + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, }; static const char *mac_ide_name[] = diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index 9f9c0b3cc3a..fa8922ef3c6 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c @@ -111,7 +111,7 @@ static const struct ide_tp_ops q40ide_tp_ops = { static const struct ide_port_info q40ide_port_info = { .tp_ops = &q40ide_tp_ops, - .host_flags = IDE_HFLAG_NO_DMA, + .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, }; /* -- cgit v1.2.3 From f94116aeec7a299640dd692128e1d22178affa8d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:23 +0100 Subject: ide: cleanup * Remove superfluous include. * No need to re-define in/out*() macros as they are no longer used by m68k host drivers. * readl() and writel() are not used by core IDE code. * Use raw_*_swapw() directly in {falcon,q40}ide.c and remove {in,out}sw_swapw() macros. Cc: Geert Uytterhoeven Cc: Michael Schmitz Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/falconide.c | 4 ++-- drivers/ide/q40ide.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index 27a56952074..bb0c86e976e 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -70,7 +70,7 @@ static void falconide_input_data(ide_drive_t *drive, struct request *rq, if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) return insw(data_addr, buf, (len + 1) / 2); - insw_swapw(data_addr, buf, (len + 1) / 2); + raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } static void falconide_output_data(ide_drive_t *drive, struct request *rq, @@ -81,7 +81,7 @@ static void falconide_output_data(ide_drive_t *drive, struct request *rq, if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) return outsw(data_addr, buf, (len + 1) / 2); - outsw_swapw(data_addr, buf, (len + 1) / 2); + raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } /* Atari has a byte-swapped IDE interface */ diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index fa8922ef3c6..ebd576df2d8 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c @@ -80,7 +80,7 @@ static void q40ide_input_data(ide_drive_t *drive, struct request *rq, if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) return insw(data_addr, buf, (len + 1) / 2); - insw_swapw(data_addr, buf, (len + 1) / 2); + raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } static void q40ide_output_data(ide_drive_t *drive, struct request *rq, @@ -91,7 +91,7 @@ static void q40ide_output_data(ide_drive_t *drive, struct request *rq, if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) return outsw(data_addr, buf, (len + 1) / 2); - outsw_swapw(data_addr, buf, (len + 1) / 2); + raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } /* Q40 has a byte-swapped IDE interface */ -- cgit v1.2.3 From 13b8860d102de3daa4a4bf23542495b507edd7e9 Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Fri, 30 Jan 2009 11:59:27 -0800 Subject: IDE: palm_bk3710: use ioremap instead of arch-specific IO_ADDRESS() Signed-off-by: Kevin Hilman Acked-by: Sergei Shtylyov [bart: minor CodingStyle fixup per Sergei's suggestion] Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/palm_bk3710.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c index f38aac78044..c7acca0b873 100644 --- a/drivers/ide/palm_bk3710.c +++ b/drivers/ide/palm_bk3710.c @@ -347,7 +347,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) struct clk *clk; struct resource *mem, *irq; void __iomem *base; - unsigned long rate; + unsigned long rate, mem_size; int i, rc; hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; @@ -374,13 +374,18 @@ static int __init palm_bk3710_probe(struct platform_device *pdev) return -ENODEV; } - if (request_mem_region(mem->start, mem->end - mem->start + 1, - "palm_bk3710") == NULL) { + mem_size = mem->end - mem->start + 1; + if (request_mem_region(mem->start, mem_size, "palm_bk3710") == NULL) { printk(KERN_ERR "failed to request memory region\n"); return -EBUSY; } - base = IO_ADDRESS(mem->start); + base = ioremap(mem->start, mem_size); + if (!base) { + printk(KERN_ERR "failed to map IO memory\n"); + release_mem_region(mem->start, mem_size); + return -ENOMEM; + } /* Configure the Palm Chip controller */ palm_bk3710_chipinit(base); -- cgit v1.2.3 From 3f2154d7e701a8a4791de95765314219caa533a2 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Tue, 27 Jan 2009 17:42:28 +0100 Subject: ide-cd: use ide_drive_t's rq in cdrom_queue_request_sense There should be no functionality change resulting from this patch. Suggested-by: Bartlomiej Zolnierkiewicz Signed-off-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-cd.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index d163e6571e0..4528e25f2bb 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -213,7 +213,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, struct request *failed_command) { struct cdrom_info *info = drive->driver_data; - struct request *rq = &info->request_sense_request; + struct request *rq = &drive->request_sense_rq; ide_debug_log(IDE_DBG_SENSE, "enter"); diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h index 3b77dd73508..1d97101099c 100644 --- a/drivers/ide/ide-cd.h +++ b/drivers/ide/ide-cd.h @@ -91,8 +91,6 @@ struct cdrom_info { on this device. */ struct request_sense sense_data; - struct request request_sense_request; - u8 max_speed; /* Max speed of the drive. */ u8 current_speed; /* Current speed of the drive. */ -- cgit v1.2.3 From 443d18c80700da1f9a5a7cdf676f27ee4db6af6a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:24 +0100 Subject: at91_ide: use readsw()/writesw() directly Use readsw()/writesw() directly intead of __ide_mm_{in,out}sw() macros. Cc: Stanislaw Gruszka Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/at91_ide.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 1bb50f46388..4bd46d2d6b6 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c @@ -156,7 +156,7 @@ static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, len++; enter_16bit(chipselect, mode); - __ide_mm_insw((void __iomem *) io_ports->data_addr, buf, len / 2); + readsw((void __iomem *)io_ports->data_addr, buf, len / 2); leave_16bit(chipselect, mode); } @@ -171,7 +171,7 @@ static void at91_ide_output_data(ide_drive_t *drive, struct request *rq, pdbg("cs %u buf %p len %d\n", chipselect, buf, len); enter_16bit(chipselect, mode); - __ide_mm_outsw((void __iomem *) io_ports->data_addr, buf, len / 2); + writesw((void __iomem *)io_ports->data_addr, buf, len / 2); leave_16bit(chipselect, mode); } -- cgit v1.2.3 From 15a453a955f89f6545118770c669b52e925368bd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:26 +0100 Subject: ide: include only when needed Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io-std.c | 7 +++++++ drivers/ide/tx4938ide.c | 2 ++ drivers/ide/tx4939ide.c | 2 ++ 3 files changed, 11 insertions(+) (limited to 'drivers') diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 45b43dd49cd..9a8da6744d9 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c @@ -2,6 +2,13 @@ #include #include +#if defined(CONFIG_ARM) || defined(CONFIG_M68K) || defined(CONFIG_MIPS) || \ + defined(CONFIG_PARISC) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) +#include +#else +#include +#endif + /* * Conventional PIO operations for ATA devices */ diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index d9095345f7c..efade9e898b 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c @@ -15,6 +15,8 @@ #include #include #include + +#include #include static void tx4938ide_tune_ebusc(unsigned int ebus_ch, diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 40b0812a045..fb037a5e70b 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -18,6 +18,8 @@ #include #include +#include + #define MODNAME "tx4939ide" /* ATA Shadow Registers (8-bit except for Data which is 16-bit) */ -- cgit v1.2.3 From 304ffd6d3a145901ac570b8afb6c9936a83c3392 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:26 +0100 Subject: scc_pata: remove DECLARE_SCC_DEV() macro (v2) v2: scc_chipsets[] -> scc_chipset fix (spotted by Daniel K.). Cc: "Daniel K." Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/scc_pata.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 8d2314b6327..540bc842f3a 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -882,21 +882,16 @@ static const struct ide_dma_ops scc_dma_ops = { .dma_sff_read_status = scc_dma_sff_read_status, }; -#define DECLARE_SCC_DEV(name_str) \ - { \ - .name = name_str, \ - .init_iops = init_iops_scc, \ - .init_dma = scc_init_dma, \ - .init_hwif = init_hwif_scc, \ - .tp_ops = &scc_tp_ops, \ - .port_ops = &scc_port_ops, \ - .dma_ops = &scc_dma_ops, \ - .host_flags = IDE_HFLAG_SINGLE, \ - .pio_mask = ATA_PIO4, \ - } - -static const struct ide_port_info scc_chipsets[] __devinitdata = { - /* 0 */ DECLARE_SCC_DEV("sccIDE"), +static const struct ide_port_info scc_chipset __devinitdata = { + .name = "sccIDE", + .init_iops = init_iops_scc, + .init_dma = scc_init_dma, + .init_hwif = init_hwif_scc, + .tp_ops = &scc_tp_ops, + .port_ops = &scc_port_ops, + .dma_ops = &scc_dma_ops, + .host_flags = IDE_HFLAG_SINGLE, + .pio_mask = ATA_PIO4, }; /** @@ -910,7 +905,7 @@ static const struct ide_port_info scc_chipsets[] __devinitdata = { static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - return init_setup_scc(dev, &scc_chipsets[id->driver_data]); + return init_setup_scc(dev, &scc_chipset); } /** -- cgit v1.2.3 From 69197ad70ef6b854988299c1377864f9755cd03d Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:26 +0100 Subject: ide: fix memleak on failure in probe_for_drive() Always free drive->id in probe_for_drive() if device is not present. While at it: - remove dead IDE_DFLAG_DEAD flag - remove superfluous IDE_DFLAG_PRESENT check Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index a3edbb5d045..4b00945cf7d 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -228,15 +228,9 @@ static void do_identify(ide_drive_t *drive, u8 cmd, u16 *id) m[ATA_ID_PROD_LEN - 1] = '\0'; if (strstr(m, "E X A B Y T E N E S T")) - goto err_misc; - - drive->dev_flags |= IDE_DFLAG_PRESENT; - drive->dev_flags &= ~IDE_DFLAG_DEAD; - - return; -err_misc: - kfree(id); - drive->dev_flags &= ~IDE_DFLAG_PRESENT; + drive->dev_flags &= ~IDE_DFLAG_PRESENT; + else + drive->dev_flags |= IDE_DFLAG_PRESENT; } /** @@ -505,8 +499,7 @@ static u8 probe_for_drive(ide_drive_t *drive) } if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) - /* drive not found */ - return 0; + goto out_free; /* identification failed? */ if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { @@ -530,7 +523,7 @@ static u8 probe_for_drive(ide_drive_t *drive) } if ((drive->dev_flags & IDE_DFLAG_PRESENT) == 0) - return 0; + goto out_free; /* The drive wasn't being helpful. Add generic info only */ if ((drive->dev_flags & IDE_DFLAG_ID_READ) == 0) { @@ -543,7 +536,10 @@ static u8 probe_for_drive(ide_drive_t *drive) ide_disk_init_mult_count(drive); } - return !!(drive->dev_flags & IDE_DFLAG_PRESENT); + return 1; +out_free: + kfree(drive->id); + return 0; } static void hwif_release_dev(struct device *dev) -- cgit v1.2.3 From c7db966bbbf216b336da921e5d7ba5b9c8467ac1 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:27 +0100 Subject: ide: fix error message in pre_task_out_intr() Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 16138bce84a..2461245820b 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -419,12 +419,14 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) { + ide_hwif_t *hwif = drive->hwif; ide_startstop_t startstop; if (ide_wait_stat(&startstop, drive, ATA_DRQ, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", - drive->name, drive->hwif->data_phase ? "MULT" : "", + drive->name, + hwif->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); return startstop; } -- cgit v1.2.3 From 255115fb35f80735c21a1cbe9809e9795a3af26e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:27 +0100 Subject: ide: allow host drivers to specify IRQ flags * Add ->irq_flags field to struct ide_port_info and struct ide_host. * Update host drivers and IDE PCI code to use ->irq_flags field. * Convert init_irq() and ide_intr() to use host->irq_flags. This fixes handling of shared IRQs for non-PCI hosts and removes ugly ifdeffery from core IDE code. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/buddha.c | 1 + drivers/ide/delkin_cb.c | 1 + drivers/ide/falconide.c | 1 + drivers/ide/gayle.c | 1 + drivers/ide/ide-cs.c | 1 + drivers/ide/ide-io.c | 15 ++++----------- drivers/ide/ide-probe.c | 13 +++---------- drivers/ide/macide.c | 1 + drivers/ide/q40ide.c | 1 + drivers/ide/scc_pata.c | 1 + drivers/ide/setup-pci.c | 4 ++++ drivers/ide/sgiioc4.c | 1 + 12 files changed, 20 insertions(+), 21 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/buddha.c b/drivers/ide/buddha.c index 606c3320fa5..d028f8864bc 100644 --- a/drivers/ide/buddha.c +++ b/drivers/ide/buddha.c @@ -145,6 +145,7 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base, static const struct ide_port_info buddha_port_info = { .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; /* diff --git a/drivers/ide/delkin_cb.c b/drivers/ide/delkin_cb.c index bacb1194c9c..f153b95619b 100644 --- a/drivers/ide/delkin_cb.c +++ b/drivers/ide/delkin_cb.c @@ -66,6 +66,7 @@ static const struct ide_port_info delkin_cb_port_info = { .port_ops = &delkin_cb_port_ops, .host_flags = IDE_HFLAG_IO_32BIT | IDE_HFLAG_UNMASK_IRQS | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, .init_chipset = delkin_cb_init_chipset, }; diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index bb0c86e976e..6085feb1fae 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -105,6 +105,7 @@ static const struct ide_port_info falconide_port_info = { .tp_ops = &falconide_tp_ops, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; static void __init falconide_setup_ports(hw_regs_t *hw) diff --git a/drivers/ide/gayle.c b/drivers/ide/gayle.c index dce01765adb..dc778251cb0 100644 --- a/drivers/ide/gayle.c +++ b/drivers/ide/gayle.c @@ -120,6 +120,7 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base, static const struct ide_port_info gayle_port_info = { .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; /* diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index f50210fe558..9e47f3529d5 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -154,6 +154,7 @@ static const struct ide_port_ops idecs_port_ops = { static const struct ide_port_info idecs_port_info = { .port_ops = &idecs_port_ops, .host_flags = IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; static struct ide_host *idecs_register(unsigned long io, unsigned long ctl, diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 030b0ea1a1e..7007c48e27a 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -841,6 +841,7 @@ static void unexpected_intr(int irq, ide_hwif_t *hwif) irqreturn_t ide_intr (int irq, void *dev_id) { ide_hwif_t *hwif = (ide_hwif_t *)dev_id; + struct ide_host *host = hwif->host; ide_drive_t *uninitialized_var(drive); ide_handler_t *handler; unsigned long flags; @@ -848,8 +849,8 @@ irqreturn_t ide_intr (int irq, void *dev_id) irqreturn_t irq_ret = IRQ_NONE; int plug_device = 0; - if (hwif->host->host_flags & IDE_HFLAG_SERIALIZE) { - if (hwif != hwif->host->cur_port) + if (host->host_flags & IDE_HFLAG_SERIALIZE) { + if (hwif != host->cur_port) goto out_early; } @@ -872,27 +873,19 @@ irqreturn_t ide_intr (int irq, void *dev_id) * * For PCI, we cannot tell the difference, * so in that case we just ignore it and hope it goes away. - * - * FIXME: unexpected_intr should be hwif-> then we can - * remove all the ifdef PCI crap */ -#ifdef CONFIG_BLK_DEV_IDEPCI - if (hwif->chipset != ide_pci) -#endif /* CONFIG_BLK_DEV_IDEPCI */ - { + if ((host->irq_flags & IRQF_SHARED) == 0) { /* * Probably not a shared PCI interrupt, * so we can safely try to do something about it: */ unexpected_intr(irq, hwif); -#ifdef CONFIG_BLK_DEV_IDEPCI } else { /* * Whack the status register, just in case * we have a leftover pending IRQ. */ (void)hwif->tp_ops->read_status(hwif); -#endif /* CONFIG_BLK_DEV_IDEPCI */ } goto out; } diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 4b00945cf7d..f3a56595eb7 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -837,20 +837,13 @@ static int ide_port_setup_devices(ide_hwif_t *hwif) static int init_irq (ide_hwif_t *hwif) { struct ide_io_ports *io_ports = &hwif->io_ports; - irq_handler_t irq_handler; - int sa = 0; + struct ide_host *host = hwif->host; + irq_handler_t irq_handler = host->irq_handler; + int sa = host->irq_flags; - irq_handler = hwif->host->irq_handler; if (irq_handler == NULL) irq_handler = ide_intr; -#if defined(__mc68000__) - sa = IRQF_SHARED; -#endif /* __mc68000__ */ - - if (hwif->chipset == ide_pci) - sa = IRQF_SHARED; - if (io_ports->ctl_addr) hwif->tp_ops->set_irq(hwif, 1); diff --git a/drivers/ide/macide.c b/drivers/ide/macide.c index 56112ee9f5a..4b1718e8328 100644 --- a/drivers/ide/macide.c +++ b/drivers/ide/macide.c @@ -82,6 +82,7 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base, static const struct ide_port_info macide_port_info = { .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; static const char *mac_ide_name[] = diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index ebd576df2d8..32f669d656a 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c @@ -112,6 +112,7 @@ static const struct ide_tp_ops q40ide_tp_ops = { static const struct ide_port_info q40ide_port_info = { .tp_ops = &q40ide_tp_ops, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, + .irq_flags = IRQF_SHARED, }; /* diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 540bc842f3a..ae965da5dde 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -891,6 +891,7 @@ static const struct ide_port_info scc_chipset __devinitdata = { .port_ops = &scc_port_ops, .dma_ops = &scc_dma_ops, .host_flags = IDE_HFLAG_SINGLE, + .irq_flags = IRQF_SHARED, .pio_mask = ATA_PIO4, }; diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 24bc884826f..a19dbccd761 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -558,6 +558,8 @@ int ide_pci_init_one(struct pci_dev *dev, const struct ide_port_info *d, host->host_priv = priv; + host->irq_flags = IRQF_SHARED; + pci_set_drvdata(dev, host); ret = do_ide_setup_pci_device(dev, d, 1); @@ -606,6 +608,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2, host->host_priv = priv; + host->irq_flags = IRQF_SHARED; + pci_set_drvdata(pdev[0], host); pci_set_drvdata(pdev[1], host); diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index fdb9d703769..1cffe70f385 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -557,6 +557,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitconst = { .port_ops = &sgiioc4_port_ops, .dma_ops = &sgiioc4_dma_ops, .host_flags = IDE_HFLAG_MMIO, + .irq_flags = IRQF_SHARED, .mwdma_mask = ATA_MWDMA2_ONLY, }; -- cgit v1.2.3 From 0a6e49e9bc1e9698b2a1a529776b928768561a5a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:27 +0100 Subject: ide: remove now superfluous check from ide_host_register() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index f3a56595eb7..75b79cc9633 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1362,20 +1362,15 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, ide_init_port_hw(hwif, hws[i]); ide_port_apply_params(hwif); - if (d == NULL) { - mate = NULL; - } else { - if ((i & 1) && mate) { - hwif->mate = mate; - mate->mate = hwif; - } - - mate = (i & 1) ? NULL : hwif; - - ide_init_port(hwif, i & 1, d); - ide_port_cable_detect(hwif); + if ((i & 1) && mate) { + hwif->mate = mate; + mate->mate = hwif; } + mate = (i & 1) ? NULL : hwif; + + ide_init_port(hwif, i & 1, d); + ide_port_cable_detect(hwif); ide_port_init_devices(hwif); } -- cgit v1.2.3 From 2787cb8ae5c68a6945eb82ccf96b5f2c4f238323 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:28 +0100 Subject: ide: add IDE_HFLAG_DTC2278 host flag Add IDE_HFLAG_DTC2278 host flag and use it instead of ide_dtc2278 chipset type in ide_init_port(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/dtc2278.c | 3 ++- drivers/ide/ide-probe.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/dtc2278.c b/drivers/ide/dtc2278.c index 689b2e49341..c6b13812298 100644 --- a/drivers/ide/dtc2278.c +++ b/drivers/ide/dtc2278.c @@ -100,7 +100,8 @@ static const struct ide_port_info dtc2278_port_info __initdata = { IDE_HFLAG_IO_32BIT | /* disallow ->io_32bit changes */ IDE_HFLAG_NO_IO_32BIT | - IDE_HFLAG_NO_DMA, + IDE_HFLAG_NO_DMA | + IDE_HFLAG_DTC2278, .pio_mask = ATA_PIO4, }; diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 75b79cc9633..62270f47468 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1061,7 +1061,7 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port, hwif->tp_ops = d->tp_ops; /* ->set_pio_mode for DTC2278 is currently limited to port 0 */ - if (hwif->chipset != ide_dtc2278 || hwif->channel == 0) + if ((hwif->host_flags & IDE_HFLAG_DTC2278) == 0 || hwif->channel == 0) hwif->port_ops = d->port_ops; hwif->swdma_mask = d->swdma_mask; -- cgit v1.2.3 From c094ea0774d6881598da430ea0916a597162f8df Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:28 +0100 Subject: ide: add IDE_HFLAG_4DRIVES host flag Add IDE_HFLAG_4DRIVES host flag and use it instead of ide_4drives chipset type in ide_init_port(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-4drives.c | 3 ++- drivers/ide/ide-probe.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-4drives.c b/drivers/ide/ide-4drives.c index 9e85b1ec960..78aca75a2c4 100644 --- a/drivers/ide/ide-4drives.c +++ b/drivers/ide/ide-4drives.c @@ -23,7 +23,8 @@ static const struct ide_port_ops ide_4drives_port_ops = { static const struct ide_port_info ide_4drives_port_info = { .port_ops = &ide_4drives_port_ops, - .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA, + .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA | + IDE_HFLAG_4DRIVES, }; static int __init ide_4drives_init(void) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 62270f47468..335322f40c5 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -1381,8 +1381,8 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, if (ide_probe_port(hwif) == 0) hwif->present = 1; - if (hwif->chipset != ide_4drives || !hwif->mate || - !hwif->mate->present) { + if ((hwif->host_flags & IDE_HFLAG_4DRIVES) == 0 || + hwif->mate == NULL || hwif->mate->present == 0) { if (ide_register_port(hwif)) { ide_disable_port(hwif); continue; -- cgit v1.2.3 From 19710d25d50ae0be05eebe4231ed8918b1092d82 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:28 +0100 Subject: ide: add "flagged" taskfile flags to struct ide_taskfile (v2) * Add ->ftf_flags field to struct ide_taskfile and convert flags for TASKFILE ioctl to use it. * Rename "flagged" taskfile flags: - IDE_TFLAG_FLAGGED -> IDE_FTFLAG_FLAGGED - IDE_TFLAG_FLAGGED_SET_IN_FLAGS -> IDE_FTFLAG_SET_IN_FLAGS - IDE_TFLAG_{OUT,IN}_DATA -> IDE_FTFLAG_{OUT,IN}_DATA v2: * Remember to fully update ide-h8300.c, scc_pata.c and tx493{8,9}ide.c (thanks to Stephen Rothwell for noticing). There should be no functional changes caused by this patch. Cc: Stephen Rothwell Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/at91_ide.c | 6 +++--- drivers/ide/ide-h8300.c | 6 +++--- drivers/ide/ide-io-std.c | 6 +++--- drivers/ide/ide-taskfile.c | 12 ++++++------ drivers/ide/ns87415.c | 2 +- drivers/ide/scc_pata.c | 6 +++--- drivers/ide/tx4938ide.c | 6 +++--- drivers/ide/tx4939ide.c | 6 +++--- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 4bd46d2d6b6..6eabf9e3129 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c @@ -192,10 +192,10 @@ static void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task) struct ide_taskfile *tf = &task->tf; u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->tf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + if (task->tf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; at91_ide_output_data(drive, NULL, &data, 2); @@ -233,7 +233,7 @@ static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->tf_flags & IDE_FTFLAG_IN_DATA) { u16 data; at91_ide_input_data(drive, NULL, &data, 2); diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c index 9270d3255ee..11e937485bf 100644 --- a/drivers/ide/ide-h8300.c +++ b/drivers/ide/ide-h8300.c @@ -51,10 +51,10 @@ static void h8300_tf_load(ide_drive_t *drive, ide_task_t *task) struct ide_taskfile *tf = &task->tf; u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) + if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr); if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) @@ -90,7 +90,7 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = mm_inw(io_ports->data_addr); tf->data = data & 0xff; diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 9a8da6744d9..cad59f0bfbc 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c @@ -96,10 +96,10 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) else tf_outb = ide_outb; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; if (mmio) @@ -153,7 +153,7 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) tf_inb = ide_inb; } - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; if (mmio) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 2461245820b..02240a3ee0f 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -73,8 +73,8 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) } } - if (task->tf_flags & IDE_TFLAG_FLAGGED) - task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + task->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; memcpy(&hwif->task, task, sizeof(*task)); @@ -551,10 +551,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); if (req_task->out_flags.all) { - args.tf_flags |= IDE_TFLAG_FLAGGED; + args.ftf_flags |= IDE_FTFLAG_FLAGGED; if (req_task->out_flags.b.data) - args.tf_flags |= IDE_TFLAG_OUT_DATA; + args.ftf_flags |= IDE_FTFLAG_OUT_DATA; if (req_task->out_flags.b.nsector_hob) args.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; @@ -582,7 +582,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) } if (req_task->in_flags.b.data) - args.tf_flags |= IDE_TFLAG_IN_DATA; + args.ftf_flags |= IDE_FTFLAG_IN_DATA; switch(req_task->data_phase) { case TASKFILE_MULTI_OUT: @@ -647,7 +647,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2); memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE); - if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) && + if ((args.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && req_task->in_flags.all == 0) { req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; if (drive->dev_flags & IDE_DFLAG_LBA48) diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index ea48a3ee806..159eb39c793 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c @@ -66,7 +66,7 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &drive->hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = inw(io_ports->data_addr); tf->data = data & 0xff; diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index ae965da5dde..82929c725d8 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -672,10 +672,10 @@ static void scc_tf_load(ide_drive_t *drive, ide_task_t *task) struct ide_taskfile *tf = &task->tf; u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) + if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) out_be32((void *)io_ports->data_addr, (tf->hob_data << 8) | tf->data); @@ -711,7 +711,7 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &drive->hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = (u16)in_be32((void *)io_ports->data_addr); tf->data = data & 0xff; diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index efade9e898b..6b51e0c58af 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c @@ -89,10 +89,10 @@ static void tx4938ide_tf_load(ide_drive_t *drive, ide_task_t *task) struct ide_taskfile *tf = &task->tf; u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; /* no endian swap */ @@ -132,7 +132,7 @@ static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; /* no endian swap */ diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index fb037a5e70b..f0033eb2e88 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -474,10 +474,10 @@ static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) struct ide_taskfile *tf = &task->tf; u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_TFLAG_FLAGGED) + if (task->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_TFLAG_OUT_DATA) { + if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; /* no endian swap */ @@ -519,7 +519,7 @@ static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) struct ide_io_ports *io_ports = &hwif->io_ports; struct ide_taskfile *tf = &task->tf; - if (task->tf_flags & IDE_TFLAG_IN_DATA) { + if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; /* no endian swap */ -- cgit v1.2.3 From 3616b6536a74ff1c56029c17cbb3575c69c0a574 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:29 +0100 Subject: ide: complete power step in ide_complete_pm_request() * Complete power step in ide_complete_pm_request(). * Rename ide_complete_pm_request() to ide_complete_pm_rq(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 8 ++------ drivers/ide/ide-pm.c | 9 +++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 7007c48e27a..49b098de367 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -178,11 +178,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) kfree(task); } } else if (blk_pm_request(rq)) { - struct request_pm_state *pm = rq->data; - - ide_complete_power_step(drive, rq); - if (pm->pm_step == IDE_PM_COMPLETED) - ide_complete_pm_request(drive, rq); + ide_complete_pm_rq(drive, rq); return; } @@ -438,7 +434,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq) startstop = ide_start_power_step(drive, rq); if (startstop == ide_stopped && pm->pm_step == IDE_PM_COMPLETED) - ide_complete_pm_request(drive, rq); + ide_complete_pm_rq(drive, rq); return startstop; } else if (!rq->rq_disk && blk_special_request(rq)) /* diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 60538d9c84e..74c7c2bbe0f 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c @@ -169,18 +169,23 @@ out_do_tf: } /** - * ide_complete_pm_request - end the current Power Management request + * ide_complete_pm_rq - end the current Power Management request * @drive: target drive * @rq: request * * This function cleans up the current PM request and stops the queue * if necessary. */ -void ide_complete_pm_request(ide_drive_t *drive, struct request *rq) +void ide_complete_pm_rq(ide_drive_t *drive, struct request *rq) { struct request_queue *q = drive->queue; + struct request_pm_state *pm = rq->data; unsigned long flags; + ide_complete_power_step(drive, rq); + if (pm->pm_step != IDE_PM_COMPLETED) + return; + #ifdef DEBUG_PM printk("%s: completing PM request, %s\n", drive->name, blk_pm_suspend_request(rq) ? "suspend" : "resume"); -- cgit v1.2.3 From e120237c0e4d9a83c1380f5ff7b5f2ba31f1c820 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:29 +0100 Subject: ide: factor out completion of taskfile from ide_end_drive_cmd() Factor out completion of taskfile from ide_end_drive_cmd() to ide_complete_task(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 49b098de367..b8426e9c090 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -144,6 +144,20 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, } EXPORT_SYMBOL_GPL(ide_end_dequeued_request); +static void ide_complete_task(ide_drive_t *drive, ide_task_t *task, + u8 stat, u8 err) +{ + struct ide_taskfile *tf = &task->tf; + + tf->error = err; + tf->status = stat; + + drive->hwif->tp_ops->tf_read(drive, task); + + if (task->tf_flags & IDE_TFLAG_DYN) + kfree(task); +} + /** * ide_end_drive_cmd - end an explicit drive command * @drive: command @@ -166,17 +180,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { ide_task_t *task = (ide_task_t *)rq->special; - if (task) { - struct ide_taskfile *tf = &task->tf; - - tf->error = err; - tf->status = stat; - - drive->hwif->tp_ops->tf_read(drive, task); - - if (task->tf_flags & IDE_TFLAG_DYN) - kfree(task); - } + if (task) + ide_complete_task(drive, task, stat, err); } else if (blk_pm_request(rq)) { ide_complete_pm_rq(drive, rq); return; -- cgit v1.2.3 From a09485df9cda49fbde2766c86eb18a9cae585162 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:31 +0100 Subject: ide: move request type specific code from ide_end_drive_cmd() to callers (v3) * Move request type specific code from ide_end_drive_cmd() to callers. * Remove stale ide_end_drive_cmd() documentation and drop no longer used 'stat' argument. Then rename the function to ide_complete_rq(). v2: * Fix handling of blk_pm_request() requests in task_no_data_intr(). v3: * Some ide_no_data_taskfile() users (HPA code and HDIO_DRIVE_* ioctls handlers) access original command later so we need to update it in ide_complete_task(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-eh.c | 11 ++++++++++- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-io.c | 40 ++++++++++------------------------------ drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 26 +++++++++++++++++++------- 5 files changed, 41 insertions(+), 40 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 1231b5e486f..e2c04886616 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -124,7 +124,16 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) /* retry only "normal" I/O: */ if (!blk_fs_request(rq)) { rq->errors = 1; - ide_end_drive_cmd(drive, stat, err); + if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { + ide_task_t *task = rq->special; + + if (task) + ide_complete_task(drive, task, stat, err); + } else if (blk_pm_request(rq)) { + ide_complete_pm_rq(drive, rq); + return ide_stopped; + } + ide_complete_rq(drive, err); return ide_stopped; } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index d1a79e8e0d6..39e7fda37c5 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -101,7 +101,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) } rq->errors = error; /* fixme: need to move this local also */ - ide_end_drive_cmd(drive, 0, 0); + ide_complete_rq(drive, 0); return 0; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index b8426e9c090..4a97a97e56c 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -144,49 +144,28 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, } EXPORT_SYMBOL_GPL(ide_end_dequeued_request); -static void ide_complete_task(ide_drive_t *drive, ide_task_t *task, - u8 stat, u8 err) +void ide_complete_task(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err) { struct ide_taskfile *tf = &task->tf; + struct request *rq = task->rq; tf->error = err; tf->status = stat; drive->hwif->tp_ops->tf_read(drive, task); + if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) + memcpy(rq->special, task, sizeof(*task)); + if (task->tf_flags & IDE_TFLAG_DYN) kfree(task); } -/** - * ide_end_drive_cmd - end an explicit drive command - * @drive: command - * @stat: status bits - * @err: error bits - * - * Clean up after success/failure of an explicit drive command. - * These get thrown onto the queue so they are synchronized with - * real I/O operations on the drive. - * - * In LBA48 mode we have to read the register set twice to get - * all the extra information out. - */ - -void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) +void ide_complete_rq(ide_drive_t *drive, u8 err) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { - ide_task_t *task = (ide_task_t *)rq->special; - - if (task) - ide_complete_task(drive, task, stat, err); - } else if (blk_pm_request(rq)) { - ide_complete_pm_rq(drive, rq); - return; - } - hwif->rq = NULL; rq->errors = err; @@ -195,7 +174,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) blk_rq_bytes(rq)))) BUG(); } -EXPORT_SYMBOL(ide_end_drive_cmd); +EXPORT_SYMBOL(ide_complete_rq); void ide_kill_rq(ide_drive_t *drive, struct request *rq) { @@ -358,8 +337,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, #ifdef DEBUG printk("%s: DRIVE_CMD (null)\n", drive->name); #endif - ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif), - ide_read_error(drive)); + (void)hwif->tp_ops->read_status(hwif); + + ide_complete_rq(drive, ide_read_error(drive)); return ide_stopped; } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 4e6181c7bbd..de2d926e66c 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -502,7 +502,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) spin_lock_irqsave(&tape->lock, flags); - ide_end_drive_cmd(drive, 0, 0); + ide_complete_rq(drive, 0); spin_unlock_irqrestore(&tape->lock, flags); return 0; diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 02240a3ee0f..297cf6f4c72 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -147,12 +147,9 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) } } return ide_error(drive, "task_no_data_intr", stat); - /* calls ide_end_drive_cmd */ } - if (!custom) - ide_end_drive_cmd(drive, stat, ide_read_error(drive)); - else if (tf->command == ATA_CMD_IDLEIMMEDIATE) { + if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) { hwif->tp_ops->tf_read(drive, task); if (tf->lbal != 0xc4) { printk(KERN_ERR "%s: head unload failed!\n", @@ -160,10 +157,22 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) ide_tf_dump(drive->name, tf); } else drive->dev_flags |= IDE_DFLAG_PARKED; - ide_end_drive_cmd(drive, stat, ide_read_error(drive)); - } else if (tf->command == ATA_CMD_SET_MULTI) + } else if (custom && tf->command == ATA_CMD_SET_MULTI) drive->mult_count = drive->mult_req; + if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { + struct request *rq = hwif->rq; + u8 err = ide_read_error(drive); + + if (blk_pm_request(rq)) + ide_complete_pm_rq(drive, rq); + else { + if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) + ide_complete_task(drive, task, stat, err); + ide_complete_rq(drive, err); + } + } + return ide_stopped; } @@ -321,9 +330,12 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) { if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { + ide_task_t *task = rq->special; u8 err = ide_read_error(drive); - ide_end_drive_cmd(drive, stat, err); + if (task) + ide_complete_task(drive, task, stat, err); + ide_complete_rq(drive, err); return; } -- cgit v1.2.3 From 5e76acd588c125fbd37390e44868dcb07cadbe4a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:31 +0100 Subject: ide: no need to read Status and Error registers for "empty" taskfile requests Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 4a97a97e56c..45fc18ff73c 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -337,9 +337,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, #ifdef DEBUG printk("%s: DRIVE_CMD (null)\n", drive->name); #endif - (void)hwif->tp_ops->read_status(hwif); - - ide_complete_rq(drive, ide_read_error(drive)); + ide_complete_rq(drive, 0); return ide_stopped; } -- cgit v1.2.3 From e3d9a73a83d98fc466dabdcfe4f4e7e4419e3f8e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:32 +0100 Subject: ide: remove ->data_phase field from ide_hwif_t * Always use hwif->task->data_phase and remove ->data_phase field from ide_hwif_t. * Remove superfluous REQ_TYPE_ATA_TASKFILE check from ide_pio_datablock() while at it. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 3 --- drivers/ide/ide-io.c | 5 +---- drivers/ide/ide-park.c | 2 +- drivers/ide/ide-taskfile.c | 18 ++++++++---------- 4 files changed, 10 insertions(+), 18 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 806760d24ce..0f196e5fcff 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -160,8 +160,6 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, task.tf_flags |= IDE_TFLAG_WRITE; ide_tf_set_cmd(drive, &task, dma); - if (!dma) - hwif->data_phase = task.data_phase; task.rq = rq; rc = do_rw_taskfile(drive, &task); @@ -170,7 +168,6 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, /* fallback to PIO */ task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; ide_tf_set_cmd(drive, &task, 0); - hwif->data_phase = task.data_phase; ide_init_sg_cmd(drive, rq); rc = do_rw_taskfile(drive, &task); } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 45fc18ff73c..38076169b89 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -310,13 +310,10 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd); static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq) { - ide_hwif_t *hwif = drive->hwif; ide_task_t *task = rq->special; if (task) { - hwif->data_phase = task->data_phase; - - switch (hwif->data_phase) { + switch (task->data_phase) { case TASKFILE_MULTI_OUT: case TASKFILE_OUT: case TASKFILE_MULTI_IN: diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index f30e52152fc..cddc7c77876 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c @@ -81,7 +81,7 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) task.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; task.rq = rq; - drive->hwif->data_phase = task.data_phase = TASKFILE_NO_DATA; + task.data_phase = TASKFILE_NO_DATA; return do_rw_taskfile(drive, &task); } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 297cf6f4c72..7237e1547b1 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -265,21 +265,18 @@ static void ide_pio_multi(ide_drive_t *drive, struct request *rq, static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, unsigned int write) { + ide_task_t *task = &drive->hwif->task; u8 saved_io_32bit = drive->io_32bit; if (rq->bio) /* fs request */ rq->errors = 0; - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { - ide_task_t *task = rq->special; - - if (task->tf_flags & IDE_TFLAG_IO_16BIT) - drive->io_32bit = 0; - } + if (task->tf_flags & IDE_TFLAG_IO_16BIT) + drive->io_32bit = 0; touch_softlockup_watchdog(); - switch (drive->hwif->data_phase) { + switch (task->data_phase) { case TASKFILE_MULTI_IN: case TASKFILE_MULTI_OUT: ide_pio_multi(drive, rq, write); @@ -297,9 +294,10 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, { if (rq->bio) { ide_hwif_t *hwif = drive->hwif; + ide_task_t *task = &hwif->task; int sectors = hwif->nsect - hwif->nleft; - switch (hwif->data_phase) { + switch (task->data_phase) { case TASKFILE_IN: if (hwif->nleft) break; @@ -431,14 +429,14 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) { - ide_hwif_t *hwif = drive->hwif; + ide_task_t *task = &drive->hwif->task; ide_startstop_t startstop; if (ide_wait_stat(&startstop, drive, ATA_DRQ, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", drive->name, - hwif->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", + task->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); return startstop; } -- cgit v1.2.3 From 39375853d77bea48b7b334daa3698277af8d33f4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:32 +0100 Subject: ide: move smart_enable() call out from get_smart_data() Move smart_enable() call out from get_smart_data() to proc_idedisk_read_smart(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk_proc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index 1f86dcbd2b1..5766c1f62ad 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c @@ -31,7 +31,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) tf->command = ATA_CMD_SMART; args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; args.data_phase = TASKFILE_IN; - (void) smart_enable(drive); + return ide_raw_taskfile(drive, &args, buf, 1); } @@ -67,6 +67,8 @@ static int proc_idedisk_read_smart(char *page, char **start, off_t off, ide_drive_t *drive = (ide_drive_t *)data; int len = 0, i = 0; + (void)smart_enable(drive); + if (get_smart_data(drive, page, sub_cmd) == 0) { unsigned short *val = (unsigned short *) page; char *out = (char *)val + SECTOR_SIZE; -- cgit v1.2.3 From f7ef12482b17a015906cf74afe655e691b5fa2cb Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:32 +0100 Subject: icside: icside_dma_setup() fixes Check for ide_build_sglist() return value and re-map sg table if necessary. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/icside.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 0cf47e6e979..cf0522f937c 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -326,6 +326,10 @@ static int icside_dma_setup(ide_drive_t *drive) BUG_ON(dma_channel_active(ec->dma)); hwif->sg_nents = ide_build_sglist(drive, rq); + if (hwif->sg_nents == 0) { + ide_map_sg(drive, rq); + return 1; + } /* * Ensure that we have the right interrupt routed. -- cgit v1.2.3 From e2bcb2acb0b076fd0e3388ed0139eb6447fa9ae9 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:32 +0100 Subject: trm290: trm290_dma_setup() fix Re-map sg table if necessary (not that it really matters since DMA support is disabled currently). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/trm290.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index 1c09e549c42..e8279f32f9a 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c @@ -198,6 +198,7 @@ static int trm290_dma_setup(ide_drive_t *drive) rw = 2; if (!(count = ide_build_dmatable(drive, rq))) { + ide_map_sg(drive, rq); /* try PIO instead of DMA */ trm290_prepare_drive(drive, 0); /* select PIO xfer */ return 1; -- cgit v1.2.3 From e295b8d27465a106cd3db150129ab539704e4c65 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:33 +0100 Subject: au1xxx-ide: auide_dma_end() cleanup No need to check / clear hwif->sg_nents. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/au1xxx-ide.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 154ec2cf734..82f153810eb 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -286,12 +286,7 @@ static int auide_build_dmatable(ide_drive_t *drive) static int auide_dma_end(ide_drive_t *drive) { - ide_hwif_t *hwif = drive->hwif; - - if (hwif->sg_nents) { - ide_destroy_dmatable(drive); - hwif->sg_nents = 0; - } + ide_destroy_dmatable(drive); return 0; } -- cgit v1.2.3 From c7016e95a556098db6dc4d9096a6189be9e18266 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:33 +0100 Subject: ide: remove no longer needed PC_FLAG_TIMEDOUT packet command flag There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 6adc5b4a440..f44474b0ada 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -336,11 +336,6 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) timeout = (drive->media == ide_floppy) ? WAIT_FLOPPY_CMD : WAIT_TAPE_CMD; - if (pc->flags & PC_FLAG_TIMEDOUT) { - drive->pc_callback(drive, 0); - return ide_stopped; - } - /* Clear the interrupt */ stat = tp_ops->read_status(hwif); -- cgit v1.2.3 From cc495557dfaeca552595cda8cd4427d67aa0142e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:33 +0100 Subject: ide-floppy: remove superfluous check from ide_floppy_end_request() There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 39e7fda37c5..6dda0fba017 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -91,9 +91,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) if (error) floppy->failed_pc = NULL; - /* Why does this happen? */ - if (!rq) - return 0; + if (!blk_special_request(rq)) { /* our real local end request function */ ide_end_request(drive, uptodate, nsecs); -- cgit v1.2.3 From bfdb0b3beb0618dd03e7aa49e2fd3ac360aef370 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:33 +0100 Subject: ide-tape: remove superfluous tape->lock tape->lock is not needed (->queue_lock protects queue). Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-tape.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index de2d926e66c..72b4350bfeb 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -245,9 +245,6 @@ typedef struct ide_tape_obj { /* Wasted space in each stage */ int excess_bh_size; - /* protects the ide-tape queue */ - spinlock_t lock; - /* Measures average tape speed */ unsigned long avg_time; int avg_size; @@ -481,7 +478,6 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) { struct request *rq = drive->hwif->rq; idetape_tape_t *tape = drive->driver_data; - unsigned long flags; int error; debug_log(DBG_PROCS, "Enter %s\n", __func__); @@ -500,11 +496,8 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) return 0; } - spin_lock_irqsave(&tape->lock, flags); - ide_complete_rq(drive, 0); - spin_unlock_irqrestore(&tape->lock, flags); return 0; } @@ -2192,8 +2185,6 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor) drive->pc_update_buffers = idetape_update_buffers; drive->pc_io_buffers = ide_tape_io_buffers; - spin_lock_init(&tape->lock); - drive->dev_flags |= IDE_DFLAG_DSC_OVERLAP; if (drive->hwif->host_flags & IDE_HFLAG_NO_DSC) { -- cgit v1.2.3 From 5e2040fd0a97888952b37243b5868872bbe0f6ac Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:34 +0100 Subject: ide: move ->failed_pc to ide_drive_t Move ->failed_pc from struct ide_{disk,tape}_obj to ide_drive_t. There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 21 ++++++++++----------- drivers/ide/ide-gd.h | 2 -- drivers/ide/ide-tape.c | 29 ++++++++++------------------- 3 files changed, 20 insertions(+), 32 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 6dda0fba017..f9ad4b3021e 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -70,7 +70,6 @@ */ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) { - struct ide_disk_obj *floppy = drive->driver_data; struct request *rq = drive->hwif->rq; int error; @@ -90,7 +89,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) } if (error) - floppy->failed_pc = NULL; + drive->failed_pc = NULL; if (!blk_special_request(rq)) { /* our real local end request function */ @@ -121,8 +120,8 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) ide_debug_log(IDE_DBG_FUNC, "enter"); - if (floppy->failed_pc == pc) - floppy->failed_pc = NULL; + if (drive->failed_pc == pc) + drive->failed_pc = NULL; if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || (pc->rq && blk_pc_request(pc->rq))) @@ -137,9 +136,9 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) floppy->progress_indication = buf[15] & 0x80 ? (u16)get_unaligned((u16 *)&buf[16]) : 0x10000; - if (floppy->failed_pc) + if (drive->failed_pc) ide_debug_log(IDE_DBG_PC, "pc = %x", - floppy->failed_pc->c[0]); + drive->failed_pc->c[0]); ide_debug_log(IDE_DBG_SENSE, "sense key = %x, asc = %x," "ascq = %x", floppy->sense_key, @@ -173,9 +172,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, { struct ide_disk_obj *floppy = drive->driver_data; - if (floppy->failed_pc == NULL && + if (drive->failed_pc == NULL && pc->c[0] != GPCMD_REQUEST_SENSE) - floppy->failed_pc = pc; + drive->failed_pc = pc; /* Set the current packet command */ drive->pc = pc; @@ -186,7 +185,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, /* Giving up */ pc->error = IDEFLOPPY_ERROR_GENERAL; - floppy->failed_pc = NULL; + drive->failed_pc = NULL; drive->pc_callback(drive, 0); return ide_stopped; } @@ -290,8 +289,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, : "dev?")); if (rq->errors >= ERROR_MAX) { - if (floppy->failed_pc) - ide_floppy_report_error(floppy, floppy->failed_pc); + if (drive->failed_pc) + ide_floppy_report_error(floppy, drive->failed_pc); else printk(KERN_ERR PFX "%s: I/O error\n", drive->name); diff --git a/drivers/ide/ide-gd.h b/drivers/ide/ide-gd.h index 70b43765327..55970772bd0 100644 --- a/drivers/ide/ide-gd.h +++ b/drivers/ide/ide-gd.h @@ -20,8 +20,6 @@ struct ide_disk_obj { struct device dev; unsigned int openers; /* protected by BKL for now */ - /* Last failed packet command */ - struct ide_atapi_pc *failed_pc; /* used for blk_{fs,pc}_request() requests */ struct ide_atapi_pc queued_pc; diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 72b4350bfeb..d6555984ee8 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -171,14 +171,6 @@ typedef struct ide_tape_obj { struct gendisk *disk; struct device dev; - /* - * failed_pc points to the last failed packet command, or contains - * NULL if we do not need to retry any packet command. This is - * required since an additional packet command is needed before the - * retry, to get detailed information on what went wrong. - */ - /* Last failed packet command */ - struct ide_atapi_pc *failed_pc; /* used by REQ_IDETAPE_{READ,WRITE} requests */ struct ide_atapi_pc queued_pc; @@ -397,7 +389,7 @@ static void idetape_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc) static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) { idetape_tape_t *tape = drive->driver_data; - struct ide_atapi_pc *pc = tape->failed_pc; + struct ide_atapi_pc *pc = drive->failed_pc; tape->sense_key = sense[2] & 0xF; tape->asc = sense[12]; @@ -477,7 +469,6 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape) static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) { struct request *rq = drive->hwif->rq; - idetape_tape_t *tape = drive->driver_data; int error; debug_log(DBG_PROCS, "Enter %s\n", __func__); @@ -489,7 +480,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) } rq->errors = error; if (error) - tape->failed_pc = NULL; + drive->failed_pc = NULL; if (!blk_special_request(rq)) { ide_end_request(drive, uptodate, nr_sects); @@ -514,8 +505,8 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) if (dsc) ide_tape_handle_dsc(drive); - if (tape->failed_pc == pc) - tape->failed_pc = NULL; + if (drive->failed_pc == pc) + drive->failed_pc = NULL; if (pc->c[0] == REQUEST_SENSE) { if (uptodate) @@ -653,8 +644,8 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, "Two request sense in serial were issued\n"); } - if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) - tape->failed_pc = pc; + if (drive->failed_pc == NULL && pc->c[0] != REQUEST_SENSE) + drive->failed_pc = pc; /* Set the current packet command */ drive->pc = pc; @@ -680,7 +671,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, /* Giving up */ pc->error = IDETAPE_ERROR_GENERAL; } - tape->failed_pc = NULL; + drive->failed_pc = NULL; drive->pc_callback(drive, 0); return ide_stopped; } @@ -740,7 +731,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) pc->error = 0; } else { pc->error = IDETAPE_ERROR_GENERAL; - tape->failed_pc = NULL; + drive->failed_pc = NULL; } drive->pc_callback(drive, 0); return ide_stopped; @@ -799,8 +790,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, } /* Retry a failed packet command */ - if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { - pc = tape->failed_pc; + if (drive->failed_pc && drive->pc->c[0] == REQUEST_SENSE) { + pc = drive->failed_pc; goto out; } -- cgit v1.2.3 From c152cc1a90f9680cefa74d9ff9ce36038081ba72 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:34 +0100 Subject: ide: use ->end_request only for private device driver requests * Move IDE{FLOPPY,TAPE}_ERROR_* defines to and rename them to IDE_DRV_ERROR_*. * Handle ->end_request special cases for floppy/tape media in ide_kill_rq(). * Call ->end_request only for private device driver requests. There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 7 ++----- drivers/ide/ide-io.c | 7 ++++++- drivers/ide/ide-tape.c | 19 +++++++------------ drivers/ide/ide-taskfile.c | 16 +++------------- 4 files changed, 18 insertions(+), 31 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f9ad4b3021e..fb235641da3 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -61,9 +61,6 @@ */ #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ -/* Error code returned in rq->errors to the higher part of the driver. */ -#define IDEFLOPPY_ERROR_GENERAL 101 - /* * Used to finish servicing a request. For read/write requests, we will call * ide_end_request to pass to the next buffer. @@ -77,7 +74,7 @@ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) switch (uptodate) { case 0: - error = IDEFLOPPY_ERROR_GENERAL; + error = IDE_DRV_ERROR_GENERAL; break; case 1: @@ -183,7 +180,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR)) ide_floppy_report_error(floppy, pc); /* Giving up */ - pc->error = IDEFLOPPY_ERROR_GENERAL; + pc->error = IDE_DRV_ERROR_GENERAL; drive->failed_pc = NULL; drive->pc_callback(drive, 0); diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 38076169b89..da2f97dfa8f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -178,7 +178,12 @@ EXPORT_SYMBOL(ide_complete_rq); void ide_kill_rq(ide_drive_t *drive, struct request *rq) { - if (rq->rq_disk) { + drive->failed_pc = NULL; + + if (drive->media == ide_tape) + rq->errors = IDE_DRV_ERROR_GENERAL; + + if (blk_special_request(rq) && rq->rq_disk) { struct ide_driver *drv; drv = *(struct ide_driver **)rq->rq_disk->private_data; diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index d6555984ee8..e3b4c1c39d3 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -152,11 +152,6 @@ struct idetape_bh { #define IDETAPE_LU_RETENSION_MASK 2 #define IDETAPE_LU_EOT_MASK 4 -/* Error codes returned in rq->errors to the higher part of the driver. */ -#define IDETAPE_ERROR_GENERAL 101 -#define IDETAPE_ERROR_FILEMARK 102 -#define IDETAPE_ERROR_EOD 103 - /* Structures related to the SELECT SENSE / MODE SENSE packet commands. */ #define IDETAPE_BLOCK_DESCRIPTOR 0 #define IDETAPE_CAPABILITIES_PAGE 0x2a @@ -422,19 +417,19 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense) } } if (pc->c[0] == READ_6 && (sense[2] & 0x80)) { - pc->error = IDETAPE_ERROR_FILEMARK; + pc->error = IDE_DRV_ERROR_FILEMARK; pc->flags |= PC_FLAG_ABORT; } if (pc->c[0] == WRITE_6) { if ((sense[2] & 0x40) || (tape->sense_key == 0xd && tape->asc == 0x0 && tape->ascq == 0x2)) { - pc->error = IDETAPE_ERROR_EOD; + pc->error = IDE_DRV_ERROR_EOD; pc->flags |= PC_FLAG_ABORT; } } if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { if (tape->sense_key == 8) { - pc->error = IDETAPE_ERROR_EOD; + pc->error = IDE_DRV_ERROR_EOD; pc->flags |= PC_FLAG_ABORT; } if (!(pc->flags & PC_FLAG_ABORT) && @@ -474,7 +469,7 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) debug_log(DBG_PROCS, "Enter %s\n", __func__); switch (uptodate) { - case 0: error = IDETAPE_ERROR_GENERAL; break; + case 0: error = IDE_DRV_ERROR_GENERAL; break; case 1: error = 0; break; default: error = uptodate; } @@ -669,7 +664,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, tape->ascq); } /* Giving up */ - pc->error = IDETAPE_ERROR_GENERAL; + pc->error = IDE_DRV_ERROR_GENERAL; } drive->failed_pc = NULL; drive->pc_callback(drive, 0); @@ -730,7 +725,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive) } pc->error = 0; } else { - pc->error = IDETAPE_ERROR_GENERAL; + pc->error = IDE_DRV_ERROR_GENERAL; drive->failed_pc = NULL; } drive->pc_callback(drive, 0); @@ -1210,7 +1205,7 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks, if (tape->merge_bh) idetape_init_merge_buffer(tape); - if (errors == IDETAPE_ERROR_GENERAL) + if (errors == IDE_DRV_ERROR_GENERAL) return -EIO; return ret; } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 7237e1547b1..f85b7f21a61 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -315,12 +315,8 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, break; } - if (sectors > 0) { - struct ide_driver *drv; - - drv = *(struct ide_driver **)rq->rq_disk->private_data; - drv->end_request(drive, 1, sectors); - } + if (sectors > 0) + ide_end_request(drive, 1, sectors); } return ide_error(drive, s, stat); } @@ -337,13 +333,7 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) return; } - if (rq->rq_disk) { - struct ide_driver *drv; - - drv = *(struct ide_driver **)rq->rq_disk->private_data;; - drv->end_request(drive, 1, rq->nr_sectors); - } else - ide_end_request(drive, 1, rq->nr_sectors); + ide_end_request(drive, 1, rq->nr_sectors); } /* -- cgit v1.2.3 From 313afea7f25cc6d420179e0b316499c164e3e372 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:34 +0100 Subject: ide-{floppy,tape}: cleanup ide*_end_request() * ide*_end_request() is only called with uptodate == 0 or uptodate == 1 so cleanup it accordingly. * Inline ide*_end_request() content at call sites so the only user left is ->end_request method. * ->end_request is now used only for private driver requests so remove handling of other requests from ide*_end_request(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-floppy.c | 66 +++++++++++++++++++++++------------------------- drivers/ide/ide-tape.c | 40 ++++++++++++++++------------- 2 files changed, 53 insertions(+), 53 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index fb235641da3..bdd8f8e2df6 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -62,40 +62,21 @@ #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ /* - * Used to finish servicing a request. For read/write requests, we will call - * ide_end_request to pass to the next buffer. + * Used to finish servicing a private request. */ static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) { struct request *rq = drive->hwif->rq; - int error; ide_debug_log(IDE_DBG_FUNC, "enter"); - switch (uptodate) { - case 0: - error = IDE_DRV_ERROR_GENERAL; - break; - - case 1: - error = 0; - break; - - default: - error = uptodate; - } - - if (error) + if (uptodate == 0) drive->failed_pc = NULL; - if (!blk_special_request(rq)) { - /* our real local end request function */ - ide_end_request(drive, uptodate, nsecs); - return 0; - } - rq->errors = error; - /* fixme: need to move this local also */ + rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; + ide_complete_rq(drive, 0); + return 0; } @@ -106,13 +87,14 @@ static void idefloppy_update_buffers(ide_drive_t *drive, struct bio *bio = rq->bio; while ((bio = rq->bio) != NULL) - ide_floppy_end_request(drive, 1, 0); + ide_end_request(drive, 1, 0); } static void ide_floppy_callback(ide_drive_t *drive, int dsc) { struct ide_disk_obj *floppy = drive->driver_data; struct ide_atapi_pc *pc = drive->pc; + struct request *rq = pc->rq; int uptodate = pc->error ? 0 : 1; ide_debug_log(IDE_DBG_FUNC, "enter"); @@ -121,7 +103,7 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) drive->failed_pc = NULL; if (pc->c[0] == GPCMD_READ_10 || pc->c[0] == GPCMD_WRITE_10 || - (pc->rq && blk_pc_request(pc->rq))) + (rq && blk_pc_request(rq))) uptodate = 1; /* FIXME */ else if (pc->c[0] == GPCMD_REQUEST_SENSE) { u8 *buf = pc->buf; @@ -145,7 +127,14 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) "Aborting request!\n"); } - ide_floppy_end_request(drive, uptodate, 0); + if (uptodate == 0) + drive->failed_pc = NULL; + + if (blk_special_request(rq)) { + rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; + ide_complete_rq(drive, 0); + } else + ide_end_request(drive, uptodate, 0); } static void ide_floppy_report_error(struct ide_disk_obj *floppy, @@ -286,21 +275,25 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, : "dev?")); if (rq->errors >= ERROR_MAX) { - if (drive->failed_pc) + if (drive->failed_pc) { ide_floppy_report_error(floppy, drive->failed_pc); - else + drive->failed_pc = NULL; + } else printk(KERN_ERR PFX "%s: I/O error\n", drive->name); - ide_floppy_end_request(drive, 0, 0); - return ide_stopped; + if (blk_special_request(rq)) { + rq->errors = IDE_DRV_ERROR_GENERAL; + ide_complete_rq(drive, 0); + return ide_stopped; + } else + goto out_end; } if (blk_fs_request(rq)) { if (((long)rq->sector % floppy->bs_factor) || (rq->nr_sectors % floppy->bs_factor)) { printk(KERN_ERR PFX "%s: unsupported r/w rq size\n", drive->name); - ide_floppy_end_request(drive, 0, 0); - return ide_stopped; + goto out_end; } pc = &floppy->queued_pc; idefloppy_create_rw_cmd(drive, pc, rq, (unsigned long)block); @@ -311,8 +304,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, idefloppy_blockpc_cmd(floppy, pc, rq); } else { blk_dump_rq_flags(rq, PFX "unsupported command in queue"); - ide_floppy_end_request(drive, 0, 0); - return ide_stopped; + goto out_end; } if (blk_fs_request(rq) || pc->req_xfer) { @@ -326,6 +318,10 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, pc->rq = rq; return idefloppy_issue_pc(drive, pc); +out_end: + drive->failed_pc = NULL; + ide_end_request(drive, 0, 0); + return ide_stopped; } /* diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index e3b4c1c39d3..35469f3069a 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -464,23 +464,13 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape) static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) { struct request *rq = drive->hwif->rq; - int error; debug_log(DBG_PROCS, "Enter %s\n", __func__); - switch (uptodate) { - case 0: error = IDE_DRV_ERROR_GENERAL; break; - case 1: error = 0; break; - default: error = uptodate; - } - rq->errors = error; - if (error) - drive->failed_pc = NULL; + rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; - if (!blk_special_request(rq)) { - ide_end_request(drive, uptodate, nr_sects); - return 0; - } + if (uptodate == 0) + drive->failed_pc = NULL; ide_complete_rq(drive, 0); @@ -493,7 +483,9 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) { idetape_tape_t *tape = drive->driver_data; struct ide_atapi_pc *pc = drive->pc; + struct request *rq = drive->hwif->rq; int uptodate = pc->error ? 0 : 1; + int err = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; debug_log(DBG_PROCS, "Enter %s\n", __func__); @@ -510,7 +502,6 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) printk(KERN_ERR "ide-tape: Error in REQUEST SENSE " "itself - Aborting request!\n"); } else if (pc->c[0] == READ_6 || pc->c[0] == WRITE_6) { - struct request *rq = drive->hwif->rq; int blocks = pc->xferred / tape->blk_size; tape->avg_size += blocks * tape->blk_size; @@ -525,8 +516,10 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) tape->first_frame += blocks; rq->current_nr_sectors -= blocks; - if (pc->error) - uptodate = pc->error; + if (pc->error) { + uptodate = 0; + err = pc->error; + } } else if (pc->c[0] == READ_POSITION && uptodate) { u8 *readpos = pc->buf; @@ -540,6 +533,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) "to the tape\n"); clear_bit(IDE_AFLAG_ADDRESS_VALID, &drive->atapi_flags); uptodate = 0; + err = IDE_DRV_ERROR_GENERAL; } else { debug_log(DBG_SENSE, "Block Location - %u\n", be32_to_cpup((__be32 *)&readpos[4])); @@ -550,7 +544,15 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) } } - idetape_end_request(drive, uptodate, 0); + rq->errors = err; + + if (uptodate == 0) + drive->failed_pc = NULL; + + if (blk_special_request(rq)) + ide_complete_rq(drive, 0); + else + ide_end_request(drive, uptodate, 0); } /* @@ -794,7 +796,9 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, if (rq != postponed_rq) { printk(KERN_ERR "ide-tape: ide-tape.c bug - " "Two DSC requests were queued\n"); - idetape_end_request(drive, 0, 0); + rq->errors = IDE_DRV_ERROR_GENERAL; + drive->failed_pc = NULL; + ide_complete_rq(drive, 0); return ide_stopped; } -- cgit v1.2.3 From 3ee38302ffc63da93eb0313053a990bb3466e275 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:36 +0100 Subject: ide: remove ->end_request method * Handle completion of private driver requests explicitly for ide_floppy and ide_tape media in ide_kill_rq(). * Remove no longer needed ->end_request method. There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 1 - drivers/ide/ide-disk.c | 1 - drivers/ide/ide-floppy.c | 20 -------------------- drivers/ide/ide-gd.c | 6 ------ drivers/ide/ide-io.c | 14 +++++++------- drivers/ide/ide-tape.c | 17 ----------------- 6 files changed, 7 insertions(+), 52 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 4528e25f2bb..bb804ae57bc 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1834,7 +1834,6 @@ static struct ide_driver ide_cdrom_driver = { .remove = ide_cd_remove, .version = IDECD_VERSION, .do_request = ide_cd_do_request, - .end_request = ide_end_request, #ifdef CONFIG_IDE_PROC_FS .proc_entries = ide_cd_proc_entries, .proc_devsets = ide_cd_proc_devsets, diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 0f196e5fcff..912be155a8c 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -734,6 +734,5 @@ const struct ide_disk_ops ide_ata_disk_ops = { .init_media = ide_disk_init_media, .set_doorlock = ide_disk_set_doorlock, .do_request = ide_do_rw_disk, - .end_request = ide_end_request, .ioctl = ide_disk_ioctl, }; diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index bdd8f8e2df6..ab870a08d62 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -61,25 +61,6 @@ */ #define IDEFLOPPY_PC_DELAY (HZ/20) /* default delay for ZIP 100 (50ms) */ -/* - * Used to finish servicing a private request. - */ -static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) -{ - struct request *rq = drive->hwif->rq; - - ide_debug_log(IDE_DBG_FUNC, "enter"); - - if (uptodate == 0) - drive->failed_pc = NULL; - - rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; - - ide_complete_rq(drive, 0); - - return 0; -} - static void idefloppy_update_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc) { @@ -560,6 +541,5 @@ const struct ide_disk_ops ide_atapi_disk_ops = { .init_media = ide_floppy_init_media, .set_doorlock = ide_set_media_lock, .do_request = ide_floppy_do_request, - .end_request = ide_floppy_end_request, .ioctl = ide_floppy_ioctl, }; diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index c51a35093ae..1aebdf1a4f5 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c @@ -145,11 +145,6 @@ static ide_startstop_t ide_gd_do_request(ide_drive_t *drive, return drive->disk_ops->do_request(drive, rq, sector); } -static int ide_gd_end_request(ide_drive_t *drive, int uptodate, int nrsecs) -{ - return drive->disk_ops->end_request(drive, uptodate, nrsecs); -} - static struct ide_driver ide_gd_driver = { .gen_driver = { .owner = THIS_MODULE, @@ -162,7 +157,6 @@ static struct ide_driver ide_gd_driver = { .shutdown = ide_gd_shutdown, .version = IDE_GD_VERSION, .do_request = ide_gd_do_request, - .end_request = ide_gd_end_request, #ifdef CONFIG_IDE_PROC_FS .proc_entries = ide_disk_proc_entries, .proc_devsets = ide_disk_proc_devsets, diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index da2f97dfa8f..6eee41beec7 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -178,17 +178,17 @@ EXPORT_SYMBOL(ide_complete_rq); void ide_kill_rq(ide_drive_t *drive, struct request *rq) { + u8 drv_req = blk_special_request(rq) && rq->rq_disk; + u8 media = drive->media; + drive->failed_pc = NULL; - if (drive->media == ide_tape) + if ((media == ide_floppy && drv_req) || media == ide_tape) rq->errors = IDE_DRV_ERROR_GENERAL; - if (blk_special_request(rq) && rq->rq_disk) { - struct ide_driver *drv; - - drv = *(struct ide_driver **)rq->rq_disk->private_data; - drv->end_request(drive, 0, 0); - } else + if ((media == ide_floppy || media == ide_tape) && drv_req) + ide_complete_rq(drive, 0); + else ide_end_request(drive, 0, 0); } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 35469f3069a..fc61bbef3bb 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -461,22 +461,6 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape) } } -static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects) -{ - struct request *rq = drive->hwif->rq; - - debug_log(DBG_PROCS, "Enter %s\n", __func__); - - rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; - - if (uptodate == 0) - drive->failed_pc = NULL; - - ide_complete_rq(drive, 0); - - return 0; -} - static void ide_tape_handle_dsc(ide_drive_t *); static void ide_tape_callback(ide_drive_t *drive, int dsc) @@ -2306,7 +2290,6 @@ static struct ide_driver idetape_driver = { .remove = ide_tape_remove, .version = IDETAPE_VERSION, .do_request = idetape_do_request, - .end_request = idetape_end_request, #ifdef CONFIG_IDE_PROC_FS .proc_entries = ide_tape_proc_entries, .proc_devsets = ide_tape_proc_devsets, -- cgit v1.2.3 From 03a2faaea8f44edfe583ddf1240948019becfbe4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:36 +0100 Subject: ide: return request status from ->pc_callback method Make ->pc_callback method return request status and then move the request completion from ->pc_callback to ide_pc_intr(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 12 +++++++++++- drivers/ide/ide-floppy.c | 12 ++++-------- drivers/ide/ide-tape.c | 10 ++-------- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f44474b0ada..f72b5a67543 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -357,6 +357,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) /* No more interrupts */ if ((stat & ATA_DRQ) == 0) { + int uptodate; + debug_log("Packet command completed, %d bytes transferred\n", pc->xferred); @@ -395,7 +397,15 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) dsc = 1; /* Command finished - Call the callback function */ - drive->pc_callback(drive, dsc); + uptodate = drive->pc_callback(drive, dsc); + + if (uptodate == 0) + drive->failed_pc = NULL; + + if (blk_special_request(rq)) + ide_complete_rq(drive, 0); + else + ide_end_request(drive, uptodate, 0); return ide_stopped; } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index ab870a08d62..5625946739a 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -71,7 +71,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive, ide_end_request(drive, 1, 0); } -static void ide_floppy_callback(ide_drive_t *drive, int dsc) +static int ide_floppy_callback(ide_drive_t *drive, int dsc) { struct ide_disk_obj *floppy = drive->driver_data; struct ide_atapi_pc *pc = drive->pc; @@ -108,14 +108,10 @@ static void ide_floppy_callback(ide_drive_t *drive, int dsc) "Aborting request!\n"); } - if (uptodate == 0) - drive->failed_pc = NULL; - - if (blk_special_request(rq)) { + if (blk_special_request(rq)) rq->errors = uptodate ? 0 : IDE_DRV_ERROR_GENERAL; - ide_complete_rq(drive, 0); - } else - ide_end_request(drive, uptodate, 0); + + return uptodate; } static void ide_floppy_report_error(struct ide_disk_obj *floppy, diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index fc61bbef3bb..a42e49c6cc3 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -463,7 +463,7 @@ static void ide_tape_kfree_buffer(idetape_tape_t *tape) static void ide_tape_handle_dsc(ide_drive_t *); -static void ide_tape_callback(ide_drive_t *drive, int dsc) +static int ide_tape_callback(ide_drive_t *drive, int dsc) { idetape_tape_t *tape = drive->driver_data; struct ide_atapi_pc *pc = drive->pc; @@ -530,13 +530,7 @@ static void ide_tape_callback(ide_drive_t *drive, int dsc) rq->errors = err; - if (uptodate == 0) - drive->failed_pc = NULL; - - if (blk_special_request(rq)) - ide_complete_rq(drive, 0); - else - ide_end_request(drive, uptodate, 0); + return uptodate; } /* -- cgit v1.2.3 From b109f526cabcd098131e770fd6232282bce147b4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:37 +0100 Subject: ide: use blk_fs_request() check in ide-taskfile.c Use blk_fs_request() in ide-taskfile.c instead of checking for: - rq->bio in ide_pio_datablock() and task_error() - rq->cmd_type == REQ_TYPE_ATA_TASKFILE in task_end_request() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index f85b7f21a61..15bbfc1dcd2 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -268,7 +268,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, ide_task_t *task = &drive->hwif->task; u8 saved_io_32bit = drive->io_32bit; - if (rq->bio) /* fs request */ + if (blk_fs_request(rq)) rq->errors = 0; if (task->tf_flags & IDE_TFLAG_IO_16BIT) @@ -292,7 +292,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, const char *s, u8 stat) { - if (rq->bio) { + if (blk_fs_request(rq)) { ide_hwif_t *hwif = drive->hwif; ide_task_t *task = &hwif->task; int sectors = hwif->nsect - hwif->nleft; @@ -323,7 +323,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) { - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { + if (blk_fs_request(rq) == 0) { ide_task_t *task = rq->special; u8 err = ide_read_error(drive); -- cgit v1.2.3 From e6830a86c260d73c6f370aa7ed17ee6c71e5ee05 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:37 +0100 Subject: ide: call ide_build_sglist() prior to ->dma_setup (v2) * Re-map sg table if needed in ide_build_sglist(). * Move ide_build_sglist() call from ->dma_setup to its users. * Un-export ide_build_sglist(). v2: * Build fix for CONFIG_BLK_DEV_IDEDMA=n (noticed by Randy Dunlap). There should be no functional changes caused by this patch. Cc: Randy Dunlap Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/au1xxx-ide.c | 7 +------ drivers/ide/icside.c | 6 ------ drivers/ide/ide-atapi.c | 19 ++++++++++++++----- drivers/ide/ide-dma-sff.c | 4 ---- drivers/ide/ide-dma.c | 5 +++-- drivers/ide/ide-taskfile.c | 1 + drivers/ide/pmac.c | 7 +------ drivers/ide/sgiioc4.c | 10 ++-------- drivers/ide/tx4939ide.c | 4 ---- 9 files changed, 22 insertions(+), 41 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 82f153810eb..3fc3ced8192 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -211,21 +211,16 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA static int auide_build_dmatable(ide_drive_t *drive) { - int i, iswrite, count = 0; ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; _auide_hwif *ahwif = &auide_hwif; struct scatterlist *sg; + int i = hwif->sg_nents, iswrite, count = 0; iswrite = (rq_data_dir(rq) == WRITE); /* Save for interrupt context */ ahwif->drive = drive; - hwif->sg_nents = i = ide_build_sglist(drive, rq); - - if (!i) - return 0; - /* fill the descriptors */ sg = hwif->sg_table; while (i && sg_dma_len(sg)) { diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index cf0522f937c..78fc36f98d2 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -325,12 +325,6 @@ static int icside_dma_setup(ide_drive_t *drive) */ BUG_ON(dma_channel_active(ec->dma)); - hwif->sg_nents = ide_build_sglist(drive, rq); - if (hwif->sg_nents == 0) { - ide_map_sg(drive, rq); - return 1; - } - /* * Ensure that we have the right interrupt routed. */ diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f72b5a67543..2b9ac210667 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -631,18 +631,23 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) struct ide_atapi_pc *pc; ide_hwif_t *hwif = drive->hwif; ide_expiry_t *expiry = NULL; + struct request *rq = hwif->rq; unsigned int timeout; u32 tf_flags; u16 bcount; if (dev_is_idecd(drive)) { tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; - bcount = ide_cd_get_xferlen(hwif->rq); + bcount = ide_cd_get_xferlen(rq); expiry = ide_cd_expiry; timeout = ATAPI_WAIT_PC; - if (drive->dma) - drive->dma = !hwif->dma_ops->dma_setup(drive); + if (drive->dma) { + if (ide_build_sglist(drive, rq)) + drive->dma = !hwif->dma_ops->dma_setup(drive); + else + drive->dma = 0; + } } else { pc = drive->pc; @@ -661,8 +666,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) } if ((pc->flags & PC_FLAG_DMA_OK) && - (drive->dev_flags & IDE_DFLAG_USING_DMA)) - drive->dma = !hwif->dma_ops->dma_setup(drive); + (drive->dev_flags & IDE_DFLAG_USING_DMA)) { + if (ide_build_sglist(drive, rq)) + drive->dma = !hwif->dma_ops->dma_setup(drive); + else + drive->dma = 0; + } if (!drive->dma) pc->flags &= ~PC_FLAG_DMA_OK; diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 123d393658a..22b3e751d19 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c @@ -120,10 +120,6 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq) struct scatterlist *sg; u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); - hwif->sg_nents = ide_build_sglist(drive, rq); - if (hwif->sg_nents == 0) - return 0; - for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { u32 cur_addr, cur_len, xcount, bcount; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index a878f4734f8..12c11b71402 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -138,14 +138,15 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) hwif->sg_dma_direction = DMA_TO_DEVICE; i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); - if (i) { + if (i == 0) + ide_map_sg(drive, rq); + else { hwif->orig_sg_nents = hwif->sg_nents; hwif->sg_nents = i; } return i; } -EXPORT_SYMBOL_GPL(ide_build_sglist); /** * ide_destroy_dmatable - clean up DMA mapping diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 15bbfc1dcd2..925fb924189 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -103,6 +103,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) return ide_started; default: if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || + ide_build_sglist(drive, hwif->rq) == 0 || dma_ops->dma_setup(drive)) return ide_stopped; dma_ops->dma_exec_cmd(drive, tf->command); diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 74625e821a4..904fb54668e 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -1429,10 +1429,10 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); struct dbdma_cmd *table; - int i, count = 0; volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; struct scatterlist *sg; int wr = (rq_data_dir(rq) == WRITE); + int i = hwif->sg_nents, count = 0; /* DMA table is already aligned */ table = (struct dbdma_cmd *) pmif->dma_table_cpu; @@ -1442,11 +1442,6 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) while (readl(&dma->status) & RUN) udelay(1); - hwif->sg_nents = i = ide_build_sglist(drive, rq); - - if (!i) - return 0; - /* Build DBDMA commands list */ sg = hwif->sg_table; while (i && sg_dma_len(sg)) { diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index 1cffe70f385..ab9433a7ad1 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -429,15 +429,9 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) { ide_hwif_t *hwif = drive->hwif; unsigned int *table = hwif->dmatable_cpu; - unsigned int count = 0, i = 1; - struct scatterlist *sg; + unsigned int count = 0, i = hwif->sg_nents; + struct scatterlist *sg = hwif->sg_table; - hwif->sg_nents = i = ide_build_sglist(drive, rq); - - if (!i) - return 0; /* sglist of length Zero */ - - sg = hwif->sg_table; while (i && sg_dma_len(sg)) { dma_addr_t cur_addr; int cur_len; diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index f0033eb2e88..ee86688d846 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -240,10 +240,6 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) int i; struct scatterlist *sg; - hwif->sg_nents = ide_build_sglist(drive, rq); - if (hwif->sg_nents == 0) - return 0; - for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { u32 cur_addr, cur_len, bcount; -- cgit v1.2.3 From 22aa4b32a19b1f231d4ce7e9af6354b577a22a35 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:37 +0100 Subject: ide: remove ide_task_t typedef While at it: - rename struct ide_task_s to struct ide_cmd - remove stale comments from idedisk_{read_native,set}_max_address() - drop unused 'cmd' argument from ide_{cmd,task}_ioctl() - drop unused 'task' argument from tx4939ide_tf_load_fixup() - rename ide_complete_task() to ide_complete_cmd() - use consistent naming for struct ide_cmd variables There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/at91_ide.c | 62 +++++++++---------- drivers/ide/ide-acpi.c | 10 +-- drivers/ide/ide-atapi.c | 42 ++++++------- drivers/ide/ide-disk.c | 121 ++++++++++++++++++------------------ drivers/ide/ide-disk_proc.c | 23 +++---- drivers/ide/ide-eh.c | 6 +- drivers/ide/ide-h8300.c | 62 +++++++++---------- drivers/ide/ide-io-std.c | 62 +++++++++---------- drivers/ide/ide-io.c | 40 ++++++------ drivers/ide/ide-ioctls.c | 44 ++++++------- drivers/ide/ide-iops.c | 30 ++++----- drivers/ide/ide-lib.c | 20 +++--- drivers/ide/ide-park.c | 17 ++--- drivers/ide/ide-pm.c | 32 +++++----- drivers/ide/ide-probe.c | 18 +++--- drivers/ide/ide-proc.c | 16 ++--- drivers/ide/ide-taskfile.c | 148 +++++++++++++++++++++++--------------------- drivers/ide/ns87415.c | 30 ++++----- drivers/ide/scc_pata.c | 62 +++++++++---------- drivers/ide/tx4938ide.c | 62 +++++++++---------- drivers/ide/tx4939ide.c | 75 +++++++++++----------- 21 files changed, 498 insertions(+), 484 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 6eabf9e3129..6be7d87382a 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c @@ -185,55 +185,55 @@ static void ide_mm_outb(u8 value, unsigned long port) writeb(value, (void __iomem *) port); } -static void at91_ide_tf_load(ide_drive_t *drive, ide_task_t *task) +static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; + struct ide_taskfile *tf = &cmd->tf; + u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->tf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->tf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->tf_flags & IDE_FTFLAG_OUT_DATA) { + if (cmd->tf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; at91_ide_output_data(drive, NULL, &data, 2); } - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) ide_mm_outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) ide_mm_outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) ide_mm_outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) ide_mm_outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) ide_mm_outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) ide_mm_outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) ide_mm_outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) ide_mm_outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) ide_mm_outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) ide_mm_outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) ide_mm_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); } -static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task) +static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->tf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->tf_flags & IDE_FTFLAG_IN_DATA) { u16 data; at91_ide_input_data(drive, NULL, &data, 2); @@ -244,31 +244,31 @@ static void at91_ide_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ ide_mm_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = ide_mm_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = ide_mm_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = ide_mm_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = ide_mm_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = ide_mm_inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = ide_mm_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { ide_mm_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = ide_mm_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = ide_mm_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = ide_mm_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = ide_mm_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = ide_mm_inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 5b704f1ea90..12f436951bf 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -304,7 +304,7 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, /* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */ for (ix = 0; ix < gtf_count; ix++) { u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF); - ide_task_t task; + struct ide_cmd cmd; DEBPRINT("(0x1f1-1f7): " "hex: %02x %02x %02x %02x %02x %02x %02x\n", @@ -317,11 +317,11 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, } /* convert GTF to taskfile */ - memset(&task, 0, sizeof(ide_task_t)); - memcpy(&task.tf_array[7], gtf, REGS_PER_GTF); - task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF); + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - err = ide_no_data_taskfile(drive, &task); + err = ide_no_data_taskfile(drive, &cmd); if (err) { printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", __func__, err); diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 2b9ac210667..92c6ef6feb5 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -302,16 +302,16 @@ EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | - IDE_TFLAG_IN_NSECT; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | + IDE_TFLAG_IN_NSECT; - drive->hwif->tp_ops->tf_read(drive, &task); + drive->hwif->tp_ops->tf_read(drive, &cmd); - *bcount = (task.tf.lbah << 8) | task.tf.lbam; - *ireason = task.tf.nsect & 3; + *bcount = (cmd.tf.lbah << 8) | cmd.tf.lbam; + *ireason = cmd.tf.nsect & 3; } EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); @@ -482,32 +482,32 @@ next_irq: static void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount) { ide_hwif_t *hwif = drive->hwif; - ide_task_t task; + struct ide_cmd cmd; u8 dma = drive->dma; - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | - IDE_TFLAG_OUT_FEATURE | tf_flags; - task.tf.feature = dma; /* Use PIO/DMA */ - task.tf.lbam = bcount & 0xff; - task.tf.lbah = (bcount >> 8) & 0xff; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | + IDE_TFLAG_OUT_FEATURE | tf_flags; + cmd.tf.feature = dma; /* Use PIO/DMA */ + cmd.tf.lbam = bcount & 0xff; + cmd.tf.lbah = (bcount >> 8) & 0xff; - ide_tf_dump(drive->name, &task.tf); + ide_tf_dump(drive->name, &cmd.tf); hwif->tp_ops->set_irq(hwif, 1); SELECT_MASK(drive, 0); - hwif->tp_ops->tf_load(drive, &task); + hwif->tp_ops->tf_load(drive, &cmd); } static u8 ide_read_ireason(ide_drive_t *drive) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_IN_NSECT; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_IN_NSECT; - drive->hwif->tp_ops->tf_read(drive, &task); + drive->hwif->tp_ops->tf_read(drive, &cmd); - return task.tf.nsect & 3; + return cmd.tf.nsect & 3; } static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 912be155a8c..6647cb8bd91 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -62,24 +62,24 @@ static const u8 ide_data_phases[] = { TASKFILE_OUT_DMA, }; -static void ide_tf_set_cmd(ide_drive_t *drive, ide_task_t *task, u8 dma) +static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) { u8 index, lba48, write; - lba48 = (task->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; - write = (task->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; + lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; + write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; if (dma) index = 8; else index = drive->mult_count ? 0 : 4; - task->tf.command = ide_rw_cmds[index + lba48 + write]; + cmd->tf.command = ide_rw_cmds[index + lba48 + write]; if (dma) index = 8; /* fixup index */ - task->data_phase = ide_data_phases[index / 2 + write]; + cmd->data_phase = ide_data_phases[index / 2 + write]; } /* @@ -93,8 +93,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, u16 nsectors = (u16)rq->nr_sectors; u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); u8 dma = !!(drive->dev_flags & IDE_DFLAG_USING_DMA); - ide_task_t task; - struct ide_taskfile *tf = &task.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; ide_startstop_t rc; if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { @@ -109,8 +109,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ide_map_sg(drive, rq); } - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (drive->dev_flags & IDE_DFLAG_LBA) { if (lba48) { @@ -129,7 +129,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, tf->lbam = (u8)(block >> 8); tf->lbah = (u8)(block >> 16); - task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); + cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); } else { tf->nsect = nsectors & 0xff; tf->lbal = block; @@ -157,19 +157,19 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, } if (rq_data_dir(rq)) - task.tf_flags |= IDE_TFLAG_WRITE; + cmd.tf_flags |= IDE_TFLAG_WRITE; - ide_tf_set_cmd(drive, &task, dma); - task.rq = rq; + ide_tf_set_cmd(drive, &cmd, dma); + cmd.rq = rq; - rc = do_rw_taskfile(drive, &task); + rc = do_rw_taskfile(drive, &cmd); if (rc == ide_stopped && dma) { /* fallback to PIO */ - task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; - ide_tf_set_cmd(drive, &task, 0); + cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; + ide_tf_set_cmd(drive, &cmd, 0); ide_init_sg_cmd(drive, rq); - rc = do_rw_taskfile(drive, &task); + rc = do_rw_taskfile(drive, &cmd); } return rc; @@ -213,22 +213,22 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, */ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) { - ide_task_t args; - struct ide_taskfile *tf = &args.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; u64 addr = 0; - /* Create IDE/ATA command request structure */ - memset(&args, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); if (lba48) tf->command = ATA_CMD_READ_NATIVE_MAX_EXT; else tf->command = ATA_CMD_READ_NATIVE_MAX; tf->device = ATA_LBA; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (lba48) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); - /* submit command request */ - ide_no_data_taskfile(drive, &args); + cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); + + ide_no_data_taskfile(drive, &cmd); /* if OK, compute maximum address value */ if ((tf->status & 0x01) == 0) @@ -243,13 +243,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) */ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) { - ide_task_t args; - struct ide_taskfile *tf = &args.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; u64 addr_set = 0; addr_req--; - /* Create IDE/ATA command request structure */ - memset(&args, 0, sizeof(ide_task_t)); + + memset(&cmd, 0, sizeof(cmd)); tf->lbal = (addr_req >> 0) & 0xff; tf->lbam = (addr_req >>= 8) & 0xff; tf->lbah = (addr_req >>= 8) & 0xff; @@ -263,11 +263,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) tf->command = ATA_CMD_SET_MAX; } tf->device |= ATA_LBA; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (lba48) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); - /* submit command request */ - ide_no_data_taskfile(drive, &args); + cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); + + ide_no_data_taskfile(drive, &cmd); + /* if OK, compute maximum address value */ if ((tf->status & 0x01) == 0) addr_set = ide_get_lba_addr(tf, lba48) + 1; @@ -386,24 +388,24 @@ static int ide_disk_get_capacity(ide_drive_t *drive) static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) { ide_drive_t *drive = q->queuedata; - ide_task_t *task = kmalloc(sizeof(*task), GFP_ATOMIC); + struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); /* FIXME: map struct ide_taskfile on rq->cmd[] */ - BUG_ON(task == NULL); + BUG_ON(cmd == NULL); - memset(task, 0, sizeof(*task)); + memset(cmd, 0, sizeof(*cmd)); if (ata_id_flush_ext_enabled(drive->id) && (drive->capacity64 >= (1UL << 28))) - task->tf.command = ATA_CMD_FLUSH_EXT; + cmd->tf.command = ATA_CMD_FLUSH_EXT; else - task->tf.command = ATA_CMD_FLUSH; - task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | + cmd->tf.command = ATA_CMD_FLUSH; + cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | IDE_TFLAG_DYN; - task->data_phase = TASKFILE_NO_DATA; + cmd->data_phase = TASKFILE_NO_DATA; rq->cmd_type = REQ_TYPE_ATA_TASKFILE; rq->cmd_flags |= REQ_SOFTBARRIER; - rq->special = task; + rq->special = cmd; } ide_devset_get(multcount, mult_count); @@ -453,15 +455,15 @@ static int set_nowerr(ide_drive_t *drive, int arg) static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); - task.tf.feature = feature; - task.tf.nsect = nsect; - task.tf.command = ATA_CMD_SET_FEATURES; - task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf.feature = feature; + cmd.tf.nsect = nsect; + cmd.tf.command = ATA_CMD_SET_FEATURES; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - return ide_no_data_taskfile(drive, &task); + return ide_no_data_taskfile(drive, &cmd); } static void update_ordered(ide_drive_t *drive) @@ -528,15 +530,16 @@ static int set_wcache(ide_drive_t *drive, int arg) static int do_idedisk_flushcache(ide_drive_t *drive) { - ide_task_t args; + struct ide_cmd cmd; - memset(&args, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); if (ata_id_flush_ext_enabled(drive->id)) - args.tf.command = ATA_CMD_FLUSH_EXT; + cmd.tf.command = ATA_CMD_FLUSH_EXT; else - args.tf.command = ATA_CMD_FLUSH; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - return ide_no_data_taskfile(drive, &args); + cmd.tf.command = ATA_CMD_FLUSH; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + + return ide_no_data_taskfile(drive, &cmd); } ide_devset_get(acoustic, acoustic); @@ -708,17 +711,17 @@ static int ide_disk_init_media(ide_drive_t *drive, struct gendisk *disk) static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk, int on) { - ide_task_t task; + struct ide_cmd cmd; int ret; if ((drive->dev_flags & IDE_DFLAG_DOORLOCKING) == 0) return 0; - memset(&task, 0, sizeof(task)); - task.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; - task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - ret = ide_no_data_taskfile(drive, &task); + ret = ide_no_data_taskfile(drive, &cmd); if (ret) drive->dev_flags &= ~IDE_DFLAG_DOORLOCKING; diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index 5766c1f62ad..afe4f47e9e1 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c @@ -6,33 +6,34 @@ static int smart_enable(ide_drive_t *drive) { - ide_task_t args; - struct ide_taskfile *tf = &args.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; - memset(&args, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); tf->feature = ATA_SMART_ENABLE; tf->lbam = ATA_SMART_LBAM_PASS; tf->lbah = ATA_SMART_LBAH_PASS; tf->command = ATA_CMD_SMART; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - return ide_no_data_taskfile(drive, &args); + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + + return ide_no_data_taskfile(drive, &cmd); } static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) { - ide_task_t args; - struct ide_taskfile *tf = &args.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; - memset(&args, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); tf->feature = sub_cmd; tf->nsect = 0x01; tf->lbam = ATA_SMART_LBAM_PASS; tf->lbah = ATA_SMART_LBAH_PASS; tf->command = ATA_CMD_SMART; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - args.data_phase = TASKFILE_IN; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.data_phase = TASKFILE_IN; - return ide_raw_taskfile(drive, &args, buf, 1); + return ide_raw_taskfile(drive, &cmd, buf, 1); } static int proc_idedisk_read_cache diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index e2c04886616..f6e1a82a3cc 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -125,10 +125,10 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) if (!blk_fs_request(rq)) { rq->errors = 1; if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { - ide_task_t *task = rq->special; + struct ide_cmd *cmd = rq->special; - if (task) - ide_complete_task(drive, task, stat, err); + if (cmd) + ide_complete_cmd(drive, cmd, stat, err); } else if (blk_pm_request(rq)) { ide_complete_pm_rq(drive, rq); return ide_stopped; diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c index 11e937485bf..c7883f23c66 100644 --- a/drivers/ide/ide-h8300.c +++ b/drivers/ide/ide-h8300.c @@ -44,53 +44,53 @@ static u16 mm_inw(unsigned long a) return r; } -static void h8300_tf_load(ide_drive_t *drive, ide_task_t *task) +static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; + struct ide_taskfile *tf = &cmd->tf; + u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) + if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) mm_outw((tf->hob_data << 8) | tf->data, io_ports->data_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) outb((tf->device & HIHI) | drive->select, io_ports->device_addr); } -static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) +static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = mm_inw(io_ports->data_addr); tf->data = data & 0xff; @@ -100,31 +100,31 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index cad59f0bfbc..570c0cc4514 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c @@ -82,24 +82,24 @@ void ide_set_irq(ide_hwif_t *hwif, int on) } EXPORT_SYMBOL_GPL(ide_set_irq); -void ide_tf_load(ide_drive_t *drive, ide_task_t *task) +void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; void (*tf_outb)(u8 addr, unsigned long port); u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; + u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; if (mmio) tf_outb = ide_mm_outb; else tf_outb = ide_outb; - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; if (mmio) @@ -108,39 +108,39 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task) outw(data, io_ports->data_addr); } - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) tf_outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) tf_outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) tf_outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) tf_outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) tf_outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) tf_outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) tf_outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) tf_outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) tf_outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) tf_outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) tf_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); } EXPORT_SYMBOL_GPL(ide_tf_load); -void ide_tf_read(ide_drive_t *drive, ide_task_t *task) +void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; void (*tf_outb)(u8 addr, unsigned long port); u8 (*tf_inb)(unsigned long port); u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; @@ -153,7 +153,7 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) tf_inb = ide_inb; } - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; if (mmio) @@ -168,31 +168,31 @@ void ide_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = tf_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = tf_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = tf_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = tf_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = tf_inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = tf_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { tf_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = tf_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = tf_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = tf_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = tf_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = tf_inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 6eee41beec7..2900271c6dd 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -144,21 +144,21 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, } EXPORT_SYMBOL_GPL(ide_end_dequeued_request); -void ide_complete_task(ide_drive_t *drive, ide_task_t *task, u8 stat, u8 err) +void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) { - struct ide_taskfile *tf = &task->tf; - struct request *rq = task->rq; + struct ide_taskfile *tf = &cmd->tf; + struct request *rq = cmd->rq; tf->error = err; tf->status = stat; - drive->hwif->tp_ops->tf_read(drive, task); + drive->hwif->tp_ops->tf_read(drive, cmd); if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) - memcpy(rq->special, task, sizeof(*task)); + memcpy(rq->special, cmd, sizeof(*cmd)); - if (task->tf_flags & IDE_TFLAG_DYN) - kfree(task); + if (cmd->tf_flags & IDE_TFLAG_DYN) + kfree(cmd); } void ide_complete_rq(ide_drive_t *drive, u8 err) @@ -217,20 +217,20 @@ static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf) static ide_startstop_t ide_disk_special(ide_drive_t *drive) { special_t *s = &drive->special; - ide_task_t args; + struct ide_cmd cmd; - memset(&args, 0, sizeof(ide_task_t)); - args.data_phase = TASKFILE_NO_DATA; + memset(&cmd, 0, sizeof(cmd)); + cmd.data_phase = TASKFILE_NO_DATA; if (s->b.set_geometry) { s->b.set_geometry = 0; - ide_tf_set_specify_cmd(drive, &args.tf); + ide_tf_set_specify_cmd(drive, &cmd.tf); } else if (s->b.recalibrate) { s->b.recalibrate = 0; - ide_tf_set_restore_cmd(drive, &args.tf); + ide_tf_set_restore_cmd(drive, &cmd.tf); } else if (s->b.set_multmode) { s->b.set_multmode = 0; - ide_tf_set_setmult_cmd(drive, &args.tf); + ide_tf_set_setmult_cmd(drive, &cmd.tf); } else if (s->all) { int special = s->all; s->all = 0; @@ -238,10 +238,10 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) return ide_stopped; } - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | - IDE_TFLAG_CUSTOM_HANDLER; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | + IDE_TFLAG_CUSTOM_HANDLER; - do_rw_taskfile(drive, &args); + do_rw_taskfile(drive, &cmd); return ide_started; } @@ -315,10 +315,10 @@ EXPORT_SYMBOL_GPL(ide_init_sg_cmd); static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq) { - ide_task_t *task = rq->special; + struct ide_cmd *cmd = rq->special; - if (task) { - switch (task->data_phase) { + if (cmd) { + switch (cmd->data_phase) { case TASKFILE_MULTI_OUT: case TASKFILE_OUT: case TASKFILE_MULTI_IN: @@ -329,7 +329,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, break; } - return do_rw_taskfile(drive, task); + return do_rw_taskfile(drive, cmd); } /* diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 1be263eb9c0..4953028a13d 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c @@ -111,13 +111,13 @@ static int ide_set_nice_ioctl(ide_drive_t *drive, unsigned long arg) return 0; } -static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) +static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) { u8 *buf = NULL; int bufsize = 0, err = 0; u8 args[4], xfer_rate = 0; - ide_task_t tfargs; - struct ide_taskfile *tf = &tfargs.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; u16 *id = drive->id; if (NULL == (void *) arg) { @@ -134,24 +134,24 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) if (copy_from_user(args, (void __user *)arg, 4)) return -EFAULT; - memset(&tfargs, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); tf->feature = args[2]; if (args[0] == ATA_CMD_SMART) { tf->nsect = args[3]; tf->lbal = args[1]; tf->lbam = 0x4f; tf->lbah = 0xc2; - tfargs.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; + cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; } else { tf->nsect = args[1]; - tfargs.tf_flags = IDE_TFLAG_OUT_FEATURE | - IDE_TFLAG_OUT_NSECT | IDE_TFLAG_IN_NSECT; + cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | + IDE_TFLAG_IN_NSECT; } tf->command = args[0]; - tfargs.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; + cmd.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; if (args[3]) { - tfargs.tf_flags |= IDE_TFLAG_IO_16BIT; + cmd.tf_flags |= IDE_TFLAG_IO_16BIT; bufsize = SECTOR_SIZE * args[3]; buf = kzalloc(bufsize, GFP_KERNEL); if (buf == NULL) @@ -172,7 +172,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) } } - err = ide_raw_taskfile(drive, &tfargs, buf, args[3]); + err = ide_raw_taskfile(drive, &cmd, buf, args[3]); args[0] = tf->status; args[1] = tf->error; @@ -194,25 +194,25 @@ abort: return err; } -static int ide_task_ioctl(ide_drive_t *drive, unsigned cmd, unsigned long arg) +static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg) { void __user *p = (void __user *)arg; int err = 0; u8 args[7]; - ide_task_t task; + struct ide_cmd cmd; if (copy_from_user(args, p, 7)) return -EFAULT; - memset(&task, 0, sizeof(task)); - memcpy(&task.tf_array[7], &args[1], 6); - task.tf.command = args[0]; - task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + memcpy(&cmd.tf_array[7], &args[1], 6); + cmd.tf.command = args[0]; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - err = ide_no_data_taskfile(drive, &task); + err = ide_no_data_taskfile(drive, &cmd); - args[0] = task.tf.command; - memcpy(&args[1], &task.tf_array[7], 6); + args[0] = cmd.tf.command; + memcpy(&args[1], &cmd.tf_array[7], 6); if (copy_to_user(p, args, 7)) err = -EFAULT; @@ -262,17 +262,17 @@ int generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev, if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) return -EACCES; if (drive->media == ide_disk) - return ide_taskfile_ioctl(drive, cmd, arg); + return ide_taskfile_ioctl(drive, arg); return -ENOMSG; #endif case HDIO_DRIVE_CMD: if (!capable(CAP_SYS_RAWIO)) return -EACCES; - return ide_cmd_ioctl(drive, cmd, arg); + return ide_cmd_ioctl(drive, arg); case HDIO_DRIVE_TASK: if (!capable(CAP_SYS_RAWIO)) return -EACCES; - return ide_task_ioctl(drive, cmd, arg); + return ide_task_ioctl(drive, arg); case HDIO_DRIVE_RESET: if (!capable(CAP_SYS_ADMIN)) return -EACCES; diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 317c5dadd7c..c3023de7270 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -31,15 +31,15 @@ void SELECT_DRIVE(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; const struct ide_port_ops *port_ops = hwif->port_ops; - ide_task_t task; + struct ide_cmd cmd; if (port_ops && port_ops->selectproc) port_ops->selectproc(drive); - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_OUT_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_OUT_DEVICE; - drive->hwif->tp_ops->tf_load(drive, &task); + drive->hwif->tp_ops->tf_load(drive, &cmd); } void SELECT_MASK(ide_drive_t *drive, int mask) @@ -52,14 +52,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask) u8 ide_read_error(ide_drive_t *drive) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_IN_FEATURE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_IN_FEATURE; - drive->hwif->tp_ops->tf_read(drive, &task); + drive->hwif->tp_ops->tf_read(drive, &cmd); - return task.tf.error; + return cmd.tf.error; } EXPORT_SYMBOL_GPL(ide_read_error); @@ -329,7 +329,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) u16 *id = drive->id, i; int error = 0; u8 stat; - ide_task_t task; + struct ide_cmd cmd; #ifdef CONFIG_BLK_DEV_IDEDMA if (hwif->dma_ops) /* check if host supports DMA */ @@ -361,12 +361,12 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) udelay(1); tp_ops->set_irq(hwif, 0); - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; - task.tf.feature = SETFEATURES_XFER; - task.tf.nsect = speed; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; + cmd.tf.feature = SETFEATURES_XFER; + cmd.tf.nsect = speed; - tp_ops->tf_load(drive, &task); + tp_ops->tf_load(drive, &cmd); tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES); diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index f6c683dd298..217b7fdf2b1 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -34,19 +34,19 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) static void ide_dump_opcode(ide_drive_t *drive) { struct request *rq = drive->hwif->rq; - ide_task_t *task = NULL; + struct ide_cmd *cmd = NULL; if (!rq) return; if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) - task = rq->special; + cmd = rq->special; printk(KERN_ERR "ide: failed opcode was: "); - if (task == NULL) + if (cmd == NULL) printk(KERN_CONT "unknown\n"); else - printk(KERN_CONT "0x%02x\n", task->tf.command); + printk(KERN_CONT "0x%02x\n", cmd->tf.command); } u64 ide_get_lba_addr(struct ide_taskfile *tf, int lba48) @@ -66,18 +66,18 @@ EXPORT_SYMBOL_GPL(ide_get_lba_addr); static void ide_dump_sector(ide_drive_t *drive) { - ide_task_t task; - struct ide_taskfile *tf = &task.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); - memset(&task, 0, sizeof(task)); + memset(&cmd, 0, sizeof(cmd)); if (lba48) - task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | + cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | IDE_TFLAG_LBA48; else - task.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; + cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; - drive->hwif->tp_ops->tf_read(drive, &task); + drive->hwif->tp_ops->tf_read(drive, &cmd); if (lba48 || (tf->device & ATA_LBA)) printk(KERN_CONT ", LBAsect=%llu", diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index cddc7c77876..63c77f99a72 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c @@ -63,10 +63,10 @@ out: ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) { - ide_task_t task; - struct ide_taskfile *tf = &task.tf; + struct ide_cmd cmd; + struct ide_taskfile *tf = &cmd.tf; - memset(&task, 0, sizeof(task)); + memset(&cmd, 0, sizeof(cmd)); if (rq->cmd[0] == REQ_PARK_HEADS) { drive->sleep = *(unsigned long *)rq->special; drive->dev_flags |= IDE_DFLAG_SLEEPING; @@ -75,14 +75,15 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) tf->lbal = 0x4c; tf->lbam = 0x4e; tf->lbah = 0x55; - task.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; + cmd.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; } else /* cmd == REQ_UNPARK_HEADS */ tf->command = ATA_CMD_CHK_POWER; - task.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - task.rq = rq; - task.data_phase = TASKFILE_NO_DATA; - return do_rw_taskfile(drive, &task); + cmd.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.rq = rq; + cmd.data_phase = TASKFILE_NO_DATA; + + return do_rw_taskfile(drive, &cmd); } ssize_t ide_park_show(struct device *dev, struct device_attribute *attr, diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 74c7c2bbe0f..5c9fc20f95b 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c @@ -8,7 +8,7 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) ide_hwif_t *hwif = drive->hwif; struct request *rq; struct request_pm_state rqpm; - ide_task_t args; + struct ide_cmd cmd; int ret; /* call ACPI _GTM only once */ @@ -16,10 +16,10 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) ide_acpi_get_timing(hwif); memset(&rqpm, 0, sizeof(rqpm)); - memset(&args, 0, sizeof(args)); + memset(&cmd, 0, sizeof(cmd)); rq = blk_get_request(drive->queue, READ, __GFP_WAIT); rq->cmd_type = REQ_TYPE_PM_SUSPEND; - rq->special = &args; + rq->special = &cmd; rq->data = &rqpm; rqpm.pm_step = IDE_PM_START_SUSPEND; if (mesg.event == PM_EVENT_PRETHAW) @@ -42,7 +42,7 @@ int generic_ide_resume(struct device *dev) ide_hwif_t *hwif = drive->hwif; struct request *rq; struct request_pm_state rqpm; - ide_task_t args; + struct ide_cmd cmd; int err; /* call ACPI _PS0 / _STM only once */ @@ -54,11 +54,11 @@ int generic_ide_resume(struct device *dev) ide_acpi_exec_tfs(drive); memset(&rqpm, 0, sizeof(rqpm)); - memset(&args, 0, sizeof(args)); + memset(&cmd, 0, sizeof(cmd)); rq = blk_get_request(drive->queue, READ, __GFP_WAIT); rq->cmd_type = REQ_TYPE_PM_RESUME; rq->cmd_flags |= REQ_PREEMPT; - rq->special = &args; + rq->special = &cmd; rq->data = &rqpm; rqpm.pm_step = IDE_PM_START_RESUME; rqpm.pm_state = PM_EVENT_ON; @@ -109,9 +109,9 @@ void ide_complete_power_step(ide_drive_t *drive, struct request *rq) ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) { struct request_pm_state *pm = rq->data; - ide_task_t *args = rq->special; + struct ide_cmd *cmd = rq->special; - memset(args, 0, sizeof(*args)); + memset(cmd, 0, sizeof(*cmd)); switch (pm->pm_step) { case IDE_PM_FLUSH_CACHE: /* Suspend step 1 (flush cache) */ @@ -124,12 +124,12 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) return ide_stopped; } if (ata_id_flush_ext_enabled(drive->id)) - args->tf.command = ATA_CMD_FLUSH_EXT; + cmd->tf.command = ATA_CMD_FLUSH_EXT; else - args->tf.command = ATA_CMD_FLUSH; + cmd->tf.command = ATA_CMD_FLUSH; goto out_do_tf; case IDE_PM_STANDBY: /* Suspend step 2 (standby) */ - args->tf.command = ATA_CMD_STANDBYNOW1; + cmd->tf.command = ATA_CMD_STANDBYNOW1; goto out_do_tf; case IDE_PM_RESTORE_PIO: /* Resume step 1 (restore PIO) */ ide_set_max_pio(drive); @@ -142,7 +142,7 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) ide_complete_power_step(drive, rq); return ide_stopped; case IDE_PM_IDLE: /* Resume step 2 (idle) */ - args->tf.command = ATA_CMD_IDLEIMMEDIATE; + cmd->tf.command = ATA_CMD_IDLEIMMEDIATE; goto out_do_tf; case IDE_PM_RESTORE_DMA: /* Resume step 3 (restore DMA) */ /* @@ -160,12 +160,14 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) } pm->pm_step = IDE_PM_COMPLETED; + return ide_stopped; out_do_tf: - args->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - args->data_phase = TASKFILE_NO_DATA; - return do_rw_taskfile(drive, args); + cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd->data_phase = TASKFILE_NO_DATA; + + return do_rw_taskfile(drive, cmd); } /** diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 335322f40c5..548864510ba 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -283,13 +283,13 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id) * identify command to be sure of reply */ if (cmd == ATA_CMD_ID_ATAPI) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); + memset(&cmd, 0, sizeof(cmd)); /* disable DMA & overlap */ - task.tf_flags = IDE_TFLAG_OUT_FEATURE; + cmd.tf_flags = IDE_TFLAG_OUT_FEATURE; - tp_ops->tf_load(drive, &task); + tp_ops->tf_load(drive, &cmd); } /* ask drive for ID */ @@ -337,14 +337,14 @@ int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) static u8 ide_read_device(ide_drive_t *drive) { - ide_task_t task; + struct ide_cmd cmd; - memset(&task, 0, sizeof(task)); - task.tf_flags = IDE_TFLAG_IN_DEVICE; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf_flags = IDE_TFLAG_IN_DEVICE; - drive->hwif->tp_ops->tf_read(drive, &task); + drive->hwif->tp_ops->tf_read(drive, &cmd); - return task.tf.device; + return cmd.tf.device; } /** diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 417cde56eaf..10a88bf3eef 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c @@ -194,20 +194,20 @@ ide_devset_get(xfer_rate, current_speed); static int set_xfer_rate (ide_drive_t *drive, int arg) { - ide_task_t task; + struct ide_cmd cmd; int err; if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) return -EINVAL; - memset(&task, 0, sizeof(task)); - task.tf.command = ATA_CMD_SET_FEATURES; - task.tf.feature = SETFEATURES_XFER; - task.tf.nsect = (u8)arg; - task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | - IDE_TFLAG_IN_NSECT; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf.command = ATA_CMD_SET_FEATURES; + cmd.tf.feature = SETFEATURES_XFER; + cmd.tf.nsect = (u8)arg; + cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | + IDE_TFLAG_IN_NSECT; - err = ide_no_data_taskfile(drive, &task); + err = ide_no_data_taskfile(drive, &cmd); if (!err) { ide_set_xfer_rate(drive, (u8) arg); diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 925fb924189..2b85c137764 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -39,33 +39,34 @@ void ide_tf_dump(const char *s, struct ide_taskfile *tf) int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) { - ide_task_t args; + struct ide_cmd cmd; - memset(&args, 0, sizeof(ide_task_t)); - args.tf.nsect = 0x01; + memset(&cmd, 0, sizeof(cmd)); + cmd.tf.nsect = 0x01; if (drive->media == ide_disk) - args.tf.command = ATA_CMD_ID_ATA; + cmd.tf.command = ATA_CMD_ID_ATA; else - args.tf.command = ATA_CMD_ID_ATAPI; - args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - args.data_phase = TASKFILE_IN; - return ide_raw_taskfile(drive, &args, buf, 1); + cmd.tf.command = ATA_CMD_ID_ATAPI; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.data_phase = TASKFILE_IN; + + return ide_raw_taskfile(drive, &cmd, buf, 1); } static ide_startstop_t task_no_data_intr(ide_drive_t *); static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); static ide_startstop_t task_in_intr(ide_drive_t *); -ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) +ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; ide_handler_t *handler = NULL; const struct ide_tp_ops *tp_ops = hwif->tp_ops; const struct ide_dma_ops *dma_ops = hwif->dma_ops; - if (task->data_phase == TASKFILE_MULTI_IN || - task->data_phase == TASKFILE_MULTI_OUT) { + if (cmd->data_phase == TASKFILE_MULTI_IN || + cmd->data_phase == TASKFILE_MULTI_OUT) { if (!drive->mult_count) { printk(KERN_ERR "%s: multimode not set!\n", drive->name); @@ -73,24 +74,24 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) } } - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) - task->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) + cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; - memcpy(&hwif->task, task, sizeof(*task)); + memcpy(&hwif->cmd, cmd, sizeof(*cmd)); - if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { + if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { ide_tf_dump(drive->name, tf); tp_ops->set_irq(hwif, 1); SELECT_MASK(drive, 0); - tp_ops->tf_load(drive, task); + tp_ops->tf_load(drive, cmd); } - switch (task->data_phase) { + switch (cmd->data_phase) { case TASKFILE_MULTI_OUT: case TASKFILE_OUT: tp_ops->exec_command(hwif, tf->command); ndelay(400); /* FIXME */ - return pre_task_out_intr(drive, task->rq); + return pre_task_out_intr(drive, cmd->rq); case TASKFILE_MULTI_IN: case TASKFILE_IN: handler = task_in_intr; @@ -119,9 +120,9 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile); static ide_startstop_t task_no_data_intr(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; - ide_task_t *task = &hwif->task; - struct ide_taskfile *tf = &task->tf; - int custom = (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0; + struct ide_cmd *cmd = &hwif->cmd; + struct ide_taskfile *tf = &cmd->tf; + int custom = (cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) ? 1 : 0; int retries = (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) ? 5 : 1; u8 stat; @@ -151,7 +152,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) } if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) { - hwif->tp_ops->tf_read(drive, task); + hwif->tp_ops->tf_read(drive, cmd); if (tf->lbal != 0xc4) { printk(KERN_ERR "%s: head unload failed!\n", drive->name); @@ -169,7 +170,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) ide_complete_pm_rq(drive, rq); else { if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) - ide_complete_task(drive, task, stat, err); + ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); } } @@ -266,18 +267,18 @@ static void ide_pio_multi(ide_drive_t *drive, struct request *rq, static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, unsigned int write) { - ide_task_t *task = &drive->hwif->task; + struct ide_cmd *cmd = &drive->hwif->cmd; u8 saved_io_32bit = drive->io_32bit; if (blk_fs_request(rq)) rq->errors = 0; - if (task->tf_flags & IDE_TFLAG_IO_16BIT) + if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) drive->io_32bit = 0; touch_softlockup_watchdog(); - switch (task->data_phase) { + switch (cmd->data_phase) { case TASKFILE_MULTI_IN: case TASKFILE_MULTI_OUT: ide_pio_multi(drive, rq, write); @@ -295,10 +296,10 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, { if (blk_fs_request(rq)) { ide_hwif_t *hwif = drive->hwif; - ide_task_t *task = &hwif->task; + struct ide_cmd *cmd = &hwif->cmd; int sectors = hwif->nsect - hwif->nleft; - switch (task->data_phase) { + switch (cmd->data_phase) { case TASKFILE_IN: if (hwif->nleft) break; @@ -325,11 +326,11 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) { if (blk_fs_request(rq) == 0) { - ide_task_t *task = rq->special; + struct ide_cmd *cmd = rq->special; u8 err = ide_read_error(drive); - if (task) - ide_complete_task(drive, task, stat, err); + if (cmd) + ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); return; } @@ -420,14 +421,14 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) { - ide_task_t *task = &drive->hwif->task; + struct ide_cmd *cmd = &drive->hwif->cmd; ide_startstop_t startstop; if (ide_wait_stat(&startstop, drive, ATA_DRQ, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", drive->name, - task->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", + cmd->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); return startstop; } @@ -441,7 +442,8 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) return ide_started; } -int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) +int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf, + u16 nsect) { struct request *rq; int error; @@ -459,11 +461,11 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) rq->hard_nr_sectors = rq->nr_sectors = nsect; rq->hard_cur_sectors = rq->current_nr_sectors = nsect; - if (task->tf_flags & IDE_TFLAG_WRITE) + if (cmd->tf_flags & IDE_TFLAG_WRITE) rq->cmd_flags |= REQ_RW; - rq->special = task; - task->rq = rq; + rq->special = cmd; + cmd->rq = rq; error = blk_execute_rq(drive->queue, NULL, rq, 0); blk_put_request(rq); @@ -473,19 +475,19 @@ int ide_raw_taskfile(ide_drive_t *drive, ide_task_t *task, u8 *buf, u16 nsect) EXPORT_SYMBOL(ide_raw_taskfile); -int ide_no_data_taskfile(ide_drive_t *drive, ide_task_t *task) +int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) { - task->data_phase = TASKFILE_NO_DATA; + cmd->data_phase = TASKFILE_NO_DATA; - return ide_raw_taskfile(drive, task, NULL, 0); + return ide_raw_taskfile(drive, cmd, NULL, 0); } EXPORT_SYMBOL_GPL(ide_no_data_taskfile); #ifdef CONFIG_IDE_TASK_IOCTL -int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) +int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) { ide_task_request_t *req_task; - ide_task_t args; + struct ide_cmd cmd; u8 *outbuf = NULL; u8 *inbuf = NULL; u8 *data_buf = NULL; @@ -539,51 +541,53 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) } } - memset(&args, 0, sizeof(ide_task_t)); + memset(&cmd, 0, sizeof(cmd)); - memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); - memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); + memcpy(&cmd.tf_array[0], req_task->hob_ports, + HDIO_DRIVE_HOB_HDR_SIZE - 2); + memcpy(&cmd.tf_array[6], req_task->io_ports, + HDIO_DRIVE_TASK_HDR_SIZE); - args.data_phase = req_task->data_phase; + cmd.data_phase = req_task->data_phase; + cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | + IDE_TFLAG_IN_TF; - args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | - IDE_TFLAG_IN_TF; if (drive->dev_flags & IDE_DFLAG_LBA48) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); + cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); if (req_task->out_flags.all) { - args.ftf_flags |= IDE_FTFLAG_FLAGGED; + cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; if (req_task->out_flags.b.data) - args.ftf_flags |= IDE_FTFLAG_OUT_DATA; + cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; if (req_task->out_flags.b.nsector_hob) - args.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; + cmd.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; if (req_task->out_flags.b.sector_hob) - args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; + cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; if (req_task->out_flags.b.lcyl_hob) - args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; + cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; if (req_task->out_flags.b.hcyl_hob) - args.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; + cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; if (req_task->out_flags.b.error_feature) - args.tf_flags |= IDE_TFLAG_OUT_FEATURE; + cmd.tf_flags |= IDE_TFLAG_OUT_FEATURE; if (req_task->out_flags.b.nsector) - args.tf_flags |= IDE_TFLAG_OUT_NSECT; + cmd.tf_flags |= IDE_TFLAG_OUT_NSECT; if (req_task->out_flags.b.sector) - args.tf_flags |= IDE_TFLAG_OUT_LBAL; + cmd.tf_flags |= IDE_TFLAG_OUT_LBAL; if (req_task->out_flags.b.lcyl) - args.tf_flags |= IDE_TFLAG_OUT_LBAM; + cmd.tf_flags |= IDE_TFLAG_OUT_LBAM; if (req_task->out_flags.b.hcyl) - args.tf_flags |= IDE_TFLAG_OUT_LBAH; + cmd.tf_flags |= IDE_TFLAG_OUT_LBAH; } else { - args.tf_flags |= IDE_TFLAG_OUT_TF; - if (args.tf_flags & IDE_TFLAG_LBA48) - args.tf_flags |= IDE_TFLAG_OUT_HOB; + cmd.tf_flags |= IDE_TFLAG_OUT_TF; + if (cmd.tf_flags & IDE_TFLAG_LBA48) + cmd.tf_flags |= IDE_TFLAG_OUT_HOB; } if (req_task->in_flags.b.data) - args.ftf_flags |= IDE_FTFLAG_IN_DATA; + cmd.ftf_flags |= IDE_FTFLAG_IN_DATA; switch(req_task->data_phase) { case TASKFILE_MULTI_OUT: @@ -630,7 +634,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) if (req_task->req_cmd == IDE_DRIVE_TASK_NO_DATA) nsect = 0; else if (!nsect) { - nsect = (args.tf.hob_nsect << 8) | args.tf.nsect; + nsect = (cmd.tf.hob_nsect << 8) | cmd.tf.nsect; if (!nsect) { printk(KERN_ERR "%s: in/out command without data\n", @@ -641,14 +645,16 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) } if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) - args.tf_flags |= IDE_TFLAG_WRITE; + cmd.tf_flags |= IDE_TFLAG_WRITE; - err = ide_raw_taskfile(drive, &args, data_buf, nsect); + err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); - memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2); - memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE); + memcpy(req_task->hob_ports, &cmd.tf_array[0], + HDIO_DRIVE_HOB_HDR_SIZE - 2); + memcpy(req_task->io_ports, &cmd.tf_array[6], + HDIO_DRIVE_TASK_HDR_SIZE); - if ((args.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && + if ((cmd.ftf_flags & IDE_FTFLAG_SET_IN_FLAGS) && req_task->in_flags.all == 0) { req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; if (drive->dev_flags & IDE_DFLAG_LBA48) diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index 159eb39c793..d93c8001632 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c @@ -61,12 +61,12 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif) return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); } -static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) +static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { struct ide_io_ports *io_ports = &drive->hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = inw(io_ports->data_addr); tf->data = data & 0xff; @@ -76,31 +76,31 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = superio_ide_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 82929c725d8..d6336753bd2 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -666,52 +666,52 @@ static int __devinit init_setup_scc(struct pci_dev *dev, return rc; } -static void scc_tf_load(ide_drive_t *drive, ide_task_t *task) +static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { struct ide_io_ports *io_ports = &drive->hwif->io_ports; - struct ide_taskfile *tf = &task->tf; - u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; + struct ide_taskfile *tf = &cmd->tf; + u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) + if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) out_be32((void *)io_ports->data_addr, (tf->hob_data << 8) | tf->data); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) scc_ide_outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) scc_ide_outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) scc_ide_outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) scc_ide_outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) scc_ide_outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) scc_ide_outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) scc_ide_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); } -static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) +static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { struct ide_io_ports *io_ports = &drive->hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data = (u16)in_be32((void *)io_ports->data_addr); tf->data = data & 0xff; @@ -721,31 +721,31 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = scc_ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = scc_ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = scc_ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = scc_ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = scc_ide_inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = scc_ide_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { scc_ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = scc_ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index 6b51e0c58af..947596d3620 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c @@ -82,57 +82,57 @@ static void tx4938ide_outb(u8 value, unsigned long port) __raw_writeb(value, (void __iomem *)port); } -static void tx4938ide_tf_load(ide_drive_t *drive, ide_task_t *task) +static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; - u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; + struct ide_taskfile *tf = &cmd->tf; + u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; /* no endian swap */ __raw_writew(data, (void __iomem *)io_ports->data_addr); } - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) tx4938ide_outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) tx4938ide_outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) tx4938ide_outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) tx4938ide_outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) tx4938ide_outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) tx4938ide_outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) tx4938ide_outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) tx4938ide_outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) tx4938ide_outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) tx4938ide_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); } -static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) +static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; /* no endian swap */ @@ -144,32 +144,32 @@ static void tx4938ide_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ tx4938ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = tx4938ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = tx4938ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = tx4938ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = tx4938ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = tx4938ide_inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = tx4938ide_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { tx4938ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = tx4938ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = tx4938ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = tx4938ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = tx4938ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = tx4938ide_inb(io_ports->lbah_addr); } } diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index ee86688d846..bf11791476f 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -435,7 +435,7 @@ static int tx4939ide_init_dma(ide_hwif_t *hwif, const struct ide_port_info *d) return ide_allocate_dma_engine(hwif); } -static void tx4939ide_tf_load_fixup(ide_drive_t *drive, ide_task_t *task) +static void tx4939ide_tf_load_fixup(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; void __iomem *base = TX4939IDE_BASE(hwif); @@ -463,59 +463,59 @@ static void tx4939ide_outb(u8 value, unsigned long port) __raw_writeb(value, (void __iomem *)port); } -static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) +static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; - u8 HIHI = task->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; + struct ide_taskfile *tf = &cmd->tf; + u8 HIHI = cmd->tf_flags & IDE_TFLAG_LBA48 ? 0xE0 : 0xEF; - if (task->ftf_flags & IDE_FTFLAG_FLAGGED) + if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) HIHI = 0xFF; - if (task->ftf_flags & IDE_FTFLAG_OUT_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) { u16 data = (tf->hob_data << 8) | tf->data; /* no endian swap */ __raw_writew(data, (void __iomem *)io_ports->data_addr); } - if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) tx4939ide_outb(tf->hob_nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) tx4939ide_outb(tf->hob_lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) tx4939ide_outb(tf->hob_lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) tx4939ide_outb(tf->hob_lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) tx4939ide_outb(tf->feature, io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_OUT_NSECT) + if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) tx4939ide_outb(tf->nsect, io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAL) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) tx4939ide_outb(tf->lbal, io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAM) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) tx4939ide_outb(tf->lbam, io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_OUT_LBAH) + if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) tx4939ide_outb(tf->lbah, io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) { + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) { tx4939ide_outb((tf->device & HIHI) | drive->select, io_ports->device_addr); - tx4939ide_tf_load_fixup(drive, task); + tx4939ide_tf_load_fixup(drive); } } -static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) +static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct ide_io_ports *io_ports = &hwif->io_ports; - struct ide_taskfile *tf = &task->tf; + struct ide_taskfile *tf = &cmd->tf; - if (task->ftf_flags & IDE_FTFLAG_IN_DATA) { + if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) { u16 data; /* no endian swap */ @@ -527,32 +527,32 @@ static void tx4939ide_tf_read(ide_drive_t *drive, ide_task_t *task) /* be sure we're looking at the low order bits */ tx4939ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_FEATURE) tf->feature = tx4939ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) tf->nsect = tx4939ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) tf->lbal = tx4939ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) tf->lbam = tx4939ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) tf->lbah = tx4939ide_inb(io_ports->lbah_addr); - if (task->tf_flags & IDE_TFLAG_IN_DEVICE) + if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) tf->device = tx4939ide_inb(io_ports->device_addr); - if (task->tf_flags & IDE_TFLAG_LBA48) { + if (cmd->tf_flags & IDE_TFLAG_LBA48) { tx4939ide_outb(ATA_DEVCTL_OBS | 0x80, io_ports->ctl_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) tf->hob_feature = tx4939ide_inb(io_ports->feature_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) tf->hob_nsect = tx4939ide_inb(io_ports->nsect_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) tf->hob_lbal = tx4939ide_inb(io_ports->lbal_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) tf->hob_lbam = tx4939ide_inb(io_ports->lbam_addr); - if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) + if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) tf->hob_lbah = tx4939ide_inb(io_ports->lbah_addr); } } @@ -599,11 +599,12 @@ static const struct ide_tp_ops tx4939ide_tp_ops = { #else /* __LITTLE_ENDIAN */ -static void tx4939ide_tf_load(ide_drive_t *drive, ide_task_t *task) +static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) { - ide_tf_load(drive, task); - if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) - tx4939ide_tf_load_fixup(drive, task); + ide_tf_load(drive, cmd); + + if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) + tx4939ide_tf_load_fixup(drive); } static const struct ide_tp_ops tx4939ide_tp_ops = { -- cgit v1.2.3 From adb1af9803d167091c2cb4de14014185054bfe2c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:38 +0100 Subject: ide: pass command instead of request to ide_pio_datablock() * Add IDE_TFLAG_FS taskfile flag and set it for REQ_TYPE_FS requests. * Convert ->{in,out}put_data methods to take command instead of request as an argument. Then convert pre_task_out_intr(), task_end_request(), task_error(), task_in_unexpected(), ide_pio_sector(), ide_pio_multi() and ide_pio_datablock() in similar way. * Rename task_end_request() to ide_finish_cmd(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/at91_ide.c | 4 +-- drivers/ide/au1xxx-ide.c | 4 +-- drivers/ide/falconide.c | 8 ++--- drivers/ide/ide-disk.c | 2 ++ drivers/ide/ide-dma.c | 4 +-- drivers/ide/ide-h8300.c | 4 +-- drivers/ide/ide-io-std.c | 4 +-- drivers/ide/ide-taskfile.c | 88 ++++++++++++++++++++++------------------------ drivers/ide/q40ide.c | 8 ++--- drivers/ide/scc_pata.c | 4 +-- drivers/ide/tx4938ide.c | 4 +-- 11 files changed, 67 insertions(+), 67 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c index 6be7d87382a..27547121daf 100644 --- a/drivers/ide/at91_ide.c +++ b/drivers/ide/at91_ide.c @@ -143,7 +143,7 @@ static void apply_timings(const u8 chipselect, const u8 pio, set_smc_timings(chipselect, cycle, setup, pulse, data_float, use_iordy); } -static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, +static void at91_ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { ide_hwif_t *hwif = drive->hwif; @@ -160,7 +160,7 @@ static void at91_ide_input_data(ide_drive_t *drive, struct request *rq, leave_16bit(chipselect, mode); } -static void at91_ide_output_data(ide_drive_t *drive, struct request *rq, +static void at91_ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { ide_hwif_t *hwif = drive->hwif; diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 3fc3ced8192..72d7d615e1f 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -86,13 +86,13 @@ void auide_outsw(unsigned long port, void *addr, u32 count) ctp->cur_ptr = au1xxx_ddma_get_nextptr_virt(dp); } -static void au1xxx_input_data(ide_drive_t *drive, struct request *rq, +static void au1xxx_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { auide_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); } -static void au1xxx_output_data(ide_drive_t *drive, struct request *rq, +static void au1xxx_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { auide_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); diff --git a/drivers/ide/falconide.c b/drivers/ide/falconide.c index 6085feb1fae..b368a5effc3 100644 --- a/drivers/ide/falconide.c +++ b/drivers/ide/falconide.c @@ -62,23 +62,23 @@ static void falconide_get_lock(irq_handler_t handler, void *data) } } -static void falconide_input_data(ide_drive_t *drive, struct request *rq, +static void falconide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; - if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) + if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) return insw(data_addr, buf, (len + 1) / 2); raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } -static void falconide_output_data(ide_drive_t *drive, struct request *rq, +static void falconide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; - if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) + if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) return outsw(data_addr, buf, (len + 1) / 2); raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6647cb8bd91..f1555dd4e6a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -156,6 +156,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, tf->device = head; } + cmd.tf_flags |= IDE_TFLAG_FS; + if (rq_data_dir(rq)) cmd.tf_flags |= IDE_TFLAG_WRITE; diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 12c11b71402..54f17ae9225 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -96,9 +96,9 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { if (!dma_stat) { - struct request *rq = hwif->rq; + struct ide_cmd *cmd = &hwif->cmd; - task_end_request(drive, rq, stat); + ide_finish_cmd(drive, cmd, stat); return ide_stopped; } printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c index c7883f23c66..ff8339ed59a 100644 --- a/drivers/ide/ide-h8300.c +++ b/drivers/ide/ide-h8300.c @@ -143,13 +143,13 @@ static void mm_insw(unsigned long addr, void *buf, u32 len) *bp = bswap(*(volatile u16 *)addr); } -static void h8300_input_data(ide_drive_t *drive, struct request *rq, +static void h8300_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { mm_insw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); } -static void h8300_output_data(ide_drive_t *drive, struct request *rq, +static void h8300_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { mm_outsw(drive->hwif->io_ports.data_addr, buf, (len + 1) / 2); diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 570c0cc4514..2d9c6dc3f95 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c @@ -219,7 +219,7 @@ static void ata_vlb_sync(unsigned long port) * so if an odd len is specified, be sure that there's at least one * extra byte allocated for the buffer. */ -void ide_input_data(ide_drive_t *drive, struct request *rq, void *buf, +void ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { ide_hwif_t *hwif = drive->hwif; @@ -265,7 +265,7 @@ EXPORT_SYMBOL_GPL(ide_input_data); /* * This is used for most PIO data transfers *to* the IDE interface */ -void ide_output_data(ide_drive_t *drive, struct request *rq, void *buf, +void ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { ide_hwif_t *hwif = drive->hwif; diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 2b85c137764..d3bd93afbf2 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -54,19 +54,20 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) } static ide_startstop_t task_no_data_intr(ide_drive_t *); -static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); +static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *); static ide_startstop_t task_in_intr(ide_drive_t *); -ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) +ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) { ide_hwif_t *hwif = drive->hwif; + struct ide_cmd *cmd = &hwif->cmd; struct ide_taskfile *tf = &cmd->tf; ide_handler_t *handler = NULL; const struct ide_tp_ops *tp_ops = hwif->tp_ops; const struct ide_dma_ops *dma_ops = hwif->dma_ops; - if (cmd->data_phase == TASKFILE_MULTI_IN || - cmd->data_phase == TASKFILE_MULTI_OUT) { + if (orig_cmd->data_phase == TASKFILE_MULTI_IN || + orig_cmd->data_phase == TASKFILE_MULTI_OUT) { if (!drive->mult_count) { printk(KERN_ERR "%s: multimode not set!\n", drive->name); @@ -74,10 +75,10 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) } } - if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) - cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; + if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED) + orig_cmd->ftf_flags |= IDE_FTFLAG_SET_IN_FLAGS; - memcpy(&hwif->cmd, cmd, sizeof(*cmd)); + memcpy(cmd, orig_cmd, sizeof(*cmd)); if ((cmd->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) { ide_tf_dump(drive->name, tf); @@ -91,7 +92,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) case TASKFILE_OUT: tp_ops->exec_command(hwif, tf->command); ndelay(400); /* FIXME */ - return pre_task_out_intr(drive, cmd->rq); + return pre_task_out_intr(drive, cmd); case TASKFILE_MULTI_IN: case TASKFILE_IN: handler = task_in_intr; @@ -203,7 +204,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) return stat; } -static void ide_pio_sector(ide_drive_t *drive, struct request *rq, +static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, unsigned int write) { ide_hwif_t *hwif = drive->hwif; @@ -244,9 +245,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, /* do the actual data transfer */ if (write) - hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE); + hwif->tp_ops->output_data(drive, cmd, buf, SECTOR_SIZE); else - hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE); + hwif->tp_ops->input_data(drive, cmd, buf, SECTOR_SIZE); kunmap_atomic(buf, KM_BIO_SRC_IRQ); #ifdef CONFIG_HIGHMEM @@ -254,24 +255,23 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq, #endif } -static void ide_pio_multi(ide_drive_t *drive, struct request *rq, +static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, unsigned int write) { unsigned int nsect; nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); while (nsect--) - ide_pio_sector(drive, rq, write); + ide_pio_sector(drive, cmd, write); } -static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, - unsigned int write) +static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, + unsigned int write) { - struct ide_cmd *cmd = &drive->hwif->cmd; u8 saved_io_32bit = drive->io_32bit; - if (blk_fs_request(rq)) - rq->errors = 0; + if (cmd->tf_flags & IDE_TFLAG_FS) + cmd->rq->errors = 0; if (cmd->tf_flags & IDE_TFLAG_IO_16BIT) drive->io_32bit = 0; @@ -281,22 +281,21 @@ static void ide_pio_datablock(ide_drive_t *drive, struct request *rq, switch (cmd->data_phase) { case TASKFILE_MULTI_IN: case TASKFILE_MULTI_OUT: - ide_pio_multi(drive, rq, write); + ide_pio_multi(drive, cmd, write); break; default: - ide_pio_sector(drive, rq, write); + ide_pio_sector(drive, cmd, write); break; } drive->io_32bit = saved_io_32bit; } -static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, +static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, const char *s, u8 stat) { - if (blk_fs_request(rq)) { + if (cmd->tf_flags & IDE_TFLAG_FS) { ide_hwif_t *hwif = drive->hwif; - struct ide_cmd *cmd = &hwif->cmd; int sectors = hwif->nsect - hwif->nleft; switch (cmd->data_phase) { @@ -323,19 +322,17 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq, return ide_error(drive, s, stat); } -void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) +void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) { - if (blk_fs_request(rq) == 0) { - struct ide_cmd *cmd = rq->special; + if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) { u8 err = ide_read_error(drive); - if (cmd) - ide_complete_cmd(drive, cmd, stat, err); + ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); return; } - ide_end_request(drive, 1, rq->nr_sectors); + ide_end_request(drive, 1, cmd->rq->nr_sectors); } /* @@ -344,11 +341,12 @@ void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) * It might be a spurious irq (shared irq), but it might be a * command that had no output. */ -static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq, u8 stat) +static ide_startstop_t task_in_unexpected(ide_drive_t *drive, + struct ide_cmd *cmd, u8 stat) { /* Command all done? */ if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { - task_end_request(drive, rq, stat); + ide_finish_cmd(drive, cmd, stat); return ide_stopped; } @@ -363,25 +361,25 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, struct request *rq static ide_startstop_t task_in_intr(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; + struct ide_cmd *cmd = &drive->hwif->cmd; u8 stat = hwif->tp_ops->read_status(hwif); /* Error? */ if (stat & ATA_ERR) - return task_error(drive, rq, __func__, stat); + return task_error(drive, cmd, __func__, stat); /* Didn't want any data? Odd. */ if ((stat & ATA_DRQ) == 0) - return task_in_unexpected(drive, rq, stat); + return task_in_unexpected(drive, cmd, stat); - ide_pio_datablock(drive, rq, 0); + ide_pio_datablock(drive, cmd, 0); /* Are we done? Check status and finish transfer. */ if (!hwif->nleft) { stat = wait_drive_not_busy(drive); if (!OK_STAT(stat, 0, BAD_STAT)) - return task_error(drive, rq, __func__, stat); - task_end_request(drive, rq, stat); + return task_error(drive, cmd, __func__, stat); + ide_finish_cmd(drive, cmd, stat); return ide_stopped; } @@ -397,31 +395,31 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) static ide_startstop_t task_out_intr (ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; + struct ide_cmd *cmd = &drive->hwif->cmd; u8 stat = hwif->tp_ops->read_status(hwif); if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) - return task_error(drive, rq, __func__, stat); + return task_error(drive, cmd, __func__, stat); /* Deal with unexpected ATA data phase. */ if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) - return task_error(drive, rq, __func__, stat); + return task_error(drive, cmd, __func__, stat); if (!hwif->nleft) { - task_end_request(drive, rq, stat); + ide_finish_cmd(drive, cmd, stat); return ide_stopped; } /* Still data left to transfer. */ - ide_pio_datablock(drive, rq, 1); + ide_pio_datablock(drive, cmd, 1); ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); return ide_started; } -static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) +static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, + struct ide_cmd *cmd) { - struct ide_cmd *cmd = &drive->hwif->cmd; ide_startstop_t startstop; if (ide_wait_stat(&startstop, drive, ATA_DRQ, @@ -437,7 +435,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, struct request *rq) local_irq_disable(); ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); - ide_pio_datablock(drive, rq, 1); + ide_pio_datablock(drive, cmd, 1); return ide_started; } diff --git a/drivers/ide/q40ide.c b/drivers/ide/q40ide.c index 32f669d656a..2a43a2f4963 100644 --- a/drivers/ide/q40ide.c +++ b/drivers/ide/q40ide.c @@ -72,23 +72,23 @@ static void q40_ide_setup_ports(hw_regs_t *hw, unsigned long base, hw->chipset = ide_generic; } -static void q40ide_input_data(ide_drive_t *drive, struct request *rq, +static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; - if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) + if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) return insw(data_addr, buf, (len + 1) / 2); raw_insw_swapw((u16 *)data_addr, buf, (len + 1) / 2); } -static void q40ide_output_data(ide_drive_t *drive, struct request *rq, +static void q40ide_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; - if (drive->media == ide_disk && rq && rq->cmd_type == REQ_TYPE_FS) + if (drive->media == ide_disk && cmd && (cmd->tf_flags & IDE_TFLAG_FS)) return outsw(data_addr, buf, (len + 1) / 2); raw_outsw_swapw((u16 *)data_addr, buf, (len + 1) / 2); diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index d6336753bd2..ada86674462 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -750,7 +750,7 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) } } -static void scc_input_data(ide_drive_t *drive, struct request *rq, +static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; @@ -766,7 +766,7 @@ static void scc_input_data(ide_drive_t *drive, struct request *rq, scc_ide_insw(data_addr, buf, len / 2); } -static void scc_output_data(ide_drive_t *drive, struct request *rq, +static void scc_output_data(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long data_addr = drive->hwif->io_ports.data_addr; diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c index 947596d3620..657a61890b1 100644 --- a/drivers/ide/tx4938ide.c +++ b/drivers/ide/tx4938ide.c @@ -174,7 +174,7 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) } } -static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, +static void tx4938ide_input_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long port = drive->hwif->io_ports.data_addr; @@ -186,7 +186,7 @@ static void tx4938ide_input_data_swap(ide_drive_t *drive, struct request *rq, __ide_flush_dcache_range((unsigned long)buf, roundup(len, 2)); } -static void tx4938ide_output_data_swap(ide_drive_t *drive, struct request *rq, +static void tx4938ide_output_data_swap(ide_drive_t *drive, struct ide_cmd *cmd, void *buf, unsigned int len) { unsigned long port = drive->hwif->io_ports.data_addr; -- cgit v1.2.3 From b6308ee0c55acd2e943d849773c9f0a49c516317 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:38 +0100 Subject: ide: move command related fields from ide_hwif_t to struct ide_cmd * Move command related fields from ide_hwif_t to struct ide_cmd. * Make ide_init_sg_cmd() take command and sectors number as arguments. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/au1xxx-ide.c | 2 +- drivers/ide/icside.c | 2 +- drivers/ide/ide-disk.c | 12 ++++++------ drivers/ide/ide-dma-sff.c | 2 +- drivers/ide/ide-dma.c | 16 +++++++++------- drivers/ide/ide-floppy.c | 5 +++-- drivers/ide/ide-io.c | 24 ++++++++++-------------- drivers/ide/ide-taskfile.c | 33 ++++++++++++++++----------------- drivers/ide/pmac.c | 2 +- drivers/ide/sgiioc4.c | 2 +- drivers/ide/tx4939ide.c | 2 +- 11 files changed, 50 insertions(+), 52 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 72d7d615e1f..3ace0cda545 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -215,7 +215,7 @@ static int auide_build_dmatable(ide_drive_t *drive) struct request *rq = hwif->rq; _auide_hwif *ahwif = &auide_hwif; struct scatterlist *sg; - int i = hwif->sg_nents, iswrite, count = 0; + int i = hwif->cmd.sg_nents, iswrite, count = 0; iswrite = (rq_data_dir(rq) == WRITE); /* Save for interrupt context */ diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 78fc36f98d2..bdfeb1222d5 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -344,7 +344,7 @@ static int icside_dma_setup(ide_drive_t *drive) * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(ec->dma, hwif->sg_table, hwif->sg_nents); + set_dma_sg(ec->dma, hwif->sg_table, hwif->cmd.sg_nents); set_dma_mode(ec->dma, dma_mode); drive->waiting_for_dma = 1; diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index f1555dd4e6a..d00d807c0f5 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -104,14 +104,14 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, lba48 = 0; } - if (!dma) { - ide_init_sg_cmd(drive, rq); - ide_map_sg(drive, rq); - } - memset(&cmd, 0, sizeof(cmd)); cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + if (dma == 0) { + ide_init_sg_cmd(&cmd, nsectors); + ide_map_sg(drive, rq); + } + if (drive->dev_flags & IDE_DFLAG_LBA) { if (lba48) { pr_debug("%s: LBA=0x%012llx\n", drive->name, @@ -170,7 +170,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, /* fallback to PIO */ cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; ide_tf_set_cmd(drive, &cmd, 0); - ide_init_sg_cmd(drive, rq); + ide_init_sg_cmd(&cmd, nsectors); rc = do_rw_taskfile(drive, &cmd); } diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 22b3e751d19..7bf28a9b6f6 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c @@ -120,7 +120,7 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq) struct scatterlist *sg; u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); - for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { + for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { u32 cur_addr, cur_len, xcount, bcount; cur_addr = sg_dma_address(sg); diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 54f17ae9225..cba9fe585d8 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -128,21 +128,22 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive->hwif; struct scatterlist *sg = hwif->sg_table; + struct ide_cmd *cmd = &hwif->cmd; int i; ide_map_sg(drive, rq); if (rq_data_dir(rq) == READ) - hwif->sg_dma_direction = DMA_FROM_DEVICE; + cmd->sg_dma_direction = DMA_FROM_DEVICE; else - hwif->sg_dma_direction = DMA_TO_DEVICE; + cmd->sg_dma_direction = DMA_TO_DEVICE; - i = dma_map_sg(hwif->dev, sg, hwif->sg_nents, hwif->sg_dma_direction); + i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); if (i == 0) ide_map_sg(drive, rq); else { - hwif->orig_sg_nents = hwif->sg_nents; - hwif->sg_nents = i; + cmd->orig_sg_nents = cmd->sg_nents; + cmd->sg_nents = i; } return i; @@ -162,9 +163,10 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq) void ide_destroy_dmatable(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; + struct ide_cmd *cmd = &hwif->cmd; - dma_unmap_sg(hwif->dev, hwif->sg_table, hwif->orig_sg_nents, - hwif->sg_dma_direction); + dma_unmap_sg(hwif->dev, hwif->sg_table, cmd->orig_sg_nents, + cmd->sg_dma_direction); } EXPORT_SYMBOL_GPL(ide_destroy_dmatable); diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 5625946739a..f56e9a918b9 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -244,6 +244,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, { struct ide_disk_obj *floppy = drive->driver_data; ide_hwif_t *hwif = drive->hwif; + struct ide_cmd *cmd = &hwif->cmd; struct ide_atapi_pc *pc; if (drive->debug_mask & IDE_DBG_RQ) @@ -285,12 +286,12 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, } if (blk_fs_request(rq) || pc->req_xfer) { - ide_init_sg_cmd(drive, rq); + ide_init_sg_cmd(cmd, rq->nr_sectors); ide_map_sg(drive, rq); } pc->sg = hwif->sg_table; - pc->sg_cnt = hwif->sg_nents; + pc->sg_cnt = cmd->sg_nents; pc->rq = rq; diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 2900271c6dd..7917fa09bf1 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -274,30 +274,26 @@ static ide_startstop_t do_special (ide_drive_t *drive) void ide_map_sg(ide_drive_t *drive, struct request *rq) { ide_hwif_t *hwif = drive->hwif; + struct ide_cmd *cmd = &hwif->cmd; struct scatterlist *sg = hwif->sg_table; if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); - hwif->sg_nents = 1; + cmd->sg_nents = 1; } else if (!rq->bio) { sg_init_one(sg, rq->data, rq->data_len); - hwif->sg_nents = 1; - } else { - hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); - } + cmd->sg_nents = 1; + } else + cmd->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); } - EXPORT_SYMBOL_GPL(ide_map_sg); -void ide_init_sg_cmd(ide_drive_t *drive, struct request *rq) +void ide_init_sg_cmd(struct ide_cmd *cmd, int nsect) { - ide_hwif_t *hwif = drive->hwif; - - hwif->nsect = hwif->nleft = rq->nr_sectors; - hwif->cursg_ofs = 0; - hwif->cursg = NULL; + cmd->nsect = cmd->nleft = nsect; + cmd->cursg_ofs = 0; + cmd->cursg = NULL; } - EXPORT_SYMBOL_GPL(ide_init_sg_cmd); /** @@ -323,7 +319,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, case TASKFILE_OUT: case TASKFILE_MULTI_IN: case TASKFILE_IN: - ide_init_sg_cmd(drive, rq); + ide_init_sg_cmd(cmd, rq->nr_sectors); ide_map_sg(drive, rq); default: break; diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index d3bd93afbf2..249a707f88a 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -209,7 +209,7 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, { ide_hwif_t *hwif = drive->hwif; struct scatterlist *sg = hwif->sg_table; - struct scatterlist *cursg = hwif->cursg; + struct scatterlist *cursg = cmd->cursg; struct page *page; #ifdef CONFIG_HIGHMEM unsigned long flags; @@ -217,14 +217,14 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, unsigned int offset; u8 *buf; - cursg = hwif->cursg; + cursg = cmd->cursg; if (!cursg) { cursg = sg; - hwif->cursg = sg; + cmd->cursg = sg; } page = sg_page(cursg); - offset = cursg->offset + hwif->cursg_ofs * SECTOR_SIZE; + offset = cursg->offset + cmd->cursg_ofs * SECTOR_SIZE; /* get the current page and offset */ page = nth_page(page, (offset >> PAGE_SHIFT)); @@ -235,12 +235,12 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, #endif buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; - hwif->nleft--; - hwif->cursg_ofs++; + cmd->nleft--; + cmd->cursg_ofs++; - if ((hwif->cursg_ofs * SECTOR_SIZE) == cursg->length) { - hwif->cursg = sg_next(hwif->cursg); - hwif->cursg_ofs = 0; + if ((cmd->cursg_ofs * SECTOR_SIZE) == cursg->length) { + cmd->cursg = sg_next(cmd->cursg); + cmd->cursg_ofs = 0; } /* do the actual data transfer */ @@ -260,7 +260,7 @@ static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, { unsigned int nsect; - nsect = min_t(unsigned int, drive->hwif->nleft, drive->mult_count); + nsect = min_t(unsigned int, cmd->nleft, drive->mult_count); while (nsect--) ide_pio_sector(drive, cmd, write); } @@ -295,19 +295,18 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, const char *s, u8 stat) { if (cmd->tf_flags & IDE_TFLAG_FS) { - ide_hwif_t *hwif = drive->hwif; - int sectors = hwif->nsect - hwif->nleft; + int sectors = cmd->nsect - cmd->nleft; switch (cmd->data_phase) { case TASKFILE_IN: - if (hwif->nleft) + if (cmd->nleft) break; /* fall through */ case TASKFILE_OUT: sectors--; break; case TASKFILE_MULTI_IN: - if (hwif->nleft) + if (cmd->nleft) break; /* fall through */ case TASKFILE_MULTI_OUT: @@ -375,7 +374,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive) ide_pio_datablock(drive, cmd, 0); /* Are we done? Check status and finish transfer. */ - if (!hwif->nleft) { + if (cmd->nleft == 0) { stat = wait_drive_not_busy(drive); if (!OK_STAT(stat, 0, BAD_STAT)) return task_error(drive, cmd, __func__, stat); @@ -402,10 +401,10 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive) return task_error(drive, cmd, __func__, stat); /* Deal with unexpected ATA data phase. */ - if (((stat & ATA_DRQ) == 0) ^ !hwif->nleft) + if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) return task_error(drive, cmd, __func__, stat); - if (!hwif->nleft) { + if (cmd->nleft == 0) { ide_finish_cmd(drive, cmd, stat); return ide_stopped; } diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 904fb54668e..f5b85f4c1b6 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -1432,7 +1432,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; struct scatterlist *sg; int wr = (rq_data_dir(rq) == WRITE); - int i = hwif->sg_nents, count = 0; + int i = hwif->cmd.sg_nents, count = 0; /* DMA table is already aligned */ table = (struct dbdma_cmd *) pmif->dma_table_cpu; diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index ab9433a7ad1..b0769e96d32 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -429,7 +429,7 @@ sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) { ide_hwif_t *hwif = drive->hwif; unsigned int *table = hwif->dmatable_cpu; - unsigned int count = 0, i = hwif->sg_nents; + unsigned int count = 0, i = hwif->cmd.sg_nents; struct scatterlist *sg = hwif->sg_table; while (i && sg_dma_len(sg)) { diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index bf11791476f..8d155ec8cca 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -240,7 +240,7 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) int i; struct scatterlist *sg; - for_each_sg(hwif->sg_table, sg, hwif->sg_nents, i) { + for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { u32 cur_addr, cur_len, bcount; cur_addr = sg_dma_address(sg); -- cgit v1.2.3 From 04d09b0e62f2180a7e3fa8578ed778eca0c454fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:38 +0100 Subject: ide: set IDE_TFLAG_WRITE basing on data phase used in ide_taskfile_ioctl() Also take care of fixing up incorrect TASKFILE_IN_DMA[Q] data phase when IDE_DRIVE_TASK_RAW_WRITE is requested (no need to do it for TASKFILE_NO_DATA and TASKFILE_[MULTI]_IN -- it had no chance of working previously). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 249a707f88a..647216c772d 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -586,7 +586,14 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) if (req_task->in_flags.b.data) cmd.ftf_flags |= IDE_FTFLAG_IN_DATA; - switch(req_task->data_phase) { + if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) { + /* fixup data phase if needed */ + if (req_task->data_phase == TASKFILE_IN_DMAQ || + req_task->data_phase == TASKFILE_IN_DMA) + cmd.data_phase = TASKFILE_OUT_DMA; + } + + switch (cmd.data_phase) { case TASKFILE_MULTI_OUT: if (!drive->mult_count) { /* (hs): give up if multcount is not set */ @@ -601,6 +608,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) /* fall through */ case TASKFILE_OUT_DMAQ: case TASKFILE_OUT_DMA: + cmd.tf_flags |= IDE_TFLAG_WRITE; nsect = taskout / SECTOR_SIZE; data_buf = outbuf; break; @@ -641,9 +649,6 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) } } - if (req_task->req_cmd == IDE_DRIVE_TASK_RAW_WRITE) - cmd.tf_flags |= IDE_TFLAG_WRITE; - err = ide_raw_taskfile(drive, &cmd, data_buf, nsect); memcpy(req_task->hob_ports, &cmd.tf_array[0], -- cgit v1.2.3 From 0dfb991c6943c810175376b58d1c29cfe532541b Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:39 +0100 Subject: ide: use ata_tf_protocols enums * Add IDE_TFLAG_MULTI_PIO taskfile flag and set it for commands using multi-PIO protocol. * Use ata_tf_protocols enums instead of TASKFILE_* defines to denote command's protocol and then rename ->data_phase field to ->protocol. * Remove no longer needed includes. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 34 +++++++------------ drivers/ide/ide-disk_proc.c | 5 ++- drivers/ide/ide-io.c | 11 ++---- drivers/ide/ide-ioctls.c | 2 +- drivers/ide/ide-park.c | 4 +-- drivers/ide/ide-pm.c | 5 ++- drivers/ide/ide-taskfile.c | 83 +++++++++++++++++++-------------------------- 7 files changed, 56 insertions(+), 88 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index d00d807c0f5..dae9d988de1 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -53,15 +52,6 @@ static const u8 ide_rw_cmds[] = { ATA_CMD_WRITE_EXT, }; -static const u8 ide_data_phases[] = { - TASKFILE_MULTI_IN, - TASKFILE_MULTI_OUT, - TASKFILE_IN, - TASKFILE_OUT, - TASKFILE_IN_DMA, - TASKFILE_OUT_DMA, -}; - static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) { u8 index, lba48, write; @@ -69,17 +59,19 @@ static void ide_tf_set_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 dma) lba48 = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 2 : 0; write = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 1 : 0; - if (dma) + if (dma) { + cmd->protocol = ATA_PROT_DMA; index = 8; - else - index = drive->mult_count ? 0 : 4; + } else { + cmd->protocol = ATA_PROT_PIO; + if (drive->mult_count) { + cmd->tf_flags |= IDE_TFLAG_MULTI_PIO; + index = 0; + } else + index = 4; + } cmd->tf.command = ide_rw_cmds[index + lba48 + write]; - - if (dma) - index = 8; /* fixup index */ - - cmd->data_phase = ide_data_phases[index / 2 + write]; } /* @@ -401,9 +393,9 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) cmd->tf.command = ATA_CMD_FLUSH_EXT; else cmd->tf.command = ATA_CMD_FLUSH; - cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | - IDE_TFLAG_DYN; - cmd->data_phase = TASKFILE_NO_DATA; + cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | + IDE_TFLAG_DYN; + cmd->protocol = ATA_PROT_NODATA; rq->cmd_type = REQ_TYPE_ATA_TASKFILE; rq->cmd_flags |= REQ_SOFTBARRIER; diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c index afe4f47e9e1..eaea3bef207 100644 --- a/drivers/ide/ide-disk_proc.c +++ b/drivers/ide/ide-disk_proc.c @@ -1,6 +1,5 @@ #include #include -#include #include "ide-disk.h" @@ -30,8 +29,8 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) tf->lbam = ATA_SMART_LBAM_PASS; tf->lbah = ATA_SMART_LBAH_PASS; tf->command = ATA_CMD_SMART; - cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - cmd.data_phase = TASKFILE_IN; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.protocol = ATA_PROT_PIO; return ide_raw_taskfile(drive, &cmd, buf, 1); } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 7917fa09bf1..c27eaab1ffc 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -220,7 +219,7 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) struct ide_cmd cmd; memset(&cmd, 0, sizeof(cmd)); - cmd.data_phase = TASKFILE_NO_DATA; + cmd.protocol = ATA_PROT_NODATA; if (s->b.set_geometry) { s->b.set_geometry = 0; @@ -314,15 +313,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct ide_cmd *cmd = rq->special; if (cmd) { - switch (cmd->data_phase) { - case TASKFILE_MULTI_OUT: - case TASKFILE_OUT: - case TASKFILE_MULTI_IN: - case TASKFILE_IN: + if (cmd->protocol == ATA_PROT_PIO) { ide_init_sg_cmd(cmd, rq->nr_sectors); ide_map_sg(drive, rq); - default: - break; } return do_rw_taskfile(drive, cmd); diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 4953028a13d..77014276743 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c @@ -148,7 +148,7 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) IDE_TFLAG_IN_NSECT; } tf->command = args[0]; - cmd.data_phase = args[3] ? TASKFILE_IN : TASKFILE_NO_DATA; + cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; if (args[3]) { cmd.tf_flags |= IDE_TFLAG_IO_16BIT; diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index 63c77f99a72..c575900d559 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c @@ -1,6 +1,5 @@ #include #include -#include #include #include @@ -80,8 +79,9 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) tf->command = ATA_CMD_CHK_POWER; cmd.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.protocol = ATA_PROT_NODATA; + cmd.rq = rq; - cmd.data_phase = TASKFILE_NO_DATA; return do_rw_taskfile(drive, &cmd); } diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index 5c9fc20f95b..ebf2d21ebdc 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c @@ -1,6 +1,5 @@ #include #include -#include int generic_ide_suspend(struct device *dev, pm_message_t mesg) { @@ -164,8 +163,8 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) return ide_stopped; out_do_tf: - cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - cmd->data_phase = TASKFILE_NO_DATA; + cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd->protocol = ATA_PROT_NODATA; return do_rw_taskfile(drive, cmd); } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 647216c772d..0c9d7148572 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -47,8 +47,8 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) cmd.tf.command = ATA_CMD_ID_ATA; else cmd.tf.command = ATA_CMD_ID_ATAPI; - cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - cmd.data_phase = TASKFILE_IN; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.protocol = ATA_PROT_PIO; return ide_raw_taskfile(drive, &cmd, buf, 1); } @@ -66,13 +66,11 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) const struct ide_tp_ops *tp_ops = hwif->tp_ops; const struct ide_dma_ops *dma_ops = hwif->dma_ops; - if (orig_cmd->data_phase == TASKFILE_MULTI_IN || - orig_cmd->data_phase == TASKFILE_MULTI_OUT) { - if (!drive->mult_count) { - printk(KERN_ERR "%s: multimode not set!\n", - drive->name); - return ide_stopped; - } + if (orig_cmd->protocol == ATA_PROT_PIO && + (orig_cmd->tf_flags & IDE_TFLAG_MULTI_PIO) && + drive->mult_count == 0) { + printk(KERN_ERR "%s: multimode not set!\n", drive->name); + return ide_stopped; } if (orig_cmd->ftf_flags & IDE_FTFLAG_FLAGGED) @@ -87,17 +85,16 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) tp_ops->tf_load(drive, cmd); } - switch (cmd->data_phase) { - case TASKFILE_MULTI_OUT: - case TASKFILE_OUT: - tp_ops->exec_command(hwif, tf->command); - ndelay(400); /* FIXME */ - return pre_task_out_intr(drive, cmd); - case TASKFILE_MULTI_IN: - case TASKFILE_IN: + switch (cmd->protocol) { + case ATA_PROT_PIO: + if (cmd->tf_flags & IDE_TFLAG_WRITE) { + tp_ops->exec_command(hwif, tf->command); + ndelay(400); /* FIXME */ + return pre_task_out_intr(drive, cmd); + } handler = task_in_intr; /* fall-through */ - case TASKFILE_NO_DATA: + case ATA_PROT_NODATA: if (handler == NULL) handler = task_no_data_intr; ide_execute_command(drive, tf->command, handler, @@ -115,9 +112,6 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) } EXPORT_SYMBOL_GPL(do_rw_taskfile); -/* - * Handler for commands without a data phase - */ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; @@ -278,15 +272,10 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, touch_softlockup_watchdog(); - switch (cmd->data_phase) { - case TASKFILE_MULTI_IN: - case TASKFILE_MULTI_OUT: + if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ide_pio_multi(drive, cmd, write); - break; - default: + else ide_pio_sector(drive, cmd, write); - break; - } drive->io_32bit = saved_io_32bit; } @@ -297,22 +286,12 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, if (cmd->tf_flags & IDE_TFLAG_FS) { int sectors = cmd->nsect - cmd->nleft; - switch (cmd->data_phase) { - case TASKFILE_IN: - if (cmd->nleft) - break; - /* fall through */ - case TASKFILE_OUT: - sectors--; - break; - case TASKFILE_MULTI_IN: - if (cmd->nleft) - break; - /* fall through */ - case TASKFILE_MULTI_OUT: - sectors -= drive->mult_count; - default: - break; + if (cmd->protocol == ATA_PROT_PIO && + ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) { + if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) + sectors -= drive->mult_count; + else + sectors--; } if (sectors > 0) @@ -425,7 +404,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, drive->bad_wstat, WAIT_DRQ)) { printk(KERN_ERR "%s: no DRQ after issuing %sWRITE%s\n", drive->name, - cmd->data_phase == TASKFILE_MULTI_OUT ? "MULT" : "", + (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ? "MULT" : "", (drive->dev_flags & IDE_DFLAG_LBA48) ? "_EXT" : ""); return startstop; } @@ -474,7 +453,7 @@ EXPORT_SYMBOL(ide_raw_taskfile); int ide_no_data_taskfile(ide_drive_t *drive, struct ide_cmd *cmd) { - cmd->data_phase = TASKFILE_NO_DATA; + cmd->protocol = ATA_PROT_NODATA; return ide_raw_taskfile(drive, cmd, NULL, 0); } @@ -545,7 +524,6 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) memcpy(&cmd.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); - cmd.data_phase = req_task->data_phase; cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | IDE_TFLAG_IN_TF; @@ -590,10 +568,12 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) /* fixup data phase if needed */ if (req_task->data_phase == TASKFILE_IN_DMAQ || req_task->data_phase == TASKFILE_IN_DMA) - cmd.data_phase = TASKFILE_OUT_DMA; + cmd.tf_flags |= IDE_TFLAG_WRITE; } - switch (cmd.data_phase) { + cmd.protocol = ATA_PROT_DMA; + + switch (req_task->data_phase) { case TASKFILE_MULTI_OUT: if (!drive->mult_count) { /* (hs): give up if multcount is not set */ @@ -603,8 +583,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) err = -EPERM; goto abort; } + cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; /* fall through */ case TASKFILE_OUT: + cmd.protocol = ATA_PROT_PIO; /* fall through */ case TASKFILE_OUT_DMAQ: case TASKFILE_OUT_DMA: @@ -621,8 +603,10 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) err = -EPERM; goto abort; } + cmd.tf_flags |= IDE_TFLAG_MULTI_PIO; /* fall through */ case TASKFILE_IN: + cmd.protocol = ATA_PROT_PIO; /* fall through */ case TASKFILE_IN_DMAQ: case TASKFILE_IN_DMA: @@ -630,6 +614,7 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) data_buf = inbuf; break; case TASKFILE_NO_DATA: + cmd.protocol = ATA_PROT_NODATA; break; default: err = -EFAULT; -- cgit v1.2.3 From 901bd08a543eed7cbd4fd9e46df588f173417388 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:39 +0100 Subject: ide: merge task_{in,out}_intr() * Merge task_out_intr() with task_in_intr(). * Rename task_in_intr() to task_pio_intr(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 72 ++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 41 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 0c9d7148572..99d6ed43497 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -55,7 +55,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) static ide_startstop_t task_no_data_intr(ide_drive_t *); static ide_startstop_t pre_task_out_intr(ide_drive_t *, struct ide_cmd *); -static ide_startstop_t task_in_intr(ide_drive_t *); +static ide_startstop_t task_pio_intr(ide_drive_t *); ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) { @@ -92,7 +92,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) ndelay(400); /* FIXME */ return pre_task_out_intr(drive, cmd); } - handler = task_in_intr; + handler = task_pio_intr; /* fall-through */ case ATA_PROT_NODATA: if (handler == NULL) @@ -329,68 +329,57 @@ static ide_startstop_t task_in_unexpected(ide_drive_t *drive, } /* Assume it was a spurious irq */ - ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); + return ide_started; } /* - * Handler for command with PIO data-in phase (Read/Read Multiple). + * Handler for command with PIO data phase. */ -static ide_startstop_t task_in_intr(ide_drive_t *drive) +static ide_startstop_t task_pio_intr(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; struct ide_cmd *cmd = &drive->hwif->cmd; u8 stat = hwif->tp_ops->read_status(hwif); + u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); - /* Error? */ - if (stat & ATA_ERR) - return task_error(drive, cmd, __func__, stat); - - /* Didn't want any data? Odd. */ - if ((stat & ATA_DRQ) == 0) - return task_in_unexpected(drive, cmd, stat); + if (write == 0) { + /* Error? */ + if (stat & ATA_ERR) + return task_error(drive, cmd, __func__, stat); - ide_pio_datablock(drive, cmd, 0); + /* Didn't want any data? Odd. */ + if ((stat & ATA_DRQ) == 0) + return task_in_unexpected(drive, cmd, stat); + } else { + if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) + return task_error(drive, cmd, __func__, stat); - /* Are we done? Check status and finish transfer. */ - if (cmd->nleft == 0) { - stat = wait_drive_not_busy(drive); - if (!OK_STAT(stat, 0, BAD_STAT)) + /* Deal with unexpected ATA data phase. */ + if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) return task_error(drive, cmd, __func__, stat); + } + + if (write && cmd->nleft == 0) { ide_finish_cmd(drive, cmd, stat); return ide_stopped; } /* Still data left to transfer. */ - ide_set_handler(drive, &task_in_intr, WAIT_WORSTCASE, NULL); - - return ide_started; -} - -/* - * Handler for command with PIO data-out phase (Write/Write Multiple). - */ -static ide_startstop_t task_out_intr (ide_drive_t *drive) -{ - ide_hwif_t *hwif = drive->hwif; - struct ide_cmd *cmd = &drive->hwif->cmd; - u8 stat = hwif->tp_ops->read_status(hwif); - - if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) - return task_error(drive, cmd, __func__, stat); + ide_pio_datablock(drive, cmd, write); - /* Deal with unexpected ATA data phase. */ - if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) - return task_error(drive, cmd, __func__, stat); - - if (cmd->nleft == 0) { + /* Are we done? Check status and finish transfer. */ + if (write == 0 && cmd->nleft == 0) { + stat = wait_drive_not_busy(drive); + if (!OK_STAT(stat, 0, BAD_STAT)) + return task_error(drive, cmd, __func__, stat); ide_finish_cmd(drive, cmd, stat); return ide_stopped; } /* Still data left to transfer. */ - ide_pio_datablock(drive, cmd, 1); - ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); return ide_started; } @@ -412,7 +401,8 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) local_irq_disable(); - ide_set_handler(drive, &task_out_intr, WAIT_WORSTCASE, NULL); + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); + ide_pio_datablock(drive, cmd, 1); return ide_started; -- cgit v1.2.3 From 151055ed84df7bebc77d88471302a7cd02c6e0a4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:39 +0100 Subject: ide: inline task_in_unexpected() into task_pio_intr() task_in_unexpected() is only used by task_pio_intr() so inline it there. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 99d6ed43497..a01c2c0450d 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -313,27 +313,6 @@ void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) ide_end_request(drive, 1, cmd->rq->nr_sectors); } -/* - * We got an interrupt on a task_in case, but no errors and no DRQ. - * - * It might be a spurious irq (shared irq), but it might be a - * command that had no output. - */ -static ide_startstop_t task_in_unexpected(ide_drive_t *drive, - struct ide_cmd *cmd, u8 stat) -{ - /* Command all done? */ - if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { - ide_finish_cmd(drive, cmd, stat); - return ide_stopped; - } - - /* Assume it was a spurious irq */ - ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); - - return ide_started; -} - /* * Handler for command with PIO data phase. */ @@ -350,8 +329,19 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) return task_error(drive, cmd, __func__, stat); /* Didn't want any data? Odd. */ - if ((stat & ATA_DRQ) == 0) - return task_in_unexpected(drive, cmd, stat); + if ((stat & ATA_DRQ) == 0) { + /* Command all done? */ + if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { + ide_finish_cmd(drive, cmd, stat); + return ide_stopped; + } + + /* Assume it was a spurious irq */ + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, + NULL); + + return ide_started; + } } else { if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) return task_error(drive, cmd, __func__, stat); -- cgit v1.2.3 From 0a1248c5a754cc8dc5b10a902d2f86b40144165c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:41 +0100 Subject: ide: unify exit paths in task_pio_intr() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a01c2c0450d..79900a7a62e 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -326,35 +326,28 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) if (write == 0) { /* Error? */ if (stat & ATA_ERR) - return task_error(drive, cmd, __func__, stat); + goto out_err; /* Didn't want any data? Odd. */ if ((stat & ATA_DRQ) == 0) { /* Command all done? */ - if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) { - ide_finish_cmd(drive, cmd, stat); - return ide_stopped; - } + if (OK_STAT(stat, ATA_DRDY, ATA_BUSY)) + goto out_end; /* Assume it was a spurious irq */ - ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, - NULL); - - return ide_started; + goto out_wait; } } else { if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) - return task_error(drive, cmd, __func__, stat); + goto out_err; /* Deal with unexpected ATA data phase. */ if (((stat & ATA_DRQ) == 0) ^ (cmd->nleft == 0)) - return task_error(drive, cmd, __func__, stat); + goto out_err; } - if (write && cmd->nleft == 0) { - ide_finish_cmd(drive, cmd, stat); - return ide_stopped; - } + if (write && cmd->nleft == 0) + goto out_end; /* Still data left to transfer. */ ide_pio_datablock(drive, cmd, write); @@ -363,15 +356,19 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) if (write == 0 && cmd->nleft == 0) { stat = wait_drive_not_busy(drive); if (!OK_STAT(stat, 0, BAD_STAT)) - return task_error(drive, cmd, __func__, stat); - ide_finish_cmd(drive, cmd, stat); - return ide_stopped; - } + goto out_err; + goto out_end; + } +out_wait: /* Still data left to transfer. */ ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); - return ide_started; +out_end: + ide_finish_cmd(drive, cmd, stat); + return ide_stopped; +out_err: + return task_error(drive, cmd, __func__, stat); } static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, -- cgit v1.2.3 From 041cea10a86a25b088185d07ad15d728f503f02c Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:41 +0100 Subject: ide: task_error() -> task_error_cmd() * Move ide_error() call from task_error() to task_pio_intr() (the only user). * Drop no longer used arguments from task_error(). * Rename task_error() to ide_error_cmd(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 79900a7a62e..c0268750768 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -280,8 +280,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, drive->io_32bit = saved_io_32bit; } -static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, - const char *s, u8 stat) +static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) { if (cmd->tf_flags & IDE_TFLAG_FS) { int sectors = cmd->nsect - cmd->nleft; @@ -297,7 +296,6 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct ide_cmd *cmd, if (sectors > 0) ide_end_request(drive, 1, sectors); } - return ide_error(drive, s, stat); } void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) @@ -368,7 +366,8 @@ out_end: ide_finish_cmd(drive, cmd, stat); return ide_stopped; out_err: - return task_error(drive, cmd, __func__, stat); + ide_error_cmd(drive, cmd); + return ide_error(drive, __func__, stat); } static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, -- cgit v1.2.3 From e7fedc3ca0b8fcd3350a40c42a7100a9539e6c4a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:41 +0100 Subject: ide: use ide_complete_cmd() for head unload commands Move handling of head unload commands from task_no_data_intr() to ide_complete_cmd() and then use ide_complete_cmd() also for head unload commands. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 11 +++++++++++ drivers/ide/ide-taskfile.c | 13 +++---------- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c27eaab1ffc..c33a8006838 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -147,12 +147,23 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) { struct ide_taskfile *tf = &cmd->tf; struct request *rq = cmd->rq; + u8 tf_cmd = tf->command; tf->error = err; tf->status = stat; drive->hwif->tp_ops->tf_read(drive, cmd); + if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && + tf_cmd == ATA_CMD_IDLEIMMEDIATE) { + if (tf->lbal != 0xc4) { + printk(KERN_ERR "%s: head unload failed!\n", + drive->name); + ide_tf_dump(drive->name, tf); + } else + drive->dev_flags |= IDE_DFLAG_PARKED; + } + if (rq && rq->cmd_type == REQ_TYPE_ATA_TASKFILE) memcpy(rq->special, cmd, sizeof(*cmd)); diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index c0268750768..4883aa4052a 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -146,15 +146,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) return ide_error(drive, "task_no_data_intr", stat); } - if (custom && tf->command == ATA_CMD_IDLEIMMEDIATE) { - hwif->tp_ops->tf_read(drive, cmd); - if (tf->lbal != 0xc4) { - printk(KERN_ERR "%s: head unload failed!\n", - drive->name); - ide_tf_dump(drive->name, tf); - } else - drive->dev_flags |= IDE_DFLAG_PARKED; - } else if (custom && tf->command == ATA_CMD_SET_MULTI) + if (custom && tf->command == ATA_CMD_SET_MULTI) drive->mult_count = drive->mult_req; if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { @@ -164,7 +156,8 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) if (blk_pm_request(rq)) ide_complete_pm_rq(drive, rq); else { - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) + if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE || + tf->command == ATA_CMD_IDLEIMMEDIATE) ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); } -- cgit v1.2.3 From d364c7f50b3bb6dc77259974038567b821e2cf0a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:42 +0100 Subject: ide: use ide_complete_cmd() for REQ_UNPARK_HEADS * Fixup ->tf_flags in ide_do_park_unpark() to match their current use. * Use ide_complete_cmd() for REQ_UNPARK_HEADS. While at it: * No need to read Error register for PM requests in task_no_data_intr(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-park.c | 4 ++-- drivers/ide/ide-taskfile.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c index c575900d559..9490b446519 100644 --- a/drivers/ide/ide-park.c +++ b/drivers/ide/ide-park.c @@ -74,11 +74,11 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq) tf->lbal = 0x4c; tf->lbam = 0x4e; tf->lbah = 0x55; - cmd.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; + cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; } else /* cmd == REQ_UNPARK_HEADS */ tf->command = ATA_CMD_CHK_POWER; - cmd.tf_flags |= IDE_TFLAG_TF | IDE_TFLAG_DEVICE; + cmd.tf_flags |= IDE_TFLAG_CUSTOM_HANDLER; cmd.protocol = ATA_PROT_NODATA; cmd.rq = rq; diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 4883aa4052a..bbf7740d58a 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -149,16 +149,16 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) if (custom && tf->command == ATA_CMD_SET_MULTI) drive->mult_count = drive->mult_req; - if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE) { + if (custom == 0 || tf->command == ATA_CMD_IDLEIMMEDIATE || + tf->command == ATA_CMD_CHK_POWER) { struct request *rq = hwif->rq; - u8 err = ide_read_error(drive); if (blk_pm_request(rq)) ide_complete_pm_rq(drive, rq); else { - if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE || - tf->command == ATA_CMD_IDLEIMMEDIATE) - ide_complete_cmd(drive, cmd, stat, err); + u8 err = ide_read_error(drive); + + ide_complete_cmd(drive, cmd, stat, err); ide_complete_rq(drive, err); } } -- cgit v1.2.3 From 2230d90dd889e35da2728b6f6ebf25fb5a6499bd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:42 +0100 Subject: ide: sanitize ide_finish_cmd() * Move ide_end_request() call out from ide_finish_cmd() to its users. * Use ide_finish_cmd() in task_no_data_intr(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 5 ++++- drivers/ide/ide-taskfile.c | 24 +++++++++--------------- 2 files changed, 13 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index cba9fe585d8..820e5104ba4 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -98,7 +98,10 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) if (!dma_stat) { struct ide_cmd *cmd = &hwif->cmd; - ide_finish_cmd(drive, cmd, stat); + if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) + ide_finish_cmd(drive, cmd, stat); + else + ide_end_request(drive, 1, cmd->rq->nr_sectors); return ide_stopped; } printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index bbf7740d58a..f99a6aaad9e 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -155,12 +155,8 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) if (blk_pm_request(rq)) ide_complete_pm_rq(drive, rq); - else { - u8 err = ide_read_error(drive); - - ide_complete_cmd(drive, cmd, stat, err); - ide_complete_rq(drive, err); - } + else + ide_finish_cmd(drive, cmd, stat); } return ide_stopped; @@ -293,15 +289,10 @@ static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) { - if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) { - u8 err = ide_read_error(drive); + u8 err = ide_read_error(drive); - ide_complete_cmd(drive, cmd, stat, err); - ide_complete_rq(drive, err); - return; - } - - ide_end_request(drive, 1, cmd->rq->nr_sectors); + ide_complete_cmd(drive, cmd, stat, err); + ide_complete_rq(drive, err); } /* @@ -356,7 +347,10 @@ out_wait: ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); return ide_started; out_end: - ide_finish_cmd(drive, cmd, stat); + if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) + ide_finish_cmd(drive, cmd, stat); + else + ide_end_request(drive, 1, cmd->rq->nr_sectors); return ide_stopped; out_err: ide_error_cmd(drive, cmd); -- cgit v1.2.3 From 1713788ff8e191de5da707ed8144698b32771f99 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:42 +0100 Subject: ide: make ide_special_rq() BUG() on unknown requests If unknown request reaches this function something is _seriously_ wrong. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c33a8006838..0873887194f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -357,9 +357,7 @@ static ide_startstop_t ide_special_rq(ide_drive_t *drive, struct request *rq) case REQ_DRIVE_RESET: return ide_do_reset(drive); default: - blk_dump_rq_flags(rq, "ide_special_rq - bad request"); - ide_end_request(drive, 0, 0); - return ide_stopped; + BUG(); } } -- cgit v1.2.3 From 1caf236dafb7291f9fdfe54b12dd945aec0dca03 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:42 +0100 Subject: ide: add ide_end_rq() (v2) * Move request dequeuing from __ide_end_request() to ide_end_request(). * Rename __ide_end_request() to ide_end_rq() and export it. * Fix ide_end_rq() to pass original blk_end_request() return value. * ide_end_dequeued_request() is used only in cdrom_end_request() so inline it there and then remove the function. v2: * Remove needless BUG_ON() while at it (start_request()'s one is enough). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 4 ++-- drivers/ide/ide-io.c | 45 ++++++++++----------------------------------- 2 files changed, 12 insertions(+), 37 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bb804ae57bc..830fd570e76 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -272,8 +272,8 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) * now end the failed request */ if (blk_fs_request(failed)) { - if (ide_end_dequeued_request(drive, failed, 0, - failed->hard_nr_sectors)) + if (ide_end_rq(drive, failed, 0, + failed->hard_nr_sectors << 9)) BUG(); } else { if (blk_end_request(failed, -EIO, diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 0873887194f..e5fcb283702 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -54,10 +54,9 @@ #include #include -static int __ide_end_request(ide_drive_t *drive, struct request *rq, - int uptodate, unsigned int nr_bytes, int dequeue) +int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate, + unsigned int nr_bytes) { - int ret = 1; int error = 0; if (uptodate <= 0) @@ -83,14 +82,9 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, ide_dma_on(drive); } - if (!blk_end_request(rq, error, nr_bytes)) - ret = 0; - - if (ret == 0 && dequeue) - drive->hwif->rq = NULL; - - return ret; + return blk_end_request(rq, error, nr_bytes); } +EXPORT_SYMBOL_GPL(ide_end_rq); /** * ide_end_request - complete an IDE I/O @@ -107,6 +101,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) { unsigned int nr_bytes = nr_sectors << 9; struct request *rq = drive->hwif->rq; + int rc; if (!nr_bytes) { if (blk_pc_request(rq)) @@ -115,33 +110,13 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) nr_bytes = rq->hard_cur_sectors << 9; } - return __ide_end_request(drive, rq, uptodate, nr_bytes, 1); -} -EXPORT_SYMBOL(ide_end_request); - -/** - * ide_end_dequeued_request - complete an IDE I/O - * @drive: IDE device for the I/O - * @uptodate: - * @nr_sectors: number of sectors completed - * - * Complete an I/O that is no longer on the request queue. This - * typically occurs when we pull the request and issue a REQUEST_SENSE. - * We must still finish the old request but we must not tamper with the - * queue in the meantime. - * - * NOTE: This path does not handle barrier, but barrier is not supported - * on ide-cd anyway. - */ - -int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq, - int uptodate, int nr_sectors) -{ - BUG_ON(!blk_rq_started(rq)); + rc = ide_end_rq(drive, rq, uptodate, nr_bytes); + if (rc == 0) + drive->hwif->rq = NULL; - return __ide_end_request(drive, rq, uptodate, nr_sectors << 9, 0); + return rc; } -EXPORT_SYMBOL_GPL(ide_end_dequeued_request); +EXPORT_SYMBOL(ide_end_request); void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) { -- cgit v1.2.3 From 37245aabfa0c628ba884cd88fe5cd633b426a1b2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:43 +0100 Subject: ide: sanitize ide_end_rq() * Move 'uptodate' quirk from ide_end_rq() to its users. * Move quirks for blk_noretry_request() and !blk_fs_request() requests from ide_end_rq() to ide_end_request(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-io.c | 34 ++++++++++++++++------------------ 2 files changed, 17 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 830fd570e76..bbbebcbb1e3 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -272,7 +272,7 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) * now end the failed request */ if (blk_fs_request(failed)) { - if (ide_end_rq(drive, failed, 0, + if (ide_end_rq(drive, failed, -EIO, failed->hard_nr_sectors << 9)) BUG(); } else { diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e5fcb283702..c38426de604 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -54,24 +54,9 @@ #include #include -int ide_end_rq(ide_drive_t *drive, struct request *rq, int uptodate, +int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, unsigned int nr_bytes) { - int error = 0; - - if (uptodate <= 0) - error = uptodate ? uptodate : -EIO; - - /* - * if failfast is set on a request, override number of sectors and - * complete the whole request right now - */ - if (blk_noretry_request(rq) && error) - nr_bytes = rq->hard_nr_sectors << 9; - - if (!blk_fs_request(rq) && error && !rq->errors) - rq->errors = -EIO; - /* * decide whether to reenable DMA -- 3 is a random magic for now, * if we DMA timeout more than 3 times, just stay in PIO @@ -101,7 +86,7 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) { unsigned int nr_bytes = nr_sectors << 9; struct request *rq = drive->hwif->rq; - int rc; + int rc, error = 0; if (!nr_bytes) { if (blk_pc_request(rq)) @@ -110,7 +95,20 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) nr_bytes = rq->hard_cur_sectors << 9; } - rc = ide_end_rq(drive, rq, uptodate, nr_bytes); + /* + * if failfast is set on a request, override number of sectors + * and complete the whole request right now + */ + if (blk_noretry_request(rq) && uptodate <= 0) + nr_bytes = rq->hard_nr_sectors << 9; + + if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) + rq->errors = -EIO; + + if (uptodate <= 0) + error = uptodate ? uptodate : -EIO; + + rc = ide_end_rq(drive, rq, error, nr_bytes); if (rc == 0) drive->hwif->rq = NULL; -- cgit v1.2.3 From 6902a5331256e1b9f4cef95a1e3622252113b260 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:43 +0100 Subject: ide: pass error value to ide_complete_rq() Set rq->errors at ide_complete_rq() call sites and then pass error value to ide_complete_rq(). [ Some rq->errors assignments look really wrong but this patch leaves them alone to not introduce too many changes at once. ] There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 5 +++-- drivers/ide/ide-eh.c | 5 +++-- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-io.c | 19 +++++++++---------- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 4 +++- 6 files changed, 20 insertions(+), 17 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 92c6ef6feb5..5d57af29c4c 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -402,9 +402,10 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) if (uptodate == 0) drive->failed_pc = NULL; - if (blk_special_request(rq)) + if (blk_special_request(rq)) { + rq->errors = 0; ide_complete_rq(drive, 0); - else + } else ide_end_request(drive, uptodate, 0); return ide_stopped; diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index f6e1a82a3cc..d1385d332e9 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -123,17 +123,18 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) /* retry only "normal" I/O: */ if (!blk_fs_request(rq)) { - rq->errors = 1; if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { struct ide_cmd *cmd = rq->special; if (cmd) ide_complete_cmd(drive, cmd, stat, err); } else if (blk_pm_request(rq)) { + rq->errors = 1; ide_complete_pm_rq(drive, rq); return ide_stopped; } - ide_complete_rq(drive, err); + rq->errors = err; + ide_complete_rq(drive, err ? -EIO : 0); return ide_stopped; } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f56e9a918b9..407e4914dfd 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -260,7 +260,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, printk(KERN_ERR PFX "%s: I/O error\n", drive->name); if (blk_special_request(rq)) { - rq->errors = IDE_DRV_ERROR_GENERAL; + rq->errors = 0; ide_complete_rq(drive, 0); return ide_stopped; } else diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c38426de604..4cc2bb13f1d 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -144,17 +144,14 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) kfree(cmd); } -void ide_complete_rq(ide_drive_t *drive, u8 err) +void ide_complete_rq(ide_drive_t *drive, int error) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; hwif->rq = NULL; - rq->errors = err; - - if (unlikely(blk_end_request(rq, (rq->errors ? -EIO : 0), - blk_rq_bytes(rq)))) + if (unlikely(blk_end_request(rq, error, blk_rq_bytes(rq)))) BUG(); } EXPORT_SYMBOL(ide_complete_rq); @@ -166,13 +163,14 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) drive->failed_pc = NULL; - if ((media == ide_floppy && drv_req) || media == ide_tape) - rq->errors = IDE_DRV_ERROR_GENERAL; - - if ((media == ide_floppy || media == ide_tape) && drv_req) + if ((media == ide_floppy || media == ide_tape) && drv_req) { + rq->errors = 0; ide_complete_rq(drive, 0); - else + } else { + if (media == ide_tape) + rq->errors = IDE_DRV_ERROR_GENERAL; ide_end_request(drive, 0, 0); + } } static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) @@ -312,6 +310,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, #ifdef DEBUG printk("%s: DRIVE_CMD (null)\n", drive->name); #endif + rq->errors = 0; ide_complete_rq(drive, 0); return ide_stopped; diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index a42e49c6cc3..3bfcd7290ce 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -774,8 +774,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, if (rq != postponed_rq) { printk(KERN_ERR "ide-tape: ide-tape.c bug - " "Two DSC requests were queued\n"); - rq->errors = IDE_DRV_ERROR_GENERAL; drive->failed_pc = NULL; + rq->errors = 0; ide_complete_rq(drive, 0); return ide_stopped; } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index f99a6aaad9e..e9d008ef3f3 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -289,10 +289,12 @@ static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) { + struct request *rq = drive->hwif->rq; u8 err = ide_read_error(drive); ide_complete_cmd(drive, cmd, stat, err); - ide_complete_rq(drive, err); + rq->errors = err; + ide_complete_rq(drive, err ? -EIO : 0); } /* -- cgit v1.2.3 From 89f78b3261f7e331e41753ea2459fbb9b60a6f7a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:43 +0100 Subject: ide: move rq->errors quirk out from ide_end_request() Move rq->errors quirk out from ide_end_request() to its call sites. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 7 ++++++- drivers/ide/ide-cd.c | 3 +++ drivers/ide/ide-disk.c | 2 ++ drivers/ide/ide-eh.c | 5 ++++- drivers/ide/ide-floppy.c | 2 ++ drivers/ide/ide-io.c | 5 ++--- drivers/ide/ide-tape.c | 2 ++ 7 files changed, 21 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 5d57af29c4c..5504a84e9bd 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -405,8 +405,13 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) if (blk_special_request(rq)) { rq->errors = 0; ide_complete_rq(drive, 0); - } else + } else { + if (blk_fs_request(rq) == 0 && uptodate <= 0) { + if (rq->errors == 0) + rq->errors = -EIO; + } ide_end_request(drive, uptodate, 0); + } return ide_stopped; } diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bbbebcbb1e3..e4fa807fdcf 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -295,6 +295,9 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) ide_debug_log(IDE_DBG_FUNC, "uptodate: 0x%x, nsectors: %d", uptodate, nsectors); + if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) + rq->errors = -EIO; + ide_end_request(drive, uptodate, nsectors); } diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index dae9d988de1..ad9a3f54d21 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -184,6 +184,8 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, if (!blk_fs_request(rq)) { blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); + if (rq->errors == 0) + rq->errors = -EIO; ide_end_request(drive, 0, 0); return ide_stopped; } diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index d1385d332e9..6ad419414f9 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -146,8 +146,11 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) { struct request *rq = drive->hwif->rq; - if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) + if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { + if (err <= 0 && rq->errors == 0) + rq->errors = -EIO; ide_end_request(drive, err ? err : 1, 0); + } } /* needed below */ diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 407e4914dfd..572aa9696da 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -298,6 +298,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, return idefloppy_issue_pc(drive, pc); out_end: drive->failed_pc = NULL; + if (blk_fs_request(rq) == 0 && rq->errors == 0) + rq->errors = -EIO; ide_end_request(drive, 0, 0); return ide_stopped; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 4cc2bb13f1d..28ac463dde1 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -102,9 +102,6 @@ int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) if (blk_noretry_request(rq) && uptodate <= 0) nr_bytes = rq->hard_nr_sectors << 9; - if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) - rq->errors = -EIO; - if (uptodate <= 0) error = uptodate ? uptodate : -EIO; @@ -169,6 +166,8 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) } else { if (media == ide_tape) rq->errors = IDE_DRV_ERROR_GENERAL; + else if (blk_fs_request(rq) == 0 && rq->errors == 0) + rq->errors = -EIO; ide_end_request(drive, 0, 0); } } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 3bfcd7290ce..94f6fb8c147 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -760,6 +760,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, /* We do not support buffer cache originated requests. */ printk(KERN_NOTICE "ide-tape: %s: Unsupported request in " "request queue (%d)\n", drive->name, rq->cmd_type); + if (blk_fs_request(rq) == 0 && rq->errors == 0) + rq->errors = -EIO; ide_end_request(drive, 0, 0); return ide_stopped; } -- cgit v1.2.3 From a9587fd8c48415cc93fef7f4ba7748a5d3477e7b Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:44 +0100 Subject: ide: remove BUG() from ide_complete_rq() It is no longer needed so remove it, also while at it dequeue the request only on blk_end_request() success and make ide_complete_rq() return an error value. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 28ac463dde1..4a79d28600f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -141,15 +141,17 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) kfree(cmd); } -void ide_complete_rq(ide_drive_t *drive, int error) +int ide_complete_rq(ide_drive_t *drive, int error) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; + int rc; - hwif->rq = NULL; + rc = blk_end_request(rq, error, blk_rq_bytes(rq)); + if (rc == 0) + hwif->rq = NULL; - if (unlikely(blk_end_request(rq, error, blk_rq_bytes(rq)))) - BUG(); + return rc; } EXPORT_SYMBOL(ide_complete_rq); -- cgit v1.2.3 From f974b196f58fe042c7b2b4c0ee15d5a6112dbf40 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:44 +0100 Subject: ide: pass number of bytes to complete to ide_complete_rq() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 2 +- drivers/ide/ide-eh.c | 2 +- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-io.c | 8 ++++---- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 5504a84e9bd..30156aa6101 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -404,7 +404,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) if (blk_special_request(rq)) { rq->errors = 0; - ide_complete_rq(drive, 0); + ide_complete_rq(drive, 0, blk_rq_bytes(rq)); } else { if (blk_fs_request(rq) == 0 && uptodate <= 0) { if (rq->errors == 0) diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 6ad419414f9..ccfd06ef5bb 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -134,7 +134,7 @@ ide_startstop_t ide_error(ide_drive_t *drive, const char *msg, u8 stat) return ide_stopped; } rq->errors = err; - ide_complete_rq(drive, err ? -EIO : 0); + ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 572aa9696da..7ef2b90e530 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -261,7 +261,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, if (blk_special_request(rq)) { rq->errors = 0; - ide_complete_rq(drive, 0); + ide_complete_rq(drive, 0, blk_rq_bytes(rq)); return ide_stopped; } else goto out_end; diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 4a79d28600f..a4aa4bf8473 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -141,13 +141,13 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) kfree(cmd); } -int ide_complete_rq(ide_drive_t *drive, int error) +int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; int rc; - rc = blk_end_request(rq, error, blk_rq_bytes(rq)); + rc = blk_end_request(rq, error, nr_bytes); if (rc == 0) hwif->rq = NULL; @@ -164,7 +164,7 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) if ((media == ide_floppy || media == ide_tape) && drv_req) { rq->errors = 0; - ide_complete_rq(drive, 0); + ide_complete_rq(drive, 0, blk_rq_bytes(rq)); } else { if (media == ide_tape) rq->errors = IDE_DRV_ERROR_GENERAL; @@ -312,7 +312,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, printk("%s: DRIVE_CMD (null)\n", drive->name); #endif rq->errors = 0; - ide_complete_rq(drive, 0); + ide_complete_rq(drive, 0, blk_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 94f6fb8c147..2df70892768 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -778,7 +778,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, "Two DSC requests were queued\n"); drive->failed_pc = NULL; rq->errors = 0; - ide_complete_rq(drive, 0); + ide_complete_rq(drive, 0, blk_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index e9d008ef3f3..b9d7ba2c8a0 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -294,7 +294,7 @@ void ide_finish_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat) ide_complete_cmd(drive, cmd, stat, err); rq->errors = err; - ide_complete_rq(drive, err ? -EIO : 0); + ide_complete_rq(drive, err ? -EIO : 0, blk_rq_bytes(rq)); } /* -- cgit v1.2.3 From ba7d479c36dde12821c01ad0696d678635b8fb92 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:44 +0100 Subject: ide: use ide_end_rq() in ide_complete_rq() This results in PIO->DMA retry being triggered also on completion of requests using ide_complete_rq() instead of ide_end_request(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index a4aa4bf8473..8e2868617a4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -147,7 +147,7 @@ int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) struct request *rq = hwif->rq; int rc; - rc = blk_end_request(rq, error, nr_bytes); + rc = ide_end_rq(drive, rq, error, nr_bytes); if (rc == 0) hwif->rq = NULL; -- cgit v1.2.3 From 130e886708d6e11f3d54e5d27c266578de56f343 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:45 +0100 Subject: ide: remove ide_end_request() * Add ide_rq_bytes() helper. * Add blk_noretry_request() quirk to ide_complete_rq() (currently only fs requests can be marked as "noretry" so there is no change in behavior). * Switch current ide_end_request() users to use ide_complete_rq(). [ No need to check for rq->nr_sectors == 0 in {ide_dma,task_pio}_intr(), nsectors == 0 in cdrom_end_request() and err == 0 in ide_do_devset(). ] * Remove no longer needed ide_end_request(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 6 +++-- drivers/ide/ide-cd.c | 7 +++--- drivers/ide/ide-devsets.c | 4 +-- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-dma.c | 3 ++- drivers/ide/ide-eh.c | 2 +- drivers/ide/ide-floppy.c | 4 +-- drivers/ide/ide-io.c | 61 ++++++++++++++-------------------------------- drivers/ide/ide-tape.c | 2 +- drivers/ide/ide-taskfile.c | 4 +-- 10 files changed, 36 insertions(+), 59 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 30156aa6101..c3fd528a1b4 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -410,7 +410,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) if (rq->errors == 0) rq->errors = -EIO; } - ide_end_request(drive, uptodate, 0); + ide_complete_rq(drive, uptodate ? 0 : -EIO, + ide_rq_bytes(rq)); } return ide_stopped; @@ -469,7 +470,8 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) /* FIXME: don't do partial completions */ if (drive->media == ide_floppy) - ide_end_request(drive, 1, done >> 9); + ide_complete_rq(drive, 0, + done ? done : ide_rq_bytes(rq)); } else xferfunc(drive, NULL, pc->cur_pos, bcount); diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index e4fa807fdcf..2f698c6e913 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -298,7 +298,7 @@ static void cdrom_end_request(ide_drive_t *drive, int uptodate) if (blk_fs_request(rq) == 0 && uptodate <= 0 && rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, uptodate, nsectors); + ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); } static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st) @@ -793,10 +793,11 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) if (dma_error) return ide_error(drive, "dma error", stat); if (blk_fs_request(rq)) { - ide_end_request(drive, 1, rq->nr_sectors); + ide_complete_rq(drive, 0, rq->nr_sectors + ? (rq->nr_sectors << 9) : ide_rq_bytes(rq)); return ide_stopped; } else if (rq->cmd_type == REQ_TYPE_ATA_PC && !rq->bio) { - ide_end_request(drive, 1, 1); + ide_complete_rq(drive, 0, 512); return ide_stopped; } goto end_request; diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index 7c3953414d4..5bf958e5b1d 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c @@ -183,8 +183,6 @@ ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) err = setfunc(drive, *(int *)&rq->cmd[1]); if (err) rq->errors = err; - else - err = 1; - ide_end_request(drive, err, 0); + ide_complete_rq(drive, err, ide_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index ad9a3f54d21..d8caa65ca7a 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -186,7 +186,7 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq, blk_dump_rq_flags(rq, "ide_do_rw_disk - bad command"); if (rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, 0, 0); + ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 820e5104ba4..8f5e32e692f 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -101,7 +101,8 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) ide_finish_cmd(drive, cmd, stat); else - ide_end_request(drive, 1, cmd->rq->nr_sectors); + ide_complete_rq(drive, 0, + cmd->rq->nr_sectors << 9); return ide_stopped; } printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n", diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index ccfd06ef5bb..aff1a9b0455 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -149,7 +149,7 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { if (err <= 0 && rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, err ? err : 1, 0); + ide_complete_rq(drive, err ? err : 0, ide_rq_bytes(rq)); } } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 7ef2b90e530..8c518c6a647 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -68,7 +68,7 @@ static void idefloppy_update_buffers(ide_drive_t *drive, struct bio *bio = rq->bio; while ((bio = rq->bio) != NULL) - ide_end_request(drive, 1, 0); + ide_complete_rq(drive, 0, ide_rq_bytes(rq)); } static int ide_floppy_callback(ide_drive_t *drive, int dsc) @@ -300,7 +300,7 @@ out_end: drive->failed_pc = NULL; if (blk_fs_request(rq) == 0 && rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, 0, 0); + ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 8e2868617a4..f59c709052d 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -71,48 +71,6 @@ int ide_end_rq(ide_drive_t *drive, struct request *rq, int error, } EXPORT_SYMBOL_GPL(ide_end_rq); -/** - * ide_end_request - complete an IDE I/O - * @drive: IDE device for the I/O - * @uptodate: - * @nr_sectors: number of sectors completed - * - * This is our end_request wrapper function. We complete the I/O - * update random number input and dequeue the request, which if - * it was tagged may be out of order. - */ - -int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) -{ - unsigned int nr_bytes = nr_sectors << 9; - struct request *rq = drive->hwif->rq; - int rc, error = 0; - - if (!nr_bytes) { - if (blk_pc_request(rq)) - nr_bytes = rq->data_len; - else - nr_bytes = rq->hard_cur_sectors << 9; - } - - /* - * if failfast is set on a request, override number of sectors - * and complete the whole request right now - */ - if (blk_noretry_request(rq) && uptodate <= 0) - nr_bytes = rq->hard_nr_sectors << 9; - - if (uptodate <= 0) - error = uptodate ? uptodate : -EIO; - - rc = ide_end_rq(drive, rq, error, nr_bytes); - if (rc == 0) - drive->hwif->rq = NULL; - - return rc; -} -EXPORT_SYMBOL(ide_end_request); - void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) { struct ide_taskfile *tf = &cmd->tf; @@ -141,12 +99,29 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) kfree(cmd); } +/* obsolete, blk_rq_bytes() should be used instead */ +unsigned int ide_rq_bytes(struct request *rq) +{ + if (blk_pc_request(rq)) + return rq->data_len; + else + return rq->hard_cur_sectors << 9; +} +EXPORT_SYMBOL_GPL(ide_rq_bytes); + int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) { ide_hwif_t *hwif = drive->hwif; struct request *rq = hwif->rq; int rc; + /* + * if failfast is set on a request, override number of sectors + * and complete the whole request right now + */ + if (blk_noretry_request(rq) && error <= 0) + nr_bytes = rq->hard_nr_sectors << 9; + rc = ide_end_rq(drive, rq, error, nr_bytes); if (rc == 0) hwif->rq = NULL; @@ -170,7 +145,7 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) rq->errors = IDE_DRV_ERROR_GENERAL; else if (blk_fs_request(rq) == 0 && rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, 0, 0); + ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); } } diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2df70892768..853d047aa78 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -762,7 +762,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, "request queue (%d)\n", drive->name, rq->cmd_type); if (blk_fs_request(rq) == 0 && rq->errors == 0) rq->errors = -EIO; - ide_end_request(drive, 0, 0); + ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); return ide_stopped; } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index b9d7ba2c8a0..db6d7821e45 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -283,7 +283,7 @@ static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) } if (sectors > 0) - ide_end_request(drive, 1, sectors); + ide_complete_rq(drive, 0, sectors << 9); } } @@ -352,7 +352,7 @@ out_end: if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) ide_finish_cmd(drive, cmd, stat); else - ide_end_request(drive, 1, cmd->rq->nr_sectors); + ide_complete_rq(drive, 0, cmd->rq->nr_sectors << 9); return ide_stopped; out_err: ide_error_cmd(drive, cmd); -- cgit v1.2.3 From 2298169418f43ba5e0919762a4bab95a1227872a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:46 +0100 Subject: ide: pass command to ide_map_sg() * Set IDE_TFLAG_WRITE flag and ->rq also for ATA_CMD_PACKET commands. * Pass command to ->dma_setup method and update all its implementations accordingly. * Pass command instead of request to ide_build_sglist(), *_build_dmatable() and ide_map_sg(). While at it: * Fix scc_dma_setup() documentation + use ATA_DMA_WR define. * Rename sgiioc4_build_dma_table() to sgiioc4_build_dmatable(), change return value type to 'int' and drop unused 'ddir' argument. * Do some minor cleanups in [tx4939]ide_dma_setup(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/alim15x3.c | 7 ++++--- drivers/ide/au1xxx-ide.c | 15 ++++++--------- drivers/ide/icside.c | 7 +++---- drivers/ide/ide-atapi.c | 16 ++++++++++++---- drivers/ide/ide-disk.c | 10 +++++----- drivers/ide/ide-dma-sff.c | 18 +++++++++--------- drivers/ide/ide-dma.c | 15 +++++++-------- drivers/ide/ide-floppy.c | 6 +++++- drivers/ide/ide-io.c | 6 +++--- drivers/ide/ide-taskfile.c | 4 ++-- drivers/ide/ns87415.c | 4 ++-- drivers/ide/pmac.c | 19 ++++++++----------- drivers/ide/scc_pata.c | 19 +++++++------------ drivers/ide/sgiioc4.c | 21 +++++++-------------- drivers/ide/trm290.c | 10 +++++----- drivers/ide/tx4939ide.c | 26 ++++++++++---------------- 16 files changed, 95 insertions(+), 108 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index d3513b6b853..e837fd9f196 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c @@ -191,17 +191,18 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) /** * ali15x3_dma_setup - begin a DMA phase * @drive: target device + * @cmd: command * * Returns 1 if the DMA cannot be performed, zero on success. */ -static int ali15x3_dma_setup(ide_drive_t *drive) +static int ali15x3_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { if (m5229_revision < 0xC2 && drive->media != ide_disk) { - if (rq_data_dir(drive->hwif->rq)) + if (cmd->tf_flags & IDE_TFLAG_WRITE) return 1; /* try PIO instead of DMA */ } - return ide_dma_setup(drive); + return ide_dma_setup(drive, cmd); } /** diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 3ace0cda545..58485d6cb02 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -209,15 +209,14 @@ static void auide_set_dma_mode(ide_drive_t *drive, const u8 speed) */ #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -static int auide_build_dmatable(ide_drive_t *drive) +static int auide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; _auide_hwif *ahwif = &auide_hwif; struct scatterlist *sg; - int i = hwif->cmd.sg_nents, iswrite, count = 0; + int i = cmd->sg_nents, count = 0; + int iswrite = !!(cmd->tf_flags & IDE_TFLAG_WRITE); - iswrite = (rq_data_dir(rq) == WRITE); /* Save for interrupt context */ ahwif->drive = drive; @@ -298,12 +297,10 @@ static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) (2*WAIT_CMD), NULL); } -static int auide_dma_setup(ide_drive_t *drive) +static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { - struct request *rq = drive->hwif->rq; - - if (!auide_build_dmatable(drive)) { - ide_map_sg(drive, rq); + if (auide_build_dmatable(drive, cmd) == 0) { + ide_map_sg(drive, cmd); return 1; } diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index bdfeb1222d5..3628b214790 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -307,15 +307,14 @@ static void icside_dma_start(ide_drive_t *drive) enable_dma(ec->dma); } -static int icside_dma_setup(ide_drive_t *drive) +static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct expansion_card *ec = ECARD_DEV(hwif->dev); struct icside_state *state = ecard_get_drvdata(ec); - struct request *rq = hwif->rq; unsigned int dma_mode; - if (rq_data_dir(rq)) + if (cmd->tf_flags & IDE_TFLAG_WRITE) dma_mode = DMA_MODE_WRITE; else dma_mode = DMA_MODE_READ; @@ -344,7 +343,7 @@ static int icside_dma_setup(ide_drive_t *drive) * Tell the DMA engine about the SG table and * data direction. */ - set_dma_sg(ec->dma, hwif->sg_table, hwif->cmd.sg_nents); + set_dma_sg(ec->dma, hwif->sg_table, cmd->sg_nents); set_dma_mode(ec->dma, dma_mode); drive->waiting_for_dma = 1; diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index c3fd528a1b4..b56af49f876 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -638,12 +638,20 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) { struct ide_atapi_pc *pc; ide_hwif_t *hwif = drive->hwif; + const struct ide_dma_ops *dma_ops = hwif->dma_ops; + struct ide_cmd *cmd = &hwif->cmd; ide_expiry_t *expiry = NULL; struct request *rq = hwif->rq; unsigned int timeout; u32 tf_flags; u16 bcount; + if (drive->media != ide_floppy) { + if (rq_data_dir(rq)) + cmd->tf_flags |= IDE_TFLAG_WRITE; + cmd->rq = rq; + } + if (dev_is_idecd(drive)) { tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; bcount = ide_cd_get_xferlen(rq); @@ -651,8 +659,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) timeout = ATAPI_WAIT_PC; if (drive->dma) { - if (ide_build_sglist(drive, rq)) - drive->dma = !hwif->dma_ops->dma_setup(drive); + if (ide_build_sglist(drive, cmd)) + drive->dma = !dma_ops->dma_setup(drive, cmd); else drive->dma = 0; } @@ -675,8 +683,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) if ((pc->flags & PC_FLAG_DMA_OK) && (drive->dev_flags & IDE_DFLAG_USING_DMA)) { - if (ide_build_sglist(drive, rq)) - drive->dma = !hwif->dma_ops->dma_setup(drive); + if (ide_build_sglist(drive, cmd)) + drive->dma = !dma_ops->dma_setup(drive, cmd); else drive->dma = 0; } diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index d8caa65ca7a..4b32c4eb7b8 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -99,11 +99,6 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, memset(&cmd, 0, sizeof(cmd)); cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; - if (dma == 0) { - ide_init_sg_cmd(&cmd, nsectors); - ide_map_sg(drive, rq); - } - if (drive->dev_flags & IDE_DFLAG_LBA) { if (lba48) { pr_debug("%s: LBA=0x%012llx\n", drive->name, @@ -156,6 +151,11 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, ide_tf_set_cmd(drive, &cmd, dma); cmd.rq = rq; + if (dma == 0) { + ide_init_sg_cmd(&cmd, nsectors); + ide_map_sg(drive, &cmd); + } + rc = do_rw_taskfile(drive, &cmd); if (rc == ide_stopped && dma) { diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index 7bf28a9b6f6..b7eb810c7b8 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c @@ -111,7 +111,7 @@ EXPORT_SYMBOL_GPL(ide_dma_host_set); * May also be invoked from trm290.c */ -int ide_build_dmatable(ide_drive_t *drive, struct request *rq) +int ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; __le32 *table = (__le32 *)hwif->dmatable_cpu; @@ -120,7 +120,7 @@ int ide_build_dmatable(ide_drive_t *drive, struct request *rq) struct scatterlist *sg; u8 is_trm290 = !!(hwif->host_flags & IDE_HFLAG_TRM290); - for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { + for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { u32 cur_addr, cur_len, xcount, bcount; cur_addr = sg_dma_address(sg); @@ -175,6 +175,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); /** * ide_dma_setup - begin a DMA phase * @drive: target device + * @cmd: command * * Build an IDE DMA PRD (IDE speak for scatter gather table) * and then set up the DMA transfer registers for a device @@ -185,17 +186,16 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); * is returned. */ -int ide_dma_setup(ide_drive_t *drive) +int ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; - unsigned int reading = rq_data_dir(rq) ? 0 : ATA_DMA_WR; u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; + u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; u8 dma_stat; /* fall back to pio! */ - if (!ide_build_dmatable(drive, rq)) { - ide_map_sg(drive, rq); + if (ide_build_dmatable(drive, cmd) == 0) { + ide_map_sg(drive, cmd); return 1; } @@ -208,9 +208,9 @@ int ide_dma_setup(ide_drive_t *drive) /* specify r/w */ if (mmio) - writeb(reading, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD)); + writeb(rw, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD)); else - outb(reading, hwif->dma_base + ATA_DMA_CMD); + outb(rw, hwif->dma_base + ATA_DMA_CMD); /* read DMA status for INTR & ERROR flags */ dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 8f5e32e692f..ad4edab9b0a 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -120,7 +120,7 @@ int ide_dma_good_drive(ide_drive_t *drive) /** * ide_build_sglist - map IDE scatter gather for DMA I/O * @drive: the drive to build the DMA table for - * @rq: the request holding the sg list + * @cmd: command * * Perform the DMA mapping magic necessary to access the source or * target buffers of a request via DMA. The lower layers of the @@ -128,23 +128,22 @@ int ide_dma_good_drive(ide_drive_t *drive) * operate in a portable fashion. */ -int ide_build_sglist(ide_drive_t *drive, struct request *rq) +int ide_build_sglist(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; struct scatterlist *sg = hwif->sg_table; - struct ide_cmd *cmd = &hwif->cmd; int i; - ide_map_sg(drive, rq); + ide_map_sg(drive, cmd); - if (rq_data_dir(rq) == READ) - cmd->sg_dma_direction = DMA_FROM_DEVICE; - else + if (cmd->tf_flags & IDE_TFLAG_WRITE) cmd->sg_dma_direction = DMA_TO_DEVICE; + else + cmd->sg_dma_direction = DMA_FROM_DEVICE; i = dma_map_sg(hwif->dev, sg, cmd->sg_nents, cmd->sg_dma_direction); if (i == 0) - ide_map_sg(drive, rq); + ide_map_sg(drive, cmd); else { cmd->orig_sg_nents = cmd->sg_nents; cmd->sg_nents = i; diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 8c518c6a647..ee3e77a7a72 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -285,9 +285,13 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, goto out_end; } + if (rq_data_dir(rq)) + cmd->tf_flags |= IDE_TFLAG_WRITE; + cmd->rq = rq; + if (blk_fs_request(rq) || pc->req_xfer) { ide_init_sg_cmd(cmd, rq->nr_sectors); - ide_map_sg(drive, rq); + ide_map_sg(drive, cmd); } pc->sg = hwif->sg_table; diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index f59c709052d..47404f5526f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -228,11 +228,11 @@ static ide_startstop_t do_special (ide_drive_t *drive) return ide_stopped; } -void ide_map_sg(ide_drive_t *drive, struct request *rq) +void ide_map_sg(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct ide_cmd *cmd = &hwif->cmd; struct scatterlist *sg = hwif->sg_table; + struct request *rq = cmd->rq; if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); @@ -273,7 +273,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, if (cmd) { if (cmd->protocol == ATA_PROT_PIO) { ide_init_sg_cmd(cmd, rq->nr_sectors); - ide_map_sg(drive, rq); + ide_map_sg(drive, cmd); } return do_rw_taskfile(drive, cmd); diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index db6d7821e45..3b23bd11945 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -102,8 +102,8 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) return ide_started; default: if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || - ide_build_sglist(drive, hwif->rq) == 0 || - dma_ops->dma_setup(drive)) + ide_build_sglist(drive, cmd) == 0 || + dma_ops->dma_setup(drive, cmd)) return ide_stopped; dma_ops->dma_exec_cmd(drive, tf->command); dma_ops->dma_start(drive); diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index d93c8001632..cf6d9a9c8a2 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c @@ -216,11 +216,11 @@ static int ns87415_dma_end(ide_drive_t *drive) return (dma_stat & 7) != 4; } -static int ns87415_dma_setup(ide_drive_t *drive) +static int ns87415_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { /* select DMA xfer */ ns87415_prepare_drive(drive, 1); - if (!ide_dma_setup(drive)) + if (ide_dma_setup(drive, cmd) == 0) return 0; /* DMA failed: select PIO xfer */ ns87415_prepare_drive(drive, 0); diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index f5b85f4c1b6..337d2d5b302 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -404,7 +404,6 @@ kauai_lookup_timing(struct kauai_timing* table, int cycle_time) #define IDE_WAKEUP_DELAY (1*HZ) static int pmac_ide_init_dma(ide_hwif_t *, const struct ide_port_info *); -static int pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq); static void pmac_ide_selectproc(ide_drive_t *drive); static void pmac_ide_kauai_selectproc(ide_drive_t *drive); @@ -1422,8 +1421,7 @@ out: * pmac_ide_build_dmatable builds the DBDMA command list * for a transfer and sets the DBDMA channel to point to it. */ -static int -pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) +static int pmac_ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; pmac_ide_hwif_t *pmif = @@ -1431,8 +1429,8 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) struct dbdma_cmd *table; volatile struct dbdma_regs __iomem *dma = pmif->dma_regs; struct scatterlist *sg; - int wr = (rq_data_dir(rq) == WRITE); - int i = hwif->cmd.sg_nents, count = 0; + int wr = !!(cmd->tf_flags & IDE_TFLAG_WRITE); + int i = cmd->sg_nents, count = 0; /* DMA table is already aligned */ table = (struct dbdma_cmd *) pmif->dma_table_cpu; @@ -1504,23 +1502,22 @@ use_pio_instead: * Prepare a DMA transfer. We build the DMA table, adjust the timings for * a read on KeyLargo ATA/66 and mark us as waiting for DMA completion */ -static int -pmac_ide_dma_setup(ide_drive_t *drive) +static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; pmac_ide_hwif_t *pmif = (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); - struct request *rq = hwif->rq; u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4); + u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); - if (!pmac_ide_build_dmatable(drive, rq)) { - ide_map_sg(drive, rq); + if (pmac_ide_build_dmatable(drive, cmd) == 0) { + ide_map_sg(drive, cmd); return 1; } /* Apple adds 60ns to wrDataSetup on reads */ if (ata4 && (pmif->timings[unit] & TR_66_UDMA_EN)) { - writel(pmif->timings[unit] + (!rq_data_dir(rq) ? 0x00800000UL : 0), + writel(pmif->timings[unit] + (write ? 0 : 0x00800000UL), PMAC_IDE_REG(IDE_TIMING_CONFIG)); (void)readl(PMAC_IDE_REG(IDE_TIMING_CONFIG)); } diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index ada86674462..1f2805ce988 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -303,8 +303,9 @@ static void scc_dma_host_set(ide_drive_t *drive, int on) } /** - * scc_ide_dma_setup - begin a DMA phase + * scc_dma_setup - begin a DMA phase * @drive: target device + * @cmd: command * * Build an IDE DMA PRD (IDE speak for scatter gather table) * and then set up the DMA transfer registers. @@ -313,21 +314,15 @@ static void scc_dma_host_set(ide_drive_t *drive, int on) * is returned. */ -static int scc_dma_setup(ide_drive_t *drive) +static int scc_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; - unsigned int reading; + u32 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; u8 dma_stat; - if (rq_data_dir(rq)) - reading = 0; - else - reading = 1 << 3; - /* fall back to pio! */ - if (!ide_build_dmatable(drive, rq)) { - ide_map_sg(drive, rq); + if (ide_build_dmatable(drive, cmd) == 0) { + ide_map_sg(drive, cmd); return 1; } @@ -335,7 +330,7 @@ static int scc_dma_setup(ide_drive_t *drive) out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); /* specify r/w */ - out_be32((void __iomem *)hwif->dma_base, reading); + out_be32((void __iomem *)hwif->dma_base, rw); /* read DMA status for INTR & ERROR flags */ dma_stat = scc_dma_sff_read_status(hwif); diff --git a/drivers/ide/sgiioc4.c b/drivers/ide/sgiioc4.c index b0769e96d32..b12de8346c7 100644 --- a/drivers/ide/sgiioc4.c +++ b/drivers/ide/sgiioc4.c @@ -424,12 +424,11 @@ sgiioc4_configure_for_dma(int dma_direction, ide_drive_t * drive) /* | Upper 32 bits - Zero |EOL| 15 unused | 16 Bit Length| */ /* --------------------------------------------------------------------- */ /* Creates the scatter gather list, DMA Table */ -static unsigned int -sgiioc4_build_dma_table(ide_drive_t * drive, struct request *rq, int ddir) +static int sgiioc4_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; unsigned int *table = hwif->dmatable_cpu; - unsigned int count = 0, i = hwif->cmd.sg_nents; + unsigned int count = 0, i = cmd->sg_nents; struct scatterlist *sg = hwif->sg_table; while (i && sg_dma_len(sg)) { @@ -484,24 +483,18 @@ use_pio_instead: return 0; /* revert to PIO for this request */ } -static int sgiioc4_dma_setup(ide_drive_t *drive) +static int sgiioc4_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { - struct request *rq = drive->hwif->rq; - unsigned int count = 0; int ddir; + u8 write = !!(cmd->tf_flags & IDE_TFLAG_WRITE); - if (rq_data_dir(rq)) - ddir = PCI_DMA_TODEVICE; - else - ddir = PCI_DMA_FROMDEVICE; - - if (!(count = sgiioc4_build_dma_table(drive, rq, ddir))) { + if (sgiioc4_build_dmatable(drive, cmd) == 0) { /* try PIO instead of DMA */ - ide_map_sg(drive, rq); + ide_map_sg(drive, cmd); return 1; } - if (rq_data_dir(rq)) + if (write) /* Writes TO the IOC4 FROM Main Memory */ ddir = IOC4_DMA_READ; else diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index e8279f32f9a..746858a7338 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c @@ -181,13 +181,12 @@ static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL); } -static int trm290_dma_setup(ide_drive_t *drive) +static int trm290_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; - struct request *rq = hwif->rq; unsigned int count, rw; - if (rq_data_dir(rq)) { + if (cmd->tf_flags & IDE_TFLAG_WRITE) { #ifdef TRM290_NO_DMA_WRITES /* always use PIO for writes */ trm290_prepare_drive(drive, 0); /* select PIO xfer */ @@ -197,8 +196,9 @@ static int trm290_dma_setup(ide_drive_t *drive) } else rw = 2; - if (!(count = ide_build_dmatable(drive, rq))) { - ide_map_sg(drive, rq); + count = ide_build_dmatable(drive, cmd); + if (count == 0) { + ide_map_sg(drive, cmd); /* try PIO instead of DMA */ trm290_prepare_drive(drive, 0); /* select PIO xfer */ return 1; diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 8d155ec8cca..39e3316ab63 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -232,7 +232,7 @@ static u8 tx4939ide_clear_dma_status(void __iomem *base) #ifdef __BIG_ENDIAN /* custom ide_build_dmatable to handle swapped layout */ -static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) +static int tx4939ide_build_dmatable(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; u32 *table = (u32 *)hwif->dmatable_cpu; @@ -240,7 +240,7 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, struct request *rq) int i; struct scatterlist *sg; - for_each_sg(hwif->sg_table, sg, hwif->cmd.sg_nents, i) { + for_each_sg(hwif->sg_table, sg, cmd->sg_nents, i) { u32 cur_addr, cur_len, bcount; cur_addr = sg_dma_address(sg); @@ -287,23 +287,15 @@ use_pio_instead: #define tx4939ide_build_dmatable ide_build_dmatable #endif -static int tx4939ide_dma_setup(ide_drive_t *drive) +static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; void __iomem *base = TX4939IDE_BASE(hwif); - struct request *rq = hwif->rq; - u8 reading; - int nent; - - if (rq_data_dir(rq)) - reading = 0; - else - reading = ATA_DMA_WR; + u8 rw = (cmd->tf_flags & IDE_TFLAG_WRITE) ? 0 : ATA_DMA_WR; /* fall back to PIO! */ - nent = tx4939ide_build_dmatable(drive, rq); - if (!nent) { - ide_map_sg(drive, rq); + if (tx4939ide_build_dmatable(drive, cmd) == 0) { + ide_map_sg(drive, cmd); return 1; } @@ -311,7 +303,7 @@ static int tx4939ide_dma_setup(ide_drive_t *drive) tx4939ide_writel(hwif->dmatable_dma, base, TX4939IDE_PRD_Ptr); /* specify r/w */ - tx4939ide_writeb(reading, base, TX4939IDE_DMA_Cmd); + tx4939ide_writeb(rw, base, TX4939IDE_DMA_Cmd); /* clear INTR & ERROR flags */ tx4939ide_clear_dma_status(base); @@ -320,7 +312,9 @@ static int tx4939ide_dma_setup(ide_drive_t *drive) tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ? TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1); - tx4939ide_writew(rq->nr_sectors, base, TX4939IDE_Sec_Cnt); + + tx4939ide_writew(cmd->rq->nr_sectors, base, TX4939IDE_Sec_Cnt); + return 0; } -- cgit v1.2.3 From b788ee9c6561fd9219a503216284d61036a0dc0b Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:46 +0100 Subject: ide: use do_rw_taskfile() for ATA_CMD_PACKET commands * Pass command to ide_issue_pc() and update ->do_request methods in ide-{cd,floppy,tape}.c accordingly. * Convert ide_pktcmd_tf_load() to ide_init_packet_cmd() which just initializes command structure and use do_rw_taskfile() to load ATA_CMD_PACKET commands. While at it: * Rename ide{floppy,tape}_issue_pc() to ide_{floppy,tape}_issue_pc(). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 37 ++++++++++++------------------------- drivers/ide/ide-cd.c | 11 ++++++++++- drivers/ide/ide-floppy.c | 24 ++++++++++++++---------- drivers/ide/ide-tape.c | 19 ++++++++++++++----- drivers/ide/ide-taskfile.c | 3 ++- 5 files changed, 52 insertions(+), 42 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index b56af49f876..75df05add1b 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -487,23 +487,15 @@ next_irq: return ide_started; } -static void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount) +static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, + u16 bcount, u8 dma) { - ide_hwif_t *hwif = drive->hwif; - struct ide_cmd cmd; - u8 dma = drive->dma; - - memset(&cmd, 0, sizeof(cmd)); - cmd.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | - IDE_TFLAG_OUT_FEATURE | tf_flags; - cmd.tf.feature = dma; /* Use PIO/DMA */ - cmd.tf.lbam = bcount & 0xff; - cmd.tf.lbah = (bcount >> 8) & 0xff; - - ide_tf_dump(drive->name, &cmd.tf); - hwif->tp_ops->set_irq(hwif, 1); - SELECT_MASK(drive, 0); - hwif->tp_ops->tf_load(drive, &cmd); + cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; + cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | + IDE_TFLAG_OUT_FEATURE | tf_flags; + cmd->tf.feature = dma; /* Use PIO/DMA */ + cmd->tf.lbam = bcount & 0xff; + cmd->tf.lbah = (bcount >> 8) & 0xff; } static u8 ide_read_ireason(ide_drive_t *drive) @@ -634,24 +626,17 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) return ide_started; } -ide_startstop_t ide_issue_pc(ide_drive_t *drive) +ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) { struct ide_atapi_pc *pc; ide_hwif_t *hwif = drive->hwif; const struct ide_dma_ops *dma_ops = hwif->dma_ops; - struct ide_cmd *cmd = &hwif->cmd; ide_expiry_t *expiry = NULL; struct request *rq = hwif->rq; unsigned int timeout; u32 tf_flags; u16 bcount; - if (drive->media != ide_floppy) { - if (rq_data_dir(rq)) - cmd->tf_flags |= IDE_TFLAG_WRITE; - cmd->rq = rq; - } - if (dev_is_idecd(drive)) { tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; bcount = ide_cd_get_xferlen(rq); @@ -696,7 +681,9 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) : WAIT_TAPE_CMD; } - ide_pktcmd_tf_load(drive, tf_flags, bcount); + ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); + + (void)do_rw_taskfile(drive, cmd); /* Issue the packet command */ if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 2f698c6e913..a6c847d31b9 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -1066,6 +1066,8 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq) static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, sector_t block) { + struct ide_cmd cmd; + ide_debug_log(IDE_DBG_RQ, "cmd: 0x%x, block: %llu", rq->cmd[0], (unsigned long long)block); @@ -1094,7 +1096,14 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, return ide_stopped; } - return ide_issue_pc(drive); + memset(&cmd, 0, sizeof(cmd)); + + if (rq_data_dir(rq)) + cmd.tf_flags |= IDE_TFLAG_WRITE; + + cmd.rq = rq; + + return ide_issue_pc(drive, &cmd); } /* diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index ee3e77a7a72..f3ed5de3141 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -130,8 +130,9 @@ static void ide_floppy_report_error(struct ide_disk_obj *floppy, } -static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, - struct ide_atapi_pc *pc) +static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive, + struct ide_cmd *cmd, + struct ide_atapi_pc *pc) { struct ide_disk_obj *floppy = drive->driver_data; @@ -157,7 +158,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive, pc->retries++; - return ide_issue_pc(drive); + return ide_issue_pc(drive, cmd); } void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc) @@ -244,7 +245,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, { struct ide_disk_obj *floppy = drive->driver_data; ide_hwif_t *hwif = drive->hwif; - struct ide_cmd *cmd = &hwif->cmd; + struct ide_cmd cmd; struct ide_atapi_pc *pc; if (drive->debug_mask & IDE_DBG_RQ) @@ -285,21 +286,24 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, goto out_end; } + memset(&cmd, 0, sizeof(cmd)); + if (rq_data_dir(rq)) - cmd->tf_flags |= IDE_TFLAG_WRITE; - cmd->rq = rq; + cmd.tf_flags |= IDE_TFLAG_WRITE; + + cmd.rq = rq; if (blk_fs_request(rq) || pc->req_xfer) { - ide_init_sg_cmd(cmd, rq->nr_sectors); - ide_map_sg(drive, cmd); + ide_init_sg_cmd(&cmd, rq->nr_sectors); + ide_map_sg(drive, &cmd); } pc->sg = hwif->sg_table; - pc->sg_cnt = cmd->sg_nents; + pc->sg_cnt = cmd.sg_nents; pc->rq = rq; - return idefloppy_issue_pc(drive, pc); + return ide_floppy_issue_pc(drive, &cmd, pc); out_end: drive->failed_pc = NULL; if (blk_fs_request(rq) == 0 && rq->errors == 0) diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 853d047aa78..64dfa7458f8 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -580,7 +580,7 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, * * The handling will be done in three stages: * - * 1. idetape_issue_pc will send the packet command to the drive, and will set + * 1. ide_tape_issue_pc will send the packet command to the drive, and will set * the interrupt handler to ide_pc_intr. * * 2. On each interrupt, ide_pc_intr will be called. This step will be @@ -608,8 +608,9 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc, * request. */ -static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, - struct ide_atapi_pc *pc) +static ide_startstop_t ide_tape_issue_pc(ide_drive_t *drive, + struct ide_cmd *cmd, + struct ide_atapi_pc *pc) { idetape_tape_t *tape = drive->driver_data; @@ -654,7 +655,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive, pc->retries++; - return ide_issue_pc(drive); + return ide_issue_pc(drive, cmd); } /* A mode sense command is used to "sense" tape parameters. */ @@ -749,6 +750,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, idetape_tape_t *tape = drive->driver_data; struct ide_atapi_pc *pc = NULL; struct request *postponed_rq = tape->postponed_rq; + struct ide_cmd cmd; u8 stat; debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %lu," @@ -844,7 +846,14 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive, BUG(); out: - return idetape_issue_pc(drive, pc); + memset(&cmd, 0, sizeof(cmd)); + + if (rq_data_dir(rq)) + cmd.tf_flags |= IDE_TFLAG_WRITE; + + cmd.rq = rq; + + return ide_tape_issue_pc(drive, &cmd, pc); } /* diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 3b23bd11945..63ab233ba94 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -100,13 +100,14 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) ide_execute_command(drive, tf->command, handler, WAIT_WORSTCASE, NULL); return ide_started; - default: + case ATA_PROT_DMA: if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || ide_build_sglist(drive, cmd) == 0 || dma_ops->dma_setup(drive, cmd)) return ide_stopped; dma_ops->dma_exec_cmd(drive, tf->command); dma_ops->dma_start(drive); + default: return ide_started; } } -- cgit v1.2.3 From 60c0cd02b254805691cdc61101ada6af7bd56fde Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:46 +0100 Subject: ide: set hwif->expiry prior to calling [__]ide_set_handler() * Set hwif->expiry prior to calling [__]ide_set_handler() and drop 'expiry' argument. * Set hwif->expiry to NULL in ide_{timer_expiry,intr}() and remove 'hwif->expiry = NULL' assignments. There should be no functional changes caused by this patch. Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 6 ++++-- drivers/ide/ide-cd.c | 3 ++- drivers/ide/ide-eh.c | 9 ++++----- drivers/ide/ide-io.c | 2 ++ drivers/ide/ide-iops.c | 13 +++++++------ drivers/ide/ide-taskfile.c | 6 +++--- 6 files changed, 22 insertions(+), 17 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index 75df05add1b..f1b1b71cb74 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -483,7 +483,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) rq->cmd[0], bcount); next_irq: /* And set the interrupt handler again */ - ide_set_handler(drive, ide_pc_intr, timeout, NULL); + ide_set_handler(drive, ide_pc_intr, timeout); return ide_started; } @@ -602,11 +602,13 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) } } + hwif->expiry = expiry; + /* Set the interrupt routine */ ide_set_handler(drive, (dev_is_idecd(drive) ? drive->irq_handler : ide_pc_intr), - timeout, expiry); + timeout); /* Begin DMA, if necessary */ if (dev_is_idecd(drive)) { diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index a6c847d31b9..3f630e4080d 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -959,7 +959,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) expiry = ide_cd_expiry; } - ide_set_handler(drive, cdrom_newpc_intr, timeout, expiry); + hwif->expiry = expiry; + ide_set_handler(drive, cdrom_newpc_intr, timeout); return ide_started; end_request: diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index aff1a9b0455..11664976eea 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c @@ -175,8 +175,7 @@ static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive) printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); else { if (time_before(jiffies, hwif->poll_timeout)) { - ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, - NULL); + ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); /* continue polling */ return ide_started; } @@ -238,7 +237,7 @@ static ide_startstop_t reset_pollfunc(ide_drive_t *drive) if (!OK_STAT(tmp, 0, ATA_BUSY)) { if (time_before(jiffies, hwif->poll_timeout)) { - ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); + ide_set_handler(drive, &reset_pollfunc, HZ/20); /* continue polling */ return ide_started; } @@ -355,7 +354,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) ndelay(400); hwif->poll_timeout = jiffies + WAIT_WORSTCASE; hwif->polling = 1; - __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); + __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20); spin_unlock_irqrestore(&hwif->lock, flags); return ide_started; } @@ -415,7 +414,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi) udelay(10); hwif->poll_timeout = jiffies + WAIT_WORSTCASE; hwif->polling = 1; - __ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); + __ide_set_handler(drive, &reset_pollfunc, HZ/20); /* * Some weird controller like resetting themselves to a strange diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 47404f5526f..b4901b690c9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -651,6 +651,7 @@ void ide_timer_expiry (unsigned long data) } } hwif->handler = NULL; + hwif->expiry = NULL; /* * We need to simulate a real interrupt when invoking * the handler() function, which means we need to @@ -830,6 +831,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) goto out; hwif->handler = NULL; + hwif->expiry = NULL; hwif->req_gen++; del_timer(&hwif->timer); spin_unlock(&hwif->lock); diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index c3023de7270..916495ba45d 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -425,26 +425,25 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) * See also ide_execute_command */ void __ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, - unsigned int timeout, ide_expiry_t *expiry) + unsigned int timeout) { ide_hwif_t *hwif = drive->hwif; BUG_ON(hwif->handler); hwif->handler = handler; - hwif->expiry = expiry; hwif->timer.expires = jiffies + timeout; hwif->req_gen_timer = hwif->req_gen; add_timer(&hwif->timer); } -void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, - unsigned int timeout, ide_expiry_t *expiry) +void ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, + unsigned int timeout) { ide_hwif_t *hwif = drive->hwif; unsigned long flags; spin_lock_irqsave(&hwif->lock, flags); - __ide_set_handler(drive, handler, timeout, expiry); + __ide_set_handler(drive, handler, timeout); spin_unlock_irqrestore(&hwif->lock, flags); } EXPORT_SYMBOL(ide_set_handler); @@ -469,8 +468,10 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, ide_hwif_t *hwif = drive->hwif; unsigned long flags; + hwif->expiry = expiry; + spin_lock_irqsave(&hwif->lock, flags); - __ide_set_handler(drive, handler, timeout, expiry); + __ide_set_handler(drive, handler, timeout); hwif->tp_ops->exec_command(hwif, cmd); /* * Drive takes 400nS to respond, we must avoid the IRQ being diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 63ab233ba94..286804142e4 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -140,7 +140,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive) } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) { if ((stat & (ATA_ERR | ATA_DRQ)) == 0) { ide_set_handler(drive, &task_no_data_intr, - WAIT_WORSTCASE, NULL); + WAIT_WORSTCASE); return ide_started; } } @@ -347,7 +347,7 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive) } out_wait: /* Still data left to transfer. */ - ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE); return ide_started; out_end: if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) @@ -377,7 +377,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive, if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) local_irq_disable(); - ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); + ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE); ide_pio_datablock(drive, cmd, 1); -- cgit v1.2.3 From 22117d6eaac50d366d9013c88318a869ea4d8739 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:47 +0100 Subject: ide: add ->dma_timer_expiry method and remove ->dma_exec_cmd one (v2) * Rename dma_timer_expiry() to ide_dma_sff_timer_expiry() and export it. * Add ->dma_timer_expiry method and use it to set hwif->expiry for ATA_PROT_DMA protocol in do_rw_taskfile(). * Initialize ->dma_timer_expiry to ide_dma_sff_timer_expiry() for SFF hosts. * Move setting hwif->expiry from ide_execute_command() to its users and drop 'expiry' argument. * Use ide_execute_command() instead of ->dma_exec_cmd in do_rw_taskfile(). * Remove ->dma_exec_cmd method and its implementations. * Unexport ide_execute_command() and ide_dma_intr(). v2: * Fix CONFIG_BLK_DEV_IDEDMA=n build (noticed by Randy Dunlap). * Fix *dma_expiry naming (suggested by Sergei Shtylyov). There should be no functional changes caused by this patch. Cc: Randy Dunlap Cc: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/alim15x3.c | 2 +- drivers/ide/au1xxx-ide.c | 8 -------- drivers/ide/cmd64x.c | 6 +++--- drivers/ide/cs5536.c | 2 +- drivers/ide/hpt366.c | 6 +++--- drivers/ide/icside.c | 7 ------- drivers/ide/ide-atapi.c | 3 ++- drivers/ide/ide-dma-sff.c | 15 ++++----------- drivers/ide/ide-dma.c | 1 - drivers/ide/ide-iops.c | 6 +----- drivers/ide/ide-taskfile.c | 6 ++++-- drivers/ide/it821x.c | 2 +- drivers/ide/ns87415.c | 2 +- drivers/ide/pdc202xx_old.c | 4 ++-- drivers/ide/pmac.c | 8 -------- drivers/ide/sc1200.c | 2 +- drivers/ide/scc_pata.c | 2 +- drivers/ide/siimage.c | 2 +- drivers/ide/sl82c105.c | 2 +- drivers/ide/tc86c001.c | 2 +- drivers/ide/trm290.c | 6 ------ drivers/ide/tx4939ide.c | 2 +- 22 files changed, 29 insertions(+), 67 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c index e837fd9f196..d516168464f 100644 --- a/drivers/ide/alim15x3.c +++ b/drivers/ide/alim15x3.c @@ -504,11 +504,11 @@ static const struct ide_port_ops ali_port_ops = { static const struct ide_dma_ops ali_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ali15x3_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c index 58485d6cb02..d3a9d6c1532 100644 --- a/drivers/ide/au1xxx-ide.c +++ b/drivers/ide/au1xxx-ide.c @@ -290,13 +290,6 @@ static void auide_dma_start(ide_drive_t *drive ) } -static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) -{ - /* issue cmd to drive */ - ide_execute_command(drive, command, &ide_dma_intr, - (2*WAIT_CMD), NULL); -} - static int auide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { if (auide_build_dmatable(drive, cmd) == 0) { @@ -356,7 +349,6 @@ static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 de static const struct ide_dma_ops au1xxx_dma_ops = { .dma_host_set = auide_dma_host_set, .dma_setup = auide_dma_setup, - .dma_exec_cmd = auide_dma_exec_cmd, .dma_start = auide_dma_start, .dma_end = auide_dma_end, .dma_test_irq = auide_dma_test_irq, diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c index aeee036b150..bf0e3f47082 100644 --- a/drivers/ide/cmd64x.c +++ b/drivers/ide/cmd64x.c @@ -379,11 +379,11 @@ static const struct ide_port_ops cmd64x_port_ops = { static const struct ide_dma_ops cmd64x_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = cmd64x_dma_end, .dma_test_irq = cmd64x_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; @@ -391,11 +391,11 @@ static const struct ide_dma_ops cmd64x_dma_ops = { static const struct ide_dma_ops cmd646_rev1_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = cmd646_1_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; @@ -403,11 +403,11 @@ static const struct ide_dma_ops cmd646_rev1_dma_ops = { static const struct ide_dma_ops cmd648_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = cmd648_dma_end, .dma_test_irq = cmd648_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/cs5536.c b/drivers/ide/cs5536.c index 7a62db719a4..d5dcf489960 100644 --- a/drivers/ide/cs5536.c +++ b/drivers/ide/cs5536.c @@ -231,11 +231,11 @@ static const struct ide_port_ops cs5536_port_ops = { static const struct ide_dma_ops cs5536_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = cs5536_dma_start, .dma_end = cs5536_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, }; diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index d3b3e824f44..dbaf184ed9c 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -1418,11 +1418,11 @@ static const struct ide_port_ops hpt3xx_port_ops = { static const struct ide_dma_ops hpt37x_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = hpt374_dma_end, .dma_test_irq = hpt374_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; @@ -1430,11 +1430,11 @@ static const struct ide_dma_ops hpt37x_dma_ops = { static const struct ide_dma_ops hpt370_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = hpt370_dma_start, .dma_end = hpt370_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = hpt370_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; @@ -1442,11 +1442,11 @@ static const struct ide_dma_ops hpt370_dma_ops = { static const struct ide_dma_ops hpt36x_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = hpt366_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/icside.c b/drivers/ide/icside.c index 3628b214790..51ce404fe53 100644 --- a/drivers/ide/icside.c +++ b/drivers/ide/icside.c @@ -351,12 +351,6 @@ static int icside_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) return 0; } -static void icside_dma_exec_cmd(ide_drive_t *drive, u8 cmd) -{ - /* issue cmd to drive */ - ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD, NULL); -} - static int icside_dma_test_irq(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; @@ -380,7 +374,6 @@ static int icside_dma_init(ide_hwif_t *hwif, const struct ide_port_info *d) static const struct ide_dma_ops icside_v6_dma_ops = { .dma_host_set = icside_dma_host_set, .dma_setup = icside_dma_setup, - .dma_exec_cmd = icside_dma_exec_cmd, .dma_start = icside_dma_start, .dma_end = icside_dma_end, .dma_test_irq = icside_dma_test_irq, diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f1b1b71cb74..f7fe1decb59 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -691,8 +691,9 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { if (drive->dma) drive->waiting_for_dma = 0; + hwif->expiry = expiry; ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc, - timeout, expiry); + timeout); return ide_started; } else { ide_execute_pkt_cmd(drive); diff --git a/drivers/ide/ide-dma-sff.c b/drivers/ide/ide-dma-sff.c index b7eb810c7b8..75a9ea2e4c8 100644 --- a/drivers/ide/ide-dma-sff.c +++ b/drivers/ide/ide-dma-sff.c @@ -224,7 +224,7 @@ int ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) EXPORT_SYMBOL_GPL(ide_dma_setup); /** - * dma_timer_expiry - handle a DMA timeout + * ide_dma_sff_timer_expiry - handle a DMA timeout * @drive: Drive that timed out * * An IDE DMA transfer timed out. In the event of an error we ask @@ -237,7 +237,7 @@ EXPORT_SYMBOL_GPL(ide_dma_setup); * This can occur if an interrupt is lost or due to hang or bugs. */ -static int dma_timer_expiry(ide_drive_t *drive) +int ide_dma_sff_timer_expiry(ide_drive_t *drive) { ide_hwif_t *hwif = drive->hwif; u8 dma_stat = hwif->dma_ops->dma_sff_read_status(hwif); @@ -261,14 +261,7 @@ static int dma_timer_expiry(ide_drive_t *drive) return 0; /* Status is unknown -- reset the bus */ } - -void ide_dma_exec_cmd(ide_drive_t *drive, u8 command) -{ - /* issue cmd to drive */ - ide_execute_command(drive, command, &ide_dma_intr, 2 * WAIT_CMD, - dma_timer_expiry); -} -EXPORT_SYMBOL_GPL(ide_dma_exec_cmd); +EXPORT_SYMBOL_GPL(ide_dma_sff_timer_expiry); void ide_dma_start(ide_drive_t *drive) { @@ -342,10 +335,10 @@ EXPORT_SYMBOL_GPL(ide_dma_test_irq); const struct ide_dma_ops sff_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, .dma_sff_read_status = ide_dma_sff_read_status, diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index ad4edab9b0a..3dbf80c1549 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -110,7 +110,6 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) } return ide_error(drive, "dma_intr", stat); } -EXPORT_SYMBOL_GPL(ide_dma_intr); int ide_dma_good_drive(ide_drive_t *drive) { diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 916495ba45d..52c1258ba9f 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -454,7 +454,6 @@ EXPORT_SYMBOL(ide_set_handler); * @command: command byte to write * @handler: handler for next phase * @timeout: timeout for command - * @expiry: handler to run on timeout * * Helper function to issue an IDE command. This handles the * atomicity requirements, command timing and ensures that the @@ -463,13 +462,11 @@ EXPORT_SYMBOL(ide_set_handler); */ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, - unsigned timeout, ide_expiry_t *expiry) + unsigned timeout) { ide_hwif_t *hwif = drive->hwif; unsigned long flags; - hwif->expiry = expiry; - spin_lock_irqsave(&hwif->lock, flags); __ide_set_handler(drive, handler, timeout); hwif->tp_ops->exec_command(hwif, cmd); @@ -482,7 +479,6 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, ndelay(400); spin_unlock_irqrestore(&hwif->lock, flags); } -EXPORT_SYMBOL(ide_execute_command); void ide_execute_pkt_cmd(ide_drive_t *drive) { diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 286804142e4..f5cf04cf571 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -98,14 +98,16 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) if (handler == NULL) handler = task_no_data_intr; ide_execute_command(drive, tf->command, handler, - WAIT_WORSTCASE, NULL); + WAIT_WORSTCASE); return ide_started; case ATA_PROT_DMA: if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || ide_build_sglist(drive, cmd) == 0 || dma_ops->dma_setup(drive, cmd)) return ide_stopped; - dma_ops->dma_exec_cmd(drive, tf->command); + hwif->expiry = dma_ops->dma_timer_expiry; + ide_execute_command(drive, tf->command, ide_dma_intr, + 2 * WAIT_CMD); dma_ops->dma_start(drive); default: return ide_started; diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c index 6b9fc950b4a..0d4ac65cf94 100644 --- a/drivers/ide/it821x.c +++ b/drivers/ide/it821x.c @@ -508,10 +508,10 @@ static void it821x_quirkproc(ide_drive_t *drive) static struct ide_dma_ops it821x_pass_through_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = it821x_dma_start, .dma_end = it821x_dma_end, .dma_test_irq = ide_dma_test_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, .dma_sff_read_status = ide_dma_sff_read_status, diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index cf6d9a9c8a2..7b65fe5bf44 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c @@ -301,11 +301,11 @@ static const struct ide_port_ops ns87415_port_ops = { static const struct ide_dma_ops ns87415_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ns87415_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ns87415_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = superio_dma_sff_read_status, }; diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c index cba66ebce4e..f7536d1943f 100644 --- a/drivers/ide/pdc202xx_old.c +++ b/drivers/ide/pdc202xx_old.c @@ -331,11 +331,11 @@ static const struct ide_port_ops pdc2026x_port_ops = { static const struct ide_dma_ops pdc20246_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = pdc202xx_dma_test_irq, .dma_lost_irq = pdc202xx_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = pdc202xx_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; @@ -343,11 +343,11 @@ static const struct ide_dma_ops pdc20246_dma_ops = { static const struct ide_dma_ops pdc2026x_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = pdc202xx_dma_start, .dma_end = pdc202xx_dma_end, .dma_test_irq = pdc202xx_dma_test_irq, .dma_lost_irq = pdc202xx_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = pdc202xx_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/pmac.c b/drivers/ide/pmac.c index 337d2d5b302..2bfcfedaa07 100644 --- a/drivers/ide/pmac.c +++ b/drivers/ide/pmac.c @@ -1527,13 +1527,6 @@ static int pmac_ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) return 0; } -static void -pmac_ide_dma_exec_cmd(ide_drive_t *drive, u8 command) -{ - /* issue cmd to drive */ - ide_execute_command(drive, command, &ide_dma_intr, 2*WAIT_CMD, NULL); -} - /* * Kick the DMA controller into life after the DMA command has been issued * to the drive. @@ -1654,7 +1647,6 @@ pmac_ide_dma_lost_irq (ide_drive_t *drive) static const struct ide_dma_ops pmac_dma_ops = { .dma_host_set = pmac_ide_dma_host_set, .dma_setup = pmac_ide_dma_setup, - .dma_exec_cmd = pmac_ide_dma_exec_cmd, .dma_start = pmac_ide_dma_start, .dma_end = pmac_ide_dma_end, .dma_test_irq = pmac_ide_dma_test_irq, diff --git a/drivers/ide/sc1200.c b/drivers/ide/sc1200.c index dbdd2985a0d..1c3a8291499 100644 --- a/drivers/ide/sc1200.c +++ b/drivers/ide/sc1200.c @@ -286,11 +286,11 @@ static const struct ide_port_ops sc1200_port_ops = { static const struct ide_dma_ops sc1200_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = sc1200_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 1f2805ce988..0cc137cfe76 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c @@ -868,12 +868,12 @@ static const struct ide_port_ops scc_port_ops = { static const struct ide_dma_ops scc_dma_ops = { .dma_host_set = scc_dma_host_set, .dma_setup = scc_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = scc_dma_start, .dma_end = scc_dma_end, .dma_test_irq = scc_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, .dma_timeout = ide_dma_timeout, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_sff_read_status = scc_dma_sff_read_status, }; diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c index 1811ae9cd84..075cb1243b2 100644 --- a/drivers/ide/siimage.c +++ b/drivers/ide/siimage.c @@ -711,10 +711,10 @@ static const struct ide_port_ops sil_sata_port_ops = { static const struct ide_dma_ops sil_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = ide_dma_end, .dma_test_irq = siimage_dma_test_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_lost_irq = ide_dma_lost_irq, .dma_sff_read_status = ide_dma_sff_read_status, diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c index dba213c51ba..d25137b04e7 100644 --- a/drivers/ide/sl82c105.c +++ b/drivers/ide/sl82c105.c @@ -293,11 +293,11 @@ static const struct ide_port_ops sl82c105_port_ops = { static const struct ide_dma_ops sl82c105_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = sl82c105_dma_start, .dma_end = sl82c105_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = sl82c105_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = sl82c105_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c index 84109f5a163..427d4b3c2c6 100644 --- a/drivers/ide/tc86c001.c +++ b/drivers/ide/tc86c001.c @@ -182,11 +182,11 @@ static const struct ide_port_ops tc86c001_port_ops = { static const struct ide_dma_ops tc86c001_dma_ops = { .dma_host_set = ide_dma_host_set, .dma_setup = ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = tc86c001_dma_start, .dma_end = ide_dma_end, .dma_test_irq = ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = ide_dma_sff_read_status, }; diff --git a/drivers/ide/trm290.c b/drivers/ide/trm290.c index 746858a7338..ed1496845a9 100644 --- a/drivers/ide/trm290.c +++ b/drivers/ide/trm290.c @@ -176,11 +176,6 @@ static void trm290_selectproc (ide_drive_t *drive) trm290_prepare_drive(drive, !!(drive->dev_flags & IDE_DFLAG_USING_DMA)); } -static void trm290_dma_exec_cmd(ide_drive_t *drive, u8 command) -{ - ide_execute_command(drive, command, &ide_dma_intr, WAIT_CMD, NULL); -} - static int trm290_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd) { ide_hwif_t *hwif = drive->hwif; @@ -315,7 +310,6 @@ static const struct ide_port_ops trm290_port_ops = { static struct ide_dma_ops trm290_dma_ops = { .dma_host_set = trm290_dma_host_set, .dma_setup = trm290_dma_setup, - .dma_exec_cmd = trm290_dma_exec_cmd, .dma_start = trm290_dma_start, .dma_end = trm290_dma_end, .dma_test_irq = trm290_dma_test_irq, diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c index 39e3316ab63..e0e0a803dde 100644 --- a/drivers/ide/tx4939ide.c +++ b/drivers/ide/tx4939ide.c @@ -627,11 +627,11 @@ static const struct ide_port_ops tx4939ide_port_ops = { static const struct ide_dma_ops tx4939ide_dma_ops = { .dma_host_set = tx4939ide_dma_host_set, .dma_setup = tx4939ide_dma_setup, - .dma_exec_cmd = ide_dma_exec_cmd, .dma_start = ide_dma_start, .dma_end = tx4939ide_dma_end, .dma_test_irq = tx4939ide_dma_test_irq, .dma_lost_irq = ide_dma_lost_irq, + .dma_timer_expiry = ide_dma_sff_timer_expiry, .dma_timeout = ide_dma_timeout, .dma_sff_read_status = tx4939ide_dma_sff_read_status, }; -- cgit v1.2.3 From 35b5d0be3d8de9a5ac51471c12029fb115200cdc Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:47 +0100 Subject: ide: remove ide_execute_pkt_cmd() (v2) * Pass command structure to ide_execute_command() and skip __ide_set_handler() for ATAPI protocols on non-DRQ devices. * Convert ide_issue_pc() to always use ide_execute_command() and remove no longer needed ide_execute_pkt_cmd(). v2: * Fix for non-DRQ devices (based on report from Borislav). There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-atapi.c | 15 +++++++-------- drivers/ide/ide-iops.c | 25 ++++++++----------------- drivers/ide/ide-taskfile.c | 6 ++---- 3 files changed, 17 insertions(+), 29 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f7fe1decb59..2fb5d28a9be 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c @@ -493,6 +493,7 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | IDE_TFLAG_OUT_FEATURE | tf_flags; + cmd->tf.command = ATA_CMD_PACKET; cmd->tf.feature = dma; /* Use PIO/DMA */ cmd->tf.lbam = bcount & 0xff; cmd->tf.lbah = (bcount >> 8) & 0xff; @@ -638,6 +639,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) unsigned int timeout; u32 tf_flags; u16 bcount; + u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); if (dev_is_idecd(drive)) { tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; @@ -687,17 +689,14 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) (void)do_rw_taskfile(drive, cmd); - /* Issue the packet command */ - if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { + if (drq_int) { if (drive->dma) drive->waiting_for_dma = 0; hwif->expiry = expiry; - ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc, - timeout); - return ide_started; - } else { - ide_execute_pkt_cmd(drive); - return ide_transfer_pc(drive); } + + ide_execute_command(drive, cmd, ide_transfer_pc, timeout); + + return drq_int ? ide_started : ide_transfer_pc(drive); } EXPORT_SYMBOL_GPL(ide_issue_pc); diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 52c1258ba9f..5403e4a44be 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -451,7 +451,7 @@ EXPORT_SYMBOL(ide_set_handler); /** * ide_execute_command - execute an IDE command * @drive: IDE drive to issue the command against - * @command: command byte to write + * @cmd: command * @handler: handler for next phase * @timeout: timeout for command * @@ -461,15 +461,18 @@ EXPORT_SYMBOL(ide_set_handler); * should go via this function or do equivalent locking. */ -void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, - unsigned timeout) +void ide_execute_command(ide_drive_t *drive, struct ide_cmd *cmd, + ide_handler_t *handler, unsigned timeout) { ide_hwif_t *hwif = drive->hwif; unsigned long flags; spin_lock_irqsave(&hwif->lock, flags); - __ide_set_handler(drive, handler, timeout); - hwif->tp_ops->exec_command(hwif, cmd); + if ((cmd->protocol != ATAPI_PROT_DMA && + cmd->protocol != ATAPI_PROT_PIO) || + (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)) + __ide_set_handler(drive, handler, timeout); + hwif->tp_ops->exec_command(hwif, cmd->tf.command); /* * Drive takes 400nS to respond, we must avoid the IRQ being * serviced before that. @@ -480,18 +483,6 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, spin_unlock_irqrestore(&hwif->lock, flags); } -void ide_execute_pkt_cmd(ide_drive_t *drive) -{ - ide_hwif_t *hwif = drive->hwif; - unsigned long flags; - - spin_lock_irqsave(&hwif->lock, flags); - hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET); - ndelay(400); - spin_unlock_irqrestore(&hwif->lock, flags); -} -EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); - /* * ide_wait_not_busy() waits for the currently selected device on the hwif * to report a non-busy status, see comments in ide_probe_port(). diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index f5cf04cf571..329fd6f13f7 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -97,8 +97,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) case ATA_PROT_NODATA: if (handler == NULL) handler = task_no_data_intr; - ide_execute_command(drive, tf->command, handler, - WAIT_WORSTCASE); + ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); return ide_started; case ATA_PROT_DMA: if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || @@ -106,8 +105,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) dma_ops->dma_setup(drive, cmd)) return ide_stopped; hwif->expiry = dma_ops->dma_timer_expiry; - ide_execute_command(drive, tf->command, ide_dma_intr, - 2 * WAIT_CMD); + ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); dma_ops->dma_start(drive); default: return ide_started; -- cgit v1.2.3 From bf717c0a2e18dbe82eeb28e57b0abede3cdf45d6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 27 Mar 2009 12:46:47 +0100 Subject: ide: keep track of number of bytes instead of sectors in struct ide_cmd * Pass number of bytes instead of sectors to ide_init_sg_cmd(). * Pass number of bytes to process to ide_pio_sector() and rename it to ide_pio_bytes(). * Rename ->nsect field to ->nbytes in struct ide_cmd and use ->nbytes, ->nleft and ->cursg_ofs to keep track of number of bytes instead of sectors. There should be no functional changes caused by this patch. Acked-by: Borislav Petkov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-disk.c | 4 ++-- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-io.c | 6 +++--- drivers/ide/ide-taskfile.c | 32 ++++++++++++++++---------------- 4 files changed, 22 insertions(+), 22 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4b32c4eb7b8..ca934c8a128 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -152,7 +152,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, cmd.rq = rq; if (dma == 0) { - ide_init_sg_cmd(&cmd, nsectors); + ide_init_sg_cmd(&cmd, nsectors << 9); ide_map_sg(drive, &cmd); } @@ -162,7 +162,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, /* fallback to PIO */ cmd.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK; ide_tf_set_cmd(drive, &cmd, 0); - ide_init_sg_cmd(&cmd, nsectors); + ide_init_sg_cmd(&cmd, nsectors << 9); rc = do_rw_taskfile(drive, &cmd); } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f3ed5de3141..7ae66233483 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -294,7 +294,7 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, cmd.rq = rq; if (blk_fs_request(rq) || pc->req_xfer) { - ide_init_sg_cmd(&cmd, rq->nr_sectors); + ide_init_sg_cmd(&cmd, rq->nr_sectors << 9); ide_map_sg(drive, &cmd); } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index b4901b690c9..1adc5e2e7fb 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -245,9 +245,9 @@ void ide_map_sg(ide_drive_t *drive, struct ide_cmd *cmd) } EXPORT_SYMBOL_GPL(ide_map_sg); -void ide_init_sg_cmd(struct ide_cmd *cmd, int nsect) +void ide_init_sg_cmd(struct ide_cmd *cmd, unsigned int nr_bytes) { - cmd->nsect = cmd->nleft = nsect; + cmd->nbytes = cmd->nleft = nr_bytes; cmd->cursg_ofs = 0; cmd->cursg = NULL; } @@ -272,7 +272,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, if (cmd) { if (cmd->protocol == ATA_PROT_PIO) { - ide_init_sg_cmd(cmd, rq->nr_sectors); + ide_init_sg_cmd(cmd, rq->nr_sectors << 9); ide_map_sg(drive, cmd); } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 329fd6f13f7..84532be97c0 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -188,8 +188,8 @@ static u8 wait_drive_not_busy(ide_drive_t *drive) return stat; } -static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, - unsigned int write) +static void ide_pio_bytes(ide_drive_t *drive, struct ide_cmd *cmd, + unsigned int write, unsigned int nr_bytes) { ide_hwif_t *hwif = drive->hwif; struct scatterlist *sg = hwif->sg_table; @@ -208,7 +208,7 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, } page = sg_page(cursg); - offset = cursg->offset + cmd->cursg_ofs * SECTOR_SIZE; + offset = cursg->offset + cmd->cursg_ofs; /* get the current page and offset */ page = nth_page(page, (offset >> PAGE_SHIFT)); @@ -219,19 +219,19 @@ static void ide_pio_sector(ide_drive_t *drive, struct ide_cmd *cmd, #endif buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset; - cmd->nleft--; - cmd->cursg_ofs++; + cmd->nleft -= nr_bytes; + cmd->cursg_ofs += nr_bytes; - if ((cmd->cursg_ofs * SECTOR_SIZE) == cursg->length) { + if (cmd->cursg_ofs == cursg->length) { cmd->cursg = sg_next(cmd->cursg); cmd->cursg_ofs = 0; } /* do the actual data transfer */ if (write) - hwif->tp_ops->output_data(drive, cmd, buf, SECTOR_SIZE); + hwif->tp_ops->output_data(drive, cmd, buf, nr_bytes); else - hwif->tp_ops->input_data(drive, cmd, buf, SECTOR_SIZE); + hwif->tp_ops->input_data(drive, cmd, buf, nr_bytes); kunmap_atomic(buf, KM_BIO_SRC_IRQ); #ifdef CONFIG_HIGHMEM @@ -244,9 +244,9 @@ static void ide_pio_multi(ide_drive_t *drive, struct ide_cmd *cmd, { unsigned int nsect; - nsect = min_t(unsigned int, cmd->nleft, drive->mult_count); + nsect = min_t(unsigned int, cmd->nleft >> 9, drive->mult_count); while (nsect--) - ide_pio_sector(drive, cmd, write); + ide_pio_bytes(drive, cmd, write, SECTOR_SIZE); } static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, @@ -265,7 +265,7 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) ide_pio_multi(drive, cmd, write); else - ide_pio_sector(drive, cmd, write); + ide_pio_bytes(drive, cmd, write, SECTOR_SIZE); drive->io_32bit = saved_io_32bit; } @@ -273,18 +273,18 @@ static void ide_pio_datablock(ide_drive_t *drive, struct ide_cmd *cmd, static void ide_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd) { if (cmd->tf_flags & IDE_TFLAG_FS) { - int sectors = cmd->nsect - cmd->nleft; + int nr_bytes = cmd->nbytes - cmd->nleft; if (cmd->protocol == ATA_PROT_PIO && ((cmd->tf_flags & IDE_TFLAG_WRITE) || cmd->nleft == 0)) { if (cmd->tf_flags & IDE_TFLAG_MULTI_PIO) - sectors -= drive->mult_count; + nr_bytes -= drive->mult_count << 9; else - sectors--; + nr_bytes -= SECTOR_SIZE; } - if (sectors > 0) - ide_complete_rq(drive, 0, sectors << 9); + if (nr_bytes > 0) + ide_complete_rq(drive, 0, nr_bytes); } } -- cgit v1.2.3