* [patch 05/30] pcmcia - spot slave decode flaws (for testing)
@ 2007-03-06 10:37 akpm
2007-03-06 11:44 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2007-03-06 10:37 UTC (permalink / raw)
To: jeff; +Cc: linux-ide, akpm, alan, alan
From: Alan <alan@lxorguk.ukuu.org.uk>
If you've got a CF adapter or PCMCIA disc which shows up twice in libata
pata_pcmcia can you try this patch on top of the updates posted. It tries
to spot when the slave is a mirror of the master and to fix up problems
that causes.
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/ata/pata_pcmcia.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff -puN drivers/ata/pata_pcmcia.c~pcmcia-spot-slave-decode-flaws-for-testing drivers/ata/pata_pcmcia.c
--- a/drivers/ata/pata_pcmcia.c~pcmcia-spot-slave-decode-flaws-for-testing
+++ a/drivers/ata/pata_pcmcia.c
@@ -54,6 +54,39 @@ struct ata_pcmcia_info {
dev_node_t node;
};
+/**
+ * pcmcia_set_mode - PCMCIA specific mode setup
+ * @ap: Port
+ * @r_failed_dev: Return pointer for failed device
+ *
+ * Perform the tuning and setup of the devices and timings, which
+ * for PCMCIA is the same as any other controller. We wrap it however
+ * as we need to spot hardware with incorrect or missing master/slave
+ * decode, which alas is embarrassingly common in the PC world
+ */
+
+static int pcmcia_set_mode(struct ata_port *ap, struct ata_device **r_failed_dev)
+{
+ struct ata_device *master = &ap->device[0];
+ struct ata_device *slave = &ap->device[1];
+
+ if (!ata_dev_enabled(master) || !ata_dev_enabled(slave))
+ return ata_do_set_mode(ap, r_failed_dev);
+
+ if (memcmp(master->id + ATA_ID_FW_REV, slave->id + ATA_ID_FW_REV,
+ ATA_ID_FW_REV_LEN + ATA_ID_PROD_LEN) == 0)
+ {
+ /* Suspicious match, but could be two cards from
+ the same vendor - check serial */
+ if (memcmp(master->id + ATA_ID_SERNO, slave->id + ATA_ID_SERNO,
+ ATA_ID_SERNO_LEN) == 0 && master->id[ATA_ID_SERNO] >> 8) {
+ ata_dev_printk(slave, KERN_WARNING, "is a ghost device, ignoring.\n");
+ ata_dev_disable(slave);
+ }
+ }
+ return ata_do_set_mode(ap, r_failed_dev);
+}
+
static struct scsi_host_template pcmcia_sht = {
.module = THIS_MODULE,
.name = DRV_NAME,
@@ -73,6 +106,7 @@ static struct scsi_host_template pcmcia_
};
static struct ata_port_operations pcmcia_port_ops = {
+ .set_mode = pcmcia_set_mode,
.port_disable = ata_port_disable,
.tf_load = ata_tf_load,
.tf_read = ata_tf_read,
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 05/30] pcmcia - spot slave decode flaws (for testing)
2007-03-06 10:37 [patch 05/30] pcmcia - spot slave decode flaws (for testing) akpm
@ 2007-03-06 11:44 ` Jeff Garzik
2007-03-06 15:21 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-03-06 11:44 UTC (permalink / raw)
To: akpm; +Cc: linux-ide, alan, alan
akpm@linux-foundation.org wrote:
> From: Alan <alan@lxorguk.ukuu.org.uk>
>
> If you've got a CF adapter or PCMCIA disc which shows up twice in libata
> pata_pcmcia can you try this patch on top of the updates posted. It tries
> to spot when the slave is a mirror of the master and to fix up problems
> that causes.
>
> Signed-off-by: Alan Cox <alan@redhat.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Seems same, but dropped due to "can you try this patch" comments. Let
me know if this actually fixes something...
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch 05/30] pcmcia - spot slave decode flaws (for testing)
2007-03-06 11:44 ` Jeff Garzik
@ 2007-03-06 15:21 ` Alan Cox
0 siblings, 0 replies; 3+ messages in thread
From: Alan Cox @ 2007-03-06 15:21 UTC (permalink / raw)
To: Jeff Garzik; +Cc: akpm, linux-ide, alan
On Tue, 06 Mar 2007 06:44:49 -0500
Jeff Garzik <jeff@garzik.org> wrote:
> akpm@linux-foundation.org wrote:
> > From: Alan <alan@lxorguk.ukuu.org.uk>
> >
> > If you've got a CF adapter or PCMCIA disc which shows up twice in libata
> > pata_pcmcia can you try this patch on top of the updates posted. It tries
> > to spot when the slave is a mirror of the master and to fix up problems
> > that causes.
> >
> > Signed-off-by: Alan Cox <alan@redhat.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> Seems same, but dropped due to "can you try this patch" comments. Let
> me know if this actually fixes something...
I've got two confirmations so far that this plus the "can fail set_xfer"
patch work for folks who had problems before. Also if you are unfortunate
enough to be running something like HAL then it'll automount the same
disk twice for you and corrupt it without the fix (aint that nice...)
Alan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-03-06 14:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 10:37 [patch 05/30] pcmcia - spot slave decode flaws (for testing) akpm
2007-03-06 11:44 ` Jeff Garzik
2007-03-06 15:21 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).