[PATCH 4/4] sis5513: remove /proc/ide/sis
This belongs to user-space (and only if really needed). textdata bss dec hex filename 7129 404 875411d75 drivers/ide/pci/sis5513.o.before 3916 404 1432110e1 drivers/ide/pci/sis5513.o.after Additionaly to being bloat the code contained two bugs: - wrong cable bit was checked (0x0001 instead of 0x8000) on ATA_133 chipsets - incorrect UDMA cycle time was reported on ATA_100a/ATA_133 chipsets Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sis5513.c | 249 -- 1 file changed, 1 insertion(+), 248 deletions(-) Index: b/drivers/ide/pci/sis5513.c === --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/sis5513.c Version 0.30Aug 9, 2007 + * linux/drivers/ide/pci/sis5513.c Version 0.31Aug 9, 2007 * * Copyright (C) 1999-2000 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2002 Lionel Bouton [EMAIL PROTECTED], Maintainer @@ -65,8 +65,6 @@ #include ide-timing.h -#define DISPLAY_SIS_TIMINGS - /* registers layout and init values are chipset family dependant */ #define ATA_16 0x01 @@ -193,243 +191,6 @@ static char* chipset_capability[] = { ATA 133 (1st gen), ATA 133 (2nd gen) }; -#if defined(DISPLAY_SIS_TIMINGS) defined(CONFIG_IDE_PROC_FS) -#include linux/stat.h -#include linux/proc_fs.h - -static u8 sis_proc = 0; - -static struct pci_dev *bmide_dev; - -static char* cable_type[] = { - 80 pins, - 40 pins -}; - -static char* recovery_time[] ={ - 12 PCICLK, 1 PCICLK, - 2 PCICLK, 3 PCICLK, - 4 PCICLK, 5 PCICLCK, - 6 PCICLK, 7 PCICLCK, - 8 PCICLK, 9 PCICLCK, - 10 PCICLK, 11 PCICLK, - 13 PCICLK, 14 PCICLK, - 15 PCICLK, 15 PCICLK -}; - -static char* active_time[] = { - 8 PCICLK, 1 PCICLCK, - 2 PCICLK, 3 PCICLK, - 4 PCICLK, 5 PCICLK, - 6 PCICLK, 12 PCICLK -}; - -static char* cycle_time[] = { - Reserved, 2 CLK, - 3 CLK, 4 CLK, - 5 CLK, 6 CLK, - 7 CLK, 8 CLK, - 9 CLK, 10 CLK, - 11 CLK, 12 CLK, - 13 CLK, 14 CLK, - 15 CLK, 16 CLK -}; - -/* Generic add master or slave info function */ -static char* get_drives_info (char *buffer, u8 pos) -{ - u8 reg00, reg01, reg10, reg11; /* timing registers */ - u32 regdw0, regdw1; - char* p = buffer; - -/* Postwrite/Prefetch */ - if (chipset_family ATA_133) { - pci_read_config_byte(bmide_dev, 0x4b, reg00); - p += sprintf(p, Drive %d:Postwrite %s \t \t Postwrite %s\n, -pos, (reg00 (0x10 pos)) ? Enabled : Disabled, -(reg00 (0x40 pos)) ? Enabled : Disabled); - p += sprintf(p, Prefetch %s \t \t Prefetch %s\n, -(reg00 (0x01 pos)) ? Enabled : Disabled, -(reg00 (0x04 pos)) ? Enabled : Disabled); - pci_read_config_byte(bmide_dev, 0x40+2*pos, reg00); - pci_read_config_byte(bmide_dev, 0x41+2*pos, reg01); - pci_read_config_byte(bmide_dev, 0x44+2*pos, reg10); - pci_read_config_byte(bmide_dev, 0x45+2*pos, reg11); - } else { - u32 reg54h; - u8 drive_pci = 0x40; - pci_read_config_dword(bmide_dev, 0x54, reg54h); - if (reg54h 0x4000) { - // Configuration space remapped to 0x70 - drive_pci = 0x70; - } - pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+4*pos, regdw0); - pci_read_config_dword(bmide_dev, (unsigned long)drive_pci+4*pos+8, regdw1); - - p += sprintf(p, Drive %d:\n, pos); - } - - -/* UDMA */ - if (chipset_family = ATA_133) { - p += sprintf(p, UDMA %s \t \t \t UDMA %s\n, -(regdw0 0x04) ? Enabled : Disabled, -(regdw1 0x04) ? Enabled : Disabled); - p += sprintf(p, UDMA Cycle Time%s \t UDMA Cycle Time%s\n, -cycle_time[(regdw0 0xF0) 4], -cycle_time[(regdw1 0xF0) 4]); - } else if (chipset_family = ATA_33) { - p += sprintf(p, UDMA %s \t \t \t UDMA %s\n, -(reg01 0x80) ? Enabled : Disabled, -(reg11 0x80) ? Enabled : Disabled); - - p += sprintf(p, UDMA Cycle Time); - switch(chipset_family) { - case ATA_33:p += sprintf(p, cycle_time[(reg01 0x60) 5]); break; - case ATA_66: - case ATA_100a: p += sprintf(p, cycle_time
Re: [PATCH 1/2] pata_hpt37x: actually clock HPT374 by 50 MHz DPLL
While at it: On Sunday 05 August 2007, Sergei Shtylyov wrote: Index: linux-2.6/drivers/ata/pata_hpt37x.c === --- linux-2.6.orig/drivers/ata/pata_hpt37x.c +++ linux-2.6/drivers/ata/pata_hpt37x.c @@ -8,12 +8,10 @@ this driver is lacking author/maintainer info: /* * Libata driver for the highpoint 37x and 30x UDMA66 ATA controllers. * * This driver is heavily based upon: * * linux/drivers/ide/pci/hpt366.c Version 0.36April 25, 2003 * * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001 Sun Microsystems, Inc. * Portions Copyright (C) 2003 Red Hat Inc - * Portions Copyright (C) 2005-2006 MontaVista Software, Inc. + * Portions Copyright (C) 2005-2007 MontaVista Software, Inc. reference to hpt366 version should also be updated (or removed) * * TODO - * PLL mode - * Look into engine reset on timeout errors. Should not be - * required. + * Look into engine reset on timeout errors. Should not be required. */ #include linux/kernel.h - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] pata_artop: fix UDMA5 for AEC6280[R] and UDMA6 for AEC6880[R]
Maximum supported UDMA mode for AEC6280[R] is UDMA5 (not UDMA4) and for AEC6880[R] it is UDMA6 (not UDMA5): * Fix the problem by adding missing struct ata_port_info to artop_init_one(). * Use the right naming (s/626/628/). * Bump driver version. Fixes IDE-libata regression, problem was never present in IDE aec62xx driver. Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ata/pata_artop.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) Index: b/drivers/ata/pata_artop.c === --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c @@ -2,6 +2,7 @@ *pata_artop.c - ARTOP ATA controller driver * * (C) 2006 Red Hat [EMAIL PROTECTED] + * (C) 2007 Bartlomiej Zolnierkiewicz * *Based in part on drivers/ide/pci/aec62xx.c * Copyright (C) 1999-2002 Andre Hedrick [EMAIL PROTECTED] @@ -28,7 +29,7 @@ #include linux/ata.h #define DRV_NAME pata_artop -#define DRV_VERSION0.4.3 +#define DRV_VERSION0.4.4 /* * The ARTOP has 33 Mhz and over clocked timing tables. Until we @@ -430,7 +431,7 @@ static int artop_init_one (struct pci_de .udma_mask = ATA_UDMA4, .port_ops = artop6260_ops, }; - static const struct ata_port_info info_626x_fast = { + static const struct ata_port_info info_628x = { .sht= artop_sht, .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = 0x1f, /* pio0-4 */ @@ -438,6 +439,14 @@ static int artop_init_one (struct pci_de .udma_mask = ATA_UDMA5, .port_ops = artop6260_ops, }; + static const struct ata_port_info info_628x_fast = { + .sht= artop_sht, + .flags = ATA_FLAG_SLAVE_POSS, + .pio_mask = 0x1f, /* pio0-4 */ + .mwdma_mask = 0x07, /* mwdma0-2 */ + .udma_mask = ATA_UDMA6, + .port_ops = artop6260_ops, + }; const struct ata_port_info *ppi[] = { NULL, NULL }; if (!printed_version++) @@ -455,13 +464,13 @@ static int artop_init_one (struct pci_de } else if (id-driver_data == 1) /* 6260 */ ppi[0] = info_626x; - else if (id-driver_data == 2) { /* 6260 or 6260 + fast */ + else if (id-driver_data == 2) { /* 6280 or 6280 + fast */ unsigned long io = pci_resource_start(pdev, 4); u8 reg; - ppi[0] = info_626x; + ppi[0] = info_628x; if (inb(io) 0x10) - ppi[0] = info_626x_fast; + ppi[0] = info_628x_fast; /* Mac systems come up with some registers not set as we will need them */ - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] pata_artop: fix UDMA5 for AEC6280[R] and UDMA6 for AEC6880[R]
On Friday 10 August 2007, Alan Cox wrote: On Thu, 9 Aug 2007 23:19:34 +0200 Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote: Maximum supported UDMA mode for AEC6280[R] is UDMA5 (not UDMA4) and for AEC6880[R] it is UDMA6 (not UDMA5): * Fix the problem by adding missing struct ata_port_info to artop_init_one(). * Use the right naming (s/626/628/). * Bump driver version. Fixes IDE-libata regression, problem was never present in IDE aec62xx driver. Have you tested this ?? -ENODEV so no and testing is welcomed. However I went over both drivers to make sure that this change is safe and correct. BTW presence of the above bugs would strongly indicate that pata_artop has never been tested (properly) with AEC6x80[R], otherwise these bugs should have been noticed and fixed much earlier. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] hpt366: fix PCI clock detection for HPT374
On Sunday 05 August 2007, Sergei Shtylyov wrote: HPT374 BIOS seems to only save f_CNT register value for the function #0 before re-tuning DPLL causing the driver to report obviously distorted f_CNT for the function #1 -- fix this by always reading the saved f_CNT register value from in the init_chipset() method the function #0 of HPT374 chip. While at it, introduce 'chip_type' for the copy of the 'struct hpt_info' member and replace the structure assignment by memcpy()... Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED] applied but the issue raised by Alan needs addressing - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] hpt366: UltraDMA filtering for SATA cards
On Sunday 05 August 2007, Sergei Shtylyov wrote: The Marvell bridge chips used on HighPoint SATA cards do not seem to support the UltraDMA modes 1, 2, and 3 (as well as any MWDMA modes), so the driver needs to account for this in the udma_filter() method. In order to achieve that, do the following changes: - install the method for all chips, not only HPT36x/370 (improve code formatting by killing an extra tabs while at it); - add to the end of the 'switch' statement in hpt3xx_udma_filter() case for HPT372[AN] and HPT374 chips upon which the SATA cards are based and check there whether we're dealing with SATA drive (by looking at words 80 and 93 of the drive's identify data), reorder HPT370[A] cases for consistency... Signed-off-by: Sergei Shtylyov [EMAIL PROTECTED] applied but --- This is against the current Linus tree and unfortunately I was able to only compile test it since that tree gives MODPOST warning and dies early. Bob, please test it if/when you'll be able to and report the results... drivers/ide/pci/hpt366.c | 75 ++- 1 files changed, 43 insertions(+), 32 deletions(-) Index: linux-2.6/drivers/ide/pci/hpt366.c === --- linux-2.6.orig/drivers/ide/pci/hpt366.c +++ linux-2.6/drivers/ide/pci/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/hpt366.cVersion 1.11Aug 4, 2007 + * linux/drivers/ide/pci/hpt366.cVersion 1.12Aug 5, 2007 * * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001 Sun Microsystems, Inc. @@ -517,29 +517,17 @@ static int check_in_drive_list(ide_drive } /* - * Note for the future; the SATA hpt37x we must set - * either PIO or UDMA modes 0,4,5 + * The Marvell bridge chips used on the HighPoint SATA cards do not seem + * to support the UltraDMA modes 1, 2, and 3 -- as well as any MWDMA modes + * (that we should start filtering out once the IDE core allows that). */ - static u8 hpt3xx_udma_filter(ide_drive_t *drive) { struct hpt_info *info = pci_get_drvdata(HWIF(drive)-pci_dev); + struct hd_driveid *id = drive-id; u8 mask; switch (info-chip_type) { HPT374/HPT372[NA] case could be added here so re-ordering wouldn't be needed. - case HPT370A: - if (!HPT370_ALLOW_ATA100_5 || - check_in_drive_list(drive, bad_ata100_5)) - return 0x1f; - else - return 0x3f; - case HPT370: - if (!HPT370_ALLOW_ATA100_5 || - check_in_drive_list(drive, bad_ata100_5)) - mask = 0x1f; - else - mask = 0x3f; - break; case HPT36x: if (!HPT366_ALLOW_ATA66_4 || check_in_drive_list(drive, bad_ata66_4)) @@ -551,6 +539,30 @@ static u8 hpt3xx_udma_filter(ide_drive_t check_in_drive_list(drive, bad_ata66_3)) mask = 0x07; break; + case HPT370: + if (!HPT370_ALLOW_ATA100_5 || + check_in_drive_list(drive, bad_ata100_5)) + mask = 0x1f; + else + mask = 0x3f; ATA_UDMA* defines should be used if you insist on re-ordering + break; + case HPT370A: + if (!HPT370_ALLOW_ATA100_5 || + check_in_drive_list(drive, bad_ata100_5)) + return 0x1f; + else + return 0x3f; ditto + case HPT372 : + case HPT372A: + case HPT372N: + case HPT374 : + /* + * Check for SATA drive by verifying that the word 93 is 0 and + * the drive is ATA-5 or higher compatible. + */ + if (id-hw_config == 0 (id-major_rev_num 0x7fe0)) Same check as in ide-iops.c::eighty_ninty_three(). Would make sense to add ide_id_is_sata_dev() inline to linux/ide.h. + return 0x71; + /* fall thru */ default: return 0x7f; HPT371[N]/HPT302[N] will use the default mask which is correct but adds hidden dependency on HPT*_ALLOW_ATA_133 being always defined as 1. IMO all HPT*_ALLOW_ATA* defines should just go away... Also now that -udma_filter is always present the initial hwif-ultra_mask doesn't matter so as well we may set it to ATA_UDMA6 (0x7f) and cleanup struct hpt_info (by removing max_ultra after fixing init_chipset_hpt366() to use info-chip_type = HPT374 check instead), init_setup_hpt366() and hpt366_chipsets[] (by removing udma_mask). } @@ -1229,25 +1241,24 @@ static unsigned int __devinit init_chips static void __devinit init_hwif_hpt366(ide_hwif_t *hwif) { - struct pci_dev *dev= hwif-pci_dev; - struct
Re: [PATCH 3/11] au1xxx-ide: use ide_tune_dma()
On Monday 06 August 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Good, that's what I lacked for hpt366.c! Were you planning to push it to Linus soon? Not really but if needed I will extract MWDMA filter part and push it sooner. * Add -mdma_filter to ide_hwif_t and use it in ide_get_mode_mask(). Hm, why not mwdma_filter()? That mdma word has unneeded connotation. ;-) Ha! As predicted: -mdma_filter name would make people more ecstatic about the code ;) * Remove needless setting of drive-using_dma from auide_dma_check(). * Split off auide_mdma_filter() from auide_dma_check(). * Use ide_tune_dma() in auide_dma_check(), this fixes following issues: - device's DMA capability bit not being checked - device not being checked against generic DMA blacklist - transfer mode not being set on device/host * Add PIO autotune fallback to auide_dma_check(). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Index: b/drivers/ide/mips/au1xxx-ide.c === --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -351,11 +351,18 @@ static int auide_dma_setup(ide_drive_t * return 0; } -static int auide_dma_check(ide_drive_t *drive) +static u8 auide_mdma_filter(ide_drive_t *drive) { - u8 speed = ide_max_dma_mode(drive); + /* +* FIXME: -white_list and -black_list are based on completely bogus +* -ide_dma_check implementation which didn't set neither the host +* controller timings nor the device for the desired transfer mode. +* +* They should be either removed or 0x00 MWDMA mask should be +* returned for devices on the -black_list. +*/ I don't get it -- why then introduce a method that does nothing? It does something as you've noticed yourself: - if( dbdma_init_done == 0 ){ + if (dbdma_init_done == 0) { I wonder what this code is doing here at all... auide_hwif.white_list = ide_in_drive_list(drive-id, dma_white_list); auide_hwif.black_list = ide_in_drive_list(drive-id, Why the results of the drive list lockup gets tied to auide_hwif? :-O To use results in auide_ddma_init()... (which needs fixing of course). The more interesting questions are: WTF is safe MWDMA mode (tsize == 1, devwidth == 16) and whether -white/black_list is really needed. I planned to cc: AU1XXX platform maintainers on this patch but to my surprise MAINTAINERS lacks AU1XXX entry. Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/11] ide: remove -ide_dma_check
On Monday 06 August 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Index: b/drivers/ide/arm/icside.c === --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -309,14 +309,6 @@ static int icside_dma_on(ide_drive_t *dr return 0; } -static int icside_dma_check(ide_drive_t *drive) -{ - if (ide_tune_dma(drive)) - return 0; - - return -1; -} - static int icside_dma_end(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); Hm, looks like there's going to be some functionality change for this driver -- it didn't fallback to PIO before this patch... ;-) It won't because this driver lacks -set_pio_mode method... :-) Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 2.6.23-rc2: check_irq_resend on resume (ali15x3)
commit 0fc4969b866671dfe39b1a9119d0fdc7ea0f63e5 I doubt that this particular report helps in debugging ne2k-pci problem... ;) On Saturday 04 August 2007, Andrey Borzenkov wrote: Just noticed this; I do not remember having seen it before, but I also do not check dmesg every time after resume. [ 54.154078] pnp: Failed to activate device 00:05. [ 54.154120] pnp: Failed to activate device 00:06. [ 54.159608] pnp: Device 00:09 activated. [ 54.205284] WARNING: at /home/bor/src/linux-git/kernel/irq/resend.c:70 check_irq_resend() [ 54.205299] [c01047fa] show_trace_log_lvl+0x1a/0x30 [ 54.205332] [c0105292] show_trace+0x12/0x20 [ 54.205343] [c01052f5] dump_stack+0x15/0x20 [ 54.205353] [c014ce7e] check_irq_resend+0x9e/0xb0 [ 54.205388] [c014c991] enable_irq+0xb1/0xc0 [ 54.205397] [df82f6fa] ide_config_drive_speed+0x18a/0x3e0 [ide_core] [ 54.205570] [df80f3cc] ali15x3_tune_drive+0x1c/0x20 [alim15x3] [ 54.205592] [df82da33] ide_do_request+0x8a3/0xa10 [ide_core] [ 54.205623] [df82dc60] ide_do_drive_cmd+0xc0/0x110 [ide_core] [ 54.205652] [df82c868] generic_ide_resume+0x98/0xe0 [ide_core] [ 54.205681] [c023793c] resume_device+0x4c/0xa0 [ 54.205717] [c02379ee] dpm_resume+0x5e/0x90 [ 54.205727] [c0237a46] device_resume+0x26/0x40 [ 54.205736] [c0141849] hibernation_snapshot+0x69/0xd0 [ 54.205747] [c0141a1c] hibernate+0xac/0x170 [ 54.205755] [c01407ae] state_store+0xbe/0xd0 [ 54.205764] [c01ab2d2] subsys_attr_store+0x32/0x50 [ 54.205784] [c01ab5ab] sysfs_write_file+0xdb/0x120 [ 54.205795] [c016f8b9] vfs_write+0x99/0x130 [ 54.205819] [c016fe2d] sys_write+0x3d/0x70 [ 54.205829] [c0104112] sysenter_past_esp+0x5f/0x99 [ 54.205839] === [ 54.206084] hda: selected mode 0x42 [ 54.225580] hdc: selected mode 0x42 [ 54.228619] usb usb1: root hub lost power or was reset [ 54.714012] eth1: PRI 31 variant 2 version 9.48 [ 54.714075] eth1: NIC 5 variant 2 version 1.02 [ 54.810451] Restarting tasks ... 5toshiba_acpi: Re-enabled hotkeys [ 54.925054] done. [ 54.925134] swsusp: Basic memory bitmaps freed [ 59.560144] eth1: PRI 31 variant 2 version 9.48 [ 59.560231] eth1: NIC 5 variant 2 version 1.02 [ 59.835398] eth1: PRI 31 variant 2 version 9.48 [ 59.835487] eth1: NIC 5 variant 2 version 1.02 [ 60.079468] eth1: PRI 31 variant 2 version 9.48 [ 60.079553] eth1: NIC 5 variant 2 version 1.02 - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 2.6.23-rc2 regression: check_irq_resend() warning from cmd64x
commit 0fc4969b866671dfe39b1a9119d0fdc7ea0f63e5 Linus, please revert it. On Sunday 05 August 2007, Mikael Pettersson wrote: This is on a sparc64 ultra5 with a rev 3 CMD646. Starting with kernel 2.6.23-rc2, each boot triggers a WARNING from kernel/irq/resend.c: Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx CMD646: IDE controller at PCI slot :01:03.0 CMD646: chipset revision 3 CMD646: MultiWord DMA force limited CMD646: 100% native mode on irq 14 ide0: BM-DMA at 0x1fe02c00020-0x1fe02c00027, BIOS settings: hda:pio, hdb:pio ide1: BM-DMA at 0x1fe02c00028-0x1fe02c0002f, BIOS settings: hdc:pio, hdd:pio Probing IDE interface ide0... hda: ST320420A, ATA DISK drive hda: selected mode 0x22 ide0 at 0x1fe02c0-0x1fe02c7,0x1fe02ca on irq 14 Probing IDE interface ide1... hdc: CRD-8483B, ATAPI CD/DVD-ROM drive WARNING: at kernel/irq/resend.c:70 check_irq_resend() Call Trace: [00475a84] enable_irq+0x9c/0xc8 [00560438] probe_hwif+0x7bc/0x934 [00560dbc] probe_hwif_init_with_fixup+0x10/0xc4 [00563454] ide_setup_pci_device+0x94/0x9c [005581f4] cmd64x_init_one+0x40/0x4c [00680670] ide_scan_pcidev+0x48/0x84 [006806e0] ide_scan_pcibus+0x34/0x100 [0068061c] ide_init+0x60/0x6c [00670200] kernel_init+0xf0/0x270 [00427344] kernel_thread+0x38/0x48 [005c5fd8] rest_init+0x18/0x5c hdc: selected mode 0x22 ide1 at 0x1fe02c00010-0x1fe02c00017,0x1fe02c0001a on irq 14 (shared with ide0) hda: max request size: 128KiB hda: 39851760 sectors (20404 MB) w/2048KiB Cache, CHS=39535/16/63, (U)DMA hda: cache flushes not supported hda: hda1 hda2 hda3 hda4 hda5 - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] hook ACPI _PSx method to IDE power on/off
On Thursday 02 August 2007, Shaohua Li wrote: ACPI spec defines the sequence of IDE power on/off: Powering down: Call _GTM. Power down drive (calls _PS3 method and turns off power planes). Powering up: Power up drive (calls _PS0 method if present and turns on power planes). Call _STM passing info from _GTM (possibly modified), with ID data from each drive. Initialize the channel. May modify the results of _GTF. For each drive: Call _GTF. Execute task file (possibly modified). This patch adds the missed _PS0/_PS3 methods call. Signed-off-by: Shaohua Li [EMAIL PROTECTED] applied, thanks Len, are you OK with the ACPI part of the patch (below)? Index: linux/drivers/acpi/bus.c === --- linux.orig/drivers/acpi/bus.c 2007-08-02 13:35:06.0 +0800 +++ linux/drivers/acpi/bus.c 2007-08-02 13:56:56.0 +0800 @@ -262,10 +262,12 @@ int acpi_bus_set_power(acpi_handle handl printk(KERN_WARNING PREFIX Transitioning device [%s] to D%d\n, device-pnp.bus_id, state); - else + else { + device-power.state = state; ACPI_DEBUG_PRINT((ACPI_DB_INFO, Device [%s] transitioned to D%d\n, device-pnp.bus_id, state)); + } return result; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ide-pmac: use ide_tune_dma() (take 2)
* Add missing initialization of hwif-autodma and drive-autodma to pmac_ide_setup_dma(). * Use ide_tune_dma() in pmac_ide_dma_check(). While at it: * Fix pmac_ide_dma_check() return value if DMA mode is not programmed (should be -1 otherwise ide_set_dma() will try to enable DMA). * Remove unnecessary drive-using_dma fiddling (-dma_off_quietly is always called before ide_set_dma() call and ide_set_dma() calls -ide_dma_on if -ide_dma_check returns 0). v2: * No reason to blacklist all ide_floppy devices and the old code was always enabling DMA anyway (without even programming controller/device if the device was ide_floppy). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- Ben, any update on the testing status of ide-pmac series? I also merged your patch to my tree but it is lacking description: http://kernel.org/pub/linux/kernel/people/bart/pata-2.6/patches/ide-pmac-fix-pio-setup-and-enable-autotune.patch Thanks, Bart. drivers/ide/ppc/pmac.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1592,23 +1592,10 @@ pmac_ide_destroy_dmatable (ide_drive_t * static int pmac_ide_dma_check(ide_drive_t *drive) { - int enable = 1; - drive-using_dma = 0; - - if (drive-media == ide_floppy) - enable = 0; - if ((drive-id-capability 1) == 0 !__ide_dma_good_drive(drive)) - enable = 0; - if (__ide_dma_bad_drive(drive)) - enable = 0; - - if (enable) { - u8 mode = ide_max_dma_mode(drive); + if (ide_tune_dma(drive)) + return 0; - if (mode pmac_ide_tune_chipset(drive, mode) == 0) - drive-using_dma = 1; - } - return 0; + return -1; } /* @@ -1842,7 +1829,10 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x00; break; - } + } + + hwif-autodma = 1; + hwif-drives[1].autodma = hwif-drives[0].autodma = hwif-autodma; } #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/11] atiixp: DMA setup fixes
* Fix handling of unsupported/invalid modes in atiixp_set_dma_mode(). * ATI controllers allow separate PIO and DMA timings so remove programming of PIO modes from atiixp_set_dma_mode(). Also remove no longer needed atiixp_dma_2_pio() helper. * SWDMA timings are not programmed by atiixp_set_dma_mode() and if SWDMA mode is chosen atiixp_dma_host_on() erroneously enables UDMA, just disable support for SWDMA modes for now. * Enable support for MWDMA0 mode. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/atiixp.c | 53 --- 1 file changed, 5 insertions(+), 48 deletions(-) Index: b/drivers/ide/pci/atiixp.c === --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/atiixp.c Version 0.02Jun 16 2007 + * linux/drivers/ide/pci/atiixp.c Version 0.03Aug 3 2007 * * Copyright (C) 2003 ATI Inc. [EMAIL PROTECTED] * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz @@ -47,43 +47,6 @@ static int save_mdma_mode[4]; static DEFINE_SPINLOCK(atiixp_lock); -/** - * atiixp_dma_2_pio- return the PIO mode matching DMA - * @xfer_rate: transfer speed - * - * Returns the nearest equivalent PIO timing for the PIO or DMA - * mode requested by the controller. - */ - -static u8 atiixp_dma_2_pio(u8 xfer_rate) { - switch(xfer_rate) { - case XFER_UDMA_6: - case XFER_UDMA_5: - case XFER_UDMA_4: - case XFER_UDMA_3: - case XFER_UDMA_2: - case XFER_UDMA_1: - case XFER_UDMA_0: - case XFER_MW_DMA_2: - case XFER_PIO_4: - return 4; - case XFER_MW_DMA_1: - case XFER_PIO_3: - return 3; - case XFER_SW_DMA_2: - case XFER_PIO_2: - return 2; - case XFER_MW_DMA_0: - case XFER_SW_DMA_1: - case XFER_SW_DMA_0: - case XFER_PIO_1: - case XFER_PIO_0: - case XFER_PIO_SLOW: - default: - return 0; - } -} - static void atiixp_dma_host_on(ide_drive_t *drive) { struct pci_dev *dev = drive-hwif-pci_dev; @@ -169,7 +132,9 @@ static void atiixp_set_dma_mode(ide_driv int timing_shift = (drive-dn 2) ? 16 : 0 + (drive-dn 1) ? 0 : 8; u32 tmp32; u16 tmp16; - u8 pio; + + if (speed XFER_MW_DMA_0) + return; spin_lock_irqsave(atiixp_lock, flags); @@ -191,13 +156,6 @@ static void atiixp_set_dma_mode(ide_driv } spin_unlock_irqrestore(atiixp_lock, flags); - - if (speed = XFER_SW_DMA_0) - pio = atiixp_dma_2_pio(speed); - else - pio = speed - XFER_PIO_0; - - atiixp_set_pio_mode(drive, pio); } /** @@ -249,8 +207,7 @@ static void __devinit init_hwif_atiixp(i hwif-atapi_dma = 1; hwif-ultra_mask = 0x3f; - hwif-mwdma_mask = 0x06; - hwif-swdma_mask = 0x04; + hwif-mwdma_mask = 0x07; pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, udma_mode); - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/11] au1xxx-ide: use ide_tune_dma()
* Add -mdma_filter to ide_hwif_t and use it in ide_get_mode_mask(). * Remove needless setting of drive-using_dma from auide_dma_check(). * Split off auide_mdma_filter() from auide_dma_check(). * Use ide_tune_dma() in auide_dma_check(), this fixes following issues: - device's DMA capability bit not being checked - device not being checked against generic DMA blacklist - transfer mode not being set on device/host * Add PIO autotune fallback to auide_dma_check(). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ide-dma.c |3 +++ drivers/ide/ide.c |1 + drivers/ide/mips/au1xxx-ide.c | 36 ++-- include/linux/ide.h |1 + 4 files changed, 27 insertions(+), 14 deletions(-) Index: b/drivers/ide/ide-dma.c === --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -677,6 +677,9 @@ static unsigned int ide_get_mode_mask(id case XFER_MW_DMA_0: if (id-field_valid 2) mask = id-dma_mword hwif-mwdma_mask; + + if (hwif-mdma_filter) + mask = hwif-mdma_filter(drive); break; case XFER_SW_DMA_0: if (id-field_valid 2) { Index: b/drivers/ide/ide.c === --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c @@ -398,6 +398,7 @@ static void ide_hwif_restore(ide_hwif_t hwif-set_pio_mode = tmp_hwif-set_pio_mode; hwif-set_dma_mode = tmp_hwif-set_dma_mode; + hwif-mdma_filter = tmp_hwif-mdma_filter; hwif-udma_filter = tmp_hwif-udma_filter; hwif-selectproc= tmp_hwif-selectproc; hwif-reset_poll= tmp_hwif-reset_poll; Index: b/drivers/ide/mips/au1xxx-ide.c === --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -351,11 +351,18 @@ static int auide_dma_setup(ide_drive_t * return 0; } -static int auide_dma_check(ide_drive_t *drive) +static u8 auide_mdma_filter(ide_drive_t *drive) { - u8 speed = ide_max_dma_mode(drive); + /* +* FIXME: -white_list and -black_list are based on completely bogus +* -ide_dma_check implementation which didn't set neither the host +* controller timings nor the device for the desired transfer mode. +* +* They should be either removed or 0x00 MWDMA mask should be +* returned for devices on the -black_list. +*/ - if( dbdma_init_done == 0 ){ + if (dbdma_init_done == 0) { auide_hwif.white_list = ide_in_drive_list(drive-id, dma_white_list); auide_hwif.black_list = ide_in_drive_list(drive-id, @@ -366,21 +373,20 @@ static int auide_dma_check(ide_drive_t * } /* Is the drive in our DMA black list? */ - - if ( auide_hwif.black_list ) { - drive-using_dma = 0; - - /* Borrowed the warning message from ide-dma.c */ - + if (auide_hwif.black_list) printk(KERN_WARNING %s: Disabling DMA for %s (blacklisted)\n, - drive-name, drive-id-model); - } - else - drive-using_dma = 1; + drive-name, drive-id-model); - if (drive-autodma (speed XFER_MODE) != XFER_PIO) + return drive-hwif-mwdma_mask; +} + +static int auide_dma_check(ide_drive_t *drive) +{ + if (ide_tune_dma(drive)) return 0; + ide_set_max_pio(drive); + return -1; } @@ -692,6 +698,8 @@ static int au_ide_probe(struct device *d hwif-dma_off_quietly = auide_dma_off_quietly; hwif-dma_timeout = auide_dma_timeout; + hwif-mdma_filter = auide_mdma_filter; + hwif-ide_dma_check = auide_dma_check; hwif-dma_exec_cmd = auide_dma_exec_cmd; hwif-dma_start = auide_dma_start; Index: b/include/linux/ide.h === --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -723,6 +723,7 @@ typedef struct hwif_s { /* driver soft-power interface */ int (*busproc)(ide_drive_t *, int); #endif + u8 (*mdma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *); void (*ata_input_data)(ide_drive_t *, void *, u32); - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/11] it8213/piix/slc90e66: remove {it8213,piix,slc90e66}_dma_2_pio()
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/it8213.c | 44 +++- drivers/ide/pci/piix.c | 44 +++- drivers/ide/pci/slc90e66.c | 33 +++-- 3 files changed, 33 insertions(+), 88 deletions(-) Index: b/drivers/ide/pci/it8213.c === --- a/drivers/ide/pci/it8213.c +++ b/drivers/ide/pci/it8213.c @@ -18,37 +18,6 @@ #include asm/io.h /** - * it8213_dma_2_pio- return the PIO mode matching DMA - * @xfer_rate: transfer speed - * - * Returns the nearest equivalent PIO timing for the DMA - * mode requested by the controller. - */ - -static u8 it8213_dma_2_pio (u8 xfer_rate) { - switch(xfer_rate) { - case XFER_UDMA_6: - case XFER_UDMA_5: - case XFER_UDMA_4: - case XFER_UDMA_3: - case XFER_UDMA_2: - case XFER_UDMA_1: - case XFER_UDMA_0: - case XFER_MW_DMA_2: - return 4; - case XFER_MW_DMA_1: - return 3; - case XFER_SW_DMA_2: - return 2; - case XFER_MW_DMA_0: - case XFER_SW_DMA_1: - case XFER_SW_DMA_0: - default: - return 0; - } -} - -/** * it8213_set_pio_mode - set host controller for PIO mode * @drive: drive * @pio: PIO mode number @@ -124,7 +93,7 @@ static void it8213_set_dma_mode(ide_driv int w_flag = 0x10 drive-dn; int u_speed = 0; u16 reg4042, reg4a; - u8 reg48, reg54, reg55; + u8 reg48, reg54, reg55, pio; pci_read_config_word(dev, maslave, reg4042); pci_read_config_byte(dev, 0x48, reg48); @@ -165,7 +134,11 @@ static void it8213_set_dma_mode(ide_driv pci_write_config_byte(dev, 0x54, reg54 | v_flag); } else pci_write_config_byte(dev, 0x54, reg54 ~v_flag); + + pio = 4; } else { + const u8 mwdma_to_pio[] = { 0, 3, 4 }; + if (reg48 u_flag) pci_write_config_byte(dev, 0x48, reg48 ~u_flag); if (reg4a a_speed) @@ -174,9 +147,14 @@ static void it8213_set_dma_mode(ide_driv pci_write_config_byte(dev, 0x54, reg54 ~v_flag); if (reg55 w_flag) pci_write_config_byte(dev, 0x55, (u8) reg55 ~w_flag); + + if (speed = XFER_MW_DMA_0) + pio = mwdma_to_pio[speed - XFER_MW_DMA_0]; + else + pio = 2; /* only SWDMA2 is allowed */ } - it8213_set_pio_mode(drive, it8213_dma_2_pio(speed)); + it8213_set_pio_mode(drive, pio); } /** Index: b/drivers/ide/pci/piix.c === --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -106,37 +106,6 @@ static int no_piix_dma; /** - * piix_dma_2_pio - return the PIO mode matching DMA - * @xfer_rate: transfer speed - * - * Returns the nearest equivalent PIO timing for the DMA - * mode requested by the controller. - */ - -static u8 piix_dma_2_pio (u8 xfer_rate) { - switch(xfer_rate) { - case XFER_UDMA_6: - case XFER_UDMA_5: - case XFER_UDMA_4: - case XFER_UDMA_3: - case XFER_UDMA_2: - case XFER_UDMA_1: - case XFER_UDMA_0: - case XFER_MW_DMA_2: - return 4; - case XFER_MW_DMA_1: - return 3; - case XFER_SW_DMA_2: - return 2; - case XFER_MW_DMA_0: - case XFER_SW_DMA_1: - case XFER_SW_DMA_0: - default: - return 0; - } -} - -/** * piix_set_pio_mode - set host controller for PIO mode * @drive: drive * @pio: PIO mode number @@ -225,7 +194,7 @@ static void piix_set_dma_mode(ide_drive_ int u_speed = 0; int sitre; u16 reg4042, reg4a; - u8 reg48, reg54, reg55; + u8 reg48, reg54, reg55, pio; pci_read_config_word(dev, maslave, reg4042); sitre = (reg4042 0x4000) ? 1 : 0; @@ -262,7 +231,11 @@ static void piix_set_dma_mode(ide_drive_ pci_write_config_byte(dev, 0x54, reg54 | v_flag); } else pci_write_config_byte(dev, 0x54, reg54 ~v_flag
[PATCH 4/11] hpt34x: fix CONFIG_HPT34X_AUTODMA=n handling
Programming DMA mode may destroy current PIO mode setting so if CONFIG_HPT34X_AUTODMA=n (the default case) make ide_tune_dma() fail early by disabling all host DMA masks and re-tune PIO mode. This fix doesn't help with the driver being broken but is needed for some other changes. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/hpt34x.c |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) Index: b/drivers/ide/pci/hpt34x.c === --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -85,11 +85,7 @@ static int hpt34x_config_drive_xfer_rate drive-init_speed = 0; if (ide_tune_dma(drive)) -#ifndef CONFIG_HPT34X_AUTODMA return -1; -#else - return 0; -#endif if (ide_use_fast_pio(drive)) ide_set_max_pio(drive); @@ -157,9 +153,11 @@ static void __devinit init_hwif_hpt34x(i if (!hwif-dma_base) return; +#ifdef CONFIG_HPT34X_AUTODMA hwif-ultra_mask = 0x07; hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x07; +#endif hwif-ide_dma_check = hpt34x_config_drive_xfer_rate; if (!noautodma) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/11] ide: remove drive-init_speed zeroing
Several host drivers used to reset drive-init_speed in their -ide_dma_check implementations which resulted in incorrect init speed being reported to the user, fix it. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/alim15x3.c |2 -- drivers/ide/pci/atiixp.c |2 -- drivers/ide/pci/cs5535.c |2 -- drivers/ide/pci/hpt34x.c |2 -- drivers/ide/pci/hpt366.c |2 -- drivers/ide/pci/pdc202xx_new.c |2 -- drivers/ide/pci/pdc202xx_old.c |2 -- drivers/ide/pci/piix.c |2 -- drivers/ide/pci/serverworks.c |2 -- drivers/ide/pci/sis5513.c |2 -- drivers/ide/pci/slc90e66.c |2 -- 11 files changed, 22 deletions(-) Index: b/drivers/ide/pci/alim15x3.c === --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -446,8 +446,6 @@ static void ali_set_dma_mode(ide_drive_t static int ali15x3_config_drive_for_dma(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/atiixp.c === --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -168,8 +168,6 @@ static void atiixp_set_dma_mode(ide_driv static int atiixp_dma_check(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/cs5535.c === --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -159,8 +159,6 @@ static void cs5535_set_pio_mode(ide_driv static int cs5535_dma_check(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/hpt34x.c === --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -82,8 +82,6 @@ static void hpt34x_set_pio_mode(ide_driv static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return -1; Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -693,8 +693,6 @@ static void hpt3xx_maskproc(ide_drive_t static int hpt366_config_drive_xfer_rate(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/pdc202xx_new.c === --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -225,8 +225,6 @@ static u8 pdcnew_cable_detect(ide_hwif_t static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/pdc202xx_old.c === --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -181,8 +181,6 @@ static void pdc_old_disable_66MHz_clock( static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/piix.c === --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c @@ -264,8 +264,6 @@ static void piix_set_dma_mode(ide_drive_ static int piix_config_drive_xfer_rate (ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/serverworks.c === --- a/drivers/ide/pci/serverworks.c +++ b/drivers/ide/pci/serverworks.c @@ -197,8 +197,6 @@ static void svwks_set_dma_mode(ide_drive static int svwks_config_drive_xfer_rate (ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/sis5513.c === --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -603,8 +603,6 @@ static void sis_set_dma_mode(ide_drive_t static int sis5513_config_xfer_rate(ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0; Index: b/drivers/ide/pci/slc90e66.c === --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -132,8 +132,6 @@ static void slc90e66_set_dma_mode(ide_dr static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive) { - drive-init_speed = 0; - if (ide_tune_dma(drive)) return 0
[PATCH 6/11] ide: remove ide_use_fast_pio()
Remove ide_use_fast_pio() and just re-tune PIO unconditionally if DMA tuning has failed in -ide_dma_check. All host drivers using ide_use_fast_pio() set drive-autotune so PIO is always tuned anyway and in some cases we _really_ need to re-tune PIO because PIO and DMA timings are shared. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ide-lib.c | 15 --- drivers/ide/pci/aec62xx.c |3 +-- drivers/ide/pci/atiixp.c |3 +-- drivers/ide/pci/cmd64x.c |3 +-- drivers/ide/pci/cs5535.c |3 +-- drivers/ide/pci/hpt34x.c |3 +-- drivers/ide/pci/hpt366.c |3 +-- drivers/ide/pci/pdc202xx_new.c |3 +-- drivers/ide/pci/pdc202xx_old.c |3 +-- drivers/ide/pci/piix.c |3 +-- drivers/ide/pci/scc_pata.c |3 +-- drivers/ide/pci/serverworks.c |3 +-- drivers/ide/pci/siimage.c |3 +-- drivers/ide/pci/sis5513.c |3 +-- drivers/ide/pci/slc90e66.c |3 +-- drivers/ide/pci/tc86c001.c |3 +-- include/linux/ide.h|1 - 17 files changed, 15 insertions(+), 46 deletions(-) Index: b/drivers/ide/ide-lib.c === --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -96,21 +96,6 @@ static u8 ide_rate_filter(ide_drive_t *d return min(speed, mode); } -int ide_use_fast_pio(ide_drive_t *drive) -{ - struct hd_driveid *id = drive-id; - - if ((id-capability 1) drive-autodma) - return 1; - - if ((id-capability 8) || (id-field_valid 2)) - return 1; - - return 0; -} - -EXPORT_SYMBOL_GPL(ide_use_fast_pio); - /* * Standard (generic) timings for PIO modes, from ATA2 specification. * These timings are for access to the IDE data port register *only*. Index: b/drivers/ide/pci/aec62xx.c === --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -146,8 +146,7 @@ static int aec62xx_config_drive_xfer_rat if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/atiixp.c === --- a/drivers/ide/pci/atiixp.c +++ b/drivers/ide/pci/atiixp.c @@ -171,8 +171,7 @@ static int atiixp_dma_check(ide_drive_t if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/cmd64x.c === --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -335,8 +335,7 @@ static int cmd64x_config_drive_for_dma ( if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/cs5535.c === --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -162,8 +162,7 @@ static int cs5535_dma_check(ide_drive_t if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/hpt34x.c === --- a/drivers/ide/pci/hpt34x.c +++ b/drivers/ide/pci/hpt34x.c @@ -85,8 +85,7 @@ static int hpt34x_config_drive_xfer_rate if (ide_tune_dma(drive)) return -1; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -696,8 +696,7 @@ static int hpt366_config_drive_xfer_rate if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/pdc202xx_new.c === --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -228,8 +228,7 @@ static int pdcnew_config_drive_xfer_rate if (ide_tune_dma(drive)) return 0; - if (ide_use_fast_pio(drive)) - ide_set_max_pio(drive); + ide_set_max_pio(drive); return -1; } Index: b/drivers/ide/pci/pdc202xx_old.c === --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c
[PATCH 7/11] cs5530/sc1200: add PIO autotune fallback to -ide_dma_check
* Add PIO autotune fallback to -ide_dma_check. Since cs5530/sc1200 allow separate PIO and DMA timings, and cs5530/sc1200 always set -autotune this change shouldn't have any other effect than bringing these drivers in-line with other host drivers wrt -ide_dma_check implementations. * Fix -ide_dma_check to return -1 if DMA cannot be set. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/cs5530.c |6 -- drivers/ide/pci/sc1200.c |6 -- 2 files changed, 8 insertions(+), 4 deletions(-) Index: b/drivers/ide/pci/cs5530.c === --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/cs5530.c Version 0.75Aug 2 2007 + * linux/drivers/ide/pci/cs5530.c Version 0.76Aug 3 2007 * * Copyright (C) 2000 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2000 Mark Lord [EMAIL PROTECTED] @@ -117,7 +117,9 @@ static int cs5530_config_dma(ide_drive_t if (ide_tune_dma(drive)) return 0; - return 1; + ide_set_max_pio(drive); + + return -1; } static void cs5530_set_dma_mode(ide_drive_t *drive, const u8 mode) Index: b/drivers/ide/pci/sc1200.c === --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/sc1200.c Version 0.96Aug 2 2007 + * linux/drivers/ide/pci/sc1200.c Version 0.97Aug 3 2007 * * Copyright (C) 2000-2002 Mark Lord [EMAIL PROTECTED] * Copyright (C) 2007 Bartlomiej Zolnierkiewicz @@ -208,7 +208,9 @@ static int sc1200_config_dma (ide_drive_ if (ide_tune_dma(drive)) return 0; - return 1; + ide_set_max_pio(drive); + + return -1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/11] ide-pmac: add PIO autotune fallback to -ide_dma_check
Since ide-pmac allows separate PIO and DMA timings, and ide-pmac always sets -autotune this change shouldn't have any other effect than bringing ide-pmac driver in-line with other host drivers wrt -ide_dma_check implementation. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ppc/pmac.c |2 ++ 1 file changed, 2 insertions(+) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1587,6 +1587,8 @@ pmac_ide_dma_check(ide_drive_t *drive) if (ide_tune_dma(drive)) return 0; + ide_set_max_pio(drive); + return -1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/11] sl82c105: add PIO autotune fallback to -ide_dma_check
Since sl82c105 re-programs DMA/PIO timings for DMA enable/disable, and sets -autotune this change shouldn't have any other effect than bringing sl82c105 driver in-line with other host drivers wrt -ide_dma_check implementation. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sl82c105.c |2 ++ 1 file changed, 2 insertions(+) Index: b/drivers/ide/pci/sl82c105.c === --- a/drivers/ide/pci/sl82c105.c +++ b/drivers/ide/pci/sl82c105.c @@ -154,6 +154,8 @@ static int sl82c105_ide_dma_check(ide_dr if (ide_tune_dma(drive)) return 0; + ide_set_max_pio(drive); + return -1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/11] ide: remove -ide_dma_check
* Add IDE_HFLAG_TRUST_BIOS_FOR_DMA host flag for host drivers that depend on BIOS for programming device/controller for DMA. Set it in cy82c693, generic, ns87415, opti621 and trm290 host drivers. * Add IDE_HFLAG_VDMA host flag for host drivers using VDMA. Set it in cs5520 host driver. * Teach ide_tune_dma() about IDE_HFLAG_TRUST_BIOS_FOR_DMA flag. * Add generic ide_dma_check() helper and remove all open coded -ide_dma_check implementations. Fix all places checking for presence of -ide_dma_check hook to check for -ide_dma_on instead. * Remove no longer needed code from config_drive_for_dma(). * Make ide_tune_dma() static. There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/arm/icside.c |9 -- drivers/ide/cris/ide-cris.c| 12 drivers/ide/ide-dma.c | 60 +++-- drivers/ide/ide-io.c |4 +- drivers/ide/ide-iops.c |4 +- drivers/ide/ide-probe.c|2 - drivers/ide/ide.c |3 -- drivers/ide/mips/au1xxx-ide.c | 11 --- drivers/ide/pci/aec62xx.c | 11 --- drivers/ide/pci/alim15x3.c | 19 drivers/ide/pci/amd74xx.c | 11 --- drivers/ide/pci/atiixp.c | 20 - drivers/ide/pci/cmd64x.c | 12 drivers/ide/pci/cs5520.c | 13 +--- drivers/ide/pci/cs5530.c | 20 - drivers/ide/pci/cs5535.c | 12 drivers/ide/pci/cy82c693.c |2 - drivers/ide/pci/generic.c | 15 ++ drivers/ide/pci/hpt34x.c | 11 --- drivers/ide/pci/hpt366.c | 12 drivers/ide/pci/it8213.c | 22 --- drivers/ide/pci/it821x.c | 22 --- drivers/ide/pci/jmicron.c | 20 - drivers/ide/pci/ns87415.c |1 drivers/ide/pci/opti621.c |2 + drivers/ide/pci/pdc202xx_new.c | 12 drivers/ide/pci/pdc202xx_old.c | 11 --- drivers/ide/pci/piix.c | 19 drivers/ide/pci/sc1200.c | 16 -- drivers/ide/pci/scc_pata.c | 22 --- drivers/ide/pci/serverworks.c | 11 --- drivers/ide/pci/sgiioc4.c | 15 -- drivers/ide/pci/siimage.c | 22 --- drivers/ide/pci/sis5513.c | 12 drivers/ide/pci/sl82c105.c | 16 -- drivers/ide/pci/slc90e66.c | 12 drivers/ide/pci/tc86c001.c | 11 --- drivers/ide/pci/triflex.c | 11 --- drivers/ide/pci/trm290.c |1 drivers/ide/pci/via82cxxx.c| 19 drivers/ide/ppc/pmac.c | 16 -- include/linux/ide.h|7 ++-- 42 files changed, 68 insertions(+), 495 deletions(-) Index: b/drivers/ide/arm/icside.c === --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -309,14 +309,6 @@ static int icside_dma_on(ide_drive_t *dr return 0; } -static int icside_dma_check(ide_drive_t *drive) -{ - if (ide_tune_dma(drive)) - return 0; - - return -1; -} - static int icside_dma_end(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); @@ -434,7 +426,6 @@ static void icside_dma_init(ide_hwif_t * hwif-set_dma_mode = icside_set_dma_mode; hwif-autodma = 1; - hwif-ide_dma_check = icside_dma_check; hwif-dma_host_off = icside_dma_host_off; hwif-dma_off_quietly = icside_dma_off_quietly; hwif-dma_host_on = icside_dma_host_on; Index: b/drivers/ide/cris/ide-cris.c === --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -664,7 +664,6 @@ cris_ide_inb(unsigned long reg) return (unsigned char)cris_ide_inw(reg); } -static int cris_dma_check (ide_drive_t *drive); static int cris_dma_end (ide_drive_t *drive); static int cris_dma_setup (ide_drive_t *drive); static void cris_dma_exec_cmd (ide_drive_t *drive, u8 command); @@ -792,7 +791,6 @@ init_e100_ide (void) hwif-ata_output_data = cris_ide_output_data; hwif-atapi_input_bytes = cris_atapi_input_bytes; hwif-atapi_output_bytes = cris_atapi_output_bytes; - hwif-ide_dma_check = cris_dma_check; hwif-ide_dma_end = cris_dma_end; hwif-dma_setup = cris_dma_setup; hwif-dma_exec_cmd = cris_dma_exec_cmd; @@ -1019,16 +1017,6 @@ static ide_startstop_t cris_dma_intr (id * the caller should revert to PIO for the current request. */ -static int cris_dma_check(ide_drive_t *drive) -{ - if (ide_tune_dma(drive)) - return 0; - - ide_set_max_pio(drive); - - return -1; -} - static int cris_dma_end(ide_drive_t *drive
[PATCH 9/10] ide-cris: add PIO autotune fallback to -ide_dma_check
Since ide-cris allows separate PIO and DMA timings, and ide-cris always sets -autotune this change shouldn't have any other effect than bringing ide-cris driver in-line with other host drivers wrt -ide_dma_check implementation. Cc: Mikael Starvik [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/cris/ide-cris.c |2 ++ 1 file changed, 2 insertions(+) Index: b/drivers/ide/cris/ide-cris.c === --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -1024,6 +1024,8 @@ static int cris_dma_check(ide_drive_t *d if (ide_tune_dma(drive)) return 0; + ide_set_max_pio(drive); + return -1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: move ide_config_drive_speed() calls to upper layers
Hi, On Saturday 28 July 2007, Sergei Shtylyov wrote: Hello. Bartlomiej Zolnierkiewicz wrote: On Fri, 27 Jul 2007 02:22:27 +0200 Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote: * Convert {ide_hwif_t,ide_pci_device_t}-host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide/cs5530/cs5535/pdc202xx_new/sc1200/via82cxxx host drivers. The CS5530 at least shouldn't care what order changes are done. I don't And neither CS5535. And Au1200 static bus controller shouldn't care about the order too, so au1xxx-ide hardly needs that. Here's the datasheet, BTW: http://www.razamicroelectronics.com/documents/32798e_Au1200_db.pdf think the SC1200 does either but I don't have the docs to hand. It seems pretty much alike CS553x except it's accessed via PCI config. space, not MSRs... Here's the datasheet: http://www.amd.com/files/connectivitysolutions/geode/32579B_sc1200_ds.pdf Thanks for links to specs. I have a feeling that only pdc202xx_new and jmicron drivers actually need this flag (and the latter one actually doesn't care as its methods are empty anyway). Well, AMD/VIA chips enable UltraDMA mode by snooping Set Features command (as the drivers tell them to do so), so the order seems important unless that is changed. Since changing of order affects the way in which hardware is accessed I prefer to keep such changes out of this patch (which is just a cleanup). Could you please handle them in pre or post patch(es)? Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 2.6.23-rc1: pata_via cable detection differs from via82cxxx
On Saturday 04 August 2007, Alan Cox wrote: On Fri, 3 Aug 2007 20:28:39 +0200 (MEST) Mikael Pettersson [EMAIL PROTECTED] wrote: The machine is an Athlon64 laptop with a K8T800 chipset. With the IDE VIA driver the disk is detected as udma/100: Currently old IDE via driver has a hack in it which goes 'did the BIOS set UDMA3+' then I guess the cable is 80 wire regardless. libata doesn't do that as it breaks with hotplug, breaks with suspend/resume before the driver is loaded and other bits. Instead we have two things - an ACPI snoop and a table of wonky laptops (eg those that use 40 wire ultrashort cables which are valid for UDMA133 but not detected as 80 wire). If your laptop is done that way then it just needs adding to the magic list and/or 2.6.23-rc1-mm should spot it by ACPI. I'd prefer the table entry anyway as I don't like relying on ACPI so an lspci -vvxx would be appreciated Please also add it to the laptop table in IDE VIA driver. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ST340823A disk size issue
On Thursday 02 August 2007, Alan Cox wrote: Additionally fs/partitions/check.c:rescan_partitions() should warn if the partition exceeds device size and we are not seeing any such warning. Why would it if there isn't anything wrong ? Look at the __generic_make_requests() snippet (which was in my original mail). ...    /* Test device or partition size, when known. */     maxsector = bio-bi_bdev-bd_inode-i_size 9;     if (maxsector) {         sector_t sector = bio-bi_sector;         if (maxsector nr_sectors || maxsector - nr_sectors sector) {             /*              * This may well happen - the kernel calls bread()              * without checking the size of the device, e.g., when              * mounting a device.              */             handle_bad_sector(bio);             goto end_io; ... This check prevents requests exceeding device/partition size to ever hit LLD. Device size is set by LLD itself so we can be sure that it is OK and for the partition size the code in rescan_partitions() would warn if the size of partition exceeds size of the device. The same disks just work in libata even with the hpa being disabled. It closed a pile of long standing bugzillas about such problems with odd Logs / bug numbers please. sized disks. This therefore (and instrumenting the requests being issued when I first looked at it) made me fairly sure its not the drive. I was seeing 1K requests for the last 512 byte sector. We should never ever see 1K requests for the last 512 bytes sector coming from the block layer. If we make driver handle such cases we may be just papering over some other issue. Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] sc1200: always tune PIO
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sc1200.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) Index: b/drivers/ide/pci/sc1200.c === --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/sc1200.c Version 0.95Jun 16 2007 + * linux/drivers/ide/pci/sc1200.c Version 0.96Aug 2 2007 * * Copyright (C) 2000-2002 Mark Lord [EMAIL PROTECTED] * Copyright (C) 2007 Bartlomiej Zolnierkiewicz @@ -354,6 +354,9 @@ static void __devinit init_hwif_sc1200 ( hwif-set_pio_mode = sc1200_set_pio_mode; hwif-set_dma_mode = sc1200_set_dma_mode; + hwif-drives[0].autotune = 1; + hwif-drives[1].autotune = 1; + if (hwif-dma_base == 0) return; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ide-cris: always tune PIO
Cc: Mikael Starvik [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/cris/ide-cris.c |2 ++ 1 file changed, 2 insertions(+) Index: b/drivers/ide/cris/ide-cris.c === --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c @@ -808,6 +808,8 @@ init_e100_ide (void) hwif-dma_off_quietly = cris_dma_off; hwif-cbl = ATA_CBL_PATA40; hwif-pio_mask = ATA_PIO4, + hwif-drives[0].autotune = 1; + hwif-drives[1].autotune = 1; hwif-ultra_mask = cris_ultra_mask; hwif-mwdma_mask = 0x07; /* Multiword DMA 0-2 */ hwif-autodma = 1; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: add cable detection for early UDMA66 devices (take 2)
Hi, On Monday 30 July 2007, Sergei Shtylyov wrote: Hello. Bartlomiej Zolnierkiewicz wrote: * Move ide_in_drive_list() from ide-dma.c to ide-iops.c. * Add ivb_list[] table for listening early UDMA66 devices which don't conform to ATA4 standard wrt cable detection (bit14 is zero, only bit13 is valid) and use only device side cable detection for them since host side cable detection may be unreliable. * Add model QUANTUM FIREBALLlct10 05 with firwmare A03.0900 to the list (from Craig's bugreport). v2: * Improve kernel message basing on suggestion from Sergei. Thanks to Craig for testing this patch. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -565,6 +565,34 @@ int ide_wait_stat (ide_startstop_t *star EXPORT_SYMBOL(ide_wait_stat); +/** + * ide_in_drive_list - look for drive in black/white list + * @id: drive identifier + * @drive_table: list to inspect + * + * Look for a drive in the blacklist and the whitelist tables + * Returns 1 if the drive is found in the table. + */ + +int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) +{ + for ( ; drive_table-id_model ; drive_table++) Good time to kill an extra space before the 2nd semicolon. Done. @@ -573,11 +601,16 @@ u8 eighty_ninty_three (ide_drive_t *driv { ide_hwif_t *hwif = drive-hwif; struct hd_driveid *id = drive-id; + int ivb = ide_in_drive_list(id, ivb_list); + + if (ivb) + printk(KERN_DEBUG %s: ignoring word 93 validity check\n, + drive-name); I think skipping woud sound better. Done. if (hwif-cbl == ATA_CBL_PATA40_SHORT) return 1; Wait, shouldn't this check come ahead of all the other code since we're basically overriding every other check with it? Fixed. [PATCH] ide: add cable detection for early UDMA66 devices (take 3) * Move ide_in_drive_list() from ide-dma.c to ide-iops.c. * Add ivb_list[] table for listening early UDMA66 devices which don't conform to ATA4 standard wrt cable detection (bit14 is zero, only bit13 is valid) and use only device side cable detection for them since host side cable detection may be unreliable. * Add model QUANTUM FIREBALLlct10 05 with firwmare A03.0900 to the list (from Craig's bugreport). v2: * Improve kernel message basing on suggestion from Sergei. v3: * Don't print kernel message when no device side cable detection is done, plus some minor fixes. (Noticed by Sergei) Thanks to Craig for testing this patch. Cc: Craig Block [EMAIL PROTECTED] Cc: Sergei Shtylyov [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ide-dma.c | 19 --- drivers/ide/ide-iops.c | 39 --- include/linux/ide.h|3 ++- 3 files changed, 38 insertions(+), 23 deletions(-) Index: b/drivers/ide/ide-dma.c === --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -135,25 +135,6 @@ static const struct drive_list_entry dri }; /** - * ide_in_drive_list - look for drive in black/white list - * @id: drive identifier - * @drive_table: list to inspect - * - * Look for a drive in the blacklist and the whitelist tables - * Returns 1 if the drive is found in the table. - */ - -int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) -{ - for ( ; drive_table-id_model ; drive_table++) - if ((!strcmp(drive_table-id_model, id-model)) - (!drive_table-id_firmware || -strstr(id-fw_rev, drive_table-id_firmware))) - return 1; - return 0; -} - -/** * ide_dma_intr- IDE DMA interrupt handler * @drive: the drive the interrupt is for * Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -565,6 +565,34 @@ int ide_wait_stat (ide_startstop_t *star EXPORT_SYMBOL(ide_wait_stat); +/** + * ide_in_drive_list - look for drive in black/white list + * @id: drive identifier + * @drive_table: list to inspect + * + * Look for a drive in the blacklist and the whitelist tables + * Returns 1 if the drive is found in the table. + */ + +int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) +{ + for ( ; drive_table-id_model; drive_table++) + if ((!strcmp(drive_table-id_model, id-model)) + (!drive_table-id_firmware || +strstr(id-fw_rev, drive_table
Re: ST340823A disk size issue
On Thursday 02 August 2007, Alan Cox wrote: hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000 hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error } hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, Ok this one does look like its actually a specific drive firmware error ide1: reset: master: error (0x00?) ide1: start_request: current=0xc1e0b408 and the drive then shits itself in style. Bart's right - this drive does need a blacklisting. Presumably thats why it shipped with a default HPA to clip the non-sector Mikko, please verify that the following patch fixes the issue. [PATCH] ide-disk: workaround for buggy HPA support on ST340823A (take 2) This disk reports total number of sectors instead of maximum sector address in response to READ_NATIVE_MAX_ADDRESS command and also happily accepts SET_MAX_ADDRESS command with the bogus value. This results in +1 sector capacity being used and errors on attempts to use the last sector. ... hdd: Host Protected Area detected.     current capacity is 78165360 sectors (40020 MB)     native  capacity is 78165361 sectors (40020 MB) hdd: Host Protected Area disabled. ... hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000 hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error } hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, sector=78165360 ... Add hpa_list[] table and workaround the issue in idedisk_check_hpa(). Fixes kernel bugzilla bug #8816. Thanks to Mikko for investigating the issue and testing this patch. v2: * Add missing export and improve patch description a bit. Cc: Mikko Rapeli [EMAIL PROTECTED] Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- This patch depends on CONFIG_BLK_DEV_IDEDMA=y but for testing purposes it is OK. Final version wouldn't depend on CONFIG_BLK_DEV_IDEDMA, [PATCH] ide: add cable detection for early UDMA66 devices (take 3) which is in IDE quilt tree moves ide_in_drive_list() out of ide-dma.c. drivers/ide/ide-disk.c | 17 + drivers/ide/ide-dma.c |2 ++ 2 files changed, 19 insertions(+) Index: b/drivers/ide/ide-disk.c === --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -481,6 +481,14 @@ static inline int idedisk_supports_lba48 id-lba_capacity_2; } +/* + * Some disks report total number of sectors instead of + * maximum sector address. We list them here. + */ +static const struct drive_list_entry hpa_list[] = { + { ST340823A, NULL }, +}; + static void idedisk_check_hpa(ide_drive_t *drive) { unsigned long long capacity, set_max; @@ -492,6 +500,15 @@ static void idedisk_check_hpa(ide_drive_ else set_max = idedisk_read_native_max_address(drive); + if (ide_in_drive_list(drive-id, hpa_list)) { + /* +* Since we are inclusive wrt to firmware revisions do this +* extra check and apply the workaround only when needed. +*/ + if (set_max == capacity + 1) + set_max--; + } + if (set_max = capacity) return; Index: b/drivers/ide/ide-dma.c === --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -153,6 +153,8 @@ int ide_in_drive_list(struct hd_driveid return 0; } +EXPORT_SYMBOL_GPL(ide_in_drive_list); + /** * ide_dma_intr- IDE DMA interrupt handler * @drive: the drive the interrupt is for - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] slc90e66: always tune PIO
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/slc90e66.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) Index: b/drivers/ide/pci/slc90e66.c === --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/slc90e66.c Version 0.16Jul 14, 2007 + * linux/drivers/ide/pci/slc90e66.c Version 0.17Aug 2, 2007 * * Copyright (C) 2000-2002 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2006-2007 MontaVista Software, Inc. [EMAIL PROTECTED] @@ -169,11 +169,11 @@ static void __devinit init_hwif_slc90e66 pci_read_config_byte(hwif-pci_dev, 0x47, reg47); - if (!hwif-dma_base) { - hwif-drives[0].autotune = 1; - hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = 1; + hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-atapi_dma = 1; hwif-ultra_mask = 0x1f; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] aec62xx: always tune PIO
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/aec62xx.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: b/drivers/ide/pci/aec62xx.c === --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/aec62xx.c Version 0.24May 24, 2007 + * linux/drivers/ide/pci/aec62xx.c Version 0.25Aug 1, 2007 * * Copyright (C) 1999-2002 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2007 MontaVista Software, Inc. [EMAIL PROTECTED] @@ -207,10 +207,10 @@ static void __devinit init_hwif_aec62xx( } else hwif-set_dma_mode = aec6260_set_mode; - if (!hwif-dma_base) { - hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] sis5513: DMA setup fixes
* Add sis_ata133_get_base() helper function for obtaining the address of the drive control registers on chipset_family == ATA_133 chipsets. * Add three helper functions for programming PIO/MWDMA timings: - sis_ata16_program_timings() (for ATA_16/33/66/100a chipset families) - sis_ata100_program_timings() (for ATA_100/133a chipset families) - sis_ata133_program_timings() (for ATA_133 chipset family) MWDMA timings are taken from datasheets and they match ATA spec. * Add generic helper function sis_program_timings() and use it in -set_pio_mode and -set_dma_mode methods (previously the driver depended on BIOS to program the correct MWDMA timings). * Remove redundant !chipset_family check from init_hwif_sis5513() (init_chipset_sis5513() guarantees that we will never get here if chipset_family cannot be determined). * SWDMA seems to be unsupported by SiS chipsets (no info about SWDMA in datasheets and for SWDMA0 mode timing requirements are impossible to fulfill) so remove -swdma_mask from init_hwif_sis5513() and handling of SWDMA modes from sis_set_dma_mode(). * Enable DMA support for chipset_family == ATA_16. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sis5513.c | 214 ++ 1 file changed, 106 insertions(+), 108 deletions(-) Index: b/drivers/ide/pci/sis5513.c === --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/sis5513.c Version 0.27Jul 14, 2007 + * linux/drivers/ide/pci/sis5513.c Version 0.28Aug 1, 2007 * * Copyright (C) 1999-2000 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2002 Lionel Bouton [EMAIL PROTECTED], Maintainer @@ -433,6 +433,95 @@ static int sis_get_info (char *buffer, c /* * Configuration functions */ + +static u8 sis_ata133_get_base(ide_drive_t *drive) +{ + struct pci_dev *dev = drive-hwif-pci_dev; + u32 reg54 = 0; + + pci_read_config_dword(dev, 0x54, reg54); + + return ((reg54 0x4000) ? 0x70 : 0x40) + drive-dn * 4; +} + +static void sis_ata16_program_timings(ide_drive_t *drive, const u8 mode) +{ + struct pci_dev *dev = drive-hwif-pci_dev; + u16 t1 = 0; + u8 drive_pci = 0x40 + drive-dn * 2; + + const u16 pio_timings[] = { 0x000, 0x607, 0x404, 0x303, 0x301 }; + const u16 mwdma_timings[] = { 0x008, 0x302, 0x301 }; + + pci_read_config_word(dev, drive_pci, t1); + + /* clear active/recovery timings */ + t1 = ~0x070f; + if (mode = XFER_MW_DMA_0) { + if (chipset_family ATA_16) + t1 = ~0x8000; /* disable UDMA */ + t1 |= mwdma_timings[mode - XFER_MW_DMA_0]; + } else + t1 |= pio_timings[mode - XFER_PIO_0]; + + pci_write_config_word(dev, drive_pci, t1); +} + +static void sis_ata100_program_timings(ide_drive_t *drive, const u8 mode) +{ + struct pci_dev *dev = drive-hwif-pci_dev; + u8 t1, drive_pci = 0x40 + drive-dn * 2; + + /* timing bits: 7:4 active 3:0 recovery */ + const u8 pio_timings[] = { 0x00, 0x67, 0x44, 0x33, 0x31 }; + const u8 mwdma_timings[] = { 0x08, 0x32, 0x31 }; + + if (mode = XFER_MW_DMA_0) { + u8 t2 = 0; + + pci_read_config_byte(dev, drive_pci, t2); + t2 = ~0x80;/* disable UDMA */ + pci_write_config_byte(dev, drive_pci, t2); + + t1 = mwdma_timings[mode - XFER_MW_DMA_0]; + } else + t1 = pio_timings[mode - XFER_PIO_0]; + + pci_write_config_byte(dev, drive_pci + 1, t1); +} + +static void sis_ata133_program_timings(ide_drive_t *drive, const u8 mode) +{ + struct pci_dev *dev = drive-hwif-pci_dev; + u32 t1 = 0; + u8 drive_pci = sis_ata133_get_base(drive), clk, idx; + + pci_read_config_dword(dev, drive_pci, t1); + + t1 = 0xc0c00fff; + clk = (t1 0x08) ? ATA_133 : ATA_100; + if (mode = XFER_MW_DMA_0) { + t1 = ~0x04;/* disable UDMA */ + idx = mode - XFER_MW_DMA_0 + 5; + } + idx = mode - XFER_PIO_0; + t1 |= ini_time_value[clk][idx] 12; + t1 |= act_time_value[clk][idx] 16; + t1 |= rco_time_value[clk][idx] 24; + + pci_write_config_dword(dev, drive_pci, t1); +} + +static void sis_program_timings(ide_drive_t *drive, const u8 mode) +{ + if (chipset_family ATA_100) /* ATA_16/33/66/100a */ + sis_ata16_program_timings(drive, mode); + else if (chipset_family ATA_133) /* ATA_100/133a */ + sis_ata100_program_timings(drive, mode); + else/* ATA_133 */ + sis_ata133_program_timings(drive, mode); +} + /* Enables per-drive prefetch and postwrite */ static void config_drive_art_rwp
Re: hpt374 sata (Highpoint Rocket 1540)
Hi, On Wednesday 01 August 2007, Sergei Shtylyov wrote: Does this patch change anything? Heh, did you *really* hope it will? :-D Well, ugh, yes? :) [PATCH] hpt366: always tune PIO Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/hpt366.c Version 1.10Jun 29, 2007 + * linux/drivers/ide/pci/hpt366.c Version 1.11Jul 29, 2007 * * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001 Sun Microsystems, Inc. @@ -1265,10 +1265,10 @@ static void __devinit init_hwif_hpt366(i if (new_mcr != old_mcr) pci_write_config_byte(dev, hwif-select_data + 1, new_mcr); - if (!hwif-dma_base) { - hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; Concerning the patch (I lacked time to look at the driver to refresh my memory before -- was looking at the new Disk-on-chip H3 driver to be submitted for comments soon, BTW): it makes little sense in its current form since setting any DMA mode also sets 8-bit PIO timings now (and if DMA can't be set, the driver will fallback to PIO anyway) Without -autotune timings for PIO data transfers are never set and we need to have a valid settings for some commands (IDENTIFY, SMART data) even if DMA is not going to be used. Thus why I was hoping that this patch might be of some help. I have a patch that changes this behavior and switches to always auto-tuning PIO but I've changed my mind on how the DMA/PIO timing register sharing should be handled now -- however, since I was unable to come up with anything better all that time, I'll consider pushing out this version when I have a spare time... Please do. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] fix runtogether printk's in cmd64x IDE driver
On Sunday 29 July 2007, Meelis Roos wrote: Fix a couple of runtogether printks in cmd64x.c IDE driver by adding proper newlines. Signed-off-by: Meelis Roos [EMAIL PROTECTED] applied - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: hpt374 sata (Highpoint Rocket 1540)
On Wednesday 01 August 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: On Wednesday 01 August 2007, Sergei Shtylyov wrote: Does this patch change anything? Heh, did you *really* hope it will? :-D Well, ugh, yes? :) Here we have some really nasty screw-up I'm afraid... [PATCH] hpt366: always tune PIO Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/hpt366.c Version 1.10Jun 29, 2007 + * linux/drivers/ide/pci/hpt366.c Version 1.11Jul 29, 2007 * * Copyright (C) 1999-2003Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001Sun Microsystems, Inc. @@ -1265,10 +1265,10 @@ static void __devinit init_hwif_hpt366(i if (new_mcr != old_mcr) pci_write_config_byte(dev, hwif-select_data + 1, new_mcr); - if (!hwif-dma_base) { - hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; Concerning the patch (I lacked time to look at the driver to refresh my memory before -- was looking at the new Disk-on-chip H3 driver to be submitted for comments soon, BTW): it makes little sense in its current form since setting any DMA mode also sets 8-bit PIO timings now (and if DMA can't be set, the driver will fallback to PIO anyway) Without -autotune timings for PIO data transfers are never set and we need The will get overwritten by DMA timings anyway. Although... you're right, Shouldn't be a real issue - for the usual case (PIO4/MWDMA2) it is not a problem since PIO data and DMA timings match and I also don't remember seeing devices which would allow S/MWDMA timings shorter than PIO timings. with UltraDMA 16-bit PIO timings aren't going to be changed from the defaults. Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[git patches] IDE fixes
Please pull from: master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6.git/ to receive the following updates: drivers/ide/arm/icside.c |3 +- drivers/ide/ide-tape.c |2 +- drivers/ide/pci/alim15x3.c |2 +- drivers/ide/pci/cmd64x.c |4 +- drivers/ide/pci/cs5520.c |2 +- drivers/ide/pci/cs5535.c | 42 +- drivers/ide/pci/it8213.c | 33 --- drivers/ide/pci/jmicron.c | 21 +++ drivers/ide/pci/piix.c | 17 ++-- drivers/ide/pci/scc_pata.c | 61 ++- drivers/ide/pci/sis5513.c |1 + drivers/ide/pci/slc90e66.c | 15 +-- drivers/scsi/ide-scsi.c| 10 +++ 13 files changed, 85 insertions(+), 128 deletions(-) Bartlomiej Zolnierkiewicz (7): alim15x3: Correct HP detect cs5520: fix PIO auto-tuning in -ide_dma_check method cs5535: PIO fixes it8213: PIO fixes (take 2) jmicron: PIO fixes piix/slc90e66: fix PIO1 handling in -speedproc method (take 2) scc_pata: PIO fixes David Lamparter (1): sis5513: Add FSC Amilo A1630 PCI subvendor/dev to laptops Jordan Crouse (1): ide: Fix an overrun found in the CS5535 IDE driver Mariusz Kozlowski (2): drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc Meelis Roos (1): ide: fix runtogether printk's in cmd64x IDE driver Stephen Rothwell (1): ide: eliminate warnings in ide-tape.c diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index c89b5f4..8a9b98f 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -693,13 +693,12 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id) if (ret) goto out; - state = kmalloc(sizeof(struct icside_state), GFP_KERNEL); + state = kzalloc(sizeof(struct icside_state), GFP_KERNEL); if (!state) { ret = -ENOMEM; goto release; } - memset(state, 0, sizeof(state)); state-type = ICS_TYPE_NOTYPE; state-dev = ec-dev; diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index e82bfa5..1fa5794 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -640,7 +640,7 @@ typedef enum { } idetape_chrdev_direction_t; struct idetape_bh { - unsigned short b_size; + u32 b_size; atomic_t b_count; struct idetape_bh *b_reqnext; char *b_data; diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 5511c86..025689d 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_table[] = { .ident = HP Pavilion N5430, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, Hewlett-Packard), - DMI_MATCH(DMI_BOARD_NAME, OmniBook N32N-736), + DMI_MATCH(DMI_BOARD_VERSION, OmniBook N32N-736), }, }, { } diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c index 19633c5..0e3b5de 100644 --- a/drivers/ide/pci/cmd64x.c +++ b/drivers/ide/pci/cmd64x.c @@ -475,11 +475,11 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha switch (rev) { case 0x07: case 0x05: - printk(%s: UltraDMA capable, name); + printk(%s: UltraDMA capable\n, name); break; case 0x03: default: - printk(%s: MultiWord DMA force limited, name); + printk(%s: MultiWord DMA force limited\n, name); break; case 0x01: printk(%s: MultiWord DMA limited, diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index bccedf9..b89e816 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -133,7 +133,7 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) { /* Tune the drive for PIO modes up to PIO 4 */ - cs5520_tune_drive(drive, 4); + cs5520_tune_drive(drive, 255); /* Then tell the core to use DMA operations */ return 0; diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c index ce44e38..082ca7d 100644 --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -2,6 +2,7 @@ * linux/drivers/ide/pci/cs5535.c * * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. + * Copyright (C) 2007 Bartlomiej Zolnierkiewicz * * History: * 09/20/2005 - Jaya Kumar [EMAIL PROTECTED] @@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed) /* Set the PIO timings */ if ((speed XFER_MODE
Re: ST340823A disk size issue
On Thursday 02 August 2007, Alan Cox wrote: If you fix the printk, add patch description (can use the one from my patch) and add Signed-off-by: I would happily apply it and dump mine version. Sorry but the patch is wrong - plain and simple. It works over the bug but its not the real problem. ide-disk needs to spot a 1K request for the last 512 bytes, issue a 512 byte request and complete the 512 bytes only. block/ll_rw_blk.c: static inline void __generic_make_request(struct bio *bio) { ... int ret, nr_sectors = bio_sectors(bio); ... /* Test device or partition size, when known. */ maxsector = bio-bi_bdev-bd_inode-i_size 9; if (maxsector) { sector_t sector = bio-bi_sector; if (maxsector nr_sectors || maxsector - nr_sectors sector) { /* * This may well happen - the kernel calls bread() * without checking the size of the device, e.g., when * mounting a device. */ handle_bad_sector(bio); goto end_io; so low-level-driver should never see such requests. Additionally fs/partitions/check.c:rescan_partitions() should warn if the partition exceeds device size and we are not seeing any such warning. Mikko, could you please revert any patches that you have applied, uncomment #define DEBUG in ide-disk.c, recompile and note the sectors count in the hdd: reading: block=78165360 sectors=... debug message? Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ST340823A disk size issue
On Thursday 02 August 2007, Bartlomiej Zolnierkiewicz wrote: Otherwise this patch looks fine and is a bit simpler than my patch. If you fix the printk, add patch description (can use the one from my patch) and add Signed-off-by: I would happily apply it and dump mine version. On the second thought - there may be real devices which have +1 native capacity so we are better off with sticking to the version with extra drive model check (this is of course given that the approach is right - yet to be verified). Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] pata_sis: fix MWDMA for = UDMA66 chipsets and UDMA for UDMA33 chipsets
* Fix MWDMA timings setup in sis_old_set_dmamode() and sis_66_set_dmamode(). The old timings were overclocked (even worse behavior than sis5513 IDE driver which depends on BIOS to program correct timings), the new timings are taken from the datasheet (they match timings from ATA spec). * Fix UDMA timings setup in sis_old_set_dmamode(). Misplaced pci_write_config_word() call resulted in UDMA timings never being set. * Fix comments for sis_133_early_set_dmamode() and sis_133_set_dmamode(): - only the former function handles early SiS 961 bridges - both functions lack MWDMA timings setup * Fix typos in sis_100_set_piomode() and sis_133_set_piomode() comments. * Bump driver version. Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- Sergei: Yes, I'm working on sis5513 IDE driver. :) drivers/ata/pata_sis.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) Index: b/drivers/ata/pata_sis.c === --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c @@ -2,6 +2,7 @@ *pata_sis.c - SiS ATA driver * * (C) 2005 Red Hat [EMAIL PROTECTED] + * (C) 2007 Bartlomiej Zolnierkiewicz * *Based upon linux/drivers/ide/pci/sis5513.c * Copyright (C) 1999-2000 Andre Hedrick [EMAIL PROTECTED] @@ -35,7 +36,7 @@ #include sis.h #define DRV_NAME pata_sis -#define DRV_VERSION0.5.1 +#define DRV_VERSION0.5.2 struct sis_chipset { u16 device; /* PCI host ID */ @@ -237,7 +238,7 @@ static void sis_old_set_piomode (struct } /** - * sis_100_set_pioode - Initialize host controller PATA PIO timings + * sis_100_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * @@ -262,7 +263,7 @@ static void sis_100_set_piomode (struct } /** - * sis_133_set_pioode - Initialize host controller PATA PIO timings + * sis_133_set_piomode - Initialize host controller PATA PIO timings * @ap: Port whose timings we are configuring * @adev: Device we are configuring for. * @@ -334,7 +335,7 @@ static void sis_old_set_dmamode (struct int drive_pci = sis_old_port_base(adev); u16 timing; - const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; + const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; const u16 udma_bits[] = { 0xE000, 0xC000, 0xA000 }; pci_read_config_word(pdev, drive_pci, timing); @@ -342,15 +343,15 @@ static void sis_old_set_dmamode (struct if (adev-dma_mode XFER_UDMA_0) { /* bits 3-0 hold recovery timing bits 8-10 active timing and the higer bits are dependant on the device */ - timing = ~ 0x870F; + timing = ~0x870F; timing |= mwdma_bits[speed]; - pci_write_config_word(pdev, drive_pci, timing); } else { /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */ speed = adev-dma_mode - XFER_UDMA_0; timing = ~0x6000; timing |= udma_bits[speed]; } + pci_write_config_word(pdev, drive_pci, timing); } /** @@ -373,7 +374,7 @@ static void sis_66_set_dmamode (struct a int drive_pci = sis_old_port_base(adev); u16 timing; - const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 }; + const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 }; const u16 udma_bits[] = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000}; pci_read_config_word(pdev, drive_pci, timing); @@ -432,8 +433,7 @@ static void sis_100_set_dmamode (struct * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. - * Handles early SiS 961 bridges. Supports MWDMA as well unlike - * the old ide/pci driver. + * Handles early SiS 961 bridges. * * LOCKING: * None (inherited from caller). @@ -467,8 +467,6 @@ static void sis_133_early_set_dmamode (s * @adev: Device to program * * Set UDMA/MWDMA mode for device, in host controller PCI config space. - * Handles early SiS 961 bridges. Supports MWDMA as well unlike - * the old ide/pci driver. * * LOCKING: * None (inherited from caller). - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: hpt374 sata (Highpoint Rocket 1540)
Hi, On Tuesday 31 July 2007, Bob Ham wrote: On Tue, 2007-07-31 at 21:52 +0400, Sergei Shtylyov wrote: Hello, I wrote: I've had a Highpoint Rocket 1540 (not RocketRAID) SATA controller for a while now, using a proprietary binary driver from Highpoint in a linux 2.4 kernel. The chipset is an hpt374. The hpt366 driver freezes on boot, as reported by others. Can we see a bootlog please? ... and the output of 'lspci -v' too. The machine locks hard when the driver is loaded so I can't give a full transcription, but here is the driver's output: HPT374: IDE controller at PCI slot :00:0d.0 ACPI: PCI Interrupt :00:0d.0[A] - GSI 16 (level, low) - IRQ 16 HPT374: chipset revision 7 HPT374: DPLL base: 48 MHz, f_CNT: 141, assuming 33 MHz PCI HPT374: using 50 MHz DPLL clock HPT374: 100% native mode on irq 16 ide2: BM-DMA at 0xec00-0xec07, BIOS settings: hde:DMA, hdf:pio ide3: BM-DMA at 0xec08-0xec0f, BIOS settings: hdg:DMA, hdh:pio ACPI: PCI Interrupt :00:0d.1[A] - GSI 16 (level, low) - IRQ 16 HPT374: no clock data saved by BIOS HPT374: DPLL base: 48 MHz, f_CNT: 93, assuming 33 MHz PCI HPT374: using 50 MHz DPLL clock ide4: BM-DMA at 0xed00-0xed07, BIOS settings: hdi:DMA, hdj:pio ide5: BM-DMA at 0xed08-0xed0f, BIOS settings: hdk:DMA, hdl:pio The pata_hpt37x driver is refusing to work as well but it doesn't crash the machine. Here is the relevant error message: hpt37x: DPLL did not stabilize. pata_hpt37x: BIOS has not set timing clocks. hpt37x: DPLL did not stabilize. Does this patch change anything? [PATCH] hpt366: always tune PIO Cc: Sergei Shtylyov [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/hpt366.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/hpt366.c Version 1.10Jun 29, 2007 + * linux/drivers/ide/pci/hpt366.c Version 1.11Jul 29, 2007 * * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001 Sun Microsystems, Inc. @@ -1265,10 +1265,10 @@ static void __devinit init_hwif_hpt366(i if (new_mcr != old_mcr) pci_write_config_byte(dev, hwif-select_data + 1, new_mcr); - if (!hwif-dma_base) { - hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] amd74xx/via82cxxx: check ide_config_drive_speed() return value
Hi, On Sunday 29 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: * Check ide_config_drive_speed() return value. * While at also call ide_config_drive_speed() if the transfer mode is XFER_PIO_SLOW (this case happens iff the transfer mode has already been set on the device by ide-proc.c::set_xfer_rate()) and remove redundant setting of -{init,current}_speed. * Bump driver version. Acked-by: Sergei Shtylyov [EMAIL PROTECTED] MBR, Sergei PS: There's no need to notify about Acked-by: addition I think -- would save everyone a keystroke or two... ;-) OK, just assume that they are added and complain in PM if they are not. :) Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ide patches
On Sunday 29 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Ok, there's a combination of things here: - First, doing a set_pio from userland (hdparm -p XX) causes the kernel to disable DMA, which I think is incorrect. It's not the case with 2.6.22 from my quick tests. The problem is that ide_config_drive_speed disables DMA, but only re-enables it when setting a DMA speed. I think The problem is that _many_ chipsets don't support separate PIO and DMA timings so disabling DMA while programming chipset for PIO timings is a necessity for them. Actually, I didn't quite follow (as I'm afraid Ben also :-). Do you mean the fact that the DMA timings may get overwritten (which happens due to the failure of the drivers to handle the shared PIO/DMA timing registers, and in some cases by coupling PIO to UltraDMA timings for no apparent reasons which leads to disabling UltraDMA when PIO is being programmed)? Yes, in particular I meant cases like cmd64x (shared MWDMA/PIO timing registers) so doing hdparm -p on a drive currently using DMA without ide_config_drive_speed() disabling DMA would result in DMA operations using PIO timings and possible data corruptions. BTW all PIO to (U)DMA couplings should be fixed now Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ide: add cable detection for early UDMA66 devices (take 2)
* Move ide_in_drive_list() from ide-dma.c to ide-iops.c. * Add ivb_list[] table for listening early UDMA66 devices which don't conform to ATA4 standard wrt cable detection (bit14 is zero, only bit13 is valid) and use only device side cable detection for them since host side cable detection may be unreliable. * Add model QUANTUM FIREBALLlct10 05 with firwmare A03.0900 to the list (from Craig's bugreport). v2: * Improve kernel message basing on suggestion from Sergei. Thanks to Craig for testing this patch. Cc: Craig Block [EMAIL PROTECTED] Cc: Sergei Shtylyov [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- - no other changes besides fixed printk, no need to retest - replacement patch for the one in the IDE quilt tree drivers/ide/ide-dma.c | 19 --- drivers/ide/ide-iops.c | 39 --- include/linux/ide.h|3 ++- 3 files changed, 38 insertions(+), 23 deletions(-) Index: b/drivers/ide/ide-dma.c === --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c @@ -135,25 +135,6 @@ static const struct drive_list_entry dri }; /** - * ide_in_drive_list - look for drive in black/white list - * @id: drive identifier - * @drive_table: list to inspect - * - * Look for a drive in the blacklist and the whitelist tables - * Returns 1 if the drive is found in the table. - */ - -int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) -{ - for ( ; drive_table-id_model ; drive_table++) - if ((!strcmp(drive_table-id_model, id-model)) - (!drive_table-id_firmware || -strstr(id-fw_rev, drive_table-id_firmware))) - return 1; - return 0; -} - -/** * ide_dma_intr- IDE DMA interrupt handler * @drive: the drive the interrupt is for * Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -565,6 +565,34 @@ int ide_wait_stat (ide_startstop_t *star EXPORT_SYMBOL(ide_wait_stat); +/** + * ide_in_drive_list - look for drive in black/white list + * @id: drive identifier + * @drive_table: list to inspect + * + * Look for a drive in the blacklist and the whitelist tables + * Returns 1 if the drive is found in the table. + */ + +int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) +{ + for ( ; drive_table-id_model ; drive_table++) + if ((!strcmp(drive_table-id_model, id-model)) + (!drive_table-id_firmware || +strstr(id-fw_rev, drive_table-id_firmware))) + return 1; + return 0; +} + +/* + * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. + * We list them here and depend on the device side cable detection for them. + */ +static const struct drive_list_entry ivb_list[] = { + { QUANTUM FIREBALLlct10 05, A03.0900}, + { NULL , NULL } +}; + /* * All hosts that use the 80c ribbon must use! * The name is derived from upper byte of word 93 and the 80c ribbon. @@ -573,11 +601,16 @@ u8 eighty_ninty_three (ide_drive_t *driv { ide_hwif_t *hwif = drive-hwif; struct hd_driveid *id = drive-id; + int ivb = ide_in_drive_list(id, ivb_list); + + if (ivb) + printk(KERN_DEBUG %s: ignoring word 93 validity check\n, + drive-name); if (hwif-cbl == ATA_CBL_PATA40_SHORT) return 1; - if (hwif-cbl != ATA_CBL_PATA80) + if (hwif-cbl != ATA_CBL_PATA80 !ivb) goto no_80w; /* Check for SATA but only if we are ATA5 or higher */ @@ -587,11 +620,11 @@ u8 eighty_ninty_three (ide_drive_t *driv /* * FIXME: * - change master/slave IDENTIFY order -* - force bit13 (80c cable present) check +* - force bit13 (80c cable present) check also for !ivb devices * (unless the slave device is pre-ATA3) */ #ifndef CONFIG_IDEDMA_IVB - if (id-hw_config 0x4000) + if ((id-hw_config 0x4000) || (ivb (id-hw_config 0x2000))) #else if (id-hw_config 0x6000) #endif Index: b/include/linux/ide.h === --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1291,13 +1291,14 @@ void ide_init_sg_cmd(ide_drive_t *, stru #define BAD_DMA_DRIVE 0 #define GOOD_DMA_DRIVE 1 -#ifdef CONFIG_BLK_DEV_IDEDMA struct drive_list_entry { const char *id_model; const char *id_firmware; }; int ide_in_drive_list(struct hd_driveid *, const struct drive_list_entry *); + +#ifdef CONFIG_BLK_DEV_IDEDMA int __ide_dma_bad_drive
[PATCH 1/12] ide: change master/slave IDENTIFY order
Need to probe slave device first to make it release PDIAG- (this is required for correct device side cable detection). Based on libata commit f31f0cc2f0b7527072d94d02da332d9bb8d7d94c. Thanks to Craig for testing this patch. Cc: Craig Block [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- I just noticed that previously I sent it only in PM to Craig. drivers/ide/ide-iops.c |1 - drivers/ide/ide-probe.c |7 +++ 2 files changed, 3 insertions(+), 5 deletions(-) Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -612,7 +612,6 @@ u8 eighty_ninty_three (ide_drive_t *driv /* * FIXME: -* - change master/slave IDENTIFY order * - force bit13 (80c cable present) check also for !ivb devices * (unless the slave device is pre-ATA3) */ Index: b/drivers/ide/ide-probe.c === --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c @@ -719,9 +719,9 @@ EXPORT_SYMBOL_GPL(ide_undecoded_slave); */ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) { - unsigned int unit; unsigned long flags; unsigned int irqd; + int unit; if (hwif-noprobe) return; @@ -777,10 +777,9 @@ static void probe_hwif(ide_hwif_t *hwif, printk(KERN_DEBUG %s: Wait for ready failed before probe !\n, hwif-name); /* -* Second drive should only exist if first drive was found, -* but a lot of cdrom drives are configured as single slaves. +* Need to probe slave device first to make it release PDIAG-. */ - for (unit = 0; unit MAX_DRIVES; ++unit) { + for (unit = MAX_DRIVES - 1; unit = 0; unit--) { ide_drive_t *drive = hwif-drives[unit]; drive-dn = (hwif-channel ? 2 : 0) + unit; (void) probe_for_drive(drive); - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/12] ide: remove CONFIG_IDEDMA_IVB config option
Devices which don't set word 93 validation bit should be now handled by ide-iops.c::ivb_list[] and for debugging purposes cable detection can be completely overriden with idex=ata66 parameter. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/Kconfig| 16 drivers/ide/ide-iops.c |4 2 files changed, 20 deletions(-) Index: b/drivers/ide/Kconfig === --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -1065,22 +1065,6 @@ endif config BLK_DEV_IDEDMA def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA -config IDEDMA_IVB - bool IGNORE word93 Validation BITS - depends on BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS - ---help--- - There are unclear terms in ATA-4 and ATA-5 standards how certain - hardware (an 80c ribbon) should be detected. Different interpretations - of the standards have been released in hardware. This causes problems: - for example, a host with Ultra Mode 4 (or higher) will not run - in that mode with an 80c ribbon. - - If you are experiencing compatibility or performance problems, you - MAY try to answer Y here. However, it does not necessarily solve - any of your problems, it could even cause more of them. - - It is normally safe to answer Y; however, the default is N. - endif config BLK_DEV_HD_ONLY Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -615,11 +615,7 @@ u8 eighty_ninty_three (ide_drive_t *driv * - force bit13 (80c cable present) check also for !ivb devices * (unless the slave device is pre-ATA3) */ -#ifndef CONFIG_IDEDMA_IVB if ((id-hw_config 0x4000) || (ivb (id-hw_config 0x2000))) -#else - if (id-hw_config 0x6000) -#endif return 1; no_80w: - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: 40-wire/80-wire detection
On Tuesday 24 July 2007, Sergei Shtylyov wrote: Hello. Bartlomiej Zolnierkiewicz wrote: [PATCH] ide: add cable detection for early UDMA66 devices * Move ide_in_drive_list() from ide-dma.c to ide-iops.c. * Add ivb_list[] table for listening early UDMA66 devices which don't conform to ATA4 standard wrt cable detection (bit14 is zero, only bit13 is valid) and use only device side cable detection for them since host side cable detection may be unreliable. * Add model QUANTUM FIREBALLlct10 05 with firwmare A03.0900 to the list (from Craig's bugreport). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -565,6 +565,34 @@ int ide_wait_stat (ide_startstop_t *star EXPORT_SYMBOL(ide_wait_stat); +/** + * ide_in_drive_list - look for drive in black/white list + * @id: drive identifier + * @drive_table: list to inspect + * + * Look for a drive in the blacklist and the whitelist tables + * Returns 1 if the drive is found in the table. + */ + +int ide_in_drive_list(struct hd_driveid *id, const struct drive_list_entry *drive_table) +{ + for ( ; drive_table-id_model ; drive_table++) + if ((!strcmp(drive_table-id_model, id-model)) + (!drive_table-id_firmware || +strstr(id-fw_rev, drive_table-id_firmware))) + return 1; + return 0; +} + +/* + * Early UDMA66 devices don't set bit14 to 1, only bit13 is valid. + * We list them here and depend on the device side cable detection for them. + */ +static const struct drive_list_entry ivb_list[] = { + { QUANTUM FIREBALLlct10 05, A03.0900}, + { NULL , NULL } +}; + /* * All hosts that use the 80c ribbon must use! * The name is derived from upper byte of word 93 and the 80c ribbon. @@ -573,11 +601,16 @@ u8 eighty_ninty_three (ide_drive_t *driv { ide_hwif_t *hwif = drive-hwif; struct hd_driveid *id = drive-id; + int ivb = ide_in_drive_list(id, ivb_list); + + if (ivb) + printk(KERN_DEBUG %s: enabling IVB cable detection quirk\n, + drive-name); Wound't more explicit message, something like ignoring word 93 validity check be better? It would, fixed in take 2. if (hwif-cbl == ATA_CBL_PATA40_SHORT) return 1; - if (hwif-cbl != ATA_CBL_PATA80) + if (hwif-cbl != ATA_CBL_PATA80 !ivb) goto no_80w; /* Check for SATA but only if we are ATA5 or higher */ @@ -587,11 +620,11 @@ u8 eighty_ninty_three (ide_drive_t *driv /* * FIXME: * - change master/slave IDENTIFY order -* - force bit13 (80c cable present) check +* - force bit13 (80c cable present) check also for !ivb devices * (unless the slave device is pre-ATA3) */ #ifndef CONFIG_IDEDMA_IVB - if (id-hw_config 0x4000) + if ((id-hw_config 0x4000) || (ivb (id-hw_config 0x2000))) I take it that change renders CONFIG_IDEDMA_IVB basically unneeded -- unless for the user which wants to see if his drive needs to be added to the list. Bbut then, the host side cable check may fail, so this doesn't seem a reliable test anyway -- so, this code either needs to be changed to behave as if the drive was foundin the list or removed completely, shouldn't it? CONFIG_IDEDMA_IVB removal was on my TODO, just haven't got a time to do it. Done... see the other mail. :) #else if (id-hw_config 0x6000) #endif BTW, shouldn't ide_ata66_check() also be changed? Nowadays ide_ata66_check() uses eighty_ninty_three() internally. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/12] cs5535: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/cs5535.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) Index: b/drivers/ide/pci/cs5535.c === --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -190,12 +190,16 @@ static u8 __devinit cs5535_cable_detect( */ static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) { - int i; - hwif-autodma = 0; hwif-set_pio_mode = cs5535_set_pio_mode; hwif-set_dma_mode = cs5535_set_dma_mode; + + hwif-drives[1].autotune = hwif-drives[0].autotune = 1; + + if (hwif-dma_base == 0) + return; + hwif-ide_dma_check = cs5535_dma_check; hwif-atapi_dma = 1; @@ -207,11 +211,7 @@ static void __devinit init_hwif_cs5535(i if (!noautodma) hwif-autodma = 1; - /* just setting autotune and not worrying about bios timings */ - for (i = 0; i 2; i++) { - hwif-drives[i].autotune = 1; - hwif-drives[i].autodma = hwif-autodma; - } + hwif-drives[1].autodma = hwif-drives[0].autodma = hwif-autodma; } static ide_pci_device_t cs5535_chipset __devinitdata = { - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/12] cs5530: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Also this host driver requires valid PCI BAR4 for normal operation so check it in -init_chipset and fail initialization if not set. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/cs5530.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) Index: b/drivers/ide/pci/cs5530.c === --- a/drivers/ide/pci/cs5530.c +++ b/drivers/ide/pci/cs5530.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/cs5530.c Version 0.73Mar 10 2007 + * linux/drivers/ide/pci/cs5530.c Version 0.74Jul 28 2007 * * Copyright (C) 2000 Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2000 Mark Lord [EMAIL PROTECTED] @@ -164,6 +164,9 @@ static unsigned int __devinit init_chips struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; unsigned long flags; + if (pci_resource_start(dev, 4) == 0) + return -EFAULT; + dev = NULL; while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { switch (dev-device) { @@ -282,6 +285,9 @@ static void __devinit init_hwif_cs5530 ( /* needs autotuning later */ } + if (hwif-dma_base == 0) + return; + hwif-atapi_dma = 1; hwif-ultra_mask = 0x07; hwif-mwdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/12] pdc202xx_new: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Also this host driver requires valid PCI BAR4 for normal operation so check it in -init_chipset and fail initialization if not set. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/pdc202xx_new.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) Index: b/drivers/ide/pci/pdc202xx_new.c === --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -370,6 +370,9 @@ static unsigned int __devinit init_chips int f, r; u8 pll_ctl0, pll_ctl1; + if (dma_base == 0) + return -EFAULT; + #ifdef CONFIG_PPC_PMAC apple_kiwi_init(dev); #endif @@ -487,15 +490,18 @@ static void __devinit init_hwif_pdc202ne hwif-quirkproc = pdcnew_quirkproc; hwif-resetproc = pdcnew_reset; + hwif-err_stops_fifo = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + if (hwif-dma_base == 0) + return; + hwif-atapi_dma = 1; hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; - hwif-err_stops_fifo = 1; - hwif-ide_dma_check = pdcnew_config_drive_xfer_rate; if (hwif-cbl != ATA_CBL_PATA40_SHORT) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/12] pdc202xx_old: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/pdc202xx_old.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) Index: b/drivers/ide/pci/pdc202xx_old.c === --- a/drivers/ide/pci/pdc202xx_old.c +++ b/drivers/ide/pci/pdc202xx_old.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/pdc202xx_old.c Version 0.50Mar 3, 2007 + * linux/drivers/ide/pci/pdc202xx_old.c Version 0.51Jul 27, 2007 * * Copyright (C) 1998-2002Andre Hedrick [EMAIL PROTECTED] * Copyright (C) 2006-2007MontaVista Software, Inc. @@ -335,15 +335,18 @@ static void __devinit init_hwif_pdc202xx if (hwif-pci_dev-device != PCI_DEVICE_ID_PROMISE_20246) hwif-resetproc = pdc202xx_reset; + hwif-err_stops_fifo = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + if (hwif-dma_base == 0) + return; + hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x07; hwif-atapi_dma = 1; - hwif-err_stops_fifo = 1; - hwif-ide_dma_check = pdc202xx_config_drive_xfer_rate; hwif-dma_lost_irq = pdc202xx_dma_lost_irq; hwif-dma_timeout = pdc202xx_dma_timeout; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/12] sgiioc4: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sgiioc4.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) Index: b/drivers/ide/pci/sgiioc4.c === --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c @@ -587,8 +587,6 @@ static void __devinit ide_init_sgiioc4(ide_hwif_t * hwif) { hwif-mmio = 1; - hwif-atapi_dma = 1; - hwif-mwdma_mask = 0x04; hwif-pio_mask = 0x00; hwif-set_pio_mode = NULL; /* Sets timing for PIO mode */ hwif-set_dma_mode = sgiioc4_set_dma_mode; @@ -602,6 +600,14 @@ ide_init_sgiioc4(ide_hwif_t * hwif) hwif-quirkproc = NULL; hwif-busproc = NULL; + hwif-INB = sgiioc4_INB; + + if (hwif-dma_base == 0) + return; + + hwif-atapi_dma = 1; + hwif-mwdma_mask = 0x04; + hwif-dma_setup = sgiioc4_ide_dma_setup; hwif-dma_start = sgiioc4_ide_dma_start; hwif-ide_dma_end = sgiioc4_ide_dma_end; @@ -613,8 +619,6 @@ ide_init_sgiioc4(ide_hwif_t * hwif) hwif-dma_host_off = sgiioc4_dma_host_off; hwif-dma_lost_irq = sgiioc4_dma_lost_irq; hwif-dma_timeout = ide_dma_timeout; - - hwif-INB = sgiioc4_INB; } static int __devinit @@ -684,8 +688,6 @@ sgiioc4_ide_setup_pci_device(struct pci_ /* Initializing chipset IRQ Registers */ writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); - ide_init_sgiioc4(hwif); - hwif-autodma = 0; if (dma_base ide_dma_sgiioc4(hwif, dma_base) == 0) { @@ -695,6 +697,8 @@ sgiioc4_ide_setup_pci_device(struct pci_ printk(KERN_INFO %s: %s Bus-Master DMA disabled\n, hwif-name, DRV_NAME); + ide_init_sgiioc4(hwif); + if (probe_hwif_init(hwif)) return -EIO; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/12] triflex: add missing -dma_base check
If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/triflex.c |3 +++ 1 file changed, 3 insertions(+) Index: b/drivers/ide/pci/triflex.c === --- a/drivers/ide/pci/triflex.c +++ b/drivers/ide/pci/triflex.c @@ -111,6 +111,9 @@ static void __devinit init_hwif_triflex( hwif-set_pio_mode = triflex_set_pio_mode; hwif-set_dma_mode = triflex_set_mode; + if (hwif-dma_base == 0) + return; + hwif-atapi_dma = 1; hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 9/12] cs5520: fix -dma_base equal zero handling
Set hwif-ide_dma_{check,on} and hwif-autodma to 1 after checking that -dma_base exists. If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/cs5520.c | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) Index: b/drivers/ide/pci/cs5520.c === --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -142,25 +142,24 @@ static void __devinit init_hwif_cs5520(i { hwif-set_pio_mode = cs5520_set_pio_mode; hwif-set_dma_mode = cs5520_set_dma_mode; - hwif-ide_dma_check = cs5520_config_drive_xfer_rate; - hwif-ide_dma_on = cs5520_dma_on; - if(!noautodma) - hwif-autodma = 1; - - if(!hwif-dma_base) - { - hwif-drives[0].autotune = 1; - hwif-drives[1].autotune = 1; + if (hwif-dma_base == 0) { + hwif-drives[1].autotune = hwif-drives[0].autotune = 1; return; } + hwif-ide_dma_check = cs5520_config_drive_xfer_rate; + hwif-ide_dma_on = cs5520_dma_on; + /* ATAPI is harder so leave it for now */ hwif-atapi_dma = 0; hwif-ultra_mask = 0; hwif-swdma_mask = 0; hwif-mwdma_mask = 0; - + + if (!noautodma) + hwif-autodma = 1; + hwif-drives[0].autodma = hwif-autodma; hwif-drives[1].autodma = hwif-autodma; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/12] sc1200: fix -dma_base equal zero handling
Set hwif-atapi_dma/{ultra,mwdma}_mask and drive-autodma after checking that -dma_base exists. If -dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. OTOH hwif-set_{pio,dma}_mode hooks should be set even if hwif-dma_base == 0. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/sc1200.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) Index: b/drivers/ide/pci/sc1200.c === --- a/drivers/ide/pci/sc1200.c +++ b/drivers/ide/pci/sc1200.c @@ -350,16 +350,20 @@ static void __devinit init_hwif_sc1200 ( if (hwif-mate) hwif-serialized = hwif-mate-serialized = 1; hwif-autodma = 0; - if (hwif-dma_base) { - hwif-udma_filter = sc1200_udma_filter; - hwif-ide_dma_check = sc1200_config_dma; - hwif-ide_dma_end = sc1200_ide_dma_end; - if (!noautodma) - hwif-autodma = 1; - - hwif-set_pio_mode = sc1200_set_pio_mode; - hwif-set_dma_mode = sc1200_set_dma_mode; - } + + hwif-set_pio_mode = sc1200_set_pio_mode; + hwif-set_dma_mode = sc1200_set_dma_mode; + + if (hwif-dma_base == 0) + return; + + hwif-udma_filter = sc1200_udma_filter; + hwif-ide_dma_check = sc1200_config_dma; + hwif-ide_dma_end = sc1200_ide_dma_end; + + if (!noautodma) + hwif-autodma = 1; + hwif-atapi_dma = 1; hwif-ultra_mask = 0x07; hwif-mwdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/12] alim15x3: remove redundant m5229_revision check
init_dma_ali15x3() guarantees that hwif-dma_base will never be set for m5229_revision 0x20 so remove redundant m5229_revision = 0x20 check from init_hwif_common_ali15x3(). While at it remove incorrect comment. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/alim15x3.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) Index: b/drivers/ide/pci/alim15x3.c === --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -687,6 +687,10 @@ static void __devinit init_hwif_common_a return; } + /* +* check in -init_dma guarantees m5229_revision = 0x20 here +*/ + if (m5229_revision 0x20) hwif-atapi_dma = 1; @@ -704,18 +708,15 @@ static void __devinit init_hwif_common_a hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x07; -if (m5229_revision = 0x20) { -/* - * M1543C or newer for DMAing - */ -hwif-ide_dma_check = ali15x3_config_drive_for_dma; - hwif-dma_setup = ali15x3_dma_setup; - if (!noautodma) - hwif-autodma = 1; + hwif-ide_dma_check = ali15x3_config_drive_for_dma; + hwif-dma_setup = ali15x3_dma_setup; + + if (hwif-cbl != ATA_CBL_PATA40_SHORT) + hwif-cbl = ata66_ali15x3(hwif); + + if (!noautodma) + hwif-autodma = 1; - if (hwif-cbl != ATA_CBL_PATA40_SHORT) - hwif-cbl = ata66_ali15x3(hwif); - } hwif-drives[0].autodma = hwif-autodma; hwif-drives[1].autodma = hwif-autodma; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/12] hpt366: always tune PIO
Cc: Sergei Shtylyov [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- Should be right thing to do nowadays? drivers/ide/pci/hpt366.c |8 1 file changed, 4 insertions(+), 4 deletions(-) Index: b/drivers/ide/pci/hpt366.c === --- a/drivers/ide/pci/hpt366.c +++ b/drivers/ide/pci/hpt366.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/hpt366.c Version 1.10Jun 29, 2007 + * linux/drivers/ide/pci/hpt366.c Version 1.11Jul 29, 2007 * * Copyright (C) 1999-2003 Andre Hedrick [EMAIL PROTECTED] * Portions Copyright (C) 2001 Sun Microsystems, Inc. @@ -1265,10 +1265,10 @@ static void __devinit init_hwif_hpt366(i if (new_mcr != old_mcr) pci_write_config_byte(dev, hwif-select_data + 1, new_mcr); - if (!hwif-dma_base) { - hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + hwif-drives[0].autotune = hwif-drives[1].autotune = 1; + + if (hwif-dma_base == 0) return; - } hwif-ultra_mask = hwif-cds-udma_mask; hwif-mwdma_mask = 0x07; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: move ide_config_drive_speed() calls to upper layers
On Friday 27 July 2007, Alan Cox wrote: On Fri, 27 Jul 2007 02:22:27 +0200 Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] wrote: * Convert {ide_hwif_t,ide_pci_device_t}-host_flag to be u16. * Add IDE_HFLAG_POST_SET_MODE host to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide/cs5530/cs5535/pdc202xx_new/sc1200/via82cxxx host drivers. The CS5530 at least shouldn't care what order changes are done. I don't think the SC1200 does either but I don't have the docs to hand. Thanks, I will make a follow up patch to remove this flag from cs5530 host driver (unless of course somebody beats me to it). For libata we went the post_set_mode way and then junked it. Instead there is a -set_mode method which defaults to the usual order and actions. IT821x and similar override it to do very little, post_set_mode people call the default method and then do their stuff, and some of the crazier cases do stuff both before and after the default. Much more flexible and it can do anything unlike flags for the cases you have. I view this patch as an intermediate step in -set_mode direction. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] use ARRAY_SIZE in ide-cd.c
Hi, On Friday 27 July 2007, Mark Hindley wrote: Hi, ARY_LEN in ide-cd.{c,h} is an unnecessary duplication. Replace with generic ARRAY_SIZE from kernel.h. Seems to be already fixed by: commit 74c8f97a6c2d12fb144ad34076e969e8a01dc4b3 Author: Robert P. J. Day [EMAIL PROTECTED] Date: Mon Jul 9 23:17:57 2007 +0200 ide-cd: replace C code with call to ARRAY_SIZE() macro Delete the unnecessary macro ARY_LEN and use ARRAY_SIZE directly. Signed-off-by: Robert P. J. Day [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Please always make sure that you are working on the current git tree or such unfortunate situation is likely to happen... ;) Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] au1xxx: fix au1xxx_set_pio_mode()
On Thursday 26 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Set transfer mode on the device before programming the host controller for the new timings (matches what auide_tune_chipset() is doing wrt DMA modes). It's not that the most other drives are doing something different... :-) Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] pdc202xx_new: check ide_config_drive_speed() return value
On Thursday 26 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: make CONFIG_IDE_GENERIC default to N
On Saturday 28 July 2007, Tejun Heo wrote: These days, CONFIG_IDE_GENERIC causes more confusion and misconfiguration than it helps. Especially so because libata is linked after the generic driver. Default to N. Signed-off-by: Tejun Heo [EMAIL PROTECTED] applied and Jeff's ACK added, thanks - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] alim15x3: Correct HP detect
Direct port of Alan's fix for pata_ali. Cc: Alan Cox [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/alim15x3.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: b/drivers/ide/pci/alim15x3.c === --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_ta .ident = HP Pavilion N5430, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, Hewlett-Packard), - DMI_MATCH(DMI_BOARD_NAME, OmniBook N32N-736), + DMI_MATCH(DMI_BOARD_VERSION, OmniBook N32N-736), }, }, { } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] cs5535: check ide_config_drive_speed() return value
On Thursday 26 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [2/3] 2.6.23-rc1: known regressions v2
On Friday 27 July 2007, Michal Piotrowski wrote: IDE Subject : ide problems: 2.6.22-git17 working, 2.6.23-rc1* is not References : http://lkml.org/lkml/2007/7/27/298 Last known good : ? Submitter : dth [EMAIL PROTECTED] Caused-By : ? Handled-By : ? Status : unknown No IDE changes after 2.6.22-git17. Despite this I will try to follow this bugreport. Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver)
On Wednesday 25 July 2007, Alan Cox wrote: pata_platform and ide_platform are carrying same driver names, to easily switch between these drivers, without need to touch platform code. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] Signed-off-by: Vitaly Bordug [EMAIL PROTECTED] Acked-by: Alan Cox [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 11/11] ide-pmac: remove pmac_ide_do_setfeature() (take 2)
On Tuesday 24 July 2007, Benjamin Herrenschmidt wrote: On Tue, 2007-07-24 at 00:29 +0200, Bartlomiej Zolnierkiewicz wrote: Use ide_config_drive_speed() instead of pmac_ide_do_setfeature() and remove the latter, also ide-iops.c::__ide_wait_stat() could be static again. Since for IDE PMAC host driver IDE_CONTROL_REG is always true, device's -quirk_list is always zero and -ide_dma_host_{on,off} are nops than the only changes in behavior are: * if PIO mode is set then -dma_off_queitly is called to disable DMA * if setting transfer mode fails ide_dump_status() is called to dump status I'll test that today. ping? - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: CONFIG_IDE_PROC_FS: /sys is not full replacement of /proc
Hi, On Wednesday 18 July 2007, Andrey Borzenkov wrote: May be I miss something obvious but most information that was available in /proc/ide is missing under /sys. At the very least, Mandriva hardware detection expects /proc/ide/hdX/model; nothing close is under /sys. It is really better to obtain some information using IOCTLs (i.e. SMART data) but for other like model it makes perfect sense to add them to /sys. Are there any plans to extend IDE /sys interface to provide full range of information from /proc? Alternatively I appreciate description (or pointer to thereof) how to get information that was available under /proc/ide without /proc/ide :) Could you please add the information that you find missing to the existing infrastructure in ide.c (ide_dev_attrs[] table)? Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] amd74xx/via82cxxx: check ide_config_drive_speed() return value
* Check ide_config_drive_speed() return value. * While at also call ide_config_drive_speed() if the transfer mode is XFER_PIO_SLOW (this case happens iff the transfer mode has already been set on the device by ide-proc.c::set_xfer_rate()) and remove redundant setting of -{init,current}_speed. * Bump driver version. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/amd74xx.c | 10 +++--- drivers/ide/pci/via82cxxx.c | 10 +++--- 2 files changed, 6 insertions(+), 14 deletions(-) Index: b/drivers/ide/pci/amd74xx.c === --- a/drivers/ide/pci/amd74xx.c +++ b/drivers/ide/pci/amd74xx.c @@ -1,5 +1,5 @@ /* - * Version 2.22 + * Version 2.23 * * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 * IDE driver for Linux. @@ -240,8 +240,8 @@ static int amd_set_drive(ide_drive_t *dr struct ide_timing t, p; int T, UT; - if (speed != XFER_PIO_SLOW) - ide_config_drive_speed(drive, speed); + if (ide_config_drive_speed(drive, speed)) + return 1; T = 10 / amd_clock; UT = (amd_config-udma_mask == ATA_UDMA2) ? T : (T / 2); @@ -258,10 +258,6 @@ static int amd_set_drive(ide_drive_t *dr amd_set_speed(HWIF(drive)-pci_dev, drive-dn, t); - if (!drive-init_speed) - drive-init_speed = speed; - drive-current_speed = speed; - return 0; } Index: b/drivers/ide/pci/via82cxxx.c === --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -1,6 +1,6 @@ /* * - * Version 3.47 + * Version 3.48 * * VIA IDE driver for Linux. Supported southbridges: * @@ -164,8 +164,8 @@ static int via_set_drive(ide_drive_t *dr struct ide_timing t, p; unsigned int T, UT; - if (speed != XFER_PIO_SLOW) - ide_config_drive_speed(drive, speed); + if (ide_config_drive_speed(drive, speed)) + return 1; T = 10 / via_clock; @@ -186,10 +186,6 @@ static int via_set_drive(ide_drive_t *dr via_set_speed(HWIF(drive), drive-dn, t); - if (!drive-init_speed) - drive-init_speed = speed; - drive-current_speed = speed; - return 0; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: move ide_config_drive_speed() calls to upper layers
On Friday 27 July 2007, Bartlomiej Zolnierkiewicz wrote: * Add IDE_HFLAG_POST_SET_MODE host to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide/cs5530/cs5535/pdc202xx_new/sc1200/via82cxxx host drivers. and amd74xx :) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver)
Hi, On Thursday 26 July 2007, Guennadi Liakhovetski wrote: On Wed, 25 Jul 2007, Alan Cox wrote: driver to using platform-device. I got a reply, that it's not worth it now that IDE is slowly becoming obsolete, and the pata_platform serves the perpose perfectly well. I found this argument reasonable, I had the same doubt, just wanted to double-check. So, why do we now need a new legacy (a/drivers/ide/legacy/ide_platform.c) driver when a modern driver exists? We don't *need* it but some people still want to use old IDE and the author was willing to make it neatly compatible so that anything that works with the pata_platform should be able to use the ide_platform driver and vice versa. For the shorter term that can only be a good thing - arch code doesn't need to care about which driver is used, end users can pick and it doesn't end up adding new ties between code and old IDE. Ok, thanks for the explanation Alan. So, there's no technical argument, just being nice to the users, and add a new driver, which we know we'll There are some rough edges (especially older and/or rare hardware, this goes for both cotrollers and devices) that SCSI/libata don't handle and IDE subsystem do. have to remove soon, thus having to persuade its users, who by that time Well, we've been hearing soon for two years now... will get used to it and will not want to invest money into switching to another one... PS wrt ide_arm.c changes, you really should have cc:ed the author... ;) Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] [IDE] Platform IDE driver (was: MMIO IDE driver)
Hi, On Wednesday 25 July 2007, Vitaly Bordug wrote: This is now very similar to pata_platform.c, they both use same platform data structure and same resources. To achieve that, byte_lanes_swapping platform data variable and platform specified iops removed from that driver. It's fine, since those were never used anyway. pata_platform and ide_platform are carrying same driver names, to easily switch between these drivers, without need to touch platform code. Looks really good, thanks for working on this. Signed-off-by: Anton Vorontsov [EMAIL PROTECTED] Signed-off-by: Vitaly Bordug [EMAIL PROTECTED] applied but it would be also nice to fix minor issues found by Sergei (please just send a new version of the patch and I will replace this version with the newer one in my tree) patch #2/2 also looks fine and when issues raised by Sergei gets addressed it will be merged Thanks, Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] icside: fix -speedproc to return on unsupported modes (take 5)
* All other implementations of -speedproc return zero on success and non-zero on failure. Currently it doesn't matter for icside host driver and isn't a bug per se since: - ide_set_xfer_rate() return value is ignored by all IDE core users - icside doesn't (yet!) use ide_tune_dma() in icside_dma_check() but sooner or later we will need to fix anyway - so lets do it now. * icside_set_speed() happily accepts unsupported transfer modes which results in drive-drive_data being set to the maximum value (480) and drive-current_speed being set to the unsupported transfer mode. Fix it. v2: * The initial version of the patch was broken because it didn't take into the account (the different from usual) return values of icside_set_speed() (Noticed by Russell). v3: * Remove no longer needed initialization/checking of cycle_time (Noticed by Sergei). * No need to set drive-drive_data if DMA is not going to be used (Noticed by Sergei). * Remove incorrect setting of drive-current_speed (Noticed by Sergei). * Move ide_config_drive_speed() at the end of icside_set_speed(). v4: * If DMA mode is not found in icside_dma_check() then just return -1 and don't call icside_set_speed() (v3 got it wrong and 1 was returned instead). v5: * Return -1/0 in icside_set_speed() instead of icside_dma_check() return value (just like it was before this patch). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Cc: Russell King [EMAIL PROTECTED] Cc: Sergei Shtylyov [EMAIL PROTECTED] --- replacement patch for the one in IDE quilt tree drivers/ide/arm/icside.c | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) Index: b/drivers/ide/arm/icside.c === --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -250,7 +250,7 @@ static void icside_build_sglist(ide_driv */ static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode) { - int on = 0, cycle_time = 0, use_dma_info = 0; + int cycle_time, use_dma_info = 0; switch (xfer_mode) { case XFER_MW_DMA_2: @@ -272,6 +272,8 @@ static int icside_set_speed(ide_drive_t case XFER_SW_DMA_0: cycle_time = 480; break; + default: + return 1; } /* @@ -283,17 +285,10 @@ static int icside_set_speed(ide_drive_t drive-drive_data = cycle_time; - if (cycle_time ide_config_drive_speed(drive, xfer_mode) == 0) - on = 1; - else - drive-drive_data = 480; - printk(%s: %s selected (peak %dMB/s)\n, drive-name, ide_xfer_verbose(xfer_mode), 2000 / drive-drive_data); - drive-current_speed = xfer_mode; - - return on; + return ide_config_drive_speed(drive, xfer_mode); } static void icside_dma_host_off(ide_drive_t *drive) @@ -320,8 +315,7 @@ static int icside_dma_check(ide_drive_t { struct hd_driveid *id = drive-id; ide_hwif_t *hwif = HWIF(drive); - int xfer_mode = XFER_PIO_2; - int on; + int xfer_mode = 0; if (!(id-capability 1) || !hwif-autodma) goto out; @@ -350,9 +344,10 @@ static int icside_dma_check(ide_drive_t } out: - on = icside_set_speed(drive, xfer_mode); + if (xfer_mode == 0) + return -1; - return on ? 0 : -1; + return icside_set_speed(drive, xfer_mode) ? -1 : 0; } static int icside_dma_end(ide_drive_t *drive) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] au1xxx: fix au1xxx_set_pio_mode()
Set transfer mode on the device before programming the host controller for the new timings (matches what auide_tune_chipset() is doing wrt DMA modes). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/mips/au1xxx-ide.c |7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) Index: b/drivers/ide/mips/au1xxx-ide.c === --- a/drivers/ide/mips/au1xxx-ide.c +++ b/drivers/ide/mips/au1xxx-ide.c @@ -103,7 +103,9 @@ static void au1xxx_set_pio_mode(ide_driv { int mem_sttime; int mem_stcfg; - u8 speed; + + if (ide_config_drive_speed(drive, pio + XFER_PIO_0)) + return; mem_sttime = 0; mem_stcfg = au_readl(MEM_STCFG2); @@ -164,9 +166,6 @@ static void au1xxx_set_pio_mode(ide_driv au_writel(mem_sttime,MEM_STTIME2); au_writel(mem_stcfg,MEM_STCFG2); - - speed = pio + XFER_PIO_0; - ide_config_drive_speed(drive, speed); } static int auide_tune_chipset(ide_drive_t *drive, const u8 speed) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide: move ide_config_drive_speed() calls to upper layers
On Friday 27 July 2007, Bartlomiej Zolnierkiewicz wrote: On Friday 27 July 2007, Bartlomiej Zolnierkiewicz wrote: * Add IDE_HFLAG_POST_SET_MODE host to indicate the need to program the host for the transfer mode after programming the device. Set it in au1xxx-ide/cs5530/cs5535/pdc202xx_new/sc1200/via82cxxx host drivers. and amd74xx :) and pmac :) :) now time for some sleep... Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] cs5535: check ide_config_drive_speed() return value
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/cs5535.c |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) Index: b/drivers/ide/pci/cs5535.c === --- a/drivers/ide/pci/cs5535.c +++ b/drivers/ide/pci/cs5535.c @@ -141,7 +141,9 @@ static void cs5535_set_speed(ide_drive_t */ static int cs5535_set_drive(ide_drive_t *drive, u8 speed) { - ide_config_drive_speed(drive, speed); + if (ide_config_drive_speed(drive, speed)) + return 1; + cs5535_set_speed(drive, speed); return 0; @@ -156,7 +158,9 @@ static int cs5535_set_drive(ide_drive_t */ static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio) { - ide_config_drive_speed(drive, XFER_PIO_0 + pio); + if (ide_config_drive_speed(drive, XFER_PIO_0 + pio)) + return; + cs5535_set_speed(drive, XFER_PIO_0 + pio); } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] pdc202xx_new: check ide_config_drive_speed() return value
Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/pci/pdc202xx_new.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Index: b/drivers/ide/pci/pdc202xx_new.c === --- a/drivers/ide/pci/pdc202xx_new.c +++ b/drivers/ide/pci/pdc202xx_new.c @@ -150,13 +150,13 @@ static int pdcnew_tune_chipset(ide_drive { ide_hwif_t *hwif= HWIF(drive); u8 adj = (drive-dn 1) ? 0x08 : 0x00; - int err; /* * Issue SETFEATURES_XFER to the drive first. PDC202xx hardware will * automatically set the timing registers based on 100 MHz PLL output. */ - err = ide_config_drive_speed(drive, speed); + if (ide_config_drive_speed(drive, speed)) + return 1; /* * As we set up the PLL to output 133 MHz for UltraDMA/133 capable @@ -212,7 +212,7 @@ static int pdcnew_tune_chipset(ide_drive set_indexed_reg(hwif, 0x10 + adj, tmp 0x7f); } - return err; + return 0; } static void pdcnew_set_pio_mode(ide_drive_t *drive, const u8 pio) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: drivers/ide/pci/cs5535.c: array overrun
Hi, On Tuesday 24 July 2007, Jordan Crouse wrote: The Coverity checker spotted the following array overrun in drivers/ide/pci/cs5535.c: -- snip -- if (speed = XFER_UDMA_0 speed = XFER_UDMA_7) reg |= cs5535_udma_timings[speed - XFER_UDMA_0]; Not a bug per se since the upper layer will never feed this function with speed XFER_UDMA_4 (thanks to -ultra_mask being set to 0x1f). Worth fixing anyway. Fix is attached. Somebody got overzealous - the 5535 only supports up to UDMA4, which matches the array. applied, thanks Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Time Problems with 2.6.23-rc1-gf695baf2
On Wednesday 25 July 2007, Bartlomiej Zolnierkiewicz wrote: Hi, On Wednesday 25 July 2007, Michal Piotrowski wrote: Hi, On 24/07/07, Eric Sesterhenn / Snakebyte [EMAIL PROTECTED] wrote: hi, seems like the clock got screwed or something similar. During bootup the computer hangs (no response on keyboard leds when pressing caps lock), the only way to make sure it resumes booting is by repeatedly pressing the power switch, :) see second 13 to 510, after pressing it about ten times, it continues booting. Probing IDE interface... [ 13.867939] VP_IDE: VIA vt82c686a (rev 22) IDE UDMA66 controller on pci:00:04.1 [ 13.868062] ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:pio [ 13.868268] ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:DMA, hdd:DMA [ 13.868574] Probing IDE interface ide0... [ 387.279576] Clocksource tsc unstable (delta = 370195339890 ns) [ 496.200082] hda: ST340823A, ATA DISK drive [ 510.264511] hda: selected mode 0x44 [ 510.264826] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 Could you please try to revert these commits It doesn't seem like a IDE bug et all, rather seems to be some issue related to the recent lack of the proper clocksource fallback bug... or ACPI [ 13.506890] ACPI Exception (processor_throttling-0084): AE_NOT_FOUND, Evaluating _PTC [20070126] [ 13.507101] ACPI Exception (processor_throttling-0147): AE_NOT_FOUND, Evaluating _TSS [20070126] Bart - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] ide-pmac: fix drive-init_speed reporting
On Sunday 22 July 2007, Benjamin Herrenschmidt wrote: On Sun, 2007-07-22 at 20:19 +0200, Bartlomiej Zolnierkiewicz wrote: pmac_ide_tune_chipset() don't set drive-init_speed. Fix it by setting drive-{current,init}_speed in pmac_ide_do_setfeature() and clean up pmac_ide_{tune_chipset,mdma_enable,udma_enable}(). Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/11] ide-pmac: don't check kauai_lookup_timing() return value
On Sunday 22 July 2007, Benjamin Herrenschmidt wrote: On Sun, 2007-07-22 at 20:20 +0200, Bartlomiej Zolnierkiewicz wrote: kauai_lookup_timing() should always return non-zero return value: * BUG() in kauai_lookup_timing() if the timing info cannot be found. * Remove code checking for zero return value from all callers. Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/11] ide-pmac: pmac_ide_tune_chipset() fixes
On Sunday 22 July 2007, Benjamin Herrenschmidt wrote: On Sun, 2007-07-22 at 20:21 +0200, Bartlomiej Zolnierkiewicz wrote: * Don't check check for pmif == NULL (it should never be NULL if we got here). * Make a local copy of the timings and set the pmif-timings[] only after setting the transfer mode on the device (otherwise SELECT_DRIVE() call in pmac_ide_do_setfeature() will program new timings before the transfer mode is set on the device - this was pointed out by Sergei). This change makes pmac_ide_tune_chipset() behavior match this of pmac_ide_{m,u}dma_enable(). Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/11] ide-pmac: fix set_timings_mdma()
On Sunday 22 July 2007, Benjamin Herrenschmidt wrote: On Sun, 2007-07-22 at 20:22 +0200, Bartlomiej Zolnierkiewicz wrote: * Move adjusting of cycle time for devices providing explicit DMA cycle time from pmac_ide_mdma_enable() to set_timings_mdma(). * Remove no longer needed drive_cycle_time argument. * BUG() if unsupported speed argument value is passed (shouldn't happen). * Matching access/recovery timings always exist so remove redundant check. * Make set_timings_mdma() void. * Update pmac_ide_tune_chipset()'s comment. Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable() (take 2)
* Fix pmac_ide_dma_check() to use pmac_ide_tune_chipset() and remove no longer necessary pmac_ide_{m,u}dma_enable(). * While at it remove some dead code from pmac_ide_dma_check() (leftovers from conversion to use ide_max_dma_mode()). There should be no functionality changes caused by this patch. v2: * Fix compile by replacing id with drive-id in pmac_ide_dma_check() (Noticed by Ben). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- replacement patch drivers/ide/ppc/pmac.c | 103 + 1 file changed, 3 insertions(+), 100 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1670,110 +1670,18 @@ pmac_ide_destroy_dmatable (ide_drive_t * } /* - * Pick up best MDMA timing for the drive and apply it - */ -static int -pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) -{ - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; - u32 *timings, *timings2; - u32 timing_local[2]; - int ret; - - /* which drive is it ? */ - timings = pmif-timings[drive-select.b.unit 0x01]; - timings2 = pmif-timings[(drive-select.b.unit 0x01) + 2]; - - /* Copy timings to local image */ - timing_local[0] = *timings; - timing_local[1] = *timings2; - - /* Calculate controller timings */ - set_timings_mdma(drive, pmif-kind, timing_local[0], timing_local[1], mode); - - /* Set feature on drive */ - printk(KERN_INFO %s: Enabling MultiWord DMA %d\n, drive-name, mode 0xf); - ret = pmac_ide_do_setfeature(drive, mode); - if (ret) { - printk(KERN_WARNING %s: Failed !\n, drive-name); - return 0; - } - - /* Apply timings to controller */ - *timings = timing_local[0]; - *timings2 = timing_local[1]; - - return 1; -} - -/* - * Pick up best UDMA timing for the drive and apply it - */ -static int -pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) -{ - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; - u32 *timings, *timings2; - u32 timing_local[2]; - int ret; - - /* which drive is it ? */ - timings = pmif-timings[drive-select.b.unit 0x01]; - timings2 = pmif-timings[(drive-select.b.unit 0x01) + 2]; - - /* Copy timings to local image */ - timing_local[0] = *timings; - timing_local[1] = *timings2; - - /* Calculate timings for interface */ - if (pmif-kind == controller_un_ata6 - || pmif-kind == controller_k2_ata6) - ret = set_timings_udma_ata6(timing_local[0], - timing_local[1], - mode); - else if (pmif-kind == controller_sh_ata6) - ret = set_timings_udma_shasta( timing_local[0], - timing_local[1], - mode); - else - ret = set_timings_udma_ata4(timing_local[0], mode); - if (ret) - return 0; - - /* Set feature on drive */ - printk(KERN_INFO %s: Enabling Ultra DMA %d\n, drive-name, mode 0x0f); - ret = pmac_ide_do_setfeature(drive, mode); - if (ret) { - printk(KERN_WARNING %s: Failed !\n, drive-name); - return 0; - } - - /* Apply timings to controller */ - *timings = timing_local[0]; - *timings2 = timing_local[1]; - - return 1; -} - -/* * Check what is the best DMA timing setting for the drive and * call appropriate functions to apply it. */ static int pmac_ide_dma_check(ide_drive_t *drive) { - struct hd_driveid *id = drive-id; - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; int enable = 1; - int map; drive-using_dma = 0; if (drive-media == ide_floppy) enable = 0; - if (((id-capability 1) == 0) !__ide_dma_good_drive(drive)) + if ((drive-id-capability 1) == 0 !__ide_dma_good_drive(drive)) enable = 0; if (__ide_dma_bad_drive(drive)) enable = 0; @@ -1781,13 +1689,8 @@ pmac_ide_dma_check(ide_drive_t *drive) if (enable) { u8 mode = ide_max_dma_mode(drive); - if (mode = XFER_UDMA_0) - drive-using_dma = pmac_ide_udma_enable(drive, mode); - else if (mode = XFER_MW_DMA_0) - drive-using_dma = pmac_ide_mdma_enable(drive, mode); - - /* Apply settings to controller */ - pmac_ide_do_update_timings(drive
Re: [PATCH 9/11] ide-pmac: use __ide_wait_stat()
On Monday 23 July 2007, Benjamin Herrenschmidt wrote: On Sun, 2007-07-22 at 20:33 +0200, Bartlomiej Zolnierkiewicz wrote: * Use __ide_wait_stat() instead of wait_for_ready() in pmac_ide_do_setfeature(). While at it do following changes to match __ide_wait_stat() call in ide_config_drive_speed(): * Wait WAIT_CMD time (20 sec) instead of 2 sec for device to clear BUSY_STAT. * Check DRQ_STAT bit (shouldn't be set for good device status). Also remove no longer needed wait_for_ready() from ide-iops.c. Acked-by: Benjamin Herrenschmidt [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/11] ide: ide_config_drive_speed() bugfixes
On Sunday 22 July 2007, Sergei Shtylyov wrote: Hello. Bartlomiej Zolnierkiewicz wrote: * Use -OUTBSYNC instead of -OUTB when writing command register (needed for scc_pata and pmac host drivers). * Don't check DRDY bit of the status register on ATAPI devices (ATAPI devices are free to ignore DRDY bit). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: ide patches
Hi, Thanks for reviewing and testing this patch series. On Monday 23 July 2007, Benjamin Herrenschmidt wrote: Ok, there's a combination of things here: - First, doing a set_pio from userland (hdparm -p XX) causes the kernel to disable DMA, which I think is incorrect. It's not the case with 2.6.22 from my quick tests. The problem is that ide_config_drive_speed disables DMA, but only re-enables it when setting a DMA speed. I think The problem is that _many_ chipsets don't support separate PIO and DMA timings so disabling DMA while programming chipset for PIO timings is a necessity for them. the whole idea of having a current speed is bogus here, we should have a separate current DMA speed and current PIO speed. We should be able to set the PIO timings without stopping DMA, toggling DMA is a separate affair. - For some reason, nowadays, hdparm -p /dev/hda will not autotune, but will set PIO 0 (hdparm -p 255 /dev/hda will autotune). Might be a bug in whatever hdparm version I have here. Since -p 255 works fine it would indicate a hdparm issue. - Some userland scripts installed on debian as part of the pbbuttonsd package are doing hdaprm -p /dev/device on all IDE devices at boot. In the meantime, that patch applied on top of your latest series fixes the PIO setting in the driver to send the correct mode value in Looks fine. Could you please rebase it on top of the fixed ide-pmac: PIO mode setup fixes patch, remove debugging printks and add description/Signed-off-by? Also since the patch series has been tested please verify that your concerns wrt patches #4, #8 and #10 are still valid. pmac_ide_set_pio_mode(). I still object to your patch serie at this point because hdparm -p N should not, imho, cause DMA to be disabled. If this change indeed causes some serious problem which breaks userland on ppc (that can't be workarounded otherwise) we may add a new -host_flags flag and special hack to ide-io.c::do_special(), something like: ... int keep_dma = drive-using_dma; ... ide_set_pio(drive, req_pio); ... if (hwif-host_flags IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) { if (keep_dma) hwif-ide_dma_on(drive); } ... which should preserve the old behavior. I will respin patch #11 with necessary changes if needed. I really believe that the kernel should keep track separately of PIO and DMA speeds. Agreed. Thanks, Bart Index: linux-work/drivers/ide/ppc/pmac.c === --- linux-work.orig/drivers/ide/ppc/pmac.c2007-07-23 10:21:07.0 +1000 +++ linux-work/drivers/ide/ppc/pmac.c 2007-07-23 11:58:50.0 +1000 @@ -535,7 +535,7 @@ pmac_outbsync(ide_drive_t *drive, u8 val static void pmac_ide_set_pio_mode(ide_drive_t *drive, const u8 pio) { - u32 *timings; + u32 *timings, t; unsigned accessTicks, recTicks; unsigned accessTime, recTime; pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data; @@ -546,6 +546,7 @@ pmac_ide_set_pio_mode(ide_drive_t *drive /* which drive is it ? */ timings = pmif-timings[drive-select.b.unit 0x01]; + t = *timings; cycle_time = ide_pio_cycle_time(drive, pio); @@ -553,14 +554,14 @@ pmac_ide_set_pio_mode(ide_drive_t *drive case controller_sh_ata6: { /* 133Mhz cell */ u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); - *timings = ((*timings) ~TR_133_PIOREG_PIO_MASK) | tr; + t = (t ~TR_133_PIOREG_PIO_MASK) | tr; break; } case controller_un_ata6: case controller_k2_ata6: { /* 100Mhz cell */ u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); - *timings = ((*timings) ~TR_100_PIOREG_PIO_MASK) | tr; + t = (t ~TR_100_PIOREG_PIO_MASK) | tr; break; } case controller_kl_ata4: @@ -574,9 +575,9 @@ pmac_ide_set_pio_mode(ide_drive_t *drive accessTicks = min(accessTicks, 0x1fU); recTicks = SYSCLK_TICKS_66(recTime); recTicks = min(recTicks, 0x1fU); - *timings = ((*timings) ~TR_66_PIO_MASK) | - (accessTicks TR_66_PIO_ACCESS_SHIFT) | - (recTicks TR_66_PIO_RECOVERY_SHIFT); + t = (t ~TR_66_PIO_MASK) | + (accessTicks TR_66_PIO_ACCESS_SHIFT) | + (recTicks TR_66_PIO_RECOVERY_SHIFT); break; default: { /* 33Mhz cell */ @@ -596,11 +597,11 @@ pmac_ide_set_pio_mode(ide_drive_t *drive recTicks--; /* guess, but it's only for PIO0, so... */ ebit = 1; } - *timings =
Re: [PATCH 7/11] ide: add __ide_wait_stat() helper
On Monday 23 July 2007, Sergei Shtylyov wrote: Hello. Bartlomiej Zolnierkiewicz wrote: * Split off checking of the status register from ide_wait_stat() to __ide_wait_stat() helper. * Use the new helper in ide_config_drive_speed(). The only change in the functionality is that the function now fails if after 20 sec (WAIT_CMD) device is still busy (BUSY_STAT bit is set) while previously instead of failing the function continued with checking for the correct device status (which would give the device additional 10 usec to clear BUSY_STAT bit). * Remove stale comment for ide_config_drive_speed(). * Remove duplicate comment for ide_wait_stat() from linux/ide.h. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/11] ide-pmac: remove nIEN clearing from pmac_ide_do_setfeature()
On Sunday 22 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Upper layers are responsible for controlling nIEN so don't clear nIEN after command execution in pmac_ide_do_setfeature(). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Acked-by: Sergei Shtylyov [EMAIL PROTECTED] added - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] ide: use only -set_pio_mode method for programming PIO modes
Hi, On Sunday 22 July 2007, Sergei Shtylyov wrote: Bartlomiej Zolnierkiewicz wrote: Use -set_pio_mode method to program PIO modes in ide_set_xfer_rate() (the only place which used -speedproc to program PIO modes) and remove handling of PIO modes from all -speedproc implementations. There should be no functionality changes caused by this patch. Does a missing printk(KERN_ERR, ...) in the cs5520.c count as a functionality change? ;-) Psst. ;-) Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/cris/ide-cris.c |5 - drivers/ide/pci/alim15x3.c|5 - drivers/ide/pci/atiixp.c |5 - drivers/ide/pci/cmd64x.c |8 drivers/ide/pci/cs5530.c |7 --- drivers/ide/pci/it8213.c |5 - drivers/ide/pci/it821x.c |9 - drivers/ide/pci/piix.c|5 - drivers/ide/pci/sc1200.c | 10 -- drivers/ide/pci/scc_pata.c|7 --- drivers/ide/pci/serverworks.c |5 - drivers/ide/pci/siimage.c |7 --- drivers/ide/pci/sis5513.c | 12 ++-- drivers/ide/pci/sl82c105.c|8 drivers/ide/pci/slc90e66.c|5 - These don't need their *_tune_pio() as a separate item anymore, however it should be OK as gcc will inline them... Removal of redundant *_tune_pio() is WIP. Index: b/drivers/ide/ide-lib.c === --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -398,6 +398,18 @@ int ide_set_xfer_rate(ide_drive_t *drive rate = ide_rate_filter(drive, rate); + if (rate = XFER_PIO_0 rate = XFER_PIO_5) { + if (hwif-set_pio_mode) + hwif-set_pio_mode(drive, rate - XFER_PIO_0); + + /* +* FIXME: this incorrect to return zero here but Missing is before this... Fixed, thanks. +* since all users of ide_set_xfer_rate() ignore +* the return value it is not a problem currently +*/ + return 0; + } + return hwif-speedproc(drive, rate); } Erm, what if there's no DMA mode support an therefore no speedproc() method, only set_pio_mode()? I guess that moving the (speedproc() == NULL) check in a prior patch was somewhat rash... Quite the contrary, it was intended... :) Few old host drivers have only -set_pio_mode and they don't set -autotune so not checking for -speedproc would be a major change in behavior for them while this patch was meant to be as non-intrusive and simple as possible. Index: b/drivers/ide/pci/cs5520.c === --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -66,30 +66,13 @@ static struct pio_clocks cs5520_pio_cloc {1, 2, 1} }; -static int cs5520_tune_chipset(ide_drive_t *drive, const u8 speed) +static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) { ide_hwif_t *hwif = HWIF(drive); struct pci_dev *pdev = hwif-pci_dev; - int pio = speed; - u8 reg; int controller = drive-dn 1 ? 1 : 0; Wouldn't hwif-channel be enough? Agreed. + u8 reg; - switch(speed) - { - case XFER_PIO_4: - case XFER_PIO_3: - case XFER_PIO_2: - case XFER_PIO_1: - case XFER_PIO_0: - pio -= XFER_PIO_0; - break; - default: - pio = 0; - printk(KERN_ERR cs55x0: bad ide timing.\n); - } - - printk(PIO clocking = %d\n, pio); - /* FIXME: if DMA = 1 do we need to set the DMA bit here ? */ Indeed? Guess not. :-) /* 8bit CAT/CRT - 8bit command timing for channel */ @@ -114,12 +97,21 @@ static int cs5520_tune_chipset(ide_drive reg |= 1((drive-dn1)+5); outb(reg, hwif-dma_base + 0x02 + 8*controller); That should go... -ENOPATCH :) - return ide_config_drive_speed(drive, speed); + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); } -static void cs5520_set_pio_mode(ide_drive_t *drive, const u8 pio) +static int cs5520_tune_chipset(ide_drive_t *drive, const u8 speed) { - cs5520_tune_chipset(drive, XFER_PIO_0 + pio); + printk(KERN_ERR cs55x0: bad ide timing.\n); + + cs5520_set_pio_mode(drive, 0); Huh? Yes, this needs fixing but not in this patch. There should be no functionality changes caused by this patch. + + /* +* FIXME: this incorrect to return zero here but Again, no is before this... Fixed. +* since all users of ide_set_xfer_rate() ignore +* the return value it is not a problem currently +*/ + return 0; } The question is why we have to leave the speedproc() handler to be in this driver
[PATCH 11/11] ide-pmac: remove pmac_ide_do_setfeature() (take 2)
Use ide_config_drive_speed() instead of pmac_ide_do_setfeature() and remove the latter, also ide-iops.c::__ide_wait_stat() could be static again. Since for IDE PMAC host driver IDE_CONTROL_REG is always true, device's -quirk_list is always zero and -ide_dma_host_{on,off} are nops than the only changes in behavior are: * if PIO mode is set then -dma_off_queitly is called to disable DMA * if setting transfer mode fails ide_dump_status() is called to dump status v2: * IDE PMAC controllers allow separate PIO and DMA timings and PPC userland depends on this fact, and calls hdparm -p without calling hdparm -d. Therefore to compensate for DMA being disabled by ide_config_drive_speed() for PIO modes: - add IDE_HFLAG_SET_PIO_MODE_KEEP_DMA flag and set it in PMAC host driver - add handling of the new flag to ide-io.c::do_special() Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ide-io.c | 10 +- drivers/ide/ide-iops.c |2 - drivers/ide/ppc/pmac.c | 80 + include/linux/ide.h|6 +++ 4 files changed, 18 insertions(+), 80 deletions(-) Index: b/drivers/ide/ide-io.c === --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -836,9 +836,17 @@ static ide_startstop_t do_special (ide_d if (set_pio_mode_abuse(drive-hwif, req_pio)) { if (hwif-set_pio_mode) hwif-set_pio_mode(drive, req_pio); - } else + } else { + int keep_dma = drive-using_dma; + ide_set_pio(drive, req_pio); + if (hwif-host_flags IDE_HFLAG_SET_PIO_MODE_KEEP_DMA) { + if (keep_dma) + hwif-ide_dma_on(drive); + } + } + return ide_stopped; } else { if (drive-media == ide_disk) Index: b/drivers/ide/ide-iops.c === --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c @@ -483,7 +483,7 @@ EXPORT_SYMBOL(drive_is_ready); * setting a timer to wake up at half second intervals thereafter, * until timeout is achieved, before timing out. */ -int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) +static int __ide_wait_stat(ide_drive_t *drive, u8 good, u8 bad, unsigned long timeout, u8 *rstat) { ide_hwif_t *hwif = drive-hwif; unsigned long flags; Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -530,81 +530,6 @@ pmac_outbsync(ide_drive_t *drive, u8 val } /* - * Send the SET_FEATURE IDE command to the drive and update drive-id with - * the new state. We currently don't use the generic routine as it used to - * cause various trouble, especially with older mediabays. - * This code is sometimes triggering a spurrious interrupt though, I need - * to sort that out sooner or later and see if I can finally get the - * common version to work properly in all cases - */ -static int -pmac_ide_do_setfeature(ide_drive_t *drive, u8 command) -{ - ide_hwif_t *hwif = HWIF(drive); - int result; - u8 stat; - - disable_irq_nosync(hwif-irq); - udelay(1); - SELECT_DRIVE(drive); - SELECT_MASK(drive, 0); - udelay(1); - hwif-OUTB(drive-ctl | 2, IDE_CONTROL_REG); - hwif-OUTB(command, IDE_NSECTOR_REG); - hwif-OUTB(SETFEATURES_XFER, IDE_FEATURE_REG); - hwif-OUTBSYNC(drive, WIN_SETFEATURES, IDE_COMMAND_REG); - result = __ide_wait_stat(drive, drive-ready_stat, -BUSY_STAT|DRQ_STAT|ERR_STAT, -WAIT_CMD, stat); - if (result) - printk(KERN_ERR %s: pmac_ide_do_setfeature disk not ready - after SET_FEATURE !\n, drive-name); - - SELECT_MASK(drive, 0); - if (result == 0) { - drive-id-dma_ultra = ~0xFF00; - drive-id-dma_mword = ~0x0F00; - drive-id-dma_1word = ~0x0F00; - switch(command) { - case XFER_UDMA_7: - drive-id-dma_ultra |= 0x8080; break; - case XFER_UDMA_6: - drive-id-dma_ultra |= 0x4040; break; - case XFER_UDMA_5: - drive-id-dma_ultra |= 0x2020; break; - case XFER_UDMA_4: - drive-id-dma_ultra |= 0x1010; break; - case XFER_UDMA_3: - drive-id-dma_ultra |= 0x0808; break; - case XFER_UDMA_2
[PATCH 12/11] ide-pmac: use ide_tune_dma()
* Add missing initialization of hwif-autodma and drive-autodma to pmac_ide_setup_dma(). * Use ide_tune_dma() in pmac_ide_dma_check(). While at it: * Fix pmac_ide_dma_check() return value if DMA mode is not programmed (should be -1 otherwise ide_set_dma() will try to enable DMA). * Remove unnecessary drive-using_dma fiddling (-dma_off_quietly is always called before ide_set_dma() call and ide_set_dma() calls -ide_dma_on if -ide_dma_check returns 0). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- bonus patch ;) drivers/ide/ppc/pmac.c | 24 +++- 1 file changed, 7 insertions(+), 17 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1592,23 +1592,10 @@ pmac_ide_destroy_dmatable (ide_drive_t * static int pmac_ide_dma_check(ide_drive_t *drive) { - int enable = 1; - drive-using_dma = 0; - - if (drive-media == ide_floppy) - enable = 0; - if ((drive-id-capability 1) == 0 !__ide_dma_good_drive(drive)) - enable = 0; - if (__ide_dma_bad_drive(drive)) - enable = 0; - - if (enable) { - u8 mode = ide_max_dma_mode(drive); + if (drive-media != ide_floppy ide_tune_dma(drive)) + return 0; - if (mode pmac_ide_tune_chipset(drive, mode) == 0) - drive-using_dma = 1; - } - return 0; + return -1; } /* @@ -1842,7 +1829,10 @@ pmac_ide_setup_dma(pmac_ide_hwif_t *pmif hwif-mwdma_mask = 0x07; hwif-swdma_mask = 0x00; break; - } + } + + hwif-autodma = 1; + hwif-drives[1].autodma = hwif-drives[0].autodma = hwif-autodma; } #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] icside: fix -speedproc to return on unsupported modes (take 4)
* All other implementations of -speedproc return zero on success and non-zero on failure. Currently it doesn't matter for icside host driver and isn't a bug per se since: - ide_set_xfer_rate() return value is ignored by all IDE core users - icside doesn't (yet!) use ide_tune_dma() in icside_dma_check() but sooner or later we will need to fix anyway - so lets do it now. * icside_set_speed() happily accepts unsupported transfer modes which results in drive-drive_data being set to the maximum value (480) and drive-current_speed being set to the unsupported transfer mode. Fix it. v2: * The initial version of the patch was broken because it didn't take into the account (the different from usual) return values of icside_set_speed() (Noticed by Russell). v3: * Remove no longer needed initialization/checking of cycle_time (Noticed by Sergei). * No need to set drive-drive_data if DMA is not going to be used (Noticed by Sergei). * Remove incorrect setting of drive-current_speed (Noticed by Sergei). * Move ide_config_drive_speed() at the end of icside_set_speed(). v4: * If DMA mode is not found in icside_dma_check() then just return -1 and don't call icside_set_speed() (v3 got it wrong and 1 was returned instead). Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Cc: Russell King [EMAIL PROTECTED] Cc: Sergei Shtylyov [EMAIL PROTECTED] --- replacement patch for the one in IDE quilt tree drivers/ide/arm/icside.c | 21 - 1 file changed, 8 insertions(+), 13 deletions(-) Index: b/drivers/ide/arm/icside.c === --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -250,7 +250,7 @@ static void icside_build_sglist(ide_driv */ static int icside_set_speed(ide_drive_t *drive, const u8 xfer_mode) { - int on = 0, cycle_time = 0, use_dma_info = 0; + int cycle_time, use_dma_info = 0; switch (xfer_mode) { case XFER_MW_DMA_2: @@ -272,6 +272,8 @@ static int icside_set_speed(ide_drive_t case XFER_SW_DMA_0: cycle_time = 480; break; + default: + return 1; } /* @@ -283,17 +285,10 @@ static int icside_set_speed(ide_drive_t drive-drive_data = cycle_time; - if (cycle_time ide_config_drive_speed(drive, xfer_mode) == 0) - on = 1; - else - drive-drive_data = 480; - printk(%s: %s selected (peak %dMB/s)\n, drive-name, ide_xfer_verbose(xfer_mode), 2000 / drive-drive_data); - drive-current_speed = xfer_mode; - - return on; + return ide_config_drive_speed(drive, xfer_mode); } static void icside_dma_host_off(ide_drive_t *drive) @@ -320,8 +315,7 @@ static int icside_dma_check(ide_drive_t { struct hd_driveid *id = drive-id; ide_hwif_t *hwif = HWIF(drive); - int xfer_mode = XFER_PIO_2; - int on; + int xfer_mode = 0; if (!(id-capability 1) || !hwif-autodma) goto out; @@ -350,9 +344,10 @@ static int icside_dma_check(ide_drive_t } out: - on = icside_set_speed(drive, xfer_mode); + if (xfer_mode == 0) + return -1; - return on ? 0 : -1; + return icside_set_speed(drive, xfer_mode); } static int icside_dma_end(ide_drive_t *drive) - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ide-pmac: fix drive-init_speed reporting
pmac_ide_tune_chipset() don't set drive-init_speed. Fix it by setting drive-{current,init}_speed in pmac_ide_do_setfeature() and clean up pmac_ide_{tune_chipset,mdma_enable,udma_enable}(). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- Goes before [PATCH] ide-pmac: PIO mode setup fixes (take 2) patch in the IDE quilt tree. drivers/ide/ppc/pmac.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -602,6 +602,9 @@ out: drive-id-dma_1word |= 0x0101; break; default: break; } + if (!drive-init_speed) + drive-init_speed = command; + drive-current_speed = command; } enable_irq(hwif-irq); return result; @@ -974,7 +977,6 @@ static int pmac_ide_tune_chipset(ide_dri return ret; pmac_ide_do_update_timings(drive); - drive-current_speed = speed; return 0; } @@ -1725,11 +1727,6 @@ pmac_ide_mdma_enable(ide_drive_t *drive, /* Apply timings to controller */ *timings = timing_local[0]; *timings2 = timing_local[1]; - - /* Set speed info in drive */ - drive-current_speed = mode; - if (!drive-init_speed) - drive-init_speed = mode; return 1; } @@ -1781,11 +1778,6 @@ pmac_ide_udma_enable(ide_drive_t *drive, *timings = timing_local[0]; *timings2 = timing_local[1]; - /* Set speed info in drive */ - drive-current_speed = mode; - if (!drive-init_speed) - drive-init_speed = mode; - return 1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] ide-pmac: PIO mode setup fixes (take 2)
* Add { 0, 0 } entry to {kauai,shasta}_pio_timings[] so kauai_lookup_timing() always returns a valid PIO timing (fixes PIO timing not being set for devices with minimum PIO cycle = 120ns). * Add setting transfer mode on the device to pmac_ide_set_pio_mode(). * Fix pmac_ide_set_pio() to always program chipset for given PIO timing instead of only when the device we want to program PIO timing for is the currently selected one. * Now that pmac_ide_set_pio() is fixed there is no need to set transfer mode on the device and program chipset for PIO in pmac_ide_tune_chipset() (returning 0 == success is not entirely correct but is OK for now since the upper layers are only checking -speedproc return value for DMA modes). v2: * s/speed/XFER_PIO_0 + pio/ in pmac_ide_set_pio_mode() so it actually compiles. * Removal of kauai_lookup_timing() return value checking went to separate patch. Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Cc: Sergei Shtylyov [EMAIL PROTECTED] --- replacement patch for the one in IDE quilt tree drivers/ide/ppc/pmac.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -6,6 +6,7 @@ * for doing DMA. * * Copyright (C) 1998-2003 Paul Mackerras Ben. Herrenschmidt + * Copyright (C) 2007 Bartlomiej Zolnierkiewicz * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -311,7 +312,8 @@ static struct kauai_timing kauai_pio_tim { 240 , 0x0800038b }, { 239 , 0x0800030c }, { 180 , 0x05000249 }, - { 120 , 0x04000148 } + { 120 , 0x04000148 }, + { 0 , 0 }, }; static struct kauai_timing kauai_mdma_timings[] = @@ -351,7 +353,8 @@ static struct kauai_timing shasta_pio_ti { 240 , 0x040003cd }, { 239 , 0x040003cd }, { 180 , 0x0400028b }, - { 120 , 0x0400010a } + { 120 , 0x0400010a }, + { 0 , 0 }, }; static struct kauai_timing shasta_mdma_timings[] = @@ -695,8 +698,10 @@ pmac_ide_set_pio_mode(ide_drive_t *drive drive-name, pio, *timings); #endif - if (drive-select.all == HWIF(drive)-INB(IDE_SELECT_REG)) - pmac_ide_do_update_timings(drive); + if (pmac_ide_do_setfeature(drive, XFER_PIO + pio)) + return; + + pmac_ide_do_update_timings(drive); } #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC @@ -965,7 +970,7 @@ static int pmac_ide_tune_chipset(ide_dri case XFER_PIO_1: case XFER_PIO_0: pmac_ide_set_pio_mode(drive, speed 0x07); - break; + return 0; default: ret = 1; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/11] ide-pmac: don't check kauai_lookup_timing() return value
kauai_lookup_timing() should always return non-zero return value: * BUG() in kauai_lookup_timing() if the timing info cannot be found. * Remove code checking for zero return value from all callers. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- patch series on top of the current IDE quilt tree drivers/ide/ppc/pmac.c | 13 + 1 file changed, 1 insertion(+), 12 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -391,6 +391,7 @@ kauai_lookup_timing(struct kauai_timing* for (i=0; table[i].cycle_time; i++) if (cycle_time table[i+1].cycle_time) return table[i].timing_reg; + BUG(); return 0; } @@ -636,8 +637,6 @@ pmac_ide_set_pio_mode(ide_drive_t *drive case controller_sh_ata6: { /* 133Mhz cell */ u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); - if (tr == 0) - return; *timings = ((*timings) ~TR_133_PIOREG_PIO_MASK) | tr; break; } @@ -645,8 +644,6 @@ pmac_ide_set_pio_mode(ide_drive_t *drive case controller_k2_ata6: { /* 100Mhz cell */ u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); - if (tr == 0) - return; *timings = ((*timings) ~TR_100_PIOREG_PIO_MASK) | tr; break; } @@ -745,8 +742,6 @@ set_timings_udma_ata6(u32 *pio_timings, if (speed XFER_UDMA_5 || t == NULL) return 1; tr = kauai_lookup_timing(kauai_udma_timings, (int)t-udma); - if (tr == 0) - return 1; *ultra_timings = ((*ultra_timings) ~TR_100_UDMAREG_UDMA_MASK) | tr; *ultra_timings = (*ultra_timings) | TR_100_UDMAREG_UDMA_EN; @@ -765,8 +760,6 @@ set_timings_udma_shasta(u32 *pio_timings if (speed XFER_UDMA_6 || t == NULL) return 1; tr = kauai_lookup_timing(shasta_udma133_timings, (int)t-udma); - if (tr == 0) - return 1; *ultra_timings = ((*ultra_timings) ~TR_133_UDMAREG_UDMA_MASK) | tr; *ultra_timings = (*ultra_timings) | TR_133_UDMAREG_UDMA_EN; @@ -838,8 +831,6 @@ set_timings_mdma(ide_drive_t *drive, int case controller_sh_ata6: { /* 133Mhz cell */ u32 tr = kauai_lookup_timing(shasta_mdma_timings, cycleTime); - if (tr == 0) - return 1; *timings = ((*timings) ~TR_133_PIOREG_MDMA_MASK) | tr; *timings2 = (*timings2) ~TR_133_UDMAREG_UDMA_EN; } @@ -847,8 +838,6 @@ set_timings_mdma(ide_drive_t *drive, int case controller_k2_ata6: { /* 100Mhz cell */ u32 tr = kauai_lookup_timing(kauai_mdma_timings, cycleTime); - if (tr == 0) - return 1; *timings = ((*timings) ~TR_100_PIOREG_MDMA_MASK) | tr; *timings2 = (*timings2) ~TR_100_UDMAREG_UDMA_EN; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/11] ide-pmac: pmac_ide_tune_chipset() fixes
* Don't check check for pmif == NULL (it should never be NULL if we got here). * Make a local copy of the timings and set the pmif-timings[] only after setting the transfer mode on the device (otherwise SELECT_DRIVE() call in pmac_ide_do_setfeature() will program new timings before the transfer mode is set on the device - this was pointed out by Sergei). This change makes pmac_ide_tune_chipset() behavior match this of pmac_ide_{m,u}dma_enable(). Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ppc/pmac.c | 27 --- 1 file changed, 16 insertions(+), 11 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -915,14 +915,15 @@ static int pmac_ide_tune_chipset(ide_dri int unit = (drive-select.b.unit 0x01); int ret = 0; pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)-hwif_data; - u32 *timings, *timings2; + u32 *timings, *timings2, tl[2]; - if (pmif == NULL) - return 1; - timings = pmif-timings[unit]; timings2 = pmif-timings[unit+2]; - + + /* Copy timings to local image */ + tl[0] = *timings; + tl[1] = *timings2; + switch(speed) { #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC case XFER_UDMA_6: @@ -933,19 +934,19 @@ static int pmac_ide_tune_chipset(ide_dri case XFER_UDMA_1: case XFER_UDMA_0: if (pmif-kind == controller_kl_ata4) - ret = set_timings_udma_ata4(timings, speed); + ret = set_timings_udma_ata4(tl[0], speed); else if (pmif-kind == controller_un_ata6 || pmif-kind == controller_k2_ata6) - ret = set_timings_udma_ata6(timings, timings2, speed); + ret = set_timings_udma_ata6(tl[0], tl[1], speed); else if (pmif-kind == controller_sh_ata6) - ret = set_timings_udma_shasta(timings, timings2, speed); + ret = set_timings_udma_shasta(tl[0], tl[1], speed); else - ret = 1; + ret = 1; break; case XFER_MW_DMA_2: case XFER_MW_DMA_1: case XFER_MW_DMA_0: - ret = set_timings_mdma(drive, pmif-kind, timings, timings2, speed, 0); + ret = set_timings_mdma(drive, pmif-kind, tl[0], tl[1], speed, 0); break; case XFER_SW_DMA_2: case XFER_SW_DMA_1: @@ -961,7 +962,11 @@ static int pmac_ide_tune_chipset(ide_dri ret = pmac_ide_do_setfeature(drive, speed); if (ret) return ret; - + + /* Apply timings to controller */ + *timings = tl[0]; + *timings2 = tl[1]; + pmac_ide_do_update_timings(drive); return 0; - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/11] ide-pmac: fix set_timings_mdma()
* Move adjusting of cycle time for devices providing explicit DMA cycle time from pmac_ide_mdma_enable() to set_timings_mdma(). * Remove no longer needed drive_cycle_time argument. * BUG() if unsupported speed argument value is passed (shouldn't happen). * Matching access/recovery timings always exist so remove redundant check. * Make set_timings_mdma() void. * Update pmac_ide_tune_chipset()'s comment. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ppc/pmac.c | 40 1 file changed, 12 insertions(+), 28 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -769,12 +769,13 @@ set_timings_udma_shasta(u32 *pio_timings /* * Calculate MDMA timings for all cells */ -static int +static void set_timings_mdma(ide_drive_t *drive, int intf_type, u32 *timings, u32 *timings2, - u8 speed, int drive_cycle_time) + u8 speed) { int cycleTime, accessTime = 0, recTime = 0; unsigned accessTicks, recTicks; + struct hd_driveid *id = drive-id; struct mdma_timings_t* tm = NULL; int i; @@ -784,11 +785,14 @@ set_timings_mdma(ide_drive_t *drive, int case 1: cycleTime = 150; break; case 2: cycleTime = 120; break; default: - return 1; + BUG(); + break; } - /* Adjust for drive */ - if (drive_cycle_time drive_cycle_time cycleTime) - cycleTime = drive_cycle_time; + + /* Check if drive provides explicit DMA cycle time */ + if ((id-field_valid 2) id-eide_dma_time) + cycleTime = max_t(int, id-eide_dma_time, cycleTime); + /* OHare limits according to some old Apple sources */ if ((intf_type == controller_ohare) (cycleTime 150)) cycleTime = 150; @@ -816,8 +820,6 @@ set_timings_mdma(ide_drive_t *drive, int break; i++; } - if (i 0) - return 1; cycleTime = tm[i].cycleTime; accessTime = tm[i].accessTime; recTime = tm[i].recoveryTime; @@ -899,16 +901,12 @@ set_timings_mdma(ide_drive_t *drive, int printk(KERN_ERR %s: Set MDMA timing for mode %d, reg: 0x%08x\n, drive-name, speed 0xf, *timings); #endif - return 0; } #endif /* #ifdef CONFIG_BLK_DEV_IDEDMA_PMAC */ /* * Speedproc. This function is called by the core to set any of the standard * timing (PIO, MDMA or UDMA) to both the drive and the controller. - * You may notice we don't use this function on normal dma check operation, - * our dedicated function is more precise as it uses the drive provided - * cycle time value. We should probably fix this one to deal with that too... */ static int pmac_ide_tune_chipset(ide_drive_t *drive, const u8 speed) { @@ -946,7 +944,7 @@ static int pmac_ide_tune_chipset(ide_dri case XFER_MW_DMA_2: case XFER_MW_DMA_1: case XFER_MW_DMA_0: - ret = set_timings_mdma(drive, pmif-kind, tl[0], tl[1], speed, 0); + set_timings_mdma(drive, pmif-kind, tl[0], tl[1], speed); break; case XFER_SW_DMA_2: case XFER_SW_DMA_1: @@ -1678,8 +1676,6 @@ pmac_ide_mdma_enable(ide_drive_t *drive, { ide_hwif_t *hwif = HWIF(drive); pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; - int drive_cycle_time; - struct hd_driveid *id = drive-id; u32 *timings, *timings2; u32 timing_local[2]; int ret; @@ -1688,24 +1684,12 @@ pmac_ide_mdma_enable(ide_drive_t *drive, timings = pmif-timings[drive-select.b.unit 0x01]; timings2 = pmif-timings[(drive-select.b.unit 0x01) + 2]; - /* Check if drive provide explicit cycle time */ - if ((id-field_valid 2) (id-eide_dma_time)) - drive_cycle_time = id-eide_dma_time; - else - drive_cycle_time = 0; - /* Copy timings to local image */ timing_local[0] = *timings; timing_local[1] = *timings2; /* Calculate controller timings */ - ret = set_timings_mdma( drive, pmif-kind, - timing_local[0], - timing_local[1], - mode, - drive_cycle_time); - if (ret) - return 0; + set_timings_mdma(drive, pmif-kind, timing_local[0], timing_local[1], mode); /* Set feature on drive */ printk(KERN_INFO %s: Enabling MultiWord DMA %d\n, drive-name, mode 0xf); - To unsubscribe
[PATCH 4/11] ide-pmac: remove control register messing from pmac_ide_dma_check()
pmac_ide_do_setfeature() contains matching nIEN setting/clearing so this Device Control register messing in pmac_ide_dma_check() is totally unnecessary. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ppc/pmac.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1784,7 +1784,7 @@ pmac_ide_dma_check(ide_drive_t *drive) drive-using_dma = pmac_ide_udma_enable(drive, mode); else if (mode = XFER_MW_DMA_0) drive-using_dma = pmac_ide_mdma_enable(drive, mode); - hwif-OUTB(0, IDE_CONTROL_REG); + /* Apply settings to controller */ pmac_ide_do_update_timings(drive); } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/11] ide-pmac: remove pmac_ide_{m,u}dma_enable()
* Fix pmac_ide_dma_check() to use pmac_ide_tune_chipset() and remove no longer necessary pmac_ide_{m,u}dma_enable(). * While at it remove some dead code from pmac_ide_dma_check() (leftovers from conversion to use ide_max_dma_mode()). There should be no functionality changes caused by this patch. Cc: Benjamin Herrenschmidt [EMAIL PROTECTED] Signed-off-by: Bartlomiej Zolnierkiewicz [EMAIL PROTECTED] --- drivers/ide/ppc/pmac.c | 101 - 1 file changed, 2 insertions(+), 99 deletions(-) Index: b/drivers/ide/ppc/pmac.c === --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1669,105 +1669,13 @@ pmac_ide_destroy_dmatable (ide_drive_t * } /* - * Pick up best MDMA timing for the drive and apply it - */ -static int -pmac_ide_mdma_enable(ide_drive_t *drive, u16 mode) -{ - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; - u32 *timings, *timings2; - u32 timing_local[2]; - int ret; - - /* which drive is it ? */ - timings = pmif-timings[drive-select.b.unit 0x01]; - timings2 = pmif-timings[(drive-select.b.unit 0x01) + 2]; - - /* Copy timings to local image */ - timing_local[0] = *timings; - timing_local[1] = *timings2; - - /* Calculate controller timings */ - set_timings_mdma(drive, pmif-kind, timing_local[0], timing_local[1], mode); - - /* Set feature on drive */ - printk(KERN_INFO %s: Enabling MultiWord DMA %d\n, drive-name, mode 0xf); - ret = pmac_ide_do_setfeature(drive, mode); - if (ret) { - printk(KERN_WARNING %s: Failed !\n, drive-name); - return 0; - } - - /* Apply timings to controller */ - *timings = timing_local[0]; - *timings2 = timing_local[1]; - - return 1; -} - -/* - * Pick up best UDMA timing for the drive and apply it - */ -static int -pmac_ide_udma_enable(ide_drive_t *drive, u16 mode) -{ - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; - u32 *timings, *timings2; - u32 timing_local[2]; - int ret; - - /* which drive is it ? */ - timings = pmif-timings[drive-select.b.unit 0x01]; - timings2 = pmif-timings[(drive-select.b.unit 0x01) + 2]; - - /* Copy timings to local image */ - timing_local[0] = *timings; - timing_local[1] = *timings2; - - /* Calculate timings for interface */ - if (pmif-kind == controller_un_ata6 - || pmif-kind == controller_k2_ata6) - ret = set_timings_udma_ata6(timing_local[0], - timing_local[1], - mode); - else if (pmif-kind == controller_sh_ata6) - ret = set_timings_udma_shasta( timing_local[0], - timing_local[1], - mode); - else - ret = set_timings_udma_ata4(timing_local[0], mode); - if (ret) - return 0; - - /* Set feature on drive */ - printk(KERN_INFO %s: Enabling Ultra DMA %d\n, drive-name, mode 0x0f); - ret = pmac_ide_do_setfeature(drive, mode); - if (ret) { - printk(KERN_WARNING %s: Failed !\n, drive-name); - return 0; - } - - /* Apply timings to controller */ - *timings = timing_local[0]; - *timings2 = timing_local[1]; - - return 1; -} - -/* * Check what is the best DMA timing setting for the drive and * call appropriate functions to apply it. */ static int pmac_ide_dma_check(ide_drive_t *drive) { - struct hd_driveid *id = drive-id; - ide_hwif_t *hwif = HWIF(drive); - pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)hwif-hwif_data; int enable = 1; - int map; drive-using_dma = 0; if (drive-media == ide_floppy) @@ -1780,13 +1688,8 @@ pmac_ide_dma_check(ide_drive_t *drive) if (enable) { u8 mode = ide_max_dma_mode(drive); - if (mode = XFER_UDMA_0) - drive-using_dma = pmac_ide_udma_enable(drive, mode); - else if (mode = XFER_MW_DMA_0) - drive-using_dma = pmac_ide_mdma_enable(drive, mode); - - /* Apply settings to controller */ - pmac_ide_do_update_timings(drive); + if (mode pmac_ide_tune_chipset(drive, mode) == 0) + drive-using_dma = 1; } return 0; } - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html