* [PATCH]: pcmcia - spot slave decode flaws (for testing)
@ 2007-02-20 18:18 Alan
2007-02-23 10:44 ` Jeff Garzik
0 siblings, 1 reply; 5+ messages in thread
From: Alan @ 2007-02-20 18:18 UTC (permalink / raw)
To: jgarzik, linux-kernel, linux-ide
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>
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c
--- linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 13:37:58.000000000 +0000
+++ linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 14:28:13.000000000 +0000
@@ -54,6 +54,39 @@
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 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] 5+ messages in thread* Re: [PATCH]: pcmcia - spot slave decode flaws (for testing) 2007-02-20 18:18 [PATCH]: pcmcia - spot slave decode flaws (for testing) Alan @ 2007-02-23 10:44 ` Jeff Garzik 2007-02-23 12:08 ` Alan 0 siblings, 1 reply; 5+ messages in thread From: Jeff Garzik @ 2007-02-23 10:44 UTC (permalink / raw) To: Alan; +Cc: linux-kernel, linux-ide Alan wrote: > 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> > > diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c > --- linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 13:37:58.000000000 +0000 > +++ linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 14:28:13.000000000 +0000 > @@ -54,6 +54,39 @@ > 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); Code looks OK. Not applied due to "for testing" note. General comment: it might be nice to do this in the core, just as a sanity check for a variety of problems, past, present and future. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: pcmcia - spot slave decode flaws (for testing) 2007-02-23 10:44 ` Jeff Garzik @ 2007-02-23 12:08 ` Alan 2007-02-24 21:23 ` Eric D. Mudama 0 siblings, 1 reply; 5+ messages in thread From: Alan @ 2007-02-23 12:08 UTC (permalink / raw) To: Jeff Garzik; +Cc: linux-kernel, linux-ide > Code looks OK. Not applied due to "for testing" note. > > General comment: it might be nice to do this in the core, just as a > sanity check for a variety of problems, past, present and future. We tried that with old IDE and all hell broke loose. Lots of virtual disk stuff and raid volumes have non-unique serial numbers. We even found a case of identically serial numbered Maxtor drives. It needs to stay in pcmcia, which is the only place we've seen the duplication. Alan ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: pcmcia - spot slave decode flaws (for testing) 2007-02-23 12:08 ` Alan @ 2007-02-24 21:23 ` Eric D. Mudama 0 siblings, 0 replies; 5+ messages in thread From: Eric D. Mudama @ 2007-02-24 21:23 UTC (permalink / raw) To: Alan; +Cc: Jeff Garzik, linux-kernel, linux-ide On 2/23/07, Alan <alan@lxorguk.ukuu.org.uk> wrote: > > Code looks OK. Not applied due to "for testing" note. > > > > General comment: it might be nice to do this in the core, just as a > > sanity check for a variety of problems, past, present and future. > > We tried that with old IDE and all hell broke loose. Lots of virtual disk > stuff and raid volumes have non-unique serial numbers. We even found a > case of identically serial numbered Maxtor drives. > > It needs to stay in pcmcia, which is the only place we've seen the > duplication. I don't think the maxtor drives actually had duplicate serial numbers. They were coming back as "M0000000000000000000" or something like that to the limit of the strlen. It looked more like buffer corruption or something, and only happened with one or two people... --eric ^ permalink raw reply [flat|nested] 5+ messages in thread
* [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer @ 2006-12-17 12:27 Komuro 2006-12-17 4:02 ` Al Viro 0 siblings, 1 reply; 5+ messages in thread From: Komuro @ 2006-12-17 12:27 UTC (permalink / raw) To: linux-kernel Hello, On kernel 2.6.20-rc1, ftp (get or put) stops during file-transfer. Client: ftp-0.17-33.fc6 (192.168.1.1) Server: vsftpd-2.0.5-8 (192.168.1.3) This problem does _not_ happen on kernel-2.6.19. is it caused by network-subsystem change on 2.6.20-rc1?? Best Regards Komuro ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer 2006-12-17 12:27 [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer Komuro @ 2006-12-17 4:02 ` Al Viro [not found] ` <20070211101537.e40fa309.komurojun-mbn@nifty.com> 0 siblings, 1 reply; 5+ messages in thread From: Al Viro @ 2006-12-17 4:02 UTC (permalink / raw) To: Komuro; +Cc: linux-kernel On Sun, Dec 17, 2006 at 09:27:52PM +0900, Komuro wrote: > > Hello, > > On kernel 2.6.20-rc1, ftp (get or put) stops > during file-transfer. > > Client: ftp-0.17-33.fc6 (192.168.1.1) > Server: vsftpd-2.0.5-8 (192.168.1.3) > > This problem does _not_ happen on kernel-2.6.19. > is it caused by network-subsystem change on 2.6.20-rc1?? Do you have NAT between you and server? ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20070211101537.e40fa309.komurojun-mbn@nifty.com>]
* Re: [BUG] PATA_PCMCIA does not work [not found] ` <20070211101537.e40fa309.komurojun-mbn@nifty.com> @ 2007-02-11 2:40 ` Komuro 2007-02-18 2:09 ` Komuro 0 siblings, 1 reply; 5+ messages in thread From: Komuro @ 2007-02-11 2:40 UTC (permalink / raw) To: linux-kernel; +Cc: alan >> [pata_pcmcia dmesg] >> ata1.00: CFA, max PIO0, 20480 sectors: LBA >> ata1.00: ata1: dev 0 multi count 0 >> ata1.01: CFA, max PIO0, 20480 sectors: LBA >> ata1.01: ata1: dev 1 multi count 0 >Do you have two cards here ? No. one card. I am not sure why two devices are detected. Actually, this card works properly with ide-cs driver. but it displays some warning message. hde: SunDisk SDP5-10, CFA DISK drive hdf: SunDisk SDP5-10, CFA DISK drive ide-probe: ignoring undecoded slave ide2 at 0xd100-0xd107,0xd10e on irq 3 hde: max request size: 128KiB hde: 20480 sectors (10 MB) w/1KiB Cache, CHS=320/2/32 hde:hde: set_geometry_intr: status=0x51 { DriveReady SeekComplete Error } hde: set_geometry_intr: error=0x04 { DriveStatusError } ide: failed opcode was: unknown hde1 ide-cs: hde: Vpp = 0.0 Best Regards Komuro ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] PATA_PCMCIA does not work 2007-02-11 2:40 ` [BUG] PATA_PCMCIA does not work Komuro @ 2007-02-18 2:09 ` Komuro 2007-02-21 15:37 ` Alan 0 siblings, 1 reply; 5+ messages in thread From: Komuro @ 2007-02-18 2:09 UTC (permalink / raw) To: linux-kernel; +Cc: alan Hi, I tried the kernel 2.6.20-git14, the pata_pcmcia drive works properly.Thanks! But I do the "pccardctl eject" NULL-pointer-dereference error happens. [dmesg] pcmcia: registering new device pcmcia1.0 SCSI subsystem initialized libata version 2.10 loaded. ata1: PATA max PIO0 cmd 0x0001d100 ctl 0x0001d10e bmdma 0x00000000 irq 3 scsi0 : pata_pcmcia ata1.00: CFA: Hitachi XXM2.3.0, Rev 3.00, max PIO1 ata1.00: 62592 sectors, multi 0: LBA ata1.00: configured for PIO0 scsi 0:0:0:0: Direct-Access ATA Hitachi XXM2.3.0 Rev PQ: 0 ANSI: 5 scsi 0:0:0:0: Attached scsi generic sg0 type 0 SCSI device sda: 62592 512-byte hdwr sectors (32 MB) sda: Write Protect is off sda: Mode Sense: 00 3a 00 00 SCSI device sda: write cache: disabled, read cache: enabled, doesn't support DPO or FUA SCSI device sda: 62592 512-byte hdwr sectors (32 MB) sda: Write Protect is off sda: Mode Sense: 00 3a 00 00 SCSI device sda: write cache: disabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sd 0:0:0:0: Attached scsi removable disk sda pccard: card ejected from slot 1 ata1.00: disabled BUG: unable to handle kernel NULL pointer dereference at virtual address 00000020 printing eip: d89f7f3e *pde = 00000000 Oops: 0000 [#1] Modules linked in: nls_ascii vfat fat sd_mod sg pata_pcmcia libata scsi_mod dm_mirror dm_multipath dm_mod pcmcia yenta_socket rsrc_nonstatic pcmcia_core CPU: 0 EIP: 0060:[<d89f7f3e>] Not tainted VLI EFLAGS: 00010246 (2.6.20-git14 #1) EIP is at ata_host_release+0x2e/0x48 [libata] eax: d7981884 ebx: d545b8c0 ecx: d7f6f180 edx: d545b8cc esi: 00000000 edi: 00000000 ebp: 00000000 esp: d5bfde58 ds: 007b es: 007b fs: 00d8 gs: 0033 ss: 0068 Process pccardctl (pid: 1711, ti=d5bfc000 task=c13d1540 task.ti=d5bfc000) Stack: d545b8c0 d5ac4700 d7981a24 c0220120 d7981a24 d7981884 00000006 d5ac4720 d5ac4660 d7981884 d887c278 d71c8dbc d7c53c48 c02201e9 00000286 d7981884 c021d363 d7981884 d7981884 c021d7ae d798192c c021cd84 d7981884 d7981884 Call Trace: [<c0220120>] release_nodes+0x10f/0x12f [<c02201e9>] devres_release_all+0x27/0x2a [<c021d363>] __device_release_driver+0x78/0x8e [<c021d7ae>] device_release_driver+0x31/0x46 [<c021cd84>] bus_remove_device+0x6d/0x7d [<c021b58a>] device_del+0x162/0x1bf [<c021b5ef>] device_unregister+0x8/0x10 [<d88304b9>] pcmcia_card_remove+0x66/0x81 [pcmcia] [<d883143d>] ds_event+0x4a/0x6d [pcmcia] [<c01b6db5>] kobject_get+0xf/0x13 [<d88172da>] send_event+0x31/0x49 [pcmcia_core] [<d88174b9>] socket_shutdown+0xc/0xb3 [pcmcia_core] [<d881757c>] socket_remove+0x1c/0x26 [pcmcia_core] [<d88175c5>] pcmcia_eject_card+0x3f/0x4c [pcmcia_core] [<d8819e48>] pccard_store_eject+0x1b/0x22 [pcmcia_core] [<d8819e2d>] pccard_store_eject+0x0/0x22 [pcmcia_core] [<c021af3b>] dev_attr_store+0x27/0x2c [<c017d1cb>] sysfs_write_file+0xbc/0xe5 [<c017d10f>] sysfs_write_file+0x0/0xe5 [<c014df18>] vfs_write+0x8a/0x10c [<c014e3ae>] sys_write+0x41/0x67 [<c0103c76>] sysenter_past_esp+0x5f/0x85 [<c02b0000>] wait_for_completion+0x33/0xaf ======================= Code: 56 53 8b b0 50 01 00 00 eb 21 8b 5c be 34 85 db 74 18 8b 43 04 8b 90 88 00 00 00 85 d2 74 04 89 d8 ff d2 8b 03 e8 fa 0d e6 ff 47 <3b> 7e 20 72 da 8b 46 28 8b 90 8c 00 00 00 85 d2 74 04 89 f0 ff EIP: [<d89f7f3e>] ata_host_release+0x2e/0x48 [libata] SS:ESP 0068:d5bfde58 Best Regards Komuro ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] PATA_PCMCIA does not work 2007-02-18 2:09 ` Komuro @ 2007-02-21 15:37 ` Alan 2007-03-21 1:56 ` [PATCH]: pcmcia - spot slave decode flaws (for testing) Komuro 0 siblings, 1 reply; 5+ messages in thread From: Alan @ 2007-02-21 15:37 UTC (permalink / raw) To: Komuro; +Cc: linux-kernel Does this fix the oops ? Alan diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c --- linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 13:37:58.000000000 +0000 +++ linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-21 14:06:58.792707976 +0000 @@ -308,7 +342,6 @@ if (info->ndev) { struct ata_host *host = dev_get_drvdata(dev); ata_host_detach(host); - dev_set_drvdata(dev, NULL); } info->ndev = 0; pdev->priv = NULL; ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: pcmcia - spot slave decode flaws (for testing) 2007-02-21 15:37 ` Alan @ 2007-03-21 1:56 ` Komuro 0 siblings, 0 replies; 5+ messages in thread From: Komuro @ 2007-03-21 1:56 UTC (permalink / raw) To: Alan; +Cc: linux-kernel Hi, "[PATCH]: pcmcia - spot slave decode flaws (for testing)" works properly. (kernel 2.6.21-rc4-mm1) pccard: PCMCIA card inserted into slot 1 pcmcia: registering new device pcmcia1.0 ata3: PATA max PIO0 cmd 0x00010100 ctl 0x0001010e bmdma 0x00000000 irq 3 scsi2 : pata_pcmcia ata3.00: CFA: SunDisk SDP5-10, Rev 3.70, max PIO0 ata3.00: 20480 sectors, multi 0: LBA ata3.01: CFA: SunDisk SDP5-10, Rev 3.70, max PIO0 ata3.01: 20480 sectors, multi 0: LBA ata3.01: is a ghost device, ignoring. ata3.01: disabled ata3.00: configured for PIO0 scsi 2:0:0:0: Direct-Access ATA SunDisk SDP5-10 Rev PQ: 0 ANSI: 5 sd 2:0:0:0: [sda] 20480 512-byte hardware sectors (10 MB) sd 2:0:0:0: [sda] Write Protect is off sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00 sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sd 2:0:0:0: [sda] 20480 512-byte hardware sectors (10 MB) sd 2:0:0:0: [sda] Write Protect is off sd 2:0:0:0: [sda] Mode Sense: 00 3a 00 00 sd 2:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sd 2:0:0:0: [sda] Attached SCSI removable disk sd 2:0:0:0: Attached scsi generic sg0 type 0 Best Regards Komuro >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> > >diff -u --new-file --recursive --exclude-from /usr/src/exclude \ >linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c \ > linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c >--- linux.vanilla-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 13:37:58.000000000 \ > +0000 >+++ linux-2.6.20-mm2/drivers/ata/pata_pcmcia.c 2007-02-20 14:28:13.000000000 +0000 >@@ -54,6 +54,39 @@ > 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 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] 5+ messages in thread
end of thread, other threads:[~2007-03-21 1:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-20 18:18 [PATCH]: pcmcia - spot slave decode flaws (for testing) Alan
2007-02-23 10:44 ` Jeff Garzik
2007-02-23 12:08 ` Alan
2007-02-24 21:23 ` Eric D. Mudama
-- strict thread matches above, loose matches on Subject: below --
2006-12-17 12:27 [BUG KERNEL 2.6.20-rc1] ftp: get or put stops during file-transfer Komuro
2006-12-17 4:02 ` Al Viro
[not found] ` <20070211101537.e40fa309.komurojun-mbn@nifty.com>
2007-02-11 2:40 ` [BUG] PATA_PCMCIA does not work Komuro
2007-02-18 2:09 ` Komuro
2007-02-21 15:37 ` Alan
2007-03-21 1:56 ` [PATCH]: pcmcia - spot slave decode flaws (for testing) Komuro
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.