From afda5e4da5abf7366ba8ac49e7634b3c85a143ae Mon Sep 17 00:00:00 2001 From: "sebdeg@ngi.it" Date: Mon, 5 Nov 2007 21:42:25 +0100 Subject: [PATCH 01/12] piix: add support for ICH7 on Acer 5602aWLMi In piix.c (and in ata_piix.c) are already included some patches to skip the cable check on some laptops and to enable UDMA > 33 modes, but I've noticed than theese doesn't work on my Acer Aspire 5602WLMi (maybe exist more versions of this laptop). With this simple patch I can set transfer mode to UDMA100. From: "sebdeg@ngi.it" Signed-off-by: Andrew Morton Acked-by: Alan Cox Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/piix.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 9329d4a810e..63625a0be71 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -302,6 +302,7 @@ struct ich_laptop { static const struct ich_laptop ich_laptop[] = { /* devid, subvendor, subdev */ + { 0x27DF, 0x1025, 0x0102 }, /* ICH7 on Acer 5602aWLMi */ { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ From 699b052ad2996c4ca87aa4b9d4a51dcca0f9e588 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Mon, 5 Nov 2007 21:42:25 +0100 Subject: [PATCH 02/12] ide: do_identify() string termination fix Terminates id->model string before invoking strstr() in do_identify(). Signed-off-by: Tejun Heo Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-probe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 6a6f2e066b4..56fb0b84342 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -172,11 +172,12 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd) ide_fixstring(id->fw_rev, sizeof(id->fw_rev), bswap); ide_fixstring(id->serial_no, sizeof(id->serial_no), bswap); + /* we depend on this a lot! */ + id->model[sizeof(id->model)-1] = '\0'; + if (strstr(id->model, "E X A B Y T E N E S T")) goto err_misc; - /* we depend on this a lot! */ - id->model[sizeof(id->model)-1] = '\0'; printk("%s: %s, ", drive->name, id->model); drive->present = 1; drive->dead = 0; From 127ba2896512699338d997418d7cf5064720b55b Mon Sep 17 00:00:00 2001 From: Matti Linnanvuori Date: Mon, 5 Nov 2007 21:42:26 +0100 Subject: [PATCH 03/12] ide/Kconfig: add IDEDISK_MULTI_MODE text adapted from hdparm manual page Add IDEDISK_MULTI_MODE text adapted from hdparm manual page. Signed-off-by: Matti Linnanvuori Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 6eaece96524..e2c21699603 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -152,9 +152,22 @@ config BLK_DEV_IDEDISK If unsure, say Y. config IDEDISK_MULTI_MODE - bool "Use multi-mode by default" + bool "Use multiple sector mode for Programmed Input/Output by default" help - If you get this error, try to say Y here: + This setting is irrelevant for most IDE disks, with direct memory + access, to which multiple sector mode does not apply. Multiple sector + mode is a feature of most modern IDE hard drives, permitting the + transfer of multiple sectors per Programmed Input/Output interrupt, + rather than the usual one sector per interrupt. When this feature is + enabled, it can reduce operating system overhead for disk Programmed + Input/Output. On some systems, it also can increase the data + throughput of Programmed Input/Output. Some drives, however, seemed + to run slower with multiple sector mode enabled. Some drives claimed + to support multiple sector mode, but lost data at some settings. + Under rare circumstances, such failures could result in massive + filesystem corruption. + + If you get the following error, try to say Y here: hda: set_multmode: status=0x51 { DriveReady SeekComplete Error } hda: set_multmode: error=0x04 { DriveStatusError } From 6d5dd21de497668c44aade803e1689bf131dc1a6 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Mon, 5 Nov 2007 21:42:26 +0100 Subject: [PATCH 04/12] ide: unexport ide_fix_driveid ide_fix_driveid can now be unexported. Signed-off-by: Adrian Bunk Acked-by: Alan Cox Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-iops.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index dcda0f109df..b3d91796805 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -403,9 +403,6 @@ void ide_fix_driveid (struct hd_driveid *id) #endif } -/* FIXME: exported for use by the USB storage (isd200.c) code only */ -EXPORT_SYMBOL(ide_fix_driveid); - void ide_fixstring (u8 *s, const int bytecount, const int byteswap) { u8 *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */ From f7d7f3fd21f06c1f07d1dc9e2cc8a3c43b53faa6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:26 +0100 Subject: [PATCH 05/12] ide/Kconfig: fix BLK_DEV_OFFBOARD dependencies This config option is effective only for host drivers that use IDE_HFLAG_OFF_BOARD host flag (aec62xx, generic, hpt34x, hpt366, pdc202xx_new, pdc202xx_old and tc86c001). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e2c21699603..d1e8df18722 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -393,9 +393,10 @@ config IDEPCI_SHARE_IRQ config IDEPCI_PCIBUS_ORDER def_bool BLK_DEV_IDE=y && BLK_DEV_IDEPCI +# TODO: split it on per host driver config options (or module parameters) config BLK_DEV_OFFBOARD bool "Boot off-board chipsets first support" - depends on BLK_DEV_IDEPCI + depends on BLK_DEV_IDEPCI && (BLK_DEV_AEC62XX || BLK_DEV_GENERIC || BLK_DEV_HPT34X || BLK_DEV_HPT366 || BLK_DEV_PDC202XX_NEW || BLK_DEV_PDC202XX_OLD || BLK_DEV_TC86C001) help Normally, IDE controllers built into the motherboard (on-board controllers) are assigned to ide0 and ide1 while those on add-in PCI From 320112bd28d3c477f6990bfe8762ccb978106a08 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:26 +0100 Subject: [PATCH 06/12] ide: check rq->cmd_type in drive_cmd_intr() drive_cmd_intr() is used by both REQ_TYPE_ATA_CMD and REQ_TYPE_ATA_TASK but commands using PIO-in protocol are valid only for REQ_TYPE_ATA_CMD (&args[4] in case of REQ_TYPE_ATA_TASK points to a value for IDE_LCYL_REG register instead of the data buffer). This fix allows REQ_TYPE_ATA_TASK commands to use non-zero values for IDE_SECTOR_REG (args[3]). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index c89f0d3058e..e04967ac25b 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -654,7 +654,8 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) int retries = 10; local_irq_enable_in_hardirq(); - if ((stat & DRQ_STAT) && args && args[3]) { + if (rq->cmd_type == REQ_TYPE_ATA_CMD && + (stat & DRQ_STAT) && args && args[3]) { u8 io_32bit = drive->io_32bit; drive->io_32bit = 0; hwif->ata_input_data(drive, &args[4], args[3] * SECTOR_WORDS); From 1c11d241115a352a4468a7a4884c22cf68a5c6fd Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:27 +0100 Subject: [PATCH 07/12] ide: clear HOB bit for REQ_TYPE_ATA_TASK requests in ide_end_drive_cmd() ide_dump_ata_status() may set HOB bit before ide_end_drive_cmd() is called. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e04967ac25b..755011827af 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -340,6 +340,8 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) if (args) { args[0] = stat; args[1] = err; + /* be sure we're looking at the low order bits */ + hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); args[2] = hwif->INB(IDE_NSECTOR_REG); args[3] = hwif->INB(IDE_SECTOR_REG); args[4] = hwif->INB(IDE_LCYL_REG); From 02ac2460ff126afadf8d364c82ebb13e116df33b Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:27 +0100 Subject: [PATCH 08/12] ide: add missing rq.ref_count initialization to ide_diag_taskfile() Noticed by Tejun Heo. Cc: Tejun Heo Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index d066546f283..eba9635f101 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -471,6 +471,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long struct request rq; memset(&rq, 0, sizeof(rq)); + rq.ref_count = 1; rq.cmd_type = REQ_TYPE_ATA_TASKFILE; rq.buffer = buf; From d34887da6be91eaac1db168fa48d91eaa4504795 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:27 +0100 Subject: [PATCH 09/12] ide: fix ide_find_dma_mode() to print human-readable info Problem reported by Mikael. Cc: Mikael Pettersson Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 428f7a8a00b..202d56a8ead 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -752,7 +752,8 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode) mode = XFER_MW_DMA_1; } - printk(KERN_DEBUG "%s: selected mode 0x%x\n", drive->name, mode); + printk(KERN_DEBUG "%s: %s mode selected\n", drive->name, + mode ? ide_xfer_verbose(mode) : "no DMA"); return min(mode, req_mode); } From 26a5b04075f6f2ccf30b22e7f0fc9127c500a698 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:27 +0100 Subject: [PATCH 10/12] ide: add missing #ifdef/#endif CONFIG_IDE_TASK_IOCTL Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index eba9635f101..2b60f1b0437 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -512,6 +512,7 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf) EXPORT_SYMBOL(ide_raw_taskfile); +#ifdef CONFIG_IDE_TASK_IOCTL int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { ide_task_request_t *req_task; @@ -661,6 +662,7 @@ abort: return err; } +#endif int ide_wait_cmd (ide_drive_t *drive, u8 cmd, u8 nsect, u8 feature, u8 sectors, u8 *buf) { From 01745112de5f721dd5afb06bc60b4a1e65e397ce Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:29 +0100 Subject: [PATCH 11/12] ide: move ide_fixstring() documentation to ide-iops.c from ide.h Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-iops.c | 7 +++++++ include/linux/ide.h | 9 +-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index b3d91796805..e17a9ee120e 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -403,6 +403,13 @@ void ide_fix_driveid (struct hd_driveid *id) #endif } +/* + * ide_fixstring() cleans up and (optionally) byte-swaps a text string, + * removing leading/trailing blanks and compressing internal blanks. + * It is primarily used to tidy up the model name/number fields as + * returned by the WIN_[P]IDENTIFY commands. + */ + void ide_fixstring (u8 *s, const int bytecount, const int byteswap) { u8 *p = s, *end = &s[bytecount & ~1]; /* bytecount must be even */ diff --git a/include/linux/ide.h b/include/linux/ide.h index 4ed4777bba6..dc75ccbcf99 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1031,14 +1031,7 @@ ide_startstop_t __ide_abort(ide_drive_t *, struct request *); extern ide_startstop_t ide_abort(ide_drive_t *, const char *); extern void ide_fix_driveid(struct hd_driveid *); -/* - * ide_fixstring() cleans up and (optionally) byte-swaps a text string, - * removing leading/trailing blanks and compressing internal blanks. - * It is primarily used to tidy up the model name/number fields as - * returned by the WIN_[P]IDENTIFY commands. - * - * (s, bytecount, byteswap) - */ + extern void ide_fixstring(u8 *, const int, const int); int ide_wait_stat(ide_startstop_t *, ide_drive_t *, u8, u8, unsigned long); From bcbf6ee3eb5212ff774161cae15ce4f92f7edafb Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Mon, 5 Nov 2007 21:42:30 +0100 Subject: [PATCH 12/12] ide: fix IDE_HFLAG_NO_ATAPI_DMA handling in config_drive_for_dma() commit 33c1002ed912ac9dacedd5d5b166da3b72d18460 incorrectly changed return value from '0' to '-1', fix it (ns87415 was the only host driver affected since it uses both IDE_HFLAG_TRUST_BIOS_FOR_DMA and IDE_HFLAG_NO_ATAPI_DMA). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 202d56a8ead..e3add70b9cd 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -340,7 +340,7 @@ static int config_drive_for_dma (ide_drive_t *drive) if (drive->media != ide_disk) { if (hwif->host_flags & IDE_HFLAG_NO_ATAPI_DMA) - return -1; + return 0; } /*