Re: [PATCH] hook ACPI _PSx method to IDE power on/off

2007-08-02 Thread Shaohua Li
On Thu, 2007-08-02 at 13:31 +0100, Matthew Garrett wrote:
> On Thu, Aug 02, 2007 at 02:14:08PM +0800, Shaohua Li wrote:
> > ACPI spec defines the sequence of IDE power on/off:
> 
> Most distributions seem to be using the libata PATA code now - any plans 
> to implement it there as well?
Ok, I'll look at it too.

Thanks,
Shaohua
-
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] cs5530: always tune PIO

2007-08-02 Thread Alan Cox
On Fri, 3 Aug 2007 00:46:27 +0200
Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]> wrote:

> 
> Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
> ---
>  drivers/ide/pci/cs5530.c |   19 ++-
>  1 file changed, 6 insertions(+), 13 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.cVersion 0.74Jul 28 2007
> + * linux/drivers/ide/pci/cs5530.cVersion 0.75Aug 2 2007

Looks good but if you've got BIOS set timings and you override them you
might want to copy the Palmax handler from the libata one. Basically the
Palmax has the CDROM in the docking station and the link between the two
is not good enough for the highest mode the drive and cd can do but must
be run 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: ST340823A disk size issue

2007-08-02 Thread Bartlomiej Zolnierkiewicz
On Friday 03 August 2007, Mikko Rapeli wrote:
> On Fri, Aug 03, 2007 at 12:34:13AM +0200, Bartlomiej Zolnierkiewicz wrote:
> > Mikko, please verify that the following patch fixes the issue.
> 
> A few oopses later and this actually works with vanilla 2.6.22.1 and Debian
> 2.6.18 (2.6.18.dfsg.1-12etch2), latter without EXPORT_SYMBOL_GPL since
> it's there already.
> 
> diff -X linux-2.6.22.1/Documentation/dontdiff -upr 
> linux-2.6.22.1.orig/drivers/ide/ide-disk.c 
> linux-2.6.22.1/drivers/ide/ide-disk.c
> --- linux-2.6.22.1.orig/drivers/ide/ide-disk.c2007-07-10 
> 21:56:30.0 +0300
> +++ linux-2.6.22.1/drivers/ide/ide-disk.c 2007-08-03 00:22:46.0 
> +0300
> @@ -481,6 +481,15 @@ 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",  "ALL" },

Doh, I forgot that the patch to change "ALL" to NULL was merged after 2.6.22.
I should have asked you from the beginning to test against 2.6.23-rc1 but it
is not that bad since now you have also working patches for 2.6.18 / 2.6.22.

;-)

> + { NULL   ,  NULL  }

Thanks, added this to the patch.

Final version (for completness) below.

[PATCH] ide-disk: workaround for buggy HPA support on ST340823A (take 3)

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().

v2:
* Add missing export and improve patch description a bit.

v3:
* Add list termination.  (From Mikko)

Fixes kernel bugzilla bug #8816.

Thanks to Mikko for investigating the issue and helping with this patch.

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 |   18 ++
 drivers/ide/ide-dma.c  |2 ++
 2 files changed, 20 insertions(+)

Index: b/drivers/ide/ide-disk.c
===
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -481,6 +481,15 @@ 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 },
+   { NULL, NULL }
+};
+
 static void idedisk_check_hpa(ide_drive_t *drive)
 {
unsigned long long capacity, set_max;
@@ -492,6 +501,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


Re: ST340823A disk size issue

2007-08-02 Thread Mikko Rapeli
On Fri, Aug 03, 2007 at 12:34:13AM +0200, Bartlomiej Zolnierkiewicz wrote:
> Mikko, please verify that the following patch fixes the issue.

A few oopses later and this actually works with vanilla 2.6.22.1 and Debian
2.6.18 (2.6.18.dfsg.1-12etch2), latter without EXPORT_SYMBOL_GPL since
it's there already.

diff -X linux-2.6.22.1/Documentation/dontdiff -upr 
linux-2.6.22.1.orig/drivers/ide/ide-disk.c linux-2.6.22.1/drivers/ide/ide-disk.c
--- linux-2.6.22.1.orig/drivers/ide/ide-disk.c  2007-07-10 21:56:30.0 
+0300
+++ linux-2.6.22.1/drivers/ide/ide-disk.c   2007-08-03 00:22:46.0 
+0300
@@ -481,6 +481,15 @@ 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",  "ALL" },
+   { NULL   ,  NULL  }
+};
+
 static void idedisk_check_hpa(ide_drive_t *drive)
 {
unsigned long long capacity, set_max;
@@ -492,6 +501,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;
 
diff -X linux-2.6.22.1/Documentation/dontdiff -upr 
linux-2.6.22.1.orig/drivers/ide/ide-dma.c linux-2.6.22.1/drivers/ide/ide-dma.c
--- linux-2.6.22.1.orig/drivers/ide/ide-dma.c   2007-07-10 21:56:30.0 
+0300
+++ linux-2.6.22.1/drivers/ide/ide-dma.c2007-08-03 01:10:25.0 
+0300
@@ -152,6 +152,7 @@ int ide_in_drive_list(struct hd_driveid 
return 1;
return 0;
 }
+EXPORT_SYMBOL_GPL(ide_in_drive_list);
 
 /**
  * ide_dma_intr-   IDE DMA interrupt handler
-
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

2007-08-02 Thread Bartlomiej Zolnierkiewicz

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] cs5530: always tune PIO

2007-08-02 Thread Bartlomiej Zolnierkiewicz

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/pci/cs5530.c |   19 ++-
 1 file changed, 6 insertions(+), 13 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.74Jul 28 2007
+ * linux/drivers/ide/pci/cs5530.c  Version 0.75Aug 2 2007
  *
  * Copyright (C) 2000  Andre Hedrick <[EMAIL PROTECTED]>
  * Copyright (C) 2000  Mark Lord <[EMAIL PROTECTED]>
@@ -270,20 +270,13 @@ static void __devinit init_hwif_cs5530 (
 
basereg = CS5530_BASEREG(hwif);
d0_timings = inl(basereg + 0);
-   if (CS5530_BAD_PIO(d0_timings)) {
-   /* PIO timings not initialized? */
+   if (CS5530_BAD_PIO(d0_timings))
outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 
0);
-   if (!hwif->drives[0].autotune)
-   hwif->drives[0].autotune = 1;
-   /* needs autotuning later */
-   }
-   if (CS5530_BAD_PIO(inl(basereg + 8))) {
-   /* PIO timings not initialized? */
+   if (CS5530_BAD_PIO(inl(basereg + 8)))
outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 
8);
-   if (!hwif->drives[1].autotune)
-   hwif->drives[1].autotune = 1;
-   /* needs autotuning later */
-   }
+
+   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

2007-08-02 Thread Bartlomiej Zolnierkiewicz

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: ST340823A disk size issue

2007-08-02 Thread Bartlomiej Zolnierkiewicz

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

2007-08-02 Thread Bartlomiej Zolnierkiewicz

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, ®47);
 
-   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


Re: [PATCH] ide: add cable detection for early UDMA66 devices (take 2)

2007-08-02 Thread Bartlomiej Zolnierkiewicz

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(driv

Re: ICH8 CF timeout (regression)...

2007-08-02 Thread Mark Lord

Daniel J Blueman wrote:

On 02/08/07, Tejun Heo <[EMAIL PROTECTED]> wrote:

Daniel J Blueman wrote:

I'll grab kernel logs from the legacy ATA boot; what else can help
debug this issue? No problem testing patches too.

Yeap, please post the old log.


Not much actually - perhaps I need to enable some debugging:

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hdc: SanDisk SDCFX-4096, CFA DISK drive
ide1 at 0x170-0x177,0x376 on irq 15
hdc: max request size: 128KiB
hdc: 8027712 sectors (4110 MB) w/1KiB Cache, CHS=7964/16/63
 hdc: hdc1 hdc2 hdc3


--- [2]
ata2.00: limiting speed to UDMA/33:PIO4
ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
ata2.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 cdb 0x0 data 4096 in
 res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata2: soft resetting port
ata2.00: configured for UDMA/33
ata2: EH complete

What happens after this?


More EH occurs - I've left it for ~5 mins, but let me know if longer
would give more information, eg if it converges on a lower speed.

Would it be useful to compare some of the port setup registers in the
working and non-working cases? Or any other debug I can grab?


I'm betting that this is the exact same problem we recently debugged
for someone else here:  there's a Marvell PATA->SATA bridge chip between
that CF card and the SATA controller, and it only works with PIO modes.

Tejun.. perhaps (for debugging) a simple patch to disallow DMA completely,
just to see if PIO works?

Cheers

-
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: ICH8 CF timeout (regression)...

2007-08-02 Thread Daniel J Blueman
On 02/08/07, Tejun Heo <[EMAIL PROTECTED]> wrote:
> Daniel J Blueman wrote:
> > I'll grab kernel logs from the legacy ATA boot; what else can help
> > debug this issue? No problem testing patches too.
>
> Yeap, please post the old log.

Not much actually - perhaps I need to enable some debugging:

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
hdc: SanDisk SDCFX-4096, CFA DISK drive
ide1 at 0x170-0x177,0x376 on irq 15
hdc: max request size: 128KiB
hdc: 8027712 sectors (4110 MB) w/1KiB Cache, CHS=7964/16/63
 hdc: hdc1 hdc2 hdc3

> > --- [2]
> > ata2.00: limiting speed to UDMA/33:PIO4
> > ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
> > ata2.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 cdb 0x0 data 4096 in
> >  res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
> > ata2: soft resetting port
> > ata2.00: configured for UDMA/33
> > ata2: EH complete
>
> What happens after this?

More EH occurs - I've left it for ~5 mins, but let me know if longer
would give more information, eg if it converges on a lower speed.

Would it be useful to compare some of the port setup registers in the
working and non-working cases? Or any other debug I can grab?
-- 
Daniel J Blueman
-
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: Early ATA devices

2007-08-02 Thread Alan Cox
> > So in theory we can persuade libata to drive original MFM/RLL disks with
> > relatively few changes
> 
> Does anyone have a working device to test?

I'm currently testing a 40MB pre-ATA IDE drive and with the LBA/non-LBA
fix I sent to Andrew and the 'its ancient, its PIO < 2 who cares if
SETXFER isn't a known command' patch likewise it is running.

That one has a pre-ATA version of identify however. Not yet found one
without to play with

Alan
-
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

2007-08-02 Thread Alan Cox
> 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 

>
-
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

2007-08-02 Thread Mikko Rapeli
On Thu, Aug 02, 2007 at 01:17:58AM +0200, Bartlomiej Zolnierkiewicz wrote:
> 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?

Full log at http://bugzilla.kernel.org/attachment.cgi?id=12235

Here's a summary:

$ egrep hdd\|ide1\|current\ capacity\|native\ \ capacity
dmesg_ide_debug_26221.txt

ide1: BM-DMA at 0xe008-0xe00f, BIOS settings: hdc:pio, hdd:pio
Probing IDE interface ide1...
probing for hdd: present=0, media=32, probetype=ATA
hdd: ST340823A, ATA DISK drive
hdd: selected mode 0x42
ide1 at 0x170-0x177,0x376 on irq 15
hdd: max request size: 128KiB
ide1: start_request: current=0xc18f5c28
hdd: do_special: 0x03
ide1: start_request: current=0xc18f5c28
hdd: do_special: 0x02
ide1: start_request: current=0xc18f5c28
hdd: Host Protected Area detected.
current capacity is 78165360 sectors (40020 MB)
native  capacity is 78165361 sectors (40020 MB)
ide1: start_request: current=0xc18f5c28
hdd: Host Protected Area disabled.
hdd: 78165361 sectors (40020 MB) w/1024KiB Cache, CHS=65535/16/63,
UDMA(33)
hdd: cache flushes not supported
 hdd:ide1: start_request: current=0xc1e0b578
hdd: reading: block=0, sectors=8, buffer=0xc18b7000
 hdd1 hdd2 hdd3
ide1: start_request: current=0xc1e0b578
hdd: reading: block=78165120, sectors=8, buffer=0xc1e54000
ide1: start_request: current=0xc1e0b578
hdd: reading: block=78165352, sectors=1, buffer=0xc1e2e000
ide1: start_request: current=0xc1e0b408
hdd: reading: block=78165353, sectors=7, buffer=0xc1e2e200
ide1: start_request: current=0xc1e0b408
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
ide1: start_request: current=0xc1e0b408
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
ide1: start_request: current=0xc1e0b408
hdd: do_special: 0x02
ide1: start_request: current=0xc1e0b408
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
ide1: start_request: current=0xc1e0b408
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
hdd: DMA disabled
ide1: reset: master: error (0x00?)
ide1: start_request: current=0xc1e0b408
hdd: do_special: 0x03
ide1: start_request: current=0xc1e0b408
hdd: do_special: 0x02
ide1: start_request: current=0xc1e0b408
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest
Error }
hdd: task_in_intr: error=0x10 { SectorIdNotFound }, LBAsect=78230639,
sector=78165360
ide1: start_request: current=0xc1e0b408
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest
Error }
hdd: task_in_intr: error=0x10 { SectorIdNotFound }, LBAsect=78230639,
sector=78165360
ide1: start_request: current=0xc1e0b408
hdd: do_special: 0x02
ide1: start_request: current=0xc1e0b408
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest
Error }
hdd: task_in_intr: error=0x10 { SectorIdNotFound }, LBAsect=78230639,
sector=781
65360
ide1: start_request: current=0xc1e0b408
hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
hdd: task_in_intr: status=0x59 { DriveReady SeekComplete DataRequest
Error }
hdd: task_in_intr: error=0x10 { SectorIdNotFound }, LBAsect=78230639,
sector=78165360
ide1: reset: master: error (0x00?)
ide1: start_request: current=0xc1e0b408
end_request: I/O error, dev hdd, sector 78165360
Buffer I/O error on device hdd, logical block 78165360
ide1: start_request: current=0xc1e0b408
end_request: I/O error, dev hdd, sector 78165360
Buffer I/O error on device hdd, logical block 78165360
ide1: start_request: current=0xc1e0b408
end_request: I/O error, dev hdd, sector 78165360
Buffer I/O error on device hdd, logical block 78165360
ide1: start_request: current=0xc1e0b408
end_request: I/O error, dev hdd, sector 78165360
Buffer I/O error on device hdd, logical block 78165360
ide1: start_request: current=0xc1e0b408
end_request: I/O error, dev hdd, sector 78165296
...
-
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/3] sis5513: always tune PIO

2007-08-02 Thread Sergei Shtylyov

Bartlomiej Zolnierkiewicz wrote:


* Always set ->autotune in init_hwif_sis5513(), this means practically
  no change in behavior since PIO was always tuned in ->ide_dma_check
  and >autotune was always set for ->dma_base == 0 case.



* Bump driver version.



Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>


Acked-by: Sergei Shtylyov <[EMAIL PROTECTED]>

MBR, Sergei
-
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: Libata Sil3124 hybrid drive failure

2007-08-02 Thread Jeff Garzik

Fajun Chen wrote:

Does anyone know if libata supports hybrid drive on Sil3124? I tried
to play with Seagate hybrid drive and got protocol mismatch error when
adding LBAs to pinned set or querying pinned set?  Sil24 driver code
does not set Protocol Override field in PRB, just wonder if we need to
set protocol explicitly to get this work because the controller may
not decode the protocol correctly for nv cache commands.


Yes, that's entirely possible for new commands...

Jeff


-
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] block: add protocol discriminators to requests and queues

2007-08-02 Thread James Bottomley
On Thu, 2007-08-02 at 12:51 -0600, Matthew Wilcox wrote:
> On Thu, Aug 02, 2007 at 12:47:25PM -0500, James Bottomley wrote:
> > This looks small and innocuous, but it's actually the beginning of
> > moving the upper layer drivers into block and adding a filtering layer.
> > The idea is that the queue contains a queue_protocol parameter which
> > details what the device actually speaks.  The requests are likewise
> > filled in with a cmd_protocol parameter by the ULDs (or bsg if it's a
> > user initiated command, using the existing sgv4 protocol fields).
> > 
> > Now we have the capability of adding say native ATA pass through to BSG,
> > but also we can add things like an ATAPI filter:  sr creates SCSI
> > requests, but these could be sent through a PACKET_COMMAND wrapper and
> > emerge as BLK_PROTOCOL_ATAPI before being sent to the device.  Likewise,
> > sd requests going to BLK_PROTOCOL_ATA devices would have to go through
> > SATL filters.  
> 
> Will it also add the ability to add device-specific filters?  For
> example, the CD burners that have manufacturer specific opcodes to turn
> on various features that are safe for users to use ... but have to be
> limited to root-only currently as we can't know what kind of device the
> command is going to.

I wasn't planning on doing this ... the idea is basically a protocol
conversion filter.  Device quirks don't quite fit into this model.

James


-
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] Optional libata LED trigger for PowerMac G5

2007-08-02 Thread Tony Vroon
This adds an optional wrapper around ata_ac_issue_prot that triggers the LED 
layer.
Powermac G5 machines with an Apple K2 controller will now blink the PMU LED to 
harddisk activity if CONFIG_ADB_PMU_LED_IDE is defined (like on a 
PowerBook/iBook).
This avoids any pollution of the hot path on non-PowerMacs and makes the 
functionality 
fully optional.

Jeff, hopefully this version addresses your earlier concerns voiced on May 25 
this year.

Signed-off-by: Tony Vroon <[EMAIL PROTECTED]>

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 60e78be..9c687db 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -5569,6 +5570,25 @@ unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc)
 }
 
 /**
+ * ata_qc_issue_prot_ledtrigger - trigger LED core
+ * @qc: command to issue to device
+ *
+ * This triggers the LED core and then calls the
+ * regular ata_qc_issue_prot function.
+ *
+ * LOCKING:
+ * spin_lock_irqsave(host lock)
+ *
+ * RETURNS:
+ * Zero on success, AC_ERR_* mask on failure
+ */
+unsigned int ata_qc_issue_prot_ledtrigger(struct ata_queued_cmd *qc)
+{
+   ledtrig_ide_activity(); 
+   return ata_qc_issue_prot(qc);
+}
+
+/**
  * ata_host_intr - Handle host interrupt for given (port, task)
  * @ap: Port on which interrupt arrived (possibly...)
  * @qc: Taskfile currently active in engine
@@ -6873,6 +6893,7 @@ EXPORT_SYMBOL_GPL(ata_hsm_move);
 EXPORT_SYMBOL_GPL(ata_qc_complete);
 EXPORT_SYMBOL_GPL(ata_qc_complete_multiple);
 EXPORT_SYMBOL_GPL(ata_qc_issue_prot);
+EXPORT_SYMBOL_GPL(ata_qc_issue_prot_ledtrigger);
 EXPORT_SYMBOL_GPL(ata_tf_load);
 EXPORT_SYMBOL_GPL(ata_tf_read);
 EXPORT_SYMBOL_GPL(ata_noop_dev_select);
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 92e8770..af3e57b 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -341,7 +341,11 @@ static const struct ata_port_operations k2_sata_ops = {
.bmdma_stop = ata_bmdma_stop,
.bmdma_status   = ata_bmdma_status,
.qc_prep= ata_qc_prep,
+#ifdef CONFIG_ADB_PMU_LED_IDE
+   .qc_issue   = ata_qc_issue_prot_ledtrigger,
+#else
.qc_issue   = ata_qc_issue_prot,
+#endif
.data_xfer  = ata_data_xfer,
.freeze = ata_bmdma_freeze,
.thaw   = ata_bmdma_thaw,
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 41978a5..ebda8ee 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -790,6 +790,7 @@ extern void ata_dumb_qc_prep(struct ata_queued_cmd *qc);
 extern void ata_qc_prep(struct ata_queued_cmd *qc);
 extern void ata_noop_qc_prep(struct ata_queued_cmd *qc);
 extern unsigned int ata_qc_issue_prot(struct ata_queued_cmd *qc);
+extern unsigned int ata_qc_issue_prot_ledtrigger(struct ata_queued_cmd *qc);
 extern void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf,
unsigned int buflen);
 extern void ata_sg_init(struct ata_queued_cmd *qc, struct scatterlist *sg,
-
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] block: add protocol discriminators to requests and queues

2007-08-02 Thread Matthew Wilcox
On Thu, Aug 02, 2007 at 12:47:25PM -0500, James Bottomley wrote:
> This looks small and innocuous, but it's actually the beginning of
> moving the upper layer drivers into block and adding a filtering layer.
> The idea is that the queue contains a queue_protocol parameter which
> details what the device actually speaks.  The requests are likewise
> filled in with a cmd_protocol parameter by the ULDs (or bsg if it's a
> user initiated command, using the existing sgv4 protocol fields).
> 
> Now we have the capability of adding say native ATA pass through to BSG,
> but also we can add things like an ATAPI filter:  sr creates SCSI
> requests, but these could be sent through a PACKET_COMMAND wrapper and
> emerge as BLK_PROTOCOL_ATAPI before being sent to the device.  Likewise,
> sd requests going to BLK_PROTOCOL_ATA devices would have to go through
> SATL filters.  

Will it also add the ability to add device-specific filters?  For
example, the CD burners that have manufacturer specific opcodes to turn
on various features that are safe for users to use ... but have to be
limited to root-only currently as we can't know what kind of device the
command is going to.

-- 
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
-
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


Libata Sil3124 hybrid drive failure

2007-08-02 Thread Fajun Chen
Hi,

Does anyone know if libata supports hybrid drive on Sil3124? I tried
to play with Seagate hybrid drive and got protocol mismatch error when
adding LBAs to pinned set or querying pinned set?  Sil24 driver code
does not set Protocol Override field in PRB, just wonder if we need to
set protocol explicitly to get this work because the controller may
not decode the protocol correctly for nv cache commands.

Thanks,
Fajun
-
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] block: add protocol discriminators to requests and queues

2007-08-02 Thread James Bottomley
This looks small and innocuous, but it's actually the beginning of
moving the upper layer drivers into block and adding a filtering layer.
The idea is that the queue contains a queue_protocol parameter which
details what the device actually speaks.  The requests are likewise
filled in with a cmd_protocol parameter by the ULDs (or bsg if it's a
user initiated command, using the existing sgv4 protocol fields).

Now we have the capability of adding say native ATA pass through to BSG,
but also we can add things like an ATAPI filter:  sr creates SCSI
requests, but these could be sent through a PACKET_COMMAND wrapper and
emerge as BLK_PROTOCOL_ATAPI before being sent to the device.  Likewise,
sd requests going to BLK_PROTOCOL_ATA devices would have to go through
SATL filters.  

The next steps are to make the block prep layer capable of binding to
drivers (and moving the SCSI ULDs up) followed by making the prep layer
filter capable.

James

Index: BUILD-2.6/block/bsg.c
===
--- BUILD-2.6.orig/block/bsg.c  2007-08-02 10:22:24.0 -0500
+++ BUILD-2.6/block/bsg.c   2007-08-02 10:22:47.0 -0500
@@ -192,6 +192,25 @@ static int blk_fill_sgv4_hdr_rq(struct r
 */
rq->cmd_len = hdr->request_len;
rq->cmd_type = REQ_TYPE_BLOCK_PC;
+   switch (hdr->protocol) {
+   case BSG_PROTOCOL_SCSI:
+   switch (hdr->subprotocol) {
+   case BSG_SUB_PROTOCOL_SCSI_CMD:
+   rq->cmd_protocol = BLK_PROTOCOL_SCSI;
+   break;
+   case BSG_SUB_PROTOCOL_SCSI_TRANSPORT:
+   /* whatever format the transport defines */
+   rq->cmd_protocol = BLK_PROTOCOL_NATIVE;
+   break;
+   default:
+   rq->cmd_protocol = BLK_PROTOCOL_NATIVE;
+   break;
+   }
+   break;
+   default:
+   rq->cmd_protocol = BLK_PROTOCOL_NATIVE;
+   break;
+   }
 
rq->timeout = (hdr->timeout * HZ) / 1000;
if (!rq->timeout)
Index: BUILD-2.6/block/ll_rw_blk.c
===
--- BUILD-2.6.orig/block/ll_rw_blk.c2007-08-02 10:22:24.0 -0500
+++ BUILD-2.6/block/ll_rw_blk.c 2007-08-02 12:45:23.0 -0500
@@ -231,6 +231,7 @@ void blk_queue_make_request(struct reque
 * by default assume old behaviour and bounce for any highmem page
 */
blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);
+   blk_queue_protocol(q, BLK_PROTOCOL_NATIVE);
 }
 
 EXPORT_SYMBOL(blk_queue_make_request);
@@ -788,6 +789,21 @@ void blk_queue_dma_alignment(struct requ
 EXPORT_SYMBOL(blk_queue_dma_alignment);
 
 /**
+ * blk_queue_protocol - set the native protocol for the device
+ * @q: The request queue for the device
+ * @proto: The protocol
+ *
+ * description:
+ * This is used to set the underlying device protocol.  It is used
+ * by the prepare functions to decide how to package commands.
+ */
+void blk_queue_protocol(struct request_queue *q, enum blk_protocol proto)
+{
+   q->queue_protocol = proto;
+}
+EXPORT_SYMBOL(blk_queue_protocol);
+
+/**
  * blk_queue_find_tag - find a request by its tag and queue
  * @q:  The request queue for the device
  * @tag: The tag of the request
Index: BUILD-2.6/block/scsi_ioctl.c
===
--- BUILD-2.6.orig/block/scsi_ioctl.c   2007-08-02 10:22:24.0 -0500
+++ BUILD-2.6/block/scsi_ioctl.c2007-08-02 10:22:47.0 -0500
@@ -229,6 +229,7 @@ static int blk_fill_sghdr_rq(struct requ
 */
rq->cmd_len = hdr->cmd_len;
rq->cmd_type = REQ_TYPE_BLOCK_PC;
+   rq->cmd_protocol = BLK_PROTOCOL_SCSI;
 
rq->timeout = (hdr->timeout * HZ) / 1000;
if (!rq->timeout)
@@ -494,6 +495,7 @@ int sg_scsi_ioctl(struct file *file, str
rq->sense = sense;
rq->sense_len = 0;
rq->cmd_type = REQ_TYPE_BLOCK_PC;
+   rq->cmd_protocol = BLK_PROTOCOL_SCSI;
 
blk_execute_rq(q, disk, rq, 0);
 
@@ -527,6 +529,7 @@ static int __blk_send_generic(struct req
 
rq = blk_get_request(q, WRITE, __GFP_WAIT);
rq->cmd_type = REQ_TYPE_BLOCK_PC;
+   rq->cmd_protocol = BLK_PROTOCOL_SCSI;
rq->data = NULL;
rq->data_len = 0;
rq->timeout = BLK_DEFAULT_SG_TIMEOUT;
Index: BUILD-2.6/include/linux/blkdev.h
===
--- BUILD-2.6.orig/include/linux/blkdev.h   2007-08-02 10:22:24.0 
-0500
+++ BUILD-2.6/include/linux/blkdev.h2007-08-02 10:22:47.0 -0500
@@ -164,6 +164,21 @@ enum rq_cmd_type_bits {
 };
 
 /*
+ * Add protocol types.  The idea here is to flag what the
+ * queue speaks natively, but allow other protocols to be sent
+ * (i.e. allow us to identify the need to find translators)
+ *
+

Re: ICH8 CF timeout (regression)...

2007-08-02 Thread Tejun Heo
Daniel J Blueman wrote:
> I'll grab kernel logs from the legacy ATA boot; what else can help
> debug this issue? No problem testing patches too.

Yeap, please post the old log.

> --- [2]
> ata2.00: limiting speed to UDMA/33:PIO4
> ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2 frozen
> ata2.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 cdb 0x0 data 4096 in
>  res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
> ata2: soft resetting port
> ata2.00: configured for UDMA/33
> ata2: EH complete

What happens after this?

-- 
tejun
-
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/3] sis5513: DMA setup fixes

2007-08-02 Thread Sergei Shtylyov

Hello.

Bartlomiej Zolnierkiewicz wrote:


* 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.


   I see that SiS has managed to make chip identification even more painful
than HighPoint representing all the different chipset families by the couple
device IDs with even no ability to differ them via revision ID... :-/

   Although I don't have docs for the newer variants (at least not at hand), 
this looks good to me.



Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>


Acked-by: Sergei Shtylyov <[EMAIL PROTECTED]>

MBR, Sergei
-
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: Boot fails on Intel SATA controller

2007-08-02 Thread Quel Qun

 -- Original message --
From: Tejun Heo <[EMAIL PROTECTED]>
> Quel Qun wrote:
> >  -- Original message --
> > From: Tejun Heo <[EMAIL PROTECTED]>
> >> Hello,
> >>
> >> Luiz Fernando N. Capitulino wrote:
> >>>  Hi there,
> >>>
> >>>  A Mandriva user is reporting that his machine hangs while booting
> >>> kernels 2.6.22.1 and 2.6.23-rc1.
> >>>
> >>>  But boots fine with 2.6.21.
> >>>
>
> Does the attached patch change anything?
> 

Hi and thanks for answering.

2.6.23-rc1 boots if I comment out these two lines. The drive does have the two 
original dell special partitions that were on it when I received the computer 
(sda1 and sda3).

Here is some info I could gather about the disk. Let me know if you need 
anything else.

Boot log:

ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)^M
ata1.00: ATA-7: HDS724040KLSA80, KFAOA20N, max UDMA/133^M
ata1.00: 781422768 sectors, multi 8: LBA48 ^M
ata1.00: configured for UDMA/133^M
scsi 0:0:0:0: Direct-Access ATA  HDS724040KLSA80  KFAO PQ: 0 ANSI: 5^M
Loading ata_piixACPI: PCI Interrupt :00:1f.1[A] -> .ko module^M

The disk partitions:

# fdisk -l /dev/sda

Disk /dev/sda: 400.0 GB, 400088457216 bytes
255 heads, 63 sectors/track, 48641 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot  Start End  Blocks   Id  System
/dev/sda1   1   6   48163+  de  Dell Utility
/dev/sda2   *   79440757786057  HPFS/NTFS
/dev/sda3   48283   48641 2883667+  db  CP/M / CTOS / ...
/dev/sda49441   48282   3119983655  Extended
/dev/sda59441   10068 5044378+   b  W95 FAT32
/dev/sda6   10069   10322 2040223+  83  Linux
/dev/sda7   10323   10462 1124518+  82  Linux swap / Solaris
/dev/sda8   10463   1173610233373+  83  Linux
/dev/sda9   11737   29948   146287858+  83  Linux
/dev/sda10  29949   48282   147267823+  83  Linux

Partition table entries are not in disk order

And the hdparm output:

# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
powers-up in standby; SET FEATURES subcmd spins-up.
Model Number:   HDS724040KLSA80 
Serial Number:  KRFS11RAGT2EZC
Firmware Revision:  KFAOA20N
Standards:
Used: ATA/ATAPI-7 T13 1532D revision 1 
Supported: 7 6 5 4 
Configuration:
Logical max current
cylinders   16383   16383
heads   16  16
sectors/track   63  63
--
CHS current addressable sectors:   16514064
LBAuser addressable sectors:  268435455
LBA48  user addressable sectors:  781422768
device size with M = 1024*1024:  381554 MBytes
device size with M = 1000*1000:  400088 MBytes (400 GB)
Capabilities:
LBA, IORDY(can be disabled)
Standby timer values: spec'd by Standard, no device specific minimum
R/W multiple sector transfer: Max = 16  Current = 8
Advanced power management level: unknown setting (0x)
Recommended acoustic management value: 128, current value: 128
DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 Cycle time: min=120ns recommended=120ns
PIO: pio0 pio1 pio2 pio3 pio4 
 Cycle time: no flow control=240ns  IORDY flow control=120ns
Commands/features:
Enabled Supported:
   *SMART feature set
Security Mode feature set
   *Power Management feature set
   *Write cache
   *Look-ahead
   *Host Protected Area feature set
   *WRITE_BUFFER command
   *READ_BUFFER command
   *NOP cmd
   *DOWNLOAD_MICROCODE
Advanced Power Management feature set
Power-Up In Standby feature set
SET_FEATURES required to spinup after power up
Address Offset Reserved Area Boot
SET_MAX security extension
   *Automatic Acoustic Management feature set
   *48-bit Address feature set
   *Device Configuration Overlay feature set
   *Mandatory FLUSH_CACHE
   *FLUSH_CACHE_EXT
   *SMART error logging
   *SMART self-test
   *General Purpose Logging feature set
   *64-bit World wide name
   *SATA-I signaling speed (1.5Gb/s)
Security: 
Master password revision code = 65534
supported
not enabled
not locked
not frozen
not expired: security count
not supported: enhanced erase
220min for SECURITY ERASE UNIT. 
Checksum: correct

Hope that helps,
--
kk1

--- Begin Message ---
diff --git a/drivers/ata/libata-core.c b/drivers/

Re: hpt374 sata (Highpoint Rocket 1540)

2007-08-02 Thread Alan Cox
> > Since you don't do a reset is it not sufficient to check word93 on the
> 
> Ah, you mean to identify a SATA drive?  Need to try this...

That is the basic approach libata uses, and I've been runnin for a while
with patches to actually pick this case up and flip the cable type as
well. PATA controller/SATA drive rather gives away the presence of a
bridge, although which end is one thing I've yet to work out a way to
probe

> > initial identify scan in PIO. Or if you do a reset the signature.
> 
> Hm, the taskfile signature, you mean?..

Yes because that is if I remember rightly also different for a SATA device
-
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

2007-08-02 Thread Alan Cox
> 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.

Quite possibly but at least in early 2.6 that issue was there, and that
means without actually doing proper tests I don't think the approach
involved is the right one. If a specific 512 byte read for that last
sector fails on that specific drive/firmware then blacklist it, but the
general case of "odd size = error" is definitely not true.

Alan
-
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

2007-08-02 Thread Matthew Garrett
On Thu, Aug 02, 2007 at 02:14:08PM +0800, Shaohua Li wrote:
> ACPI spec defines the sequence of IDE power on/off:

Most distributions seem to be using the libata PATA code now - any plans 
to implement it there as well?
-- 
Matthew Garrett | [EMAIL PROTECTED]
-
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] sata_qstor, pdc_adma, sata_sx4: convert to new EH

2007-08-02 Thread Tejun Heo
Mark Lord wrote:
> Jeff Garzik wrote:
>> This is just a refresh of the existing libata-dev.git#new-eh patches
>> that convert all remaining old-EH drivers to new EH, against 2.6.23-rc1.
>>
>> All three conversions are completely untested.  pdc_adma and sata_qstor
>> need reviewing by someone with docs, in addition to testing.
>>
>> Even "it still works" or "this patch breaks stuff" feedback from users
>> is useful.
> 
> Tejun has some pdc_adma hardware..  ;)

Yeah, I actually have two thanks to Mark. :-)  Will test soon.

-- 
tejun
-
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)

2007-08-02 Thread Sergei Shtylyov

Alan Cox wrote:
   Too bad, this is the standard HPT subsystem ID of 0x0001... So, nothing 
comes to my mind other than add a module parameter to hpt366.c to specify that 
we're using the crippled SATA bridge... well, maybe it would also make sense 
to scan the BIOS for the signatures...



Since you don't do a reset is it not sufficient to check word93 on the


   Ah, you mean to identify a SATA drive?  Need to try this...


initial identify scan in PIO. Or if you do a reset the signature.


   Hm, the taskfile signature, you mean?..

MBR, Sergei

-
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

2007-08-02 Thread Sergei Shtylyov

Hello, I wrote:

diff -ru linux-2.6.22.1/drivers/ide/ide-disk.c 
linux-2.6.22.1.new/drivers/ide/ide-disk.c
--- linux-2.6.22.1/drivers/ide/ide-disk.c2007-07-10 
21:56:30.0 +0300
+++ linux-2.6.22.1.new/drivers/ide/ide-disk.c2007-08-01 
22:59:47.0 +0300

@@ -502,6 +502,17 @@
  capacity, sectors_to_MB(capacity),
  set_max, sectors_to_MB(set_max));
 
+if ((set_max % 2)


   I hope gcc will convert this to (set_max & 1) but it wouldn't hurt to 
code this explicitly.



 && (set_max == capacity + 1)) {



   Wait, isn't set_max an address of a last sector,


   Well, I was wrong: idedisk_read_native_max_address*() increments this 
value bofore returning.


and isn't capacity a 
sector count? Shouldn't it be (set_max == capacity)?


   No, it was OK.

 MBR, Sergei

-
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

2007-08-02 Thread Mikko Rapeli
On Wed, Aug 01, 2007 at 02:05:56PM +0100, Alan Cox wrote:
> You've got an odd sized disk. If you have that, old IDE, and you also have
> anything which tries to read the last sector (eg GPT partitioning) it'll
> break as it tries to read 1K block sizes.
>
> Vendors normally clip the drive to an even size which seems to be the
> case on your box with the HPA left alone.

Sorry, but I don't quite get the odd size and 1k block thing.

Drive manual (
http://www.seagate.com/support/disc/manuals/ata/u5pmb01.pdf ) says on
page 12 that the drive has 78165360 sectors of size 512 bytes of which 
0 to 78165359 are addressable in LBA mode.

The drive reports its size as 78165360 and falsely, according to kernels
addr++, with HPA as 78165361. So instead of reporting the maximum
addressable sector 78165359, the drive reports its size 78165360.

Kernel now picks the larger value 78165361 as the drive size and thinks 
sector 78165360 should exist, but it doesn't. Partition code tries to
read the last sector 78165360 and fails:

hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error }
hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360,
sector=78165360
ide: failed opcode was: unknown

Shouldn't the partition code also try to read 78165361 if there was a 1k
read issued?

> It *should* all "just work" with the libata drivers but needs more
> testing of odd sizes to be 100% sure

The drive just worked with libata and 2.6.22.1, but I'd like to get a
back protable fix to ide-disk.c, so distro kernels like 2.6.18 could be
made to work too.

-Mikko
-
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

2007-08-02 Thread Bartlomiej Zolnierkiewicz
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


Re: [PATCH] sata_qstor, pdc_adma, sata_sx4: convert to new EH

2007-08-02 Thread Mark Lord

Jeff Garzik wrote:

This is just a refresh of the existing libata-dev.git#new-eh patches
that convert all remaining old-EH drivers to new EH, against 2.6.23-rc1.

All three conversions are completely untested.  pdc_adma and sata_qstor
need reviewing by someone with docs, in addition to testing.

Even "it still works" or "this patch breaks stuff" feedback from users
is useful.


Tejun has some pdc_adma hardware..  ;)

I have a single sata_qstor board here somewhere,
and with luck will finally reinstall it next week
to test this stuff.

It's not normally a fun board to use, because the stupid onboard
BIOS extension adds about an extra 30 seconds to the BIOS boot sequence.

Cheers
-
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: No equivalent for ide-scsi available with the new PATA drivers?

2007-08-02 Thread Mark Lord

Alan Cox wrote:

On Mon, 23 Jul 2007 12:36:44 -0400
Chuck Ebbert <[EMAIL PROTECTED]> wrote:


People with IDE tape drives are complaining there's no ide-scsi
driver available anymore with the new PATA layer. Is anyone
working on one?


It would make no sense. The libata layer is already using the SCSI
midlayer so compliant devices should already appear with the st driver.

We might need some tape detect logic, but I don't have any tape devices
so its up to someone with a tape drive handy to help out...


I have a PATA tape drive here somewhere.
Does anyone out there want it, with the understanding that it be
used to test/improve libata tape support?

One thing about ATAPI tape drives, is that they generally won't "stream"
with the generic SCSI st code.  Instead, many of them will do a *very* sluggish
stop/start stop/start stop/start kind of action when reading/writing bulk
data.  To get them to stream continously requires more driver intelligence,
*especially* when sharing a cable with some other device.

With an appropriate driver, tailored for ATAPI tape drives, they can run
at full speed while sharing a channel with another active ATA/ATAPI device,
both drives in use at the same time.

Cheers
-
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

2007-08-02 Thread Sergei Shtylyov

Mikko Rapeli wrote:


diff -ru linux-2.6.22.1/drivers/ide/ide-disk.c 
linux-2.6.22.1.new/drivers/ide/ide-disk.c
--- linux-2.6.22.1/drivers/ide/ide-disk.c   2007-07-10 21:56:30.0 
+0300
+++ linux-2.6.22.1.new/drivers/ide/ide-disk.c   2007-08-01 22:59:47.0 
+0300
@@ -502,6 +502,17 @@
 capacity, sectors_to_MB(capacity),
 set_max, sectors_to_MB(set_max));
 
+	if ((set_max % 2)


   I hope gcc will convert this to (set_max & 1) but it wouldn't hurt to code 
this explicitly.



 && (set_max == capacity + 1)) {


   Wait, isn't set_max an address of a last sector, and isn't capacity a 
sector count? Shouldn't it be (set_max == capacity)?



+   printk(KERN_INFO "Old drive detected, keeping current 
capacity.\n");
+   return;
+   }
+
if (lba48)
set_max = idedisk_set_max_address_ext(drive, set_max);
else


MBR, Sergei
-
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 UPDATED] libata: add support for ATA_16 on ATAPI

2007-08-02 Thread Mark Lord

Tejun Heo wrote:

Jeff Garzik wrote:

Tejun Heo wrote:

Jeff, Mark, are you guys okay with the modified version?

Close!  Thanks for revising!

My only comment now is that I dislike atapi_scmd85.  That means nothing
to me.

I liked the old name better.  Or maybe use atapi_passthru16.


The problem with ata16_passthru is that it suggests the opposite of what
it does.  The default value 0 allows ATA_16 passthrough command while
setting it to 1 disallows ATA_16 passthrough and passes through SCSI
Command 0x85 which shares command byte with ATA_16.  Maybe it's because
I'm not a native speaker but the last sentence is pretty difficult to
digest.  So, IMHO, atapi_scmd85 is slightly better in that it means
nothing rather than suggesting the opposite.


Thanks for plugging away at this one, Tejun.

And I do agree that ata16_passthru sounds backwards of what it really does.
There's got to be a nicer name for this thing.

In practice, I doubt that anyone will ever use the parameter,
so it really doesn't matter a whole lot what we call it.

But something sensible would be nice.
There's got to be a shorter version of "atapi_pass_opcode_0x85_to_device=1".

Perhaps "atapi_op_85_passthru=1" or "atapi_passthru_op_85=1" ??

Also, this is an example of something that is really a "per device"
parameter, rather than a global.  But we haven't yet cracked a good way
to do that yet in libata.

Cheers
-
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_isapnp: use MODULE_DEVICE_TABLE()

2007-08-02 Thread Alan Cox
On Thu, 2 Aug 2007 07:06:07 -0400
Jeff Garzik <[EMAIL PROTECTED]> wrote:

> 
> I found this while doing ISDN PCI API conversions...  I presume this
> omission was not intentional?
> 
> Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>

Looks fine to me 

Alan
-
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

2007-08-02 Thread Alan Cox
> 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 ?

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
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.

Alan
-
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_isapnp: use MODULE_DEVICE_TABLE()

2007-08-02 Thread Jeff Garzik

I found this while doing ISDN PCI API conversions...  I presume this
omission was not intentional?

Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>


diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 5525518..91a396f 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -139,6 +139,8 @@ static struct pnp_device_id isapnp_devices[] = {
{.id = ""}
 };
 
+MODULE_DEVICE_TABLE(pnp, isapnp_devices);
+
 static struct pnp_driver isapnp_driver = {
.name   = DRV_NAME,
.id_table   = isapnp_devices,
-
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


ICH8 CF timeout (regression)...

2007-08-02 Thread Daniel J Blueman
I'm experiencing timeouts with libata when reading from a compact
flash card connected to onboard IDE. Reproducible with 2.6.20, 2.6.22,
2.6.23-rc1, with both short cable and a on-mobo CF socket on a x86-64
Core2Duo.

Sometimes (~7%), we see some EH and the interface stablises, then the
system continues to work as expected [1] (35MB/s DMA from the CF), but
most of the time, it goes nowhere [2].

When running with legacy ATA support, the system consistently works
fine (but without DMA). CF [3] and controller [4] info supplied.

I'll grab kernel logs from the legacy ATA boot; what else can help
debug this issue? No problem testing patches too.

Daniel

--- [1]

[0.00] Linux version 2.6.22-8-generic ([EMAIL PROTECTED]) (gcc
version 4.1.3 20070629 (prerelease) (Ubuntu 4.1.2-13ubuntu2)) #1 SMP
Thu Jul 12 16:09:47 GMT 2007
...
[   23.987509] ata_piix :00:1f.2: version 2.11
[   23.987514] ata_piix :00:1f.2: MAP [ IDE IDE -- -- ]
[   23.987835] scsi0 : ata_piix
[   23.987903] scsi1 : ata_piix
[   23.987960] ata1: PATA max UDMA/100 cmd 0x000101f0 ctl
0x000103f6 bmdma 0x0001f800 irq 14
[   23.988015] ata2: SATA max UDMA/133 cmd 0x00010170 ctl
0x00010376 bmdma 0x0001f808 irq 15
[   24.306364] ata2.00: CFA: SanDisk SDCFX-4096, HDX 4.04, max UDMA/66
[   24.306408] ata2.00: 8027712 sectors, multi 0: LBA
[   24.306446] ata2.00: applying bridge limits
[   24.306971] ata2.00: configured for UDMA/66
[   24.307086] scsi 1:0:0:0: Direct-Access ATA  SanDisk
SDCFX-40 HDX  PQ: 0 ANSI: 5
[   24.311383] sd 1:0:0:0: [sda] 8027712 512-byte hardware sectors (4110 MB)
[   24.311435] sd 1:0:0:0: [sda] Write Protect is off
[   24.311474] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   24.311487] sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   24.311585] sd 1:0:0:0: [sda] 8027712 512-byte hardware sectors (4110 MB)
[   24.311634] sd 1:0:0:0: [sda] Write Protect is off
[   24.311673] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   24.311685] sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   24.311740]  sda: sda1 sda2 sda3
[   24.312962] sd 1:0:0:0: [sda] Attached SCSI removable disk
[   24.316318] sd 1:0:0:0: Attached scsi generic sg0 type 0
[   24.350048] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
[   24.350097] ata2.00: (BMDMA stat 0x24)
[   24.350142] ata2.00: cmd c8/00:07:d2:b7:72/00:00:00:00:00/e0 tag 0
cdb 0x0 data 3584 in
[   24.350144]  res 51/84:00:d8:b7:72/00:00:00:00:00/e0 Emask
0x10 (ATA bus error)
[   24.350266] ata2: soft resetting port
[   24.508020] ata2.00: configured for UDMA/66
[   24.508068] ata2: EH complete
[   24.509290] sd 1:0:0:0: [sda] 8027712 512-byte hardware sectors (4110 MB)
[   24.509572] sd 1:0:0:0: [sda] Write Protect is off
[   24.509612] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   24.509974] sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   24.539976] EXT3-fs: mounted filesystem with ordered data mode.
[   24.552259] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
[   24.552307] ata2.00: (BMDMA stat 0x24)
[   24.552351] ata2.00: cmd c8/00:08:59:13:00/00:00:00:00:00/e0 tag 0
cdb 0x0 data 4096 in
[   24.552354]  res 51/84:00:60:13:00/00:00:00:00:00/e0 Emask
0x10 (ATA bus error)
[   24.552473] ata2: soft resetting port
[   24.712647] ata2.00: configured for UDMA/66
[   24.712687] ata2: EH complete
[   24.713173] sd 1:0:0:0: [sda] 8027712 512-byte hardware sectors (4110 MB)
[   24.713462] sd 1:0:0:0: [sda] Write Protect is off
[   24.713505] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   24.713769] sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   24.726935] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
[   24.726983] ata2.00: (BMDMA stat 0x24)
[   24.727028] ata2.00: cmd c8/00:20:01:c4:06/00:00:00:00:00/e0 tag 0
cdb 0x0 data 16384 in
[   24.727031]  res 51/84:00:20:c4:06/00:00:00:00:00/e0 Emask
0x10 (ATA bus error)
[   24.727151] ata2: soft resetting port
[   24.881089] ata2.00: configured for UDMA/66
[   24.881128] ata2: EH complete
[   24.881944] sd 1:0:0:0: [sda] 8027712 512-byte hardware sectors (4110 MB)
[   24.882420] sd 1:0:0:0: [sda] Write Protect is off
[   24.882463] sd 1:0:0:0: [sda] Mode Sense: 00 3a 00 00
[   24.884157] sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   24.886454] ata2.00: limiting speed to UDMA/44:PIO4
[   24.886497] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x2
[   24.886542] ata2.00: (BMDMA stat 0x24)
[   24.886586] ata2.00: cmd c8/00:90:71:c4:06/00:00:00:00:00/e0 tag 0
cdb 0x0 data 73728 in
[   24.886588]  res 51/84:00:00:c5:06/00:00:00:00:00/e0 Emask
0x10 (ATA bus error)
[   24.886705] ata2: soft resetting port
[   25.041843] ata2.00: configured for UDMA/44
[   25.041882] ata2: EH complete
[   25.044050] sd 1:0:0:

SiS driver K2.4 for 180/182/965/966....

2007-08-02 Thread Franck Bourdonnec
Hello Uwe & Jeff,


I'm trying to follow the 'life' of this driver "sata_sis.c".

I want to report back in Kernel 2.4.34 the additions found
since some time. I do this to extend IPCOP usage of
SATA boards and also to contribute to linux kernel if
possible.

It's not easy because there is many source, that seems
like each others, but not exactly

1) http://driver.sis.com/linux/raid/sis18x_20060508.zip
2) what is today in kernel 2.6.21
3) the list of patch against sata_sis.c (git)
4) the kernel 2.4.34 "sata_sis.c" source

After compiling all this, result is a kernel 2.4 driver
that I think, ressemble a lot to the actual 2.6 version.

I would like you just to read the source (test it??) for advice.




Strange thing I noted is:

Sis1180,1184: present in sis18x_20060508.zip but inexistant
elsewhere (particulary in K2.6). Why?



in this fix 
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.22.y.git;a=commitdiff;h=29da9f6d9cc3685ae7f6c8b817f6ed8864c78a4c

the call to "ata_pci_init_native_mode" function is a little bit changed: 
&ppi becomes ppi.

probe_ent = ata_pci_init_native_mode(pdev, ppi, ATA_PORT_PRIMARY | 
ATA_PORT_SECONDARY);

just a confirmation that this match K2.4 prototype. Sometimes I don't really 
follow some C notation with **  ;-)

==

I wasn't sure here:

1)
.host_flags  = ATA_FLAG_SATA | ATA_FLAG_SLAVE_POSS | ATA_FLAG_SATA_RESET |
  ATA_FLAG_NO_LEGACY,
2)
.host_flags  = ATA_FLAG_SATA | ATA_FLAG_SATA_RESET |
  ATA_FLAG_NO_LEGACY,
3)
.host_flags  = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,



Choosed 2) because
ATA_FLAG_SLAVE_POSS is positionned in the code (set to one)


=

Thank you to have read this.
Hope it's ok. For my project (IPCop) or directly in k2.4
if you don't see major obstacle.

Franck
/*
 *  sata_sis.c - Silicon Integrated Systems SATA
 *
 *  Maintained by:  Uwe Koziolek
 *  		Please ALWAYS copy linux-ide@vger.kernel.org
 *		on emails.
 *
 *  Copyright 2004 Uwe Koziolek
 *
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 *
 *  libata documentation is available via 'make {ps|pdf}docs',
 *  as Documentation/DocBook/libata.*
 *
 *  Hardware documentation available under NDA.
 *
 */

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include "scsi.h"
#include 
#include 

#define DRV_NAME	"sata_sis"
#define DRV_VERSION	"0.6"

enum {
	sis_180			= 0,
	SIS_SCR_PCI_BAR		= 5,

	/* PCI configuration registers */
	SIS_GENCTL		= 0x54, /* IDE General Control register */
	SIS_SCR_BASE		= 0xc0, /* sata0 phy SCR registers */
	SIS180_SATA1_OFS	= 0x10, /* offset from sata0->sata1 phy regs */
	SIS182_SATA1_OFS	= 0x20, /* offset from sata0->sata1 phy regs */
	SIS_PMR			= 0x90, /* port mapping register */
	SIS_PMR_COMBINED	= 0x30,

	/* random bits */
	SIS_FLAG_CFGSCR		= (1 << 30), /* host flag: SCRs via PCI cfg */

	GENCTL_IOMAPPED_SCR	= (1 << 26), /* if set, SCRs are in IO space */
};

static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent);
static u32 sis_scr_read (struct ata_port *ap, unsigned int sc_reg);
static void sis_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);

static const struct pci_device_id sis_pci_tbl[] = {
	{ PCI_VENDOR_ID_SI, 0x0180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 964/180 */
	{ PCI_VENDOR_ID_SI, 0x0181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 964/180 */
	{ PCI_VENDOR_ID_SI, 0x0182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 965/965L*/
	{ PCI_VENDOR_ID_SI, 0x0183, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 965/965L*/
	{ PCI_VENDOR_ID_SI, 0x1180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },
	{ PCI_VENDOR_ID_SI, 0x1182, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 966/680*/
	{ PCI_VENDOR_ID_SI, 0x1183, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	/* SiS 966/966L/968/680*/
	{ PCI_VENDOR_ID_SI, 0x1184, PCI_ANY_ID, PCI_ANY_ID, 0, 0, sis_180 },	
	{ }	/* terminate list */
};


static struct pci_driver sis_pci_driver = {
	.name			= DRV_NAME,
	.id_table		= sis_pci_tbl,
	.probe			= sis_init_one,
	.remove			= ata_pci_remove_one,
};

static Scsi_Host_Template sis_sht = {
	.module			= THIS_MODULE,
	.name			= DRV_NAME,
	.detect			= ata_scsi_detect,
	.release		= ata_scsi_release,
	.ioctl			= at