* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) @ 2007-04-14 20:11 Mikael Pettersson 2007-04-14 20:16 ` Sergei Shtylyov 0 siblings, 1 reply; 10+ messages in thread From: Mikael Pettersson @ 2007-04-14 20:11 UTC (permalink / raw) To: bzolnier, sshtylyov; +Cc: linux-ide On Sat, 14 Apr 2007 23:41:16 +0400, Sergei Shtylyov wrote: > While at it, also perform the following cleanups: ... > - correct the chipset names (from CMDxxx to PCI-xxx) Please explain why this rename is a correction. Did the company making these chips change name at some point? Or did they change the names of the chips? CMD64x is an established name, while PCI-xxx is something I've never heard of (and it sounds awfully generic). /Mikael ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-14 20:11 [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Mikael Pettersson @ 2007-04-14 20:16 ` Sergei Shtylyov 2007-04-14 22:18 ` Mark Lord 2007-04-17 14:07 ` Alan Cox 0 siblings, 2 replies; 10+ messages in thread From: Sergei Shtylyov @ 2007-04-14 20:16 UTC (permalink / raw) To: Mikael Pettersson; +Cc: bzolnier, linux-ide Hello. Mikael Pettersson wrote: >>While at it, also perform the following cleanups: > ... >>- correct the chipset names (from CMDxxx to PCI-xxx) > Please explain why this rename is a correction. Because the chips are officially named PCI064[036] and PCI-64[89]. > Did the company making these chips change name at some point? > Or did they change the names of the chips? It's just that Linux named them differently. > CMD64x is an established name, while PCI-xxx is something > I've never heard of (and it sounds awfully generic). Specs are available from http://gkernel.sourceforge.net/specs/ -- you can see the names on the first pages. > /Mikael MBR, Sergei ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-14 20:16 ` Sergei Shtylyov @ 2007-04-14 22:18 ` Mark Lord 2007-04-16 12:15 ` Sergei Shtylyov 2007-04-17 14:07 ` Alan Cox 1 sibling, 1 reply; 10+ messages in thread From: Mark Lord @ 2007-04-14 22:18 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Mikael Pettersson, bzolnier, linux-ide Sergei Shtylyov wrote: >>> - correct the chipset names (from CMDxxx to PCI-xxx) > >> Please explain why this rename is a correction. > > Because the chips are officially named PCI064[036] and PCI-64[89]. We normally name things with a combination of brand and chip number. Lots of companies could have chips with PCI in the name, but the CMD64x designator makes it quite clear what we're dealing with here. In the machines I have here with these chips, they are clearly labelled as "CMD" and then "PCI646.." -ml ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-14 22:18 ` Mark Lord @ 2007-04-16 12:15 ` Sergei Shtylyov 2007-04-17 17:59 ` Mark Lord 0 siblings, 1 reply; 10+ messages in thread From: Sergei Shtylyov @ 2007-04-16 12:15 UTC (permalink / raw) To: Mark Lord; +Cc: Mikael Pettersson, bzolnier, linux-ide Hello. Mark Lord wrote: >>>> - correct the chipset names (from CMDxxx to PCI-xxx) >>> Please explain why this rename is a correction. >> Because the chips are officially named PCI064[036] and PCI-64[89]. > We normally name things with a combination of brand and chip number. > Lots of companies could have chips with PCI in the name, > but the CMD64x designator makes it quite clear what we're dealing with > here. Note that I'm only changing designator in the procfs output, i.e. not something important to end user. > In the machines I have here with these chips, > they are clearly labelled as "CMD" and then "PCI646.." Although I've never seen the chip, I guess that should be logo, not the name. > -ml MBR, Sergei ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-16 12:15 ` Sergei Shtylyov @ 2007-04-17 17:59 ` Mark Lord 2007-04-17 18:04 ` Sergei Shtylyov 0 siblings, 1 reply; 10+ messages in thread From: Mark Lord @ 2007-04-17 17:59 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Mikael Pettersson, bzolnier, linux-ide Sergei Shtylyov wrote: > Mark Lord wrote: > >>>>> - correct the chipset names (from CMDxxx to PCI-xxx) >>>> Please explain why this rename is a correction. > >>> Because the chips are officially named PCI064[036] and PCI-64[89]. > >> We normally name things with a combination of brand and chip number. >> Lots of companies could have chips with PCI in the name, >> but the CMD64x designator makes it quite clear what we're dealing with here. > > Note that I'm only changing designator in the procfs output, i.e. not > something important to end user. Err.. in this case, the procfs output *is* there for the end-user. Using the name printed on the chip, which matches the cmdxxx.c driver name, is by far the least confusing way to do it here. >> In the machines I have here with these chips, >> they are clearly labelled as "CMD" and then "PCI646.." > > Although I've never seen the chip, I guess that should be logo, not > the name. Then perhaps you should test the scheme against the real hardware before patching it. Cheers ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-17 17:59 ` Mark Lord @ 2007-04-17 18:04 ` Sergei Shtylyov 0 siblings, 0 replies; 10+ messages in thread From: Sergei Shtylyov @ 2007-04-17 18:04 UTC (permalink / raw) To: Mark Lord; +Cc: Mikael Pettersson, bzolnier, linux-ide Mark Lord wrote: >>>>>> - correct the chipset names (from CMDxxx to PCI-xxx) >>>>> Please explain why this rename is a correction. >>>> Because the chips are officially named PCI064[036] and PCI-64[89]. >>> We normally name things with a combination of brand and chip number. >>> Lots of companies could have chips with PCI in the name, >>> but the CMD64x designator makes it quite clear what we're dealing >>> with here. >> Note that I'm only changing designator in the procfs output, i.e. >> not something important to end user. > Err.. in this case, the procfs output *is* there for the end-user. Aha, that's why it was removed form the most IDE drivers I guess. :-) > Using the name printed on the chip, which matches the cmdxxx.c driver name, > is by far the least confusing way to do it here. And I'm using the name printed on the chip. >>> In the machines I have here with these chips, >>> they are clearly labelled as "CMD" and then "PCI646.." >> Although I've never seen the chip, I guess that should be logo, not >> the name. > Then perhaps you should test the scheme against the real hardware > before patching it. LOL. There's thing called remote testing -- I guess you never bothered to look at the patches themselves. > Cheers MBR, Sergei ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-14 20:16 ` Sergei Shtylyov 2007-04-14 22:18 ` Mark Lord @ 2007-04-17 14:07 ` Alan Cox 2007-04-17 14:09 ` Sergei Shtylyov 1 sibling, 1 reply; 10+ messages in thread From: Alan Cox @ 2007-04-17 14:07 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: Mikael Pettersson, bzolnier, linux-ide > > CMD64x is an established name, while PCI-xxx is something > > I've never heard of (and it sounds awfully generic). > > Specs are available from http://gkernel.sourceforge.net/specs/ -- you can see the names on the first pages. End users don't read the specs, they read the box, and they seem to have been marketed as CMD PCI-064x. So at least keep the CMD in the name so people know what is what and can work out the pointless name change ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-17 14:07 ` Alan Cox @ 2007-04-17 14:09 ` Sergei Shtylyov 0 siblings, 0 replies; 10+ messages in thread From: Sergei Shtylyov @ 2007-04-17 14:09 UTC (permalink / raw) To: Alan Cox; +Cc: Mikael Pettersson, bzolnier, linux-ide Hello. Alan Cox wrote: >>>CMD64x is an established name, while PCI-xxx is something >>>I've never heard of (and it sounds awfully generic). >> Specs are available from http://gkernel.sourceforge.net/specs/ -- you can see the names on the first pages. > End users don't read the specs, they read the box, and they seem to have > been marketed as CMD PCI-064x. So at least keep the CMD in the name so > people know what is what and can work out the pointless name change I wonder how often they look into /proc/ide/cmd64x for starters? :-) MBR, Sergei ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup
@ 2007-02-03 20:09 Sergei Shtylyov
2007-02-03 21:04 ` [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup (take 2) Sergei Shtylyov
0 siblings, 1 reply; 10+ messages in thread
From: Sergei Shtylyov @ 2007-02-03 20:09 UTC (permalink / raw)
To: bzolnier; +Cc: linux-ide
The driver's tuneproc() method fails to set the drive's own speed -- fix this
by renaming the function to cmd64x_tune_pio(), making it return the mode set,
and "wrapping" the new tuneproc() method around it; while at it, also get rid
of the non-working prefetch control code, remove redundant PIO5 mode limitation,
and make cmdprintk() give more sensible mode info. Also, get rid of the broken
config_chipset_for_pio() which always tried to set PIO4 instead auto-tuning PIO.
Note that removing a call from config_chipset_for_dma() breaks "rudimentary"
MWDMA2 support which can only work because of the timing registers being pre-
setup for PIO4 since the code in the speedproc() method which sets up the chip
for SW/MW DMA is completely bogus (!) and I'm going to remove it for the time
being in the next patch...
Oh, and add the missing PIO5 support to the speedproc() method while at it. :-)
Warning: compile tested only -- getting to the real hardware isn't that easy...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
drivers/ide/pci/cmd64x.c | 92 ++++++++++++++++-------------------------------
1 files changed, 32 insertions(+), 60 deletions(-)
Index: linux-2.6/drivers/ide/pci/cmd64x.c
===================================================================
--- linux-2.6.orig/drivers/ide/pci/cmd64x.c
+++ linux-2.6/drivers/ide/pci/cmd64x.c
@@ -262,43 +262,25 @@ static void program_drive_counts (ide_dr
}
/*
- * Attempts to set the interface PIO mode.
- * The preferred method of selecting PIO modes (e.g. mode 4) is
- * "echo 'piomode:4' > /proc/ide/hdx/settings". Special cases are
- * 8: prefetch off, 9: prefetch on, 255: auto-select best mode.
- * Called with 255 at boot time.
+ * This routine selects drive's best PIO mode, calculates setup/active/recovery
+ * counts, and writes them into the chipset registers.
*/
-
-static void cmd64x_tuneproc (ide_drive_t *drive, u8 mode_wanted)
+static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted)
{
int setup_time, active_time, recovery_time;
int clock_time, pio_mode, cycle_time;
u8 recovery_count2, cycle_count;
int setup_count, active_count, recovery_count;
int bus_speed = system_bus_clock();
- /*byte b;*/
ide_pio_data_t d;
- switch (mode_wanted) {
- case 8: /* set prefetch off */
- case 9: /* set prefetch on */
- mode_wanted &= 1;
- /*set_prefetch_mode(index, mode_wanted);*/
- cmdprintk("%s: %sabled cmd640 prefetch\n",
- drive->name, mode_wanted ? "en" : "dis");
- return;
- }
-
- mode_wanted = ide_get_best_pio_mode (drive, mode_wanted, 5, &d);
- pio_mode = d.pio_mode;
+ pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d);
cycle_time = d.cycle_time;
/*
* I copied all this complicated stuff from cmd640.c and made a few
* minor changes. For now I am just going to pray that it is correct.
*/
- if (pio_mode > 5)
- pio_mode = 5;
setup_time = ide_pio_timings[pio_mode].setup_time;
active_time = ide_pio_timings[pio_mode].active_time;
recovery_time = cycle_time - (setup_time + active_time);
@@ -320,22 +302,27 @@ static void cmd64x_tuneproc (ide_drive_t
if (active_count > 16)
active_count = 16; /* maximum allowed by cmd646 */
- /*
- * In a perfect world, we might set the drive pio mode here
- * (using WIN_SETFEATURE) before continuing.
- *
- * But we do not, because:
- * 1) this is the wrong place to do it
- * (proper is do_special() in ide.c)
- * 2) in practice this is rarely, if ever, necessary
- */
program_drive_counts (drive, setup_count, active_count, recovery_count);
- cmdprintk("%s: selected cmd646 PIO mode%d : %d (%dns)%s, "
+ cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, "
"clocks=%d/%d/%d\n",
- drive->name, pio_mode, mode_wanted, cycle_time,
+ drive->name, mode_wanted, pio_mode, cycle_time,
d.overridden ? " (overriding vendor mode)" : "",
setup_count, active_count, recovery_count);
+
+ return pio_mode;
+}
+
+/*
+ * Attempts to set drive's PIO mode.
+ * The preferred method of selecting PIO modes (e.g. mode 4) is
+ * "echo 'piomode:4' > /proc/ide/hdx/settings".
+ * Special case is 255: auto-select best mode (used at boot time).
+ */
+static void cmd64x_tune_drive (ide_drive_t *drive, u8 pio)
+{
+ pio = cmd64x_tune_pio(drive, pio);
+ (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio);
}
static u8 cmd64x_ratemask (ide_drive_t *drive)
@@ -387,22 +374,6 @@ static u8 cmd64x_ratemask (ide_drive_t *
return mode;
}
-static void config_cmd64x_chipset_for_pio (ide_drive_t *drive, u8 set_speed)
-{
- u8 speed = 0x00;
- u8 set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL);
-
- cmd64x_tuneproc(drive, set_pio);
- speed = XFER_PIO_0 + set_pio;
- if (set_speed)
- (void) ide_config_drive_speed(drive, speed);
-}
-
-static void config_chipset_for_pio (ide_drive_t *drive, u8 set_speed)
-{
- config_cmd64x_chipset_for_pio(drive, set_speed);
-}
-
static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed)
{
ide_hwif_t *hwif = HWIF(drive);
@@ -414,7 +385,7 @@ static int cmd64x_tune_chipset (ide_driv
u8 speed = ide_rate_filter(cmd64x_ratemask(drive), xferspeed);
- if (speed > XFER_PIO_4) {
+ if (speed >= XFER_SW_DMA_0) {
(void) pci_read_config_byte(dev, pciD, ®D);
(void) pci_read_config_byte(dev, pciU, ®U);
regD &= ~(unit ? 0x40 : 0x20);
@@ -438,17 +409,20 @@ static int cmd64x_tune_chipset (ide_driv
case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break;
case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break;
case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break;
- case XFER_PIO_4: cmd64x_tuneproc(drive, 4); break;
- case XFER_PIO_3: cmd64x_tuneproc(drive, 3); break;
- case XFER_PIO_2: cmd64x_tuneproc(drive, 2); break;
- case XFER_PIO_1: cmd64x_tuneproc(drive, 1); break;
- case XFER_PIO_0: cmd64x_tuneproc(drive, 0); break;
+ case XFER_PIO_5:
+ case XFER_PIO_4:
+ case XFER_PIO_3:
+ case XFER_PIO_2:
+ case XFER_PIO_1:
+ case XFER_PIO_0:
+ (void) cmd64x_tune_pio(drive, speed - XFER_PIO_0);
+ break;
default:
return 1;
}
- if (speed > XFER_PIO_4) {
+ if (speed >= XFER_SW_DMA_0) {
(void) pci_write_config_byte(dev, pciU, regU);
regD |= (unit ? 0x40 : 0x20);
(void) pci_write_config_byte(dev, pciD, regD);
@@ -461,8 +435,6 @@ static int config_chipset_for_dma (ide_d
{
u8 speed = ide_dma_speed(drive, cmd64x_ratemask(drive));
- config_chipset_for_pio(drive, !speed);
-
if (!speed)
return 0;
@@ -491,7 +463,7 @@ static int cmd64x_config_drive_for_dma (
} else if ((id->capability & 8) || (id->field_valid & 2)) {
fast_ata_pio:
- config_chipset_for_pio(drive, 1);
+ cmd64x_tune_drive(drive, 255);
return hwif->ide_dma_off_quietly(drive);
}
/* IORDY not supported */
@@ -694,7 +666,7 @@ static void __devinit init_hwif_cmd64x(i
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
- hwif->tuneproc = &cmd64x_tuneproc;
+ hwif->tuneproc = &cmd64x_tune_drive;
hwif->speedproc = &cmd64x_tune_chipset;
if (!hwif->dma_base) {
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup (take 2) 2007-02-03 20:09 [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup Sergei Shtylyov @ 2007-02-03 21:04 ` Sergei Shtylyov 2007-02-15 19:17 ` [PATCH] (pata-2.6 fix queue) cmd64x: procfs code fixes/cleanups Sergei Shtylyov 0 siblings, 1 reply; 10+ messages in thread From: Sergei Shtylyov @ 2007-02-03 21:04 UTC (permalink / raw) To: bzolnier; +Cc: linux-ide [Finally forgot to stamp MV's copyright on the driver, so here's take #2...] The driver's tuneproc() method fails to set the drive's own speed -- fix this by renaming the function to cmd64x_tune_pio(), making it return the mode set, and "wrapping" the new tuneproc() method around it; while at it, also get rid of the non-working prefetch control code, remove redundant PIO5 mode limitation, and make cmdprintk() give more sensible mode info. Also, get rid of the broken config_chipset_for_pio() which always tried to set PIO4 instead auto-tuning PIO. Note that removing a call from config_chipset_for_dma() breaks "rudimentary" MWDMA2 support which can only work because of the timing registers being pre- setup for PIO4 since the code in the speedproc() method which sets up the chip for SW/MW DMA is completely bogus (!) and I'm going to remove it for the time being in the next patch. Oh, and add the missing PIO5 support to the speedproc() method while at it. :-) Warning: compile tested only -- getting to the real hardware isn't that easy... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> drivers/ide/pci/cmd64x.c | 95 ++++++++++++++++------------------------------- 1 files changed, 34 insertions(+), 61 deletions(-) Index: linux-2.6/drivers/ide/pci/cmd64x.c =================================================================== --- linux-2.6.orig/drivers/ide/pci/cmd64x.c +++ linux-2.6/drivers/ide/pci/cmd64x.c @@ -1,6 +1,6 @@ /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 * - * linux/drivers/ide/pci/cmd64x.c Version 1.30 Sept 10, 2002 + * linux/drivers/ide/pci/cmd64x.c Version 1.41 Feb 3, 2007 * * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. * Note, this driver is not used at all on other systems because @@ -12,6 +12,7 @@ * Copyright (C) 1998 David S. Miller (davem@redhat.com) * * Copyright (C) 1999-2002 Andre Hedrick <andre@linux-ide.org> + * Copyright (C) 2007 MontaVista Software, Inc. <source@mvista.com> */ #include <linux/module.h> @@ -262,43 +263,25 @@ static void program_drive_counts (ide_dr } /* - * Attempts to set the interface PIO mode. - * The preferred method of selecting PIO modes (e.g. mode 4) is - * "echo 'piomode:4' > /proc/ide/hdx/settings". Special cases are - * 8: prefetch off, 9: prefetch on, 255: auto-select best mode. - * Called with 255 at boot time. + * This routine selects drive's best PIO mode, calculates setup/active/recovery + * counts, and writes them into the chipset registers. */ - -static void cmd64x_tuneproc (ide_drive_t *drive, u8 mode_wanted) +static u8 cmd64x_tune_pio (ide_drive_t *drive, u8 mode_wanted) { int setup_time, active_time, recovery_time; int clock_time, pio_mode, cycle_time; u8 recovery_count2, cycle_count; int setup_count, active_count, recovery_count; int bus_speed = system_bus_clock(); - /*byte b;*/ ide_pio_data_t d; - switch (mode_wanted) { - case 8: /* set prefetch off */ - case 9: /* set prefetch on */ - mode_wanted &= 1; - /*set_prefetch_mode(index, mode_wanted);*/ - cmdprintk("%s: %sabled cmd640 prefetch\n", - drive->name, mode_wanted ? "en" : "dis"); - return; - } - - mode_wanted = ide_get_best_pio_mode (drive, mode_wanted, 5, &d); - pio_mode = d.pio_mode; + pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &d); cycle_time = d.cycle_time; /* * I copied all this complicated stuff from cmd640.c and made a few * minor changes. For now I am just going to pray that it is correct. */ - if (pio_mode > 5) - pio_mode = 5; setup_time = ide_pio_timings[pio_mode].setup_time; active_time = ide_pio_timings[pio_mode].active_time; recovery_time = cycle_time - (setup_time + active_time); @@ -320,22 +303,27 @@ static void cmd64x_tuneproc (ide_drive_t if (active_count > 16) active_count = 16; /* maximum allowed by cmd646 */ - /* - * In a perfect world, we might set the drive pio mode here - * (using WIN_SETFEATURE) before continuing. - * - * But we do not, because: - * 1) this is the wrong place to do it - * (proper is do_special() in ide.c) - * 2) in practice this is rarely, if ever, necessary - */ program_drive_counts (drive, setup_count, active_count, recovery_count); - cmdprintk("%s: selected cmd646 PIO mode%d : %d (%dns)%s, " + cmdprintk("%s: PIO mode wanted %d, selected %d (%dns)%s, " "clocks=%d/%d/%d\n", - drive->name, pio_mode, mode_wanted, cycle_time, + drive->name, mode_wanted, pio_mode, cycle_time, d.overridden ? " (overriding vendor mode)" : "", setup_count, active_count, recovery_count); + + return pio_mode; +} + +/* + * Attempts to set drive's PIO mode. + * The preferred method of selecting PIO modes (e.g. mode 4) is + * "echo 'piomode:4' > /proc/ide/hdx/settings". + * Special case is 255: auto-select best mode (used at boot time). + */ +static void cmd64x_tune_drive (ide_drive_t *drive, u8 pio) +{ + pio = cmd64x_tune_pio(drive, pio); + (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); } static u8 cmd64x_ratemask (ide_drive_t *drive) @@ -387,22 +375,6 @@ static u8 cmd64x_ratemask (ide_drive_t * return mode; } -static void config_cmd64x_chipset_for_pio (ide_drive_t *drive, u8 set_speed) -{ - u8 speed = 0x00; - u8 set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); - - cmd64x_tuneproc(drive, set_pio); - speed = XFER_PIO_0 + set_pio; - if (set_speed) - (void) ide_config_drive_speed(drive, speed); -} - -static void config_chipset_for_pio (ide_drive_t *drive, u8 set_speed) -{ - config_cmd64x_chipset_for_pio(drive, set_speed); -} - static int cmd64x_tune_chipset (ide_drive_t *drive, u8 xferspeed) { ide_hwif_t *hwif = HWIF(drive); @@ -414,7 +386,7 @@ static int cmd64x_tune_chipset (ide_driv u8 speed = ide_rate_filter(cmd64x_ratemask(drive), xferspeed); - if (speed > XFER_PIO_4) { + if (speed >= XFER_SW_DMA_0) { (void) pci_read_config_byte(dev, pciD, ®D); (void) pci_read_config_byte(dev, pciU, ®U); regD &= ~(unit ? 0x40 : 0x20); @@ -438,17 +410,20 @@ static int cmd64x_tune_chipset (ide_driv case XFER_SW_DMA_2: regD |= (unit ? 0x40 : 0x10); break; case XFER_SW_DMA_1: regD |= (unit ? 0x80 : 0x20); break; case XFER_SW_DMA_0: regD |= (unit ? 0xC0 : 0x30); break; - case XFER_PIO_4: cmd64x_tuneproc(drive, 4); break; - case XFER_PIO_3: cmd64x_tuneproc(drive, 3); break; - case XFER_PIO_2: cmd64x_tuneproc(drive, 2); break; - case XFER_PIO_1: cmd64x_tuneproc(drive, 1); break; - case XFER_PIO_0: cmd64x_tuneproc(drive, 0); break; + case XFER_PIO_5: + case XFER_PIO_4: + case XFER_PIO_3: + case XFER_PIO_2: + case XFER_PIO_1: + case XFER_PIO_0: + (void) cmd64x_tune_pio(drive, speed - XFER_PIO_0); + break; default: return 1; } - if (speed > XFER_PIO_4) { + if (speed >= XFER_SW_DMA_0) { (void) pci_write_config_byte(dev, pciU, regU); regD |= (unit ? 0x40 : 0x20); (void) pci_write_config_byte(dev, pciD, regD); @@ -461,8 +436,6 @@ static int config_chipset_for_dma (ide_d { u8 speed = ide_dma_speed(drive, cmd64x_ratemask(drive)); - config_chipset_for_pio(drive, !speed); - if (!speed) return 0; @@ -491,7 +464,7 @@ static int cmd64x_config_drive_for_dma ( } else if ((id->capability & 8) || (id->field_valid & 2)) { fast_ata_pio: - config_chipset_for_pio(drive, 1); + cmd64x_tune_drive(drive, 255); return hwif->ide_dma_off_quietly(drive); } /* IORDY not supported */ @@ -694,7 +667,7 @@ static void __devinit init_hwif_cmd64x(i pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev); class_rev &= 0xff; - hwif->tuneproc = &cmd64x_tuneproc; + hwif->tuneproc = &cmd64x_tune_drive; hwif->speedproc = &cmd64x_tune_chipset; if (!hwif->dma_base) { ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] (pata-2.6 fix queue) cmd64x: procfs code fixes/cleanups 2007-02-03 21:04 ` [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup (take 2) Sergei Shtylyov @ 2007-02-15 19:17 ` Sergei Shtylyov 2007-04-14 19:41 ` [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Sergei Shtylyov 0 siblings, 1 reply; 10+ messages in thread From: Sergei Shtylyov @ 2007-02-15 19:17 UTC (permalink / raw) To: bzolnier; +Cc: linux-ide Fix several issues with the driver's procfs output: - when testing if channel is enabled, the code looks at the "simplex" bits, not at the real enable bits -- add #define for the primary channel enable bit; - UltraDMA modes 0, 1, 3 for slave drive reported incorrectly due to using the master drive's clock cycle resolution bit. While at it, also perform some cleanups: - don't read from the registers which are not used for dump; - correct the chipset names (from CMDxxx to PCI-xxx); - rework UltraDMA mode dump code; - remove PIO mode dump code that has never been finished; - remove the duplicate interrupt status dump (the MRDMODE register bits mirror those in the CFR and ARTTIM23 registers); - add spaces in the ?: operators... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> --- Warning: as usual, this has only been compile-tested. :-) drivers/ide/pci/cmd64x.c | 99 ++++++++++++++++++----------------------------- 1 files changed, 39 insertions(+), 60 deletions(-) Index: linux-2.6/drivers/ide/pci/cmd64x.c =================================================================== --- linux-2.6.orig/drivers/ide/pci/cmd64x.c +++ linux-2.6/drivers/ide/pci/cmd64x.c @@ -1,6 +1,6 @@ /* $Id: cmd64x.c,v 1.21 2000/01/30 23:23:16 * - * linux/drivers/ide/pci/cmd64x.c Version 1.45 Feb 14, 2007 + * linux/drivers/ide/pci/cmd64x.c Version 1.46 Feb 15, 2007 * * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. * Note, this driver is not used at all on other systems because @@ -41,9 +41,10 @@ #define CFR 0x50 #define CFR_INTR_CH0 0x04 #define CNTRL 0x51 -#define CNTRL_DIS_RA0 0x40 -#define CNTRL_DIS_RA1 0x80 -#define CNTRL_ENA_2ND 0x08 +#define CNTRL_ENA_1ST 0x04 +#define CNTRL_ENA_2ND 0x08 +#define CNTRL_DIS_RA0 0x40 +#define CNTRL_DIS_RA1 0x80 #define CMDTIM 0x52 #define ARTTIM0 0x53 @@ -90,23 +91,15 @@ static int n_cmd_devs; static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) { char *p = buf; - - u8 reg53 = 0, reg54 = 0, reg55 = 0, reg56 = 0; /* primary */ - u8 reg57 = 0, reg58 = 0, reg5b; /* secondary */ u8 reg72 = 0, reg73 = 0; /* primary */ u8 reg7a = 0, reg7b = 0; /* secondary */ - u8 reg50 = 0, reg71 = 0; /* extra */ + u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ p += sprintf(p, "\nController: %d\n", index); - p += sprintf(p, "CMD%x Chipset.\n", dev->device); + p += sprintf(p, "PCI-%x Chipset.\n", dev->device); (void) pci_read_config_byte(dev, CFR, ®50); - (void) pci_read_config_byte(dev, ARTTIM0, ®53); - (void) pci_read_config_byte(dev, DRWTIM0, ®54); - (void) pci_read_config_byte(dev, ARTTIM1, ®55); - (void) pci_read_config_byte(dev, DRWTIM1, ®56); - (void) pci_read_config_byte(dev, ARTTIM2, ®57); - (void) pci_read_config_byte(dev, DRWTIM2, ®58); - (void) pci_read_config_byte(dev, DRWTIM3, ®5b); + (void) pci_read_config_byte(dev, CNTRL, ®51); + (void) pci_read_config_byte(dev, ARTTIM23, ®57); (void) pci_read_config_byte(dev, MRDMODE, ®71); (void) pci_read_config_byte(dev, BMIDESR0, ®72); (void) pci_read_config_byte(dev, UDIDETCR0, ®73); @@ -116,57 +109,43 @@ static char * print_cmd64x_get_info (cha p += sprintf(p, "--------------- Primary Channel " "---------------- Secondary Channel " "-------------\n"); - p += sprintf(p, " %sabled " - " %sabled\n", - (reg72&0x80)?"dis":" en", - (reg7a&0x80)?"dis":" en"); + p += sprintf(p, " %sabled " + " %sabled\n", + (reg51 & CNTRL_ENA_1ST) ? "dis" : " en", + (reg51 & CNTRL_ENA_2ND) ? "dis" : " en"); p += sprintf(p, "--------------- drive0 " "--------- drive1 -------- drive0 " "---------- drive1 ------\n"); p += sprintf(p, "DMA enabled: %s %s" " %s %s\n", - (reg72&0x20)?"yes":"no ", (reg72&0x40)?"yes":"no ", - (reg7a&0x20)?"yes":"no ", (reg7a&0x40)?"yes":"no "); + (reg72 & 0x20) ? "yes" : "no ", (reg72 & 0x40)? "yes" : "no ", + (reg7a & 0x20) ? "yes" : "no ", (reg7a & 0x40)? "yes" : "no "); - p += sprintf(p, "DMA Mode: %s(%s) %s(%s)", - (reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO", - (reg72&0x20)?( - ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"): - ((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"): - ((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"): - ((reg73&0x00)==0x00)?(((reg73&0x05)==0x05)?"5":"2"): - "X"):"?", - (reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO", - (reg72&0x40)?( - ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"): - ((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"): - ((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"): - ((reg73&0x00)==0x00)?(((reg73&0x0A)==0x0A)?"5":"2"): - "X"):"?"); - p += sprintf(p, " %s(%s) %s(%s)\n", - (reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO", - (reg7a&0x20)?( - ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"): - ((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"): - ((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"): - ((reg7b&0x00)==0x00)?(((reg7b&0x05)==0x05)?"5":"2"): - "X"):"?", - (reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO", - (reg7a&0x40)?( - ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"): - ((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"): - ((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"): - ((reg7b&0x00)==0x00)?(((reg7b&0x0A)==0x0A)?"5":"2"): - "X"):"?" ); - p += sprintf(p, "PIO Mode: %s %s" - " %s %s\n", - "?", "?", "?", "?"); - p += sprintf(p, " %s %s\n", - (reg50 & CFR_INTR_CH0) ? "interrupting" : "polling ", - (reg57 & ARTTIM23_INTR_CH1) ? "interrupting" : "polling"); + p += sprintf(p, "UDMA Mode: %s (%c) %s (%c)", + ( reg73 & 0x01) ? " on" : "off", + ((reg73 & 0x30) == 0x30) ? ((reg73 & 0x04) ? '3' : '0') : + ((reg73 & 0x30) == 0x20) ? ((reg73 & 0x04) ? '3' : '1') : + ((reg73 & 0x30) == 0x10) ? ((reg73 & 0x04) ? '4' : '2') : + ((reg73 & 0x30) == 0x00) ? ((reg73 & 0x04) ? '5' : '2') : '?', + ( reg73 & 0x02) ? " on" : "off", + ((reg73 & 0xC0) == 0xC0) ? ((reg73 & 0x08) ? '3' : '0') : + ((reg73 & 0xC0) == 0x80) ? ((reg73 & 0x08) ? '3' : '1') : + ((reg73 & 0xC0) == 0x40) ? ((reg73 & 0x08) ? '4' : '2') : + ((reg73 & 0xC0) == 0x00) ? ((reg73 & 0x08) ? '5' : '2') : '?'); + p += sprintf(p, " %s (%c) %s (%c)\n", + ( reg7b & 0x01) ? " on" : "off", + ((reg7b & 0x30) == 0x30) ? ((reg7b & 0x04) ? '3' : '0') : + ((reg7b & 0x30) == 0x20) ? ((reg7b & 0x04) ? '3' : '1') : + ((reg7b & 0x30) == 0x10) ? ((reg7b & 0x04) ? '4' : '2') : + ((reg7b & 0x30) == 0x00) ? ((reg7b & 0x04) ? '5' : '2') : '?', + ( reg7b & 0x02) ? " on" : "off", + ((reg7b & 0xC0) == 0xC0) ? ((reg7b & 0x08) ? '3' : '0'): + ((reg7b & 0xC0) == 0x80) ? ((reg7b & 0x08) ? '3' : '1'): + ((reg7b & 0xC0) == 0x40) ? ((reg7b & 0x08) ? '4' : '2'): + ((reg7b & 0xC0) == 0x00) ? ((reg7b & 0x08) ? '5' : '2'): '?'); p += sprintf(p, " %s %s\n", - (reg71 & MRDMODE_INTR_CH0) ? "pending" : "clear ", - (reg71 & MRDMODE_INTR_CH1) ? "pending" : "clear"); + (reg50 & CFR_INTR_CH0 ) ? "pending" : "clear ", + (reg57 & ARTTIM23_INTR_CH1) ? "pending" : "clear "); p += sprintf(p, " %s %s\n", (reg71 & MRDMODE_BLK_CH0) ? "blocked" : "enabled", (reg71 & MRDMODE_BLK_CH1) ? "blocked" : "enabled"); ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-02-15 19:17 ` [PATCH] (pata-2.6 fix queue) cmd64x: procfs code fixes/cleanups Sergei Shtylyov @ 2007-04-14 19:41 ` Sergei Shtylyov 2007-04-23 21:58 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 10+ messages in thread From: Sergei Shtylyov @ 2007-04-14 19:41 UTC (permalink / raw) To: bzolnier; +Cc: linux-ide Fix several issues with the driver's procfs output: - when testing if channel is enabled, the code looks at the "simplex" bits, not at the real enable bits -- add #define for the primary channel enable bit; - UltraDMA modes 0, 1, 3 for slave drive reported incorrectly due to using the master drive's clock cycle resolution bit. While at it, also perform the following cleanups: - don't print extra newline before the first controller's dump; - correct the chipset names (from CMDxxx to PCI-xxx) - don't read from the registers which aren't used for dump; - better align the table column sizes; - rework UltraDMA mode dump code; - remove PIO mode dump code that has never been finished; - remove the duplicate interrupt status (the MRDMODE register bits mirror those those in the CFR and ARTTIM23 registers) and fold the dump into single line; - correct the style of the ?: operators... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> --- This version fixes an issue with the channel enable misreporting in the older patch, adds workaround for missing primary channel enable bit on PCI0643/6, and also beuatifies the overall table format. Has been tested on PCI-649 as well. drivers/ide/pci/cmd64x.c | 129 ++++++++++++++++++++--------------------------- 1 files changed, 55 insertions(+), 74 deletions(-) Index: linux-2.6/drivers/ide/pci/cmd64x.c =================================================================== --- linux-2.6.orig/drivers/ide/pci/cmd64x.c +++ linux-2.6/drivers/ide/pci/cmd64x.c @@ -1,5 +1,5 @@ /* - * linux/drivers/ide/pci/cmd64x.c Version 1.45 Mar 14, 2007 + * linux/drivers/ide/pci/cmd64x.c Version 1.46 Mar 16, 2007 * * cmd64x.c: Enable interrupts at initialization time on Ultra/PCI machines. * Due to massive hardware bugs, UltraDMA is only supported @@ -38,9 +38,10 @@ #define CFR 0x50 #define CFR_INTR_CH0 0x04 #define CNTRL 0x51 -#define CNTRL_DIS_RA0 0x40 -#define CNTRL_DIS_RA1 0x80 -#define CNTRL_ENA_2ND 0x08 +#define CNTRL_ENA_1ST 0x04 +#define CNTRL_ENA_2ND 0x08 +#define CNTRL_DIS_RA0 0x40 +#define CNTRL_DIS_RA1 0x80 #define CMDTIM 0x52 #define ARTTIM0 0x53 @@ -87,86 +88,67 @@ static int n_cmd_devs; static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index) { char *p = buf; - - u8 reg53 = 0, reg54 = 0, reg55 = 0, reg56 = 0; /* primary */ - u8 reg57 = 0, reg58 = 0, reg5b; /* secondary */ u8 reg72 = 0, reg73 = 0; /* primary */ u8 reg7a = 0, reg7b = 0; /* secondary */ - u8 reg50 = 0, reg71 = 0; /* extra */ + u8 reg50 = 1, reg51 = 1, reg57 = 0, reg71 = 0; /* extra */ + u8 rev = 0; p += sprintf(p, "\nController: %d\n", index); - p += sprintf(p, "CMD%x Chipset.\n", dev->device); + p += sprintf(p, "PCI-%x Chipset.\n", dev->device); + (void) pci_read_config_byte(dev, CFR, ®50); - (void) pci_read_config_byte(dev, ARTTIM0, ®53); - (void) pci_read_config_byte(dev, DRWTIM0, ®54); - (void) pci_read_config_byte(dev, ARTTIM1, ®55); - (void) pci_read_config_byte(dev, DRWTIM1, ®56); - (void) pci_read_config_byte(dev, ARTTIM2, ®57); - (void) pci_read_config_byte(dev, DRWTIM2, ®58); - (void) pci_read_config_byte(dev, DRWTIM3, ®5b); + (void) pci_read_config_byte(dev, CNTRL, ®51); + (void) pci_read_config_byte(dev, ARTTIM23, ®57); (void) pci_read_config_byte(dev, MRDMODE, ®71); (void) pci_read_config_byte(dev, BMIDESR0, ®72); (void) pci_read_config_byte(dev, UDIDETCR0, ®73); (void) pci_read_config_byte(dev, BMIDESR1, ®7a); (void) pci_read_config_byte(dev, UDIDETCR1, ®7b); - p += sprintf(p, "--------------- Primary Channel " - "---------------- Secondary Channel " - "-------------\n"); - p += sprintf(p, " %sabled " - " %sabled\n", - (reg72&0x80)?"dis":" en", - (reg7a&0x80)?"dis":" en"); - p += sprintf(p, "--------------- drive0 " - "--------- drive1 -------- drive0 " - "---------- drive1 ------\n"); - p += sprintf(p, "DMA enabled: %s %s" - " %s %s\n", - (reg72&0x20)?"yes":"no ", (reg72&0x40)?"yes":"no ", - (reg7a&0x20)?"yes":"no ", (reg7a&0x40)?"yes":"no "); - - p += sprintf(p, "DMA Mode: %s(%s) %s(%s)", - (reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO", - (reg72&0x20)?( - ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"): - ((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"): - ((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"): - ((reg73&0x00)==0x00)?(((reg73&0x05)==0x05)?"5":"2"): - "X"):"?", - (reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO", - (reg72&0x40)?( - ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"): - ((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"): - ((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"): - ((reg73&0x00)==0x00)?(((reg73&0x0A)==0x0A)?"5":"2"): - "X"):"?"); - p += sprintf(p, " %s(%s) %s(%s)\n", - (reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO", - (reg7a&0x20)?( - ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"): - ((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"): - ((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"): - ((reg7b&0x00)==0x00)?(((reg7b&0x05)==0x05)?"5":"2"): - "X"):"?", - (reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO", - (reg7a&0x40)?( - ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"): - ((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"): - ((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"): - ((reg7b&0x00)==0x00)?(((reg7b&0x0A)==0x0A)?"5":"2"): - "X"):"?" ); - p += sprintf(p, "PIO Mode: %s %s" - " %s %s\n", - "?", "?", "?", "?"); - p += sprintf(p, " %s %s\n", - (reg50 & CFR_INTR_CH0) ? "interrupting" : "polling ", - (reg57 & ARTTIM23_INTR_CH1) ? "interrupting" : "polling"); - p += sprintf(p, " %s %s\n", - (reg71 & MRDMODE_INTR_CH0) ? "pending" : "clear ", - (reg71 & MRDMODE_INTR_CH1) ? "pending" : "clear"); - p += sprintf(p, " %s %s\n", - (reg71 & MRDMODE_BLK_CH0) ? "blocked" : "enabled", - (reg71 & MRDMODE_BLK_CH1) ? "blocked" : "enabled"); + /* PCI0643/6 originally didn't have the primary channel enable bit */ + (void) pci_read_config_byte(dev, PCI_REVISION_ID, &rev); + if ((dev->device == PCI_DEVICE_ID_CMD_643) || + (dev->device == PCI_DEVICE_ID_CMD_646 && rev < 3)) + reg51 |= CNTRL_ENA_1ST; + + p += sprintf(p, "---------------- Primary Channel " + "---------------- Secondary Channel ------------\n"); + p += sprintf(p, " %s %s\n", + (reg51 & CNTRL_ENA_1ST) ? "enabled " : "disabled", + (reg51 & CNTRL_ENA_2ND) ? "enabled " : "disabled"); + p += sprintf(p, "---------------- drive0 --------- drive1 " + "-------- drive0 --------- drive1 ------\n"); + p += sprintf(p, "DMA enabled: %s %s" + " %s %s\n", + (reg72 & 0x20) ? "yes" : "no ", (reg72 & 0x40) ? "yes" : "no ", + (reg7a & 0x20) ? "yes" : "no ", (reg7a & 0x40) ? "yes" : "no "); + p += sprintf(p, "UltraDMA mode: %s (%c) %s (%c)", + ( reg73 & 0x01) ? " on" : "off", + ((reg73 & 0x30) == 0x30) ? ((reg73 & 0x04) ? '3' : '0') : + ((reg73 & 0x30) == 0x20) ? ((reg73 & 0x04) ? '3' : '1') : + ((reg73 & 0x30) == 0x10) ? ((reg73 & 0x04) ? '4' : '2') : + ((reg73 & 0x30) == 0x00) ? ((reg73 & 0x04) ? '5' : '2') : '?', + ( reg73 & 0x02) ? " on" : "off", + ((reg73 & 0xC0) == 0xC0) ? ((reg73 & 0x08) ? '3' : '0') : + ((reg73 & 0xC0) == 0x80) ? ((reg73 & 0x08) ? '3' : '1') : + ((reg73 & 0xC0) == 0x40) ? ((reg73 & 0x08) ? '4' : '2') : + ((reg73 & 0xC0) == 0x00) ? ((reg73 & 0x08) ? '5' : '2') : '?'); + p += sprintf(p, " %s (%c) %s (%c)\n", + ( reg7b & 0x01) ? " on" : "off", + ((reg7b & 0x30) == 0x30) ? ((reg7b & 0x04) ? '3' : '0') : + ((reg7b & 0x30) == 0x20) ? ((reg7b & 0x04) ? '3' : '1') : + ((reg7b & 0x30) == 0x10) ? ((reg7b & 0x04) ? '4' : '2') : + ((reg7b & 0x30) == 0x00) ? ((reg7b & 0x04) ? '5' : '2') : '?', + ( reg7b & 0x02) ? " on" : "off", + ((reg7b & 0xC0) == 0xC0) ? ((reg7b & 0x08) ? '3' : '0') : + ((reg7b & 0xC0) == 0x80) ? ((reg7b & 0x08) ? '3' : '1') : + ((reg7b & 0xC0) == 0x40) ? ((reg7b & 0x08) ? '4' : '2') : + ((reg7b & 0xC0) == 0x00) ? ((reg7b & 0x08) ? '5' : '2') : '?'); + p += sprintf(p, "Interrupt: %s, %s %s, %s\n", + (reg71 & MRDMODE_BLK_CH0 ) ? "blocked" : "enabled", + (reg50 & CFR_INTR_CH0 ) ? "pending" : "clear ", + (reg71 & MRDMODE_BLK_CH1 ) ? "blocked" : "enabled", + (reg57 & ARTTIM23_INTR_CH1) ? "pending" : "clear "); return (char *)p; } @@ -176,7 +158,6 @@ static int cmd64x_get_info (char *buffer char *p = buffer; int i; - p += sprintf(p, "\n"); for (i = 0; i < n_cmd_devs; i++) { struct pci_dev *dev = cmd_devs[i]; p = print_cmd64x_get_info(p, dev, i); ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) 2007-04-14 19:41 ` [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Sergei Shtylyov @ 2007-04-23 21:58 ` Bartlomiej Zolnierkiewicz 0 siblings, 0 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2007-04-23 21:58 UTC (permalink / raw) To: Sergei Shtylyov; +Cc: linux-ide On Saturday 14 April 2007, Sergei Shtylyov wrote: > Fix several issues with the driver's procfs output: > > - when testing if channel is enabled, the code looks at the "simplex" bits, not > at the real enable bits -- add #define for the primary channel enable bit; > > - UltraDMA modes 0, 1, 3 for slave drive reported incorrectly due to using the > master drive's clock cycle resolution bit. > > While at it, also perform the following cleanups: > > - don't print extra newline before the first controller's dump; > > - correct the chipset names (from CMDxxx to PCI-xxx) > > - don't read from the registers which aren't used for dump; > > - better align the table column sizes; > > - rework UltraDMA mode dump code; > > - remove PIO mode dump code that has never been finished; > > - remove the duplicate interrupt status (the MRDMODE register bits mirror those > those in the CFR and ARTTIM23 registers) and fold the dump into single line; > > - correct the style of the ?: operators... > > Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> > > --- > This version fixes an issue with the channel enable misreporting in the older > patch, adds workaround for missing primary channel enable bit on PCI0643/6, and > also beuatifies the overall table format. Has been tested on PCI-649 as well. applied ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2007-04-23 22:30 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-04-14 20:11 [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Mikael Pettersson 2007-04-14 20:16 ` Sergei Shtylyov 2007-04-14 22:18 ` Mark Lord 2007-04-16 12:15 ` Sergei Shtylyov 2007-04-17 17:59 ` Mark Lord 2007-04-17 18:04 ` Sergei Shtylyov 2007-04-17 14:07 ` Alan Cox 2007-04-17 14:09 ` Sergei Shtylyov -- strict thread matches above, loose matches on Subject: below -- 2007-02-03 20:09 [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup Sergei Shtylyov 2007-02-03 21:04 ` [PATCH] (2.6.20-rc7) cmd64x: fix PIO mode setup (take 2) Sergei Shtylyov 2007-02-15 19:17 ` [PATCH] (pata-2.6 fix queue) cmd64x: procfs code fixes/cleanups Sergei Shtylyov 2007-04-14 19:41 ` [PATCH pata-2.6] cmd64x: procfs code fixes/cleanups (take 2) Sergei Shtylyov 2007-04-23 21:58 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).