Re: [PATCH 1/5] ata_piix: kill unused constants and flags

2008-01-16 Thread Jeff Garzik

Tejun Heo wrote:

Kill PIIX_FLAG_SCR, PIIX_PORT_ENABLED and PIIX_PORT_PRESENT.  These
are unused.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/ata/ata_piix.c |   27 +++
 1 files changed, 7 insertions(+), 20 deletions(-)


applied 1-2


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/5] libata: factor out ata_pci_activate_sff_host() from ata_pci_one()

2008-01-16 Thread Jeff Garzik

Tejun Heo wrote:

Factor out ata_pci_activate_sff_host() from ata_pci_one().  This does
about the same thing as ata_host_activate() but needs to be separate
because SFF controllers use different and multiple IRQs in legacy
mode.

This will be used to make SFF LLD initialization more flexible.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |1 +
 drivers/ata/libata-sff.c  |  184 +
 include/linux/libata.h|3 +
 3 files changed, 107 insertions(+), 81 deletions(-)


ACK patches 3-5, but they failed to apply to #upstream


-
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/4] sata_qstor: convert to new data_xfer prototype

2008-01-16 Thread Jeff Garzik

Tejun Heo wrote:

While merging data_xfer prototype change, pata_pcmcia was left out.
Convert it.

Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/ata/pata_pcmcia.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)


applied


-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] [libata] sata_mv: Remove PCI dependency

2008-01-16 Thread Jeff Garzik

saeed bishara wrote:

-   if (unlikely(irq_stat & PCI_ERR)) {
+   if (unlikely(irq_stat & PCI_ERR) && HAS_PCI(host)) {
mv_pci_error(host, mmio);
handled = 1;
goto out_unlock;/* skip all other HC irq handling */


the unlikely() should cover the entire expression.




 static int __init mv_init(void)
 {
-   return pci_register_driver(&mv_pci_driver);
+   int rc;
+#ifdef CONFIG_PCI
+   rc = pci_register_driver(&mv_pci_driver);
+   if (rc)
+   return rc;
+#endif
+   return 0;
 }


I would do

{
int rc = -ENODEV;

#ifdef CONFIG_PCI
rc = pci_register_driver(...);
#endif

return rc;
}

to ensure sane non-SoC, non-PCI behavior (which this patch now enables).

Finally, in Kconfig, even when removing the CONFIG_PCI dependency, the 
driver suddenly has other unsatified dependencies:  CONFIG_HAS_DMA and 
CONFIG_HAS_IOMEM.  Those two need to be added to the Kconfig dep list.


I would have made these minor corrections myself, but git-am (main 
kernel patch-apply tool, for git users) doesn't seem to like the patch:


Applying sata_mv: Remove PCI dependency

fatal: corrupt patch at line 59


-
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: sata_promise: Keeps saying SATA link down (SStatus 0 SControl 0)

2008-01-16 Thread Mikael Pettersson
Kurt Roeckx writes:
 > On Tue, Jan 15, 2008 at 10:28:06AM +0100, Mikael Pettersson wrote:
 > >  > 00:08.0 RAID bus controller: Promise Technology, Inc. PDC20376 
 > > (FastTrak 376) (rev 02)
 > > ...
 > >  > 00:08.0 0104: 105a:3376 (rev 02)
 > > 
 > > Let me guess, this is a Promise chip included on the mainboard
 > > as a RAID controller, and not an add-on PCI card?
 > 
 > Yes, it's a K8V motherboard which has that onboard.
 > 
 > > If it's a mainboard chip, please enter the BIOS and see if it
 > > can be configured for non-RAID mode. If it can, please reconfigure
 > > it and boot Linux. Does it still claim to be a 20376 or is it
 > > now a 20378?
 > 
 > I can't find an option to turn that off in the BIOS.  If it did, I'd
 > probably have turned it off already.  I've also opened the case and it
 > says PDC20376 on the chip.

Ok. I haven't yet found any information about the 20376 which
could explain why the 20376 fails while the 20378 works.
For now, you can disable hotplugging in the driver by applying
the patch below. This should at least bring back some stability
to your system.

Longer-term I guess I'll have to invent a blacklist mechanism
to automatically prevent 20376 chips from enabling hotplugging.
That is, unless someone can show me a system where a 20376
actually does work with hotplugging, in which case I'd need a
module parameter (yuck) or some form of dynamic detection of
this condition.

/Mikael

--- linux-2.6.23/drivers/ata/sata_promise.c.~1~ 2007-10-10 10:33:23.0 
+0200
+++ linux-2.6.23/drivers/ata/sata_promise.c 2008-01-16 10:46:29.0 
+0100
@@ -743,6 +743,7 @@ static irqreturn_t pdc_interrupt (int ir
if (hotplug_status & 0xff)
writel(hotplug_status | 0xff, mmio_base + hotplug_offset);
hotplug_status &= 0xff; /* clear uninteresting bits */
+   hotplug_status = 0; /* ignore hotplug status */
 
/* reading should also clear interrupts */
mask = readl(mmio_base + PDC_INT_SEQMASK);
@@ -938,9 +939,9 @@ static void pdc_host_init(struct ata_hos
tmp = readl(mmio + hotplug_offset);
writel(tmp | 0xff, mmio + hotplug_offset);
 
-   /* unmask plug/unplug ints */
+   /* mask plug/unplug ints */
tmp = readl(mmio + hotplug_offset);
-   writel(tmp & ~0xff, mmio + hotplug_offset);
+   writel(tmp | 0xff, mmio + hotplug_offset);
 
/* don't initialise TBG or SLEW on 2nd generation chips */
if (is_gen2)
-
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


ATA, SATA Disk Problems

2008-01-16 Thread rgheck


Hi, and sorry if this turns out to be a known issue. Actually, I'll be 
thrilled if this turns out to be a known issue. But I've searched on it 
forever, and although I've found some information, I've not found a 
definite fix. Possibly my fault, but this is driving me nuts.


System: Asus P5N32E MB, Intel Quad Core; on SATA: two HDs, SATA Pioneer 
DVD-RW; on PATA: Plextor CDRW, one HD. (Can send more info of course.) 
Kernel is 2.6.23.9 on Fedora 8.

[EMAIL PROTECTED] lyxsvn]# lsmod | grep ata
pata_amd   20293  2
pata_pdc2027x  17477  0
sata_nv25157  6
ata_generic14405  0
libata114673  4 pata_amd,pata_pdc2027x,sata_nv,ata_generic
scsi_mod  145657  5 sr_mod,sg,usb_storage,libata,sd_mod

The issue concerns locks ups and other errors that seem to be focused on 
the optical drives. I'm getting this kind of error:
Jan 16 01:33:19 rghquad kernel: ata7.01: exception Emask 0x0 SAct 0x0 
SErr 0x0 action 0x2 frozen
Jan 16 01:33:19 rghquad kernel: ata7.01: cmd 
a0/00:00:00:00:20/00:00:00:00:00/b0 tag 0 cdb 0x0 data 0

Jan 16 01:33:19 rghquad kernel: ata7: soft resetting port
Jan 16 01:33:19 rghquad kernel: ata7.01: configured for MWDMA2
Jan 16 01:33:19 rghquad kernel: ata7: EH complete
repeatedly, sometimes with the Plextor, sometimes with the Pioneer. But 
then things sometimes get worse:
Jan 16 01:36:22 rghquad kernel: sr1: CDROM (ioctl) error, command: 
<6>ata7: EH complete
Jan 16 01:36:22 rghquad kernel: __journal_remove_journal_head: freeing 
b_committed_data
Jan 16 01:36:22 rghquad kernel: __journal_remove_journal_head: freeing 
b_frozen_data
Jan 16 01:36:22 rghquad kernel: __journal_remove_journal_head: freeing 
b_committed_data
and it seems as if the whole ATA system locks up. The main drive gets 
reset to read-only, and, well, things are not then good.


The fact that this sometimes happens on SATA and sometimes on PATA 
suggests its not a cable issue. (That particular case was the Plextor.)


Is it worth trying a larger PS? I believe I have 450W in this system.

Any help or suggestions more than welcome.

Best,
Richard Heck

-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] [libata] sata_mv: Remove PCI dependency

2008-01-16 Thread saeed bishara
On 1/16/08, Jeff Garzik <[EMAIL PROTECTED]> wrote:
> saeed bishara wrote:
> > -   if (unlikely(irq_stat & PCI_ERR)) {
> > +   if (unlikely(irq_stat & PCI_ERR) && HAS_PCI(host)) {
> > mv_pci_error(host, mmio);
> > handled = 1;
> > goto out_unlock;/* skip all other HC irq handling */
>
> the unlikely() should cover the entire expression.
this will be applied into the new patch
>
>
>
> >  static int __init mv_init(void)
> >  {
> > -   return pci_register_driver(&mv_pci_driver);
> > +   int rc;
> > +#ifdef CONFIG_PCI
> > +   rc = pci_register_driver(&mv_pci_driver);
> > +   if (rc)
> > +   return rc;
> > +#endif
> > +   return 0;
> >  }
>
> I would do
>
> {
>   int rc = -ENODEV;
>
>   #ifdef CONFIG_PCI
>   rc = pci_register_driver(...);
>   #endif
>
>   return rc;
> }
ditto
>
> to ensure sane non-SoC, non-PCI behavior (which this patch now enables).
>
> Finally, in Kconfig, even when removing the CONFIG_PCI dependency, the
> driver suddenly has other unsatified dependencies:  CONFIG_HAS_DMA and
> CONFIG_HAS_IOMEM.  Those two need to be added to the Kconfig dep list.
but ATA is already depends on HAS_IOMEM! so it's not needed by the
driver's entry.
>
> I would have made these minor corrections myself, but git-am (main
> kernel patch-apply tool, for git users) doesn't seem to like the patch:
>
> Applying sata_mv: Remove PCI dependency
>
> fatal: corrupt patch at line 59
I attached the new patch


0001-sata_mv-Remove-PCI-dependency.patch
Description: Binary data


Re: [PATCH 1/2] [libata] sata_mv: Remove PCI dependency

2008-01-16 Thread Mark Lord

saeed bishara wrote:


I attached the new patch

..

Try again, please.
This time, post the patch *inline* in the body of the email,
so that it can more easily be seen, read, and commented on.

Beware of many email clients that mangle inline patches, though.

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 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:
> On Mon, Jan 14, 2008 at 11:32:58PM +0100, Bartlomiej Zolnierkiewicz wrote:
> > On Monday 14 January 2008, Bartlomiej Zolnierkiewicz wrote:
> > > On Sunday 13 January 2008, Borislav Petkov wrote:
> > > > ..and replace them with flag enums.
> > > > 
> > > > Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>
> > 
> > small update:
> > 
> > PC_ABORT is never set and may as well be removed in a pre-patch
> 
> Here you go, the one below should be pushed first...
> 
> --
> From: Borislav Petkov <[EMAIL PROTECTED]>
> Date: Tue, 15 Jan 2008 20:34:50 +0100
> Subject: ide-floppy: remove unused flag PC_ABORT
> 
> This flag was never being set in the code so remove it. By the way, the
> code in the second patch was being executed unconditionally, i.e. in case
> pc->retries > IDEFLOPPY_MAX_PC_RETRIES is true (actually that is the only case
> when the outer if-test passed), !test_bit(PC_ABORT, &pc->flags)
> was always true so the comment is now incorrect and has to go.
> 
> Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>

thanks, applied
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/12] ide-floppy: remove atomic test_*bit macros

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:

[...]

> .. this is the second one...
> 
> 
> From: Borislav Petkov <[EMAIL PROTECTED]>
> Date: Tue, 15 Jan 2008 20:49:18 +0100
> Subject: [PATCH 16/18] ide-floppy: remove atomic test_*bit macros
> 
> ..and replace them with flag enums.
> 
> Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>

applied

[...]

> @@ -1713,13 +1723,16 @@ static int idefloppy_media_changed(struct gendisk 
> *disk)
>  {
>   struct ide_floppy_obj *floppy = ide_floppy_g(disk);
>   ide_drive_t *drive = floppy->drive;
> + int ret;
>  
>   /* do not scan partitions twice if this is a removable device */
>   if (drive->attach) {
>   drive->attach = 0;
>   return 0;
>   }
> - return test_and_clear_bit(IDEFLOPPY_MEDIA_CHANGED, &floppy->flags);
> + ret = floppy->flags & IDEFLOPPY_FLAG_MEDIA_CHANGED;
> + floppy->flags &= ~IDEFLOPPY_FLAG_MEDIA_CHANGED;
> + return ret;
>  }

this chunk (idefloppy_media_changed() return value is now 2 instead of 1
if IDEFLOPPY_FLAG_MEDIA_CHANGED flag is set) seems to have slipped through

[ I fixed it while merging the patch ]
-
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: (was: Re:...) [PATCH 12/12] ide-floppy: fix most of the remaining checkpatch.pl issues-v2

2008-01-16 Thread Bartlomiej Zolnierkiewicz
On Tuesday 15 January 2008, Borislav Petkov wrote:
> ... and finally the last one. Whew! I think we're done here for now. :)
> 
> --
> From: Borislav Petkov <[EMAIL PROTECTED]>
> Date: Tue, 15 Jan 2008 21:01:04 +0100
> Subject: ide-floppy: fix most of the remaining checkpatch.pl issues-v2
> 
> such as
> ERROR: switch and case should be at the same indent
> ERROR: need spaces around that '=' (ctx:VxV)
> ERROR: trailing statements should be on next line
> WARNING: no space between function name and open parenthesis '('
> WARNING: printk() should include KERN_ facility level
> ERROR: That open brace { should be on the previous line
> ERROR: use tabs not spaces
> ERROR: do not use assignment in if condition
> WARNING: braces {} are not necessary for single statement blocks
> ERROR: need space after that ',' (ctx:VxV)
> WARNING: line over 80 characters
> ERROR: do not use assignment in if condition
> ...
> and so on.
> 
> Signed-off-by: Borislav Petkov <[EMAIL PROTECTED]>

applied
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[sata] Anybody have a PDF converter?

2008-01-16 Thread Jeff Garzik

Promise got me an open, non-NDA'd version of the SX4 (sata_sx4) docs:
http://gtf.org/garzik/misc/PDC20621%20Programming%20Guide%20for%20Fastrak%20SX4_1.2_no_water_mark.doc.bz2

Unfortunately, they are in MS Word format and my OpenOffice refuses to 
import it.


Would anyone out there be willing to do a nice conversion to PDF, so 
that I may post it permanently at 
http://gkernel.sourceforge.net/specs/promise/ ?


Thanks,

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


[PATCH 00/22] ide: even more IDE probing code rework

2008-01-16 Thread Bartlomiej Zolnierkiewicz

Just another bunch of small fixes/cleanups...

diffstat:

 drivers/ide/arm/bast-ide.c|   22 +++-
 drivers/ide/arm/rapide.c  |4
 drivers/ide/ide-acpi.c|   60 +++
 drivers/ide/ide-pnp.c |9 -
 drivers/ide/ide-probe.c   |  204 +-
 drivers/ide/ide-proc.c|7 -
 drivers/ide/ide.c |   66 +++-
 drivers/ide/legacy/dtc2278.c  |   10 -
 drivers/ide/legacy/ht6560b.c  |   26 ++--
 drivers/ide/legacy/ide-cs.c   |   31 +
 drivers/ide/legacy/ide_platform.c |4
 drivers/ide/legacy/qd65xx.c   |   44 ++--
 drivers/ide/mips/au1xxx-ide.c |7 -
 drivers/ide/pci/delkin_cb.c   |   40 +--
 drivers/ide/pci/opti621.c |   10 +
 drivers/ide/pci/rz1000.c  |3
 drivers/ide/pci/scc_pata.c|4
 drivers/macintosh/mediabay.c  |2
 include/linux/ide.h   |   22 ++--
 19 files changed, 340 insertions(+), 235 deletions(-)
-
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 01/22] ide: remove redundant hwif->present check from ide_register_hw()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
We check earlier for hwif->present and call ide_unregister() if necessary
(after ide_unregister() hwif->present will be always cleared).

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide.c |2 --
 1 file changed, 2 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -720,8 +720,6 @@ found:
ide_init_port_data(hwif, index);
init_hwif_default(hwif, index);
}
-   if (hwif->present)
-   return -1;
 
ide_init_port_hw(hwif, hw);
hwif->quirkproc = quirkproc;
-
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 02/22] ide: remove redundant init_hwif_default() call from ide_register_hw()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
ide_init_port_hw() call overrides setup done by init_hwif_default().

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -716,10 +716,8 @@ int ide_register_hw(hw_regs_t *hw, void 
 found:
if (hwif->present)
ide_unregister(index);
-   else if (!hwif->hold) {
+   else if (!hwif->hold)
ide_init_port_data(hwif, index);
-   init_hwif_default(hwif, index);
-   }
 
ide_init_port_hw(hwif, hw);
hwif->quirkproc = quirkproc;
-
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 03/22] ide: add 'init_default' and 'restore' arguments to ide_unregister()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Add 'init_default' (flag for calling init_hwif_default()) and 'restore'
  (flag for calling ide_hwif_restore()) arguments to ide_unregister().

* Update ide_unregister() users to set 'init_default' and 'restore' flags.

* No need to set 'init_default' flag in ide_register_hw() if the setup done
  by init_hwif_default() is going to be overridden by ide_init_port_hw().

* No need to set 'init_default' and 'restore' flags in cleanup_module().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/arm/rapide.c  |2 +-
 drivers/ide/ide-pnp.c |7 ---
 drivers/ide/ide.c |   19 ---
 drivers/ide/legacy/ide-cs.c   |2 +-
 drivers/ide/legacy/ide_platform.c |2 +-
 drivers/ide/mips/au1xxx-ide.c |2 +-
 drivers/ide/pci/delkin_cb.c   |3 ++-
 drivers/ide/pci/scc_pata.c|2 +-
 drivers/macintosh/mediabay.c  |2 +-
 include/linux/ide.h   |2 +-
 10 files changed, 25 insertions(+), 18 deletions(-)

Index: b/drivers/ide/arm/rapide.c
===
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(stru
 
ecard_set_drvdata(ec, NULL);
 
-   ide_unregister(hwif->index);
+   ide_unregister(hwif->index, 1, 1);
 
ecard_release_resources(ec);
 }
Index: b/drivers/ide/ide-pnp.c
===
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -60,9 +60,10 @@ static int idepnp_probe(struct pnp_dev *
 static void idepnp_remove(struct pnp_dev * dev)
 {
ide_hwif_t *hwif = pnp_get_drvdata(dev);
-   if (hwif) {
-   ide_unregister(hwif->index);
-   } else
+
+   if (hwif)
+   ide_unregister(hwif->index, 1, 1);
+   else
printk(KERN_ERR "idepnp: Unable to remove device, please 
report.\n");
 }
 
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -499,6 +499,8 @@ void ide_remove_port_from_hwgroup(ide_hw
 /**
  * ide_unregister  -   free an IDE interface
  * @index: index of interface (will change soon to a pointer)
+ * @init_default: init default hwif flag
+ * @restore: restore hwif flag
  *
  * Perform the final unregister of an IDE interface. At the moment
  * we don't refcount interfaces so this will also get split up.
@@ -518,7 +520,7 @@ void ide_remove_port_from_hwgroup(ide_hw
  * This is raving bonkers.
  */
 
-void ide_unregister(unsigned int index)
+void ide_unregister(unsigned int index, int init_default, int restore)
 {
ide_drive_t *drive;
ide_hwif_t *hwif, *g;
@@ -602,9 +604,12 @@ void ide_unregister(unsigned int index)
 
/* restore hwif data to pristine status */
ide_init_port_data(hwif, index);
-   init_hwif_default(hwif, index);
 
-   ide_hwif_restore(hwif, &tmp_hwif);
+   if (init_default)
+   init_hwif_default(hwif, index);
+
+   if (restore)
+   ide_hwif_restore(hwif, &tmp_hwif);
 
 abort:
spin_unlock_irq(&ide_lock);
@@ -710,12 +715,12 @@ int ide_register_hw(hw_regs_t *hw, void 
goto found;
}
for (index = 0; index < MAX_HWIFS; index++)
-   ide_unregister(index);
+   ide_unregister(index, 1, 1);
} while (retry--);
return -1;
 found:
if (hwif->present)
-   ide_unregister(index);
+   ide_unregister(index, 0, 1);
else if (!hwif->hold)
ide_init_port_data(hwif, index);
 
@@ -1058,7 +1063,7 @@ int generic_ide_ioctl(ide_drive_t *drive
case HDIO_UNREGISTER_HWIF:
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
/* (arg > MAX_HWIFS) checked in function */
-   ide_unregister(arg);
+   ide_unregister(arg, 1, 1);
return 0;
case HDIO_SET_NICE:
if (!capable(CAP_SYS_ADMIN)) return -EACCES;
@@ -1703,7 +1708,7 @@ void __exit cleanup_module (void)
int index;
 
for (index = 0; index < MAX_HWIFS; ++index)
-   ide_unregister(index);
+   ide_unregister(index, 0, 0);
 
proc_ide_destroy();
 
Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -337,7 +337,7 @@ void ide_release(struct pcmcia_device *l
 if (info->ndev) {
/* FIXME: if this fails we need to queue the cleanup somehow
   -- need to investigate the required PCMCIA magic */
-   ide_unregister

[PATCH 04/22] ide: add ide_deprecated_find_port() helper

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out code for finding ide_hwifs[] slot from ide_register_hw()
  to ide_deprecated_find_port().

* Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add()
  instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop
  which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot
  cannot be find).

This patch leaves us with only two ide_register_hw() users:
- drivers/macintosh/mediabay.c
- drivers/ide/ide.c

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/arm/bast-ide.c  |   20 +++-
 drivers/ide/ide.c   |   41 +
 drivers/ide/legacy/ide-cs.c |   25 -
 drivers/ide/pci/delkin_cb.c |   33 +++--
 include/linux/ide.h |1 +
 5 files changed, 100 insertions(+), 20 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -28,8 +28,10 @@ static int __init
 bastide_register(unsigned int base, unsigned int aux, int irq,
 ide_hwif_t **hwif)
 {
+   ide_hwif_t *hwif;
hw_regs_t hw;
int i;
+   u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
memset(&hw, 0, sizeof(hw));
 
@@ -44,8 +46,24 @@ bastide_register(unsigned int base, unsi
hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20);
hw.irq = irq;
 
-   ide_register_hw(&hw, NULL, hwif);
+   hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+   if (hwif == NULL)
+   goto out;
 
+   i = hwif->index;
+
+   if (hwif->present)
+   ide_unregister(i, 0, 1);
+   else if (!hwif->hold)
+   ide_init_port_data(hwif, i);
+
+   ide_init_port_hw(hwif, &hw);
+   hwif->quirkproc = NULL;
+
+   idx[0] = i;
+
+   ide_device_add(idx, NULL);
+out:
return 0;
 }
 
Index: b/drivers/ide/ide.c
===
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -683,6 +683,31 @@ void ide_init_port_hw(ide_hwif_t *hwif, 
 }
 EXPORT_SYMBOL_GPL(ide_init_port_hw);
 
+ide_hwif_t *ide_deprecated_find_port(unsigned long base)
+{
+   ide_hwif_t *hwif;
+   int i;
+
+   for (i = 0; i < MAX_HWIFS; i++) {
+   hwif = &ide_hwifs[i];
+   if (hwif->io_ports[IDE_DATA_OFFSET] == base)
+   goto found;
+   }
+
+   for (i = 0; i < MAX_HWIFS; i++) {
+   hwif = &ide_hwifs[i];
+   if (hwif->hold)
+   continue;
+   if (!hwif->present && hwif->mate == NULL)
+   goto found;
+   }
+
+   hwif = NULL;
+found:
+   return hwif;
+}
+EXPORT_SYMBOL_GPL(ide_deprecated_find_port);
+
 /**
  * ide_register_hw -   register IDE interface
  * @hw: hardware registers
@@ -702,18 +727,10 @@ int ide_register_hw(hw_regs_t *hw, void 
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
do {
-   for (index = 0; index < MAX_HWIFS; ++index) {
-   hwif = &ide_hwifs[index];
-   if (hwif->io_ports[IDE_DATA_OFFSET] == 
hw->io_ports[IDE_DATA_OFFSET])
-   goto found;
-   }
-   for (index = 0; index < MAX_HWIFS; ++index) {
-   hwif = &ide_hwifs[index];
-   if (hwif->hold)
-   continue;
-   if (!hwif->present && hwif->mate == NULL)
-   goto found;
-   }
+   hwif = ide_deprecated_find_port(hw->io_ports[IDE_DATA_OFFSET]);
+   index = hwif->index;
+   if (hwif)
+   goto found;
for (index = 0; index < MAX_HWIFS; index++)
ide_unregister(index, 1, 1);
} while (retry--);
Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -145,13 +145,36 @@ static void ide_detach(struct pcmcia_dev
 
 static int idecs_register(unsigned long io, unsigned long ctl, unsigned long 
irq, struct pcmcia_device *handle)
 {
+ide_hwif_t *hwif;
 hw_regs_t hw;
+int i;
+u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
+
 memset(&hw, 0, sizeof(hw));
 ide_init_hwif_ports(&hw, io, ctl, NULL);
 hw.irq = irq;
 hw.chipset = ide_pci;
 hw.dev = &handle->dev;
-return ide_register_hw(&hw, &ide_undecoded_slave, NULL);
+
+hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
+if (hwif == NULL)
+   return -1;
+
+i = hwif->index;
+
+if (hwif->present)
+   ide_unregister(i, 0, 1);
+else if (!hwif->hold)
+   ide_init_port_data(hwif, i);
+
+ide_init_port_hw(hwif, &hw);
+hwi

[PATCH 05/22] ide: fix ide_unregister() usage in host drivers

2008-01-16 Thread Bartlomiej Zolnierkiewicz
bast-ide.c/ide-cs.c/delkin_cb.c:

* Don't set 'restore' flag for ide_unregister() when initializing new
  interface.

rapide.c/ide-pnp.c/ide-cs.c/ide_platform.c/au1xxx-ide.c/delkin_cb.c/scc_pata.c:

* Don't set 'init_default' and 'restore' flags for ide_unregister() when
  removing interface.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/arm/bast-ide.c|2 +-
 drivers/ide/arm/rapide.c  |2 +-
 drivers/ide/ide-pnp.c |2 +-
 drivers/ide/legacy/ide-cs.c   |4 ++--
 drivers/ide/legacy/ide_platform.c |2 +-
 drivers/ide/mips/au1xxx-ide.c |2 +-
 drivers/ide/pci/delkin_cb.c   |4 ++--
 drivers/ide/pci/scc_pata.c|2 +-
 8 files changed, 10 insertions(+), 10 deletions(-)

Index: b/drivers/ide/arm/bast-ide.c
===
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -53,7 +53,7 @@ bastide_register(unsigned int base, unsi
i = hwif->index;
 
if (hwif->present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
else if (!hwif->hold)
ide_init_port_data(hwif, i);
 
Index: b/drivers/ide/arm/rapide.c
===
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -76,7 +76,7 @@ static void __devexit rapide_remove(stru
 
ecard_set_drvdata(ec, NULL);
 
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
 
ecard_release_resources(ec);
 }
Index: b/drivers/ide/ide-pnp.c
===
--- a/drivers/ide/ide-pnp.c
+++ b/drivers/ide/ide-pnp.c
@@ -62,7 +62,7 @@ static void idepnp_remove(struct pnp_dev
ide_hwif_t *hwif = pnp_get_drvdata(dev);
 
if (hwif)
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
else
printk(KERN_ERR "idepnp: Unable to remove device, please 
report.\n");
 }
Index: b/drivers/ide/legacy/ide-cs.c
===
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -163,7 +163,7 @@ static int idecs_register(unsigned long 
 i = hwif->index;
 
 if (hwif->present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
 else if (!hwif->hold)
ide_init_port_data(hwif, i);
 
@@ -360,7 +360,7 @@ void ide_release(struct pcmcia_device *l
 if (info->ndev) {
/* FIXME: if this fails we need to queue the cleanup somehow
   -- need to investigate the required PCMCIA magic */
-   ide_unregister(info->hd, 1, 1);
+   ide_unregister(info->hd, 0, 0);
 }
 info->ndev = 0;
 
Index: b/drivers/ide/legacy/ide_platform.c
===
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -122,7 +122,7 @@ static int __devexit plat_ide_remove(str
 {
ide_hwif_t *hwif = pdev->dev.driver_data;
 
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
 
return 0;
 }
Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -678,7 +678,7 @@ static int au_ide_remove(struct device *
ide_hwif_t *hwif = dev_get_drvdata(dev);
_auide_hwif *ahwif = &auide_hwif;
 
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
 
iounmap((void *)ahwif->regbase);
 
Index: b/drivers/ide/pci/delkin_cb.c
===
--- a/drivers/ide/pci/delkin_cb.c
+++ b/drivers/ide/pci/delkin_cb.c
@@ -85,7 +85,7 @@ delkin_cb_probe (struct pci_dev *dev, co
i = hwif->index;
 
if (hwif->present)
-   ide_unregister(i, 0, 1);
+   ide_unregister(i, 0, 0);
else if (!hwif->hold)
ide_init_port_data(hwif, i);
 
@@ -120,7 +120,7 @@ delkin_cb_remove (struct pci_dev *dev)
ide_hwif_t *hwif = pci_get_drvdata(dev);
 
if (hwif)
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
 
pci_disable_device(dev);
 }
Index: b/drivers/ide/pci/scc_pata.c
===
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -736,7 +736,7 @@ static void __devexit scc_remove(struct 
hwif->dmatable_cpu = NULL;
}
 
-   ide_unregister(hwif->index, 1, 1);
+   ide_unregister(hwif->index, 0, 0);
 
hwif->chipset = ide_unknown;
iounmap((void*)ports->dma);
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
Mor

[PATCH 06/22] ide: factor out code initializing devices from ide_init_port()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out code initializing devices from ide_init_port() to
  ide_port_init_devices().

* Call the new function from ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1289,6 +1289,22 @@ static void hwif_register_devices(ide_hw
}
 }
 
+static void ide_port_init_devices(ide_hwif_t *hwif)
+{
+   int i;
+
+   for (i = 0; i < MAX_DRIVES; i++) {
+   ide_drive_t *drive = &hwif->drives[i];
+
+   if (hwif->host_flags & IDE_HFLAG_IO_32BIT)
+   drive->io_32bit = 1;
+   if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS)
+   drive->unmask = 1;
+   if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0)
+   drive->autotune = 1;
+   }
+}
+
 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
  const struct ide_port_info *d)
 {
@@ -1314,16 +1330,6 @@ static void ide_init_port(ide_hwif_t *hw
if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
hwif->mate->serialized = hwif->serialized = 1;
 
-   if (d->host_flags & IDE_HFLAG_IO_32BIT) {
-   hwif->drives[0].io_32bit = 1;
-   hwif->drives[1].io_32bit = 1;
-   }
-
-   if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
-   hwif->drives[0].unmask = 1;
-   hwif->drives[1].unmask = 1;
-   }
-
hwif->swdma_mask = d->swdma_mask;
hwif->mwdma_mask = d->mwdma_mask;
hwif->ultra_mask = d->udma_mask;
@@ -1332,11 +1338,6 @@ static void ide_init_port(ide_hwif_t *hw
if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0)
hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0;
 
-   if ((d->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0) {
-   hwif->drives[0].autotune = 1;
-   hwif->drives[1].autotune = 1;
-   }
-
if (d->host_flags & IDE_HFLAG_RQSIZE_256)
hwif->rqsize = 256;
 
@@ -1371,6 +1372,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
mate = (i & 1) ? NULL : hwif;
 
ide_init_port(hwif, i & 1, d);
+   ide_port_init_devices(hwif);
}
 
for (i = 0; i < MAX_HWIFS; i++) {
-
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 07/22] ide: add IDE_HFLAG_NO_{IO32_BIT,UNMASK_IRQS} host flags

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Use the same bit for IDE_HFLAG_CS5520 and IDE_HFLAG_VDMA host flags
  (both are used only by cs5520 host driver currently).

* Add IDE_HFLAG_NO_IO32_BIT host flag and use it instead of ->no_io_32bit
  ide_hwif_t field.

* Add IDE_HFLAG_NO_UNMASK_IRQS host flag, then convert dtc2278 and rz1000
  host drivers to use it.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c   |4 +++-
 drivers/ide/legacy/dtc2278.c  |   10 +++---
 drivers/ide/mips/au1xxx-ide.c |3 +--
 drivers/ide/pci/rz1000.c  |3 +--
 include/linux/ide.h   |   13 -
 5 files changed, 16 insertions(+), 17 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -822,7 +822,7 @@ static void ide_port_tune_devices(ide_hw
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
 
-   if (hwif->no_io_32bit)
+   if (hwif->host_flags & IDE_HFLAG_NO_IO_32BIT)
drive->no_io_32bit = 1;
else
drive->no_io_32bit = drive->id->dword_io ? 1 : 0;
@@ -1300,6 +1300,8 @@ static void ide_port_init_devices(ide_hw
drive->io_32bit = 1;
if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS)
drive->unmask = 1;
+   if (hwif->host_flags & IDE_HFLAG_NO_UNMASK_IRQS)
+   drive->no_unmask = 1;
if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0)
drive->autotune = 1;
}
Index: b/drivers/ide/legacy/dtc2278.c
===
--- a/drivers/ide/legacy/dtc2278.c
+++ b/drivers/ide/legacy/dtc2278.c
@@ -89,7 +89,10 @@ static void dtc2278_set_pio_mode(ide_dri
 static const struct ide_port_info dtc2278_port_info __initdata = {
.chipset= ide_dtc2278,
.host_flags = IDE_HFLAG_SERIALIZE |
+ IDE_HFLAG_NO_UNMASK_IRQS |
  IDE_HFLAG_IO_32BIT |
+ /* disallow ->io_32bit changes */
+ IDE_HFLAG_NO_IO_32BIT |
  IDE_HFLAG_NO_DMA |
  IDE_HFLAG_NO_AUTOTUNE,
.pio_mask   = ATA_PIO4,
@@ -125,14 +128,7 @@ static int __init dtc2278_probe(void)
 #endif
local_irq_restore(flags);
 
-   hwif->no_io_32bit = 1;  /* disallow ->io_32bit changes */
hwif->set_pio_mode = &dtc2278_set_pio_mode;
-   hwif->drives[0].no_unmask = 1;
-   hwif->drives[1].no_unmask = 1;
-
-   mate->no_io_32bit = 1;
-   mate->drives[0].no_unmask = 1;
-   mate->drives[1].no_unmask = 1;
 
ide_device_add(idx, &dtc2278_port_info);
 
Index: b/drivers/ide/mips/au1xxx-ide.c
===
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -551,6 +551,7 @@ static void auide_setup_ports(hw_regs_t 
 static const struct ide_port_info au1xxx_port_info = {
.host_flags = IDE_HFLAG_POST_SET_MODE |
  IDE_HFLAG_NO_DMA | /* no SFF-style DMA */
+ IDE_HFLAG_NO_IO_32BIT |
  IDE_HFLAG_UNMASK_IRQS,
.pio_mask   = ATA_PIO4,
 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA
@@ -649,8 +650,6 @@ static int au_ide_probe(struct device *d
hwif->select_data   = 0;/* no chipset-specific code */
hwif->config_data   = 0;/* no chipset-specific code */
 
-   hwif->no_io_32bit   = 1;
-
auide_hwif.hwif = hwif;
hwif->hwif_data = &auide_hwif;
 
Index: b/drivers/ide/pci/rz1000.c
===
--- a/drivers/ide/pci/rz1000.c
+++ b/drivers/ide/pci/rz1000.c
@@ -33,8 +33,7 @@ static void __devinit init_hwif_rz1000 (
} else {
if (hwif->mate)
hwif->mate->serialized = hwif->serialized = 1;
-   hwif->drives[0].no_unmask = 1;
-   hwif->drives[1].no_unmask = 1;
+   hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS;
printk(KERN_INFO "%s: serialized, disabled unmasking "
"(buggy RZ1000/RZ1001)\n", hwif->name);
}
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -607,7 +607,6 @@ typedef struct hwif_s {
unsignedreset  : 1; /* reset after probe */
unsignedauto_poll  : 1; /* supports nop auto-po

[PATCH 08/22] ide: add ->init_port_devs method to ide_hwif_t

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Add ->init_port_devs method to ide_hwif_t for a host specific
  initialization of devices on a port.  Call the new method from
  ide_port_init_devices().

* Convert ht6560b, qd65xx and opti621 host drivers to use the new
  ->init_port_devs method.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c  |3 ++
 drivers/ide/legacy/ht6560b.c |   26 +
 drivers/ide/legacy/qd65xx.c  |   44 ---
 drivers/ide/pci/opti621.c|   10 ++---
 include/linux/ide.h  |2 +
 5 files changed, 59 insertions(+), 26 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1305,6 +1305,9 @@ static void ide_port_init_devices(ide_hw
if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0)
drive->autotune = 1;
}
+
+   if (hwif->port_init_devs)
+   hwif->port_init_devs(hwif);
 }
 
 static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
Index: b/drivers/ide/legacy/ht6560b.c
===
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -300,6 +300,18 @@ static void ht6560b_set_pio_mode(ide_dri
 #endif
 }
 
+static void __init ht6560b_port_init_devs(ide_hwif_t *hwif)
+{
+   /* Setting default configurations for drives. */
+   int t = (HT_CONFIG_DEFAULT << 8) | HT_TIMING_DEFAULT;
+
+   if (hwif->channel)
+   t |= (HT_SECONDARY_IF << 8);
+
+   hwif->drives[0].drive_data = t;
+   hwif->drives[1].drive_data = t;
+}
+
 int probe_ht6560b = 0;
 
 module_param_named(probe, probe_ht6560b, bool, 0);
@@ -318,7 +330,6 @@ static int __init ht6560b_init(void)
 {
ide_hwif_t *hwif, *mate;
static u8 idx[4] = { 0, 1, 0xff, 0xff };
-   int t;
 
if (probe_ht6560b == 0)
return -ENODEV;
@@ -343,17 +354,8 @@ static int __init ht6560b_init(void)
mate->selectproc = &ht6560b_selectproc;
mate->set_pio_mode = &ht6560b_set_pio_mode;
 
-   /*
-* Setting default configurations for drives
-*/
-   t = (HT_CONFIG_DEFAULT << 8);
-   t |= HT_TIMING_DEFAULT;
-   hwif->drives[0].drive_data = t;
-   hwif->drives[1].drive_data = t;
-
-   t |= (HT_SECONDARY_IF << 8);
-   mate->drives[0].drive_data = t;
-   mate->drives[1].drive_data = t;
+   hwif->port_init_devs = ht6560b_port_init_devs;
+   mate->port_init_devs = ht6560b_port_init_devs;
 
ide_device_add(idx, &ht6560b_port_info);
 
Index: b/drivers/ide/legacy/qd65xx.c
===
--- a/drivers/ide/legacy/qd65xx.c
+++ b/drivers/ide/legacy/qd65xx.c
@@ -305,13 +305,33 @@ static int __init qd_testreg(int port)
  * called to setup an ata channel : adjusts attributes & links for tuning
  */
 
-static void __init qd_setup(ide_hwif_t *hwif, int base, int config,
-   unsigned int data0, unsigned int data1)
+static void __init qd_setup(ide_hwif_t *hwif, int base, int config)
 {
hwif->select_data = base;
hwif->config_data = config;
-   hwif->drives[0].drive_data = data0;
-   hwif->drives[1].drive_data = data1;
+}
+
+static void __init qd6500_port_init_devs(ide_hwif_t *hwif)
+{
+   u8 base = hwif->select_data, config = QD_CONFIG(hwif);
+
+   hwif->drives[0].drive_data = QD6500_DEF_DATA;
+   hwif->drives[1].drive_data = QD6500_DEF_DATA;
+}
+
+static void __init qd6580_port_init_devs(ide_hwif_t *hwif)
+{
+   u16 t1, t2;
+   u8 base = hwif->select_data, config = QD_CONFIG(hwif);
+
+   if (QD_CONTROL(hwif) & QD_CONTR_SEC_DISABLED) {
+   t1 = QD6580_DEF_DATA;
+   t2 = QD6580_DEF_DATA2;
+   } else
+   t2 = t1 = hwif->channel ? QD6580_DEF_DATA2 : QD6580_DEF_DATA;
+
+   hwif->drives[0].drive_data = t1;
+   hwif->drives[1].drive_data = t2;
 }
 
 /*
@@ -396,8 +416,9 @@ static int __init qd_probe(int base)
return 1;
}
 
-   qd_setup(hwif, base, config, QD6500_DEF_DATA, QD6500_DEF_DATA);
+   qd_setup(hwif, base, config);
 
+   hwif->port_init_devs = qd6500_port_init_devs;
hwif->set_pio_mode = &qd6500_set_pio_mode;
 
idx[unit] = unit;
@@ -429,9 +450,10 @@ static int __init qd_probe(int base)
hwif = &ide_hwifs[unit];
printk(KERN_INFO "%s: qd6580: single IDE board\n",
 hwif->name);
-   qd_setup(hwif, base, config | (control << 8),
-QD6580_DEF_DATA, QD6580_DEF_DATA2);
 
+   qd_setup(hwif, base, config | (control << 

[PATCH 09/22] ide: remove incorrect init_gendisk() comment

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |6 --
 1 file changed, 6 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1182,12 +1182,6 @@ static void drive_release_dev (struct de
complete(&drive->gendev_rel_comp);
 }
 
-/*
- * init_gendisk() (as opposed to ide_geninit) is called for each major device,
- * after probing for drives, to allocate partition tables and other data
- * structures needed for the routines in genhd.c.  ide_geninit() gets called
- * somewhat later, during the partition check.
- */
 static void init_gendisk (ide_hwif_t *hwif)
 {
unsigned int unit;
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/22] ide: skip not present devices in init_gendisk()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
No need to initialize drive->gendev and waste memory on IDE settings
for not present devices.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |4 
 1 file changed, 4 insertions(+)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1194,6 +1194,10 @@ static void init_gendisk (ide_hwif_t *hw
 
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t * drive = &hwif->drives[unit];
+
+   if (!drive->present)
+   continue;
+
ide_add_generic_settings(drive);
snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
 hwif->index,unit);
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/22] ide: move blk_register_region() call out from init_gendisk()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move blk_register_region() call out from init_gendisk() to hwif_init().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1200,8 +1200,6 @@ static void init_gendisk (ide_hwif_t *hw
drive->gendev.driver_data = drive;
drive->gendev.release = drive_release_dev;
}
-   blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
-   THIS_MODULE, ata_probe, ata_lock, hwif);
 }
 
 static int hwif_init(ide_hwif_t *hwif)
@@ -1261,6 +1259,8 @@ static int hwif_init(ide_hwif_t *hwif)
 
 done:
init_gendisk(hwif);
+   blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
+   THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
return 1;
 
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/22] ide: call init_gendisk() after ide_acpi_init()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1258,10 +1258,10 @@ static int hwif_init(ide_hwif_t *hwif)
hwif->name, hwif->irq);
 
 done:
-   init_gendisk(hwif);
blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
+   init_gendisk(hwif);
return 1;
 
 out:
-
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 13/22] ide: merge init_gendisk() into hwif_register_devices()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   44 
 1 file changed, 16 insertions(+), 28 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1182,26 +1182,6 @@ static void drive_release_dev (struct de
complete(&drive->gendev_rel_comp);
 }
 
-static void init_gendisk (ide_hwif_t *hwif)
-{
-   unsigned int unit;
-
-   for (unit = 0; unit < MAX_DRIVES; ++unit) {
-   ide_drive_t * drive = &hwif->drives[unit];
-
-   if (!drive->present)
-   continue;
-
-   ide_add_generic_settings(drive);
-   snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
-hwif->index,unit);
-   drive->gendev.parent = &hwif->gendev;
-   drive->gendev.bus = &ide_bus_type;
-   drive->gendev.driver_data = drive;
-   drive->gendev.release = drive_release_dev;
-   }
-}
-
 static int hwif_init(ide_hwif_t *hwif)
 {
int old_irq;
@@ -1261,7 +1241,6 @@ done:
blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
ide_acpi_init(hwif);
-   init_gendisk(hwif);
return 1;
 
 out:
@@ -1275,15 +1254,24 @@ static void hwif_register_devices(ide_hw
 
for (i = 0; i < MAX_DRIVES; i++) {
ide_drive_t *drive = &hwif->drives[i];
+   struct device *dev = &drive->gendev;
+   int ret;
 
-   if (drive->present) {
-   int ret = device_register(&drive->gendev);
+   if (!drive->present)
+   continue;
 
-   if (ret < 0)
-   printk(KERN_WARNING "IDE: %s: "
-   "device_register error: %d\n",
-   __FUNCTION__, ret);
-   }
+   ide_add_generic_settings(drive);
+
+   snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i);
+   dev->parent = &hwif->gendev;
+   dev->bus = &ide_bus_type;
+   dev->driver_data = drive;
+   dev->release = drive_release_dev;
+
+   ret = device_register(dev);
+   if (ret < 0)
+   printk(KERN_WARNING "IDE: %s: device_register error: "
+   "%d\n", __func__, ret);
}
 }
 
-
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 14/22] ide: move hwif->rqsize init from ide_init_queue() to init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move hwif->rqsize init from ide_init_queue() to init_irq().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -881,13 +881,6 @@ static int ide_init_queue(ide_drive_t *d
q->queuedata = drive;
blk_queue_segment_boundary(q, 0x);
 
-   if (!hwif->rqsize) {
-   if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
-   (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA))
-   hwif->rqsize = 256;
-   else
-   hwif->rqsize = 65536;
-   }
if (hwif->rqsize < max_sectors)
max_sectors = hwif->rqsize;
blk_queue_max_sectors(q, max_sectors);
@@ -1019,6 +1012,14 @@ static int init_irq (ide_hwif_t *hwif)
goto out_unlink;
}
 
+   if (!hwif->rqsize) {
+   if ((hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
+   (hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA))
+   hwif->rqsize = 256;
+   else
+   hwif->rqsize = 65536;
+   }
+
/*
 * For any present drive:
 * - allocate the block device queue
-
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 15/22] ide: factor out adding drive to hwgroup from init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -911,6 +911,23 @@ static int ide_init_queue(ide_drive_t *d
return 0;
 }
 
+static void ide_add_drive_to_hwgroup(ide_drive_t *drive)
+{
+   ide_hwgroup_t *hwgroup = drive->hwif->hwgroup;
+
+   spin_lock_irq(&ide_lock);
+   if (!hwgroup->drive) {
+   /* first drive for hwgroup. */
+   drive->next = drive;
+   hwgroup->drive = drive;
+   hwgroup->hwif = HWIF(hwgroup->drive);
+   } else {
+   drive->next = hwgroup->drive->next;
+   hwgroup->drive->next = drive;
+   }
+   spin_unlock_irq(&ide_lock);
+}
+
 /*
  * This routine sets up the irq for an ide interface, and creates a new
  * hwgroup for the irq/hwif if none was previously assigned.
@@ -1033,17 +1050,7 @@ static int init_irq (ide_hwif_t *hwif)
printk(KERN_ERR "ide: failed to init %s\n",drive->name);
continue;
}
-   spin_lock_irq(&ide_lock);
-   if (!hwgroup->drive) {
-   /* first drive for hwgroup. */
-   drive->next = drive;
-   hwgroup->drive = drive;
-   hwgroup->hwif = HWIF(hwgroup->drive);
-   } else {
-   drive->next = hwgroup->drive->next;
-   hwgroup->drive->next = drive;
-   }
-   spin_unlock_irq(&ide_lock);
+   ide_add_drive_to_hwgroup(drive);
}
 
 #if !defined(__mc68000__) && !defined(CONFIG_APUS)
-
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 16/22] ide: factor out devices setup from init_irq()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out devices setup from init_irq() to ide_port_setup_devices().

While at it:
* Do devices setup after printing port information.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |   44 
 1 file changed, 28 insertions(+), 16 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -929,6 +929,31 @@ static void ide_add_drive_to_hwgroup(ide
 }
 
 /*
+ * For any present drive:
+ * - allocate the block device queue
+ * - link drive into the hwgroup
+ */
+static void ide_port_setup_devices(ide_hwif_t *hwif)
+{
+   int i;
+
+   for (i = 0; i < MAX_DRIVES; i++) {
+   ide_drive_t *drive = &hwif->drives[i];
+
+   if (!drive->present)
+   continue;
+
+   if (ide_init_queue(drive)) {
+   printk(KERN_ERR "ide: failed to init %s\n",
+   drive->name);
+   continue;
+   }
+
+   ide_add_drive_to_hwgroup(drive);
+   }
+}
+
+/*
  * This routine sets up the irq for an ide interface, and creates a new
  * hwgroup for the irq/hwif if none was previously assigned.
  *
@@ -1037,22 +1062,6 @@ static int init_irq (ide_hwif_t *hwif)
hwif->rqsize = 65536;
}
 
-   /*
-* For any present drive:
-* - allocate the block device queue
-* - link drive into the hwgroup
-*/
-   for (index = 0; index < MAX_DRIVES; ++index) {
-   ide_drive_t *drive = &hwif->drives[index];
-   if (!drive->present)
-   continue;
-   if (ide_init_queue(drive)) {
-   printk(KERN_ERR "ide: failed to init %s\n",drive->name);
-   continue;
-   }
-   ide_add_drive_to_hwgroup(drive);
-   }
-
 #if !defined(__mc68000__) && !defined(CONFIG_APUS)
printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
hwif->io_ports[IDE_DATA_OFFSET],
@@ -1066,6 +1075,9 @@ static int init_irq (ide_hwif_t *hwif)
printk(" (%sed with %s)",
hwif->sharing_irq ? "shar" : "serializ", match->name);
printk("\n");
+
+   ide_port_setup_devices(hwif);
+
mutex_unlock(&ide_cfg_mtx);
return 0;
 out_unlink:
-
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 17/22] ide: move ide_acpi_init() call to ide_device_add_all()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1260,7 +1260,6 @@ static int hwif_init(ide_hwif_t *hwif)
 done:
blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS,
THIS_MODULE, ata_probe, ata_lock, hwif);
-   ide_acpi_init(hwif);
return 1;
 
 out:
@@ -1429,6 +1428,8 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
rc = -1;
continue;
}
+
+   ide_acpi_init(hwif);
}
 
for (i = 0; i < MAX_HWIFS; i++) {
-
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 18/22] ide-acpi: remove needless exports

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-acpi.c |4 
 1 file changed, 4 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -494,7 +494,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drive
 
return ret;
 }
-EXPORT_SYMBOL_GPL(ide_acpi_exec_tfs);
 
 /**
  * ide_acpi_get_timing - get the channel (controller) timings
@@ -580,7 +579,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwi
 
kfree(output.pointer);
 }
-EXPORT_SYMBOL_GPL(ide_acpi_get_timing);
 
 /**
  * ide_acpi_push_timing - set the channel (controller) timings
@@ -634,7 +632,6 @@ void ide_acpi_push_timing(ide_hwif_t *hw
}
DEBPRINT("_STM status: %d\n", status);
 }
-EXPORT_SYMBOL_GPL(ide_acpi_push_timing);
 
 /**
  * ide_acpi_set_state - set the channel power state
@@ -762,4 +759,3 @@ void ide_acpi_init(ide_hwif_t *hwif)
}
}
 }
-EXPORT_SYMBOL_GPL(ide_acpi_init);
-
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 19/22] ide-acpi: remove dead code from do_drive_get_GTF()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
These pointers are always setup in ide_acpi_init().

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-acpi.c |   10 --
 1 file changed, 10 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -280,16 +280,6 @@ static int do_drive_get_GTF(ide_drive_t 
 
port = hwif->channel ? drive->dn - 2: drive->dn;
 
-   if (!drive->acpidata) {
-   if (port == 0) {
-   drive->acpidata = &hwif->acpidata->master;
-   hwif->acpidata->master.drive = drive;
-   } else {
-   drive->acpidata = &hwif->acpidata->slave;
-   hwif->acpidata->slave.drive = drive;
-   }
-   }
-
DEBPRINT("ENTER: %s at %s, port#: %d, hard_port#: %d\n",
 hwif->name, dev->bus_id, port, hwif->channel);
 
-
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 20/22] ide: factor out devices setup from ide_acpi_init()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Factor out devices setup from ide_acpi_init() to
  ide_acpi_port_init_devices().

* Call ide_acpi_port_init_devices() in ide_device_add_all().

While at it:
* Remove no longer needed 'drive' field from struct ide_acpi_drive_link.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-acpi.c  |   49 +++-
 drivers/ide/ide-probe.c |1 
 include/linux/ide.h |2 +
 3 files changed, 23 insertions(+), 29 deletions(-)

Index: b/drivers/ide/ide-acpi.c
===
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -39,7 +39,6 @@ struct GTM_buffer {
 };
 
 struct ide_acpi_drive_link {
-   ide_drive_t *drive;
acpi_handle  obj_handle;
u8   idbuff[512];
 };
@@ -675,11 +674,6 @@ void ide_acpi_set_state(ide_hwif_t *hwif
  */
 void ide_acpi_init(ide_hwif_t *hwif)
 {
-   int unit;
-   int err;
-   struct ide_acpi_drive_link  *master;
-   struct ide_acpi_drive_link  *slave;
-
ide_acpi_blacklist();
 
hwif->acpidata = kzalloc(sizeof(struct ide_acpi_hwif_link), GFP_KERNEL);
@@ -691,40 +685,38 @@ void ide_acpi_init(ide_hwif_t *hwif)
DEBPRINT("no ACPI object for %s found\n", hwif->name);
kfree(hwif->acpidata);
hwif->acpidata = NULL;
-   return;
}
+}
+
+void ide_acpi_port_init_devices(ide_hwif_t *hwif)
+{
+   ide_drive_t *drive;
+   int i, err;
+
+   if (hwif->acpidata == NULL)
+   return;
 
/*
 * The ACPI spec mandates that we send information
 * for both drives, regardless whether they are connected
 * or not.
 */
-   hwif->acpidata->master.drive = &hwif->drives[0];
hwif->drives[0].acpidata = &hwif->acpidata->master;
-   master = &hwif->acpidata->master;
-
-   hwif->acpidata->slave.drive = &hwif->drives[1];
hwif->drives[1].acpidata = &hwif->acpidata->slave;
-   slave = &hwif->acpidata->slave;
-
 
/*
 * Send IDENTIFY for each drive
 */
-   if (master->drive->present) {
-   err = taskfile_lib_get_identify(master->drive, master->idbuff);
-   if (err) {
-   DEBPRINT("identify device %s failed (%d)\n",
-master->drive->name, err);
-   }
-   }
+   for (i = 0; i < MAX_DRIVES; i++) {
+   drive = &hwif->drives[i];
+
+   if (!drive->present)
+   continue;
 
-   if (slave->drive->present) {
-   err = taskfile_lib_get_identify(slave->drive, slave->idbuff);
-   if (err) {
+   err = taskfile_lib_get_identify(drive, drive->acpidata->idbuff);
+   if (err)
DEBPRINT("identify device %s failed (%d)\n",
-slave->drive->name, err);
-   }
+drive->name, err);
}
 
if (ide_noacpionboot) {
@@ -740,12 +732,11 @@ void ide_acpi_init(ide_hwif_t *hwif)
ide_acpi_get_timing(hwif);
ide_acpi_push_timing(hwif);
 
-   for (unit = 0; unit < MAX_DRIVES; ++unit) {
-   ide_drive_t *drive = &hwif->drives[unit];
+   for (i = 0; i < MAX_DRIVES; i++) {
+   drive = &hwif->drives[i];
 
-   if (drive->present) {
+   if (drive->present)
/* Execute ACPI startup code */
ide_acpi_exec_tfs(drive);
-   }
}
 }
Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1430,6 +1430,7 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
}
 
ide_acpi_init(hwif);
+   ide_acpi_port_init_devices(hwif);
}
 
for (i = 0; i < MAX_HWIFS; i++) {
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1205,12 +1205,14 @@ extern int ide_acpi_exec_tfs(ide_drive_t
 extern void ide_acpi_get_timing(ide_hwif_t *hwif);
 extern void ide_acpi_push_timing(ide_hwif_t *hwif);
 extern void ide_acpi_init(ide_hwif_t *hwif);
+void ide_acpi_port_init_devices(ide_hwif_t *);
 extern void ide_acpi_set_state(ide_hwif_t *hwif, int on);
 #else
 static inline int ide_acpi_exec_tfs(ide_drive_t *drive) { return 0; }
 static inline void ide_acpi_get_timing(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_push_timing(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_init(ide_hwif_t *hwif) { ; }
+static inline void ide_acpi_port_init_devices(ide_hwif_t *hwif) { ; }
 static inline void ide_acpi_set_state(ide_hwif_t *hwif, int on) {}
 #

[PATCH 21/22] ide: move hwif->present check out from ide_proc_register_port()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
Move hwif->present check out from ide_proc_register_port() to
ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |9 +++--
 drivers/ide/ide-proc.c  |3 ---
 2 files changed, 7 insertions(+), 5 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1448,8 +1448,13 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
}
 
for (i = 0; i < MAX_HWIFS; i++) {
-   if (idx[i] != 0xff)
-   ide_proc_register_port(&ide_hwifs[idx[i]]);
+   if (idx[i] == 0xff)
+   continue;
+
+   hwif = &ide_hwifs[idx[i]];
+
+   if (hwif->present)
+   ide_proc_register_port(hwif);
}
 
return rc;
Index: b/drivers/ide/ide-proc.c
===
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -793,9 +793,6 @@ static ide_proc_entry_t hwif_entries[] =
 
 void ide_proc_register_port(ide_hwif_t *hwif)
 {
-   if (!hwif->present)
-   return;
-
if (!hwif->proc) {
hwif->proc = proc_mkdir(hwif->name, proc_ide_root);
 
-
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 22/22] ide: move create_proc_ide_drives() call to ide_device_add_all()

2008-01-16 Thread Bartlomiej Zolnierkiewicz
* Un-static create_proc_ide_drives() and call it from ide_device_add_all().

While at it:
* Rename create_proc_ide_drives() to ide_proc_port_register_devices().

Signed-off-by: Bartlomiej Zolnierkiewicz <[EMAIL PROTECTED]>
---
 drivers/ide/ide-probe.c |4 +++-
 drivers/ide/ide-proc.c  |4 +---
 include/linux/ide.h |2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)

Index: b/drivers/ide/ide-probe.c
===
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1453,8 +1453,10 @@ int ide_device_add_all(u8 idx[MAX_HWIFS]
 
hwif = &ide_hwifs[idx[i]];
 
-   if (hwif->present)
+   if (hwif->present) {
ide_proc_register_port(hwif);
+   ide_proc_port_register_devices(hwif);
+   }
}
 
return rc;
Index: b/drivers/ide/ide-proc.c
===
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -739,7 +739,7 @@ void ide_proc_unregister_driver(ide_driv
 
 EXPORT_SYMBOL(ide_proc_unregister_driver);
 
-static void create_proc_ide_drives(ide_hwif_t *hwif)
+void ide_proc_port_register_devices(ide_hwif_t *hwif)
 {
int d;
struct proc_dir_entry *ent;
@@ -801,8 +801,6 @@ void ide_proc_register_port(ide_hwif_t *
 
ide_add_proc_entries(hwif->proc, hwif_entries, hwif);
}
-
-   create_proc_ide_drives(hwif);
 }
 
 #ifdef CONFIG_BLK_DEV_IDEPCI
Index: b/include/linux/ide.h
===
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -715,6 +715,7 @@ typedef struct {
 void proc_ide_create(void);
 void proc_ide_destroy(void);
 void ide_proc_register_port(ide_hwif_t *);
+void ide_proc_port_register_devices(ide_hwif_t *);
 void ide_proc_unregister_port(ide_hwif_t *);
 void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
 void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -747,6 +748,7 @@ void ide_pci_create_host_proc(const char
 static inline void proc_ide_create(void) { ; }
 static inline void proc_ide_destroy(void) { ; }
 static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
+static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
 static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
 static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t 
*driver) { ; }
 static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t 
*driver) { ; }
-
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


The SX4 challenge

2008-01-16 Thread Jeff Garzik


Promise just gave permission to post the docs for their PDC20621 (i.e. 
SX4) hardware:

http://gkernel.sourceforge.net/specs/promise/pdc20621-pguide-1.2.pdf.bz2

joining the existing PDC20621 DIMM and PLL docs:
http://gkernel.sourceforge.net/specs/promise/pdc20621-pguide-dimm-1.6.pdf.bz2
http://gkernel.sourceforge.net/specs/promise/pdc20621-pguide-pll-ata-timing-1.2.pdf.bz2


So, the SX4 is now open.  Yay :)  I am hoping to talk Mikael into 
becoming the sata_sx4 maintainer, and finally integrating my 'new-eh' 
conversion in libata-dev.git.


But now is a good time to remind people how lame the sata_sx4 driver 
software really is -- and I should know, I wrote it.


The SX4 hardware, simplified, is three pieces:  XOR engine (for raid5), 
host<->board memcpy engine, and several ATA engines (and some helpful 
transaction sequencing features).  Data for each WRITE command is first 
copied to the board RAM, then the ATA engines DMA to/from the board RAM. 
 Data for each READ command is copied to board RAM via the ATA engines, 
then DMA'd across PCI to your host memory.


Therefore, while it is not hardware RAID, the SX4 provides all the 
pieces necessary to offload RAID1 and RAID5, and handle other RAID 
levels optimally.  RAID1 and 5 copies can be offloaded (provided all 
copies go to SX4-attached devices of course).  RAID5 XOR gen and 
checking can be offloaded, allowing the OS to see a single request, 
while the hardware processes a sequence of low-level requests sent in a 
batch.


This hardware presents an interesting challenge:  it does not really fit 
into software RAID (i.e. no RAID) /or/ hardware RAID categories.  The 
sata_sx4 driver presents the no-RAID configuration, while is terribly 
inefficient:


WRITE:
submit host DMA (copy to board)
host DMA completion via interrupt
submit ATA command
ATA command completion via interrupt
READ:
submit ATA command
ATA command completion via interrupt
submit host DMA (copy from board)
host DMA completion via interrupt

Thus, the "SX4 challenge" is a challenge to developers to figure out the 
most optimal configuration for this hardware, given the existing MD and 
DM work going on.


Now, it must be noted that the SX4 is not current-gen technology.  Most 
vendors have moved towards an "IOP" model, where the hw vendor puts most 
of their hard work into an ARM/MIPS firmware, running on an embedded 
chip specially tuned for storage purposes.  (ref "hptiop" and "stex" 
drivers, very very small SCSI drivers)


I know Dan Williams @ Intel is working on very similar issues on the IOP 
-- async memcpy, XOR offload, etc. -- and I am hoping that, due to that 
current work, some of the good ideas can be reused with the SX4.


Anyway...  it's open, it's interesting, even if it's not current-gen 
tech anymore.  You can probably find them on Ebay or in an 
out-of-the-way computer shop somewhere.


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: The SX4 challenge

2008-01-16 Thread Mark Lord

Jeff Garzik wrote:
..
Thus, the "SX4 challenge" is a challenge to developers to figure out the 
most optimal configuration for this hardware, given the existing MD and 
DM work going on.

..

This sort of RAID optimization hardware is not unique to the SX4,
so hopefully we can work out a way to take advantage of similar/different
RAID throughput features of other chipsets too (eventually).

This could be a good topic for discussion/beer in San Jose next month..

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: [sata] Anybody have a PDF converter?

2008-01-16 Thread Mark Lord

Jeff Garzik wrote:

Promise got me an open, non-NDA'd version of the SX4 (sata_sx4) docs:
http://gtf.org/garzik/misc/PDC20621%20Programming%20Guide%20for%20Fastrak%20SX4_1.2_no_water_mark.doc.bz2 



Unfortunately, they are in MS Word format and my OpenOffice refuses to 
import it.


Would anyone out there be willing to do a nice conversion to PDF, so 
that I may post it permanently at 
http://gkernel.sourceforge.net/specs/promise/ ?

..

I've already done this and emailed Jeff.

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: [sata] Anybody have a PDF converter?

2008-01-16 Thread Jeff Garzik

Posted as
http://gkernel.sourceforge.net/specs/promise/pdc20621-pguide-1.2.pdf.bz2

Thanks all!

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


[PATCH #upstream-fixes] ata_piix: Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.

2008-01-16 Thread Peter Schwenke
From: Peter Schwenke <[EMAIL PROTECTED]>

Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.  This is
from OSDL bug 7780.

Signed-off-by: Peter Schwenke <[EMAIL PROTECTED]>
---
 drivers/ata/ata_piix.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index bb62a58..867a263 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -988,6 +988,13 @@ static int piix_broken_suspend(void)
},
},
{
+   .ident = "TECRA M6",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M6"),
+   },
+   },
+   {
.ident = "TECRA M7",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
@@ -1002,6 +1009,13 @@ static int piix_broken_suspend(void)
},
},
{
+   .ident = "Satellite R20",
+   .matches = {
+   DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+   DMI_MATCH(DMI_PRODUCT_NAME, "Satellite R20"),
+   },
+   },
+   {
.ident = "Satellite R25",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-- 
1.5.2.5
-
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 #upstream-fixes] ata_piix: Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.

2008-01-16 Thread Tejun Heo
Peter Schwenke wrote:
> From: Peter Schwenke <[EMAIL PROTECTED]>
> 
> Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.  This is
> from OSDL bug 7780.
> 
> Signed-off-by: Peter Schwenke <[EMAIL PROTECTED]>

Acked-by: Tejun Heo <[EMAIL PROTECTED]>

If Toshiba is still doing this for their new products.  We either need a
better way to blacklist them or contact and tell them to stop what
they're doing.  Does anyone have a Toshiba contact?

Thanks.

-- 
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 #upstream-fixes] ata_piix: Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.

2008-01-16 Thread Peter Schwenke
Tejun Heo wrote:
> If Toshiba is still doing this for their new products.  We either need a
> better way to blacklist them or contact and tell them to stop what
> they're doing.  Does anyone have a Toshiba contact?
> 

I've been thinking the same thing.  It appears that all their newer
laptops are doing this - and they have a lot of models.

So we probably do need a better method of blacklisting them and also let
Toshiba know.

I have found a contact for engineering at [EMAIL PROTECTED]
from http://linux.toshiba-dme.co.jp/linux/eng/contact.htm.

I'm willing to send them some mail if nobody else wants to or they have
an "inside" contact.

I also realised I didn't give attribution to Matt Piermarini  for the M6
  lines in my comment.

-- 
  ...Peter
-
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 #upstream-fixes] ata_piix: Add Toshiba Satellite R20 and Tecra M6 to broken suspend list.

2008-01-16 Thread Tejun Heo
Peter Schwenke wrote:
> Tejun Heo wrote:
>> If Toshiba is still doing this for their new products.  We either need a
>> better way to blacklist them or contact and tell them to stop what
>> they're doing.  Does anyone have a Toshiba contact?
>>
> 
> I've been thinking the same thing.  It appears that all their newer
> laptops are doing this - and they have a lot of models.
> 
> So we probably do need a better method of blacklisting them and also let
> Toshiba know.
> 
> I have found a contact for engineering at [EMAIL PROTECTED]
> from http://linux.toshiba-dme.co.jp/linux/eng/contact.htm.
> 
> I'm willing to send them some mail if nobody else wants to or they have
> an "inside" contact.

Yes, please go ahead and cc me and Jeff.

> I also realised I didn't give attribution to Matt Piermarini  for the M6
>   lines in my comment.

Feel free to post updated version.

Thanks.

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