* [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
@ 2008-01-08 13:19 Tejun Heo
2008-01-08 14:40 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2008-01-08 13:19 UTC (permalink / raw)
To: Jeff Garzik, IDE/ATA development list
Implement libata.force_cbl parameter to work around incorrect PATA
cable detection.
Signed-off-by: Tejun Heo <htejun@gmail.com>
---
Sledgehammer for just-in-case. Feel free to include or ignore.
drivers/ata/libata-core.c | 4 ++++
drivers/ata/libata-eh.c | 20 +++++++++++++++++++-
drivers/ata/libata.h | 1 +
3 files changed, 24 insertions(+), 1 deletion(-)
Index: linux-2.6.22-SL103_BRANCH/drivers/ata/libata-core.c
===================================================================
--- linux-2.6.22-SL103_BRANCH.orig/drivers/ata/libata-core.c
+++ linux-2.6.22-SL103_BRANCH/drivers/ata/libata-core.c
@@ -110,6 +110,10 @@ int libata_noacpi = 1;
module_param_named(noacpi, libata_noacpi, int, 0444);
MODULE_PARM_DESC(noacpi, "Disables the use of ACPI in suspend/resume when set");
+int libata_force_cbl = 0;
+module_param_named(force_cbl, libata_force_cbl, int, 0644);
+MODULE_PARM_DESC(force_cbl, "force PATA cable type (0=keep, 40=40c, 80=80c)");
+
MODULE_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("Library module for ATA devices");
MODULE_LICENSE("GPL");
Index: linux-2.6.22-SL103_BRANCH/drivers/ata/libata-eh.c
===================================================================
--- linux-2.6.22-SL103_BRANCH.orig/drivers/ata/libata-eh.c
+++ linux-2.6.22-SL103_BRANCH/drivers/ata/libata-eh.c
@@ -2165,9 +2165,27 @@ static int ata_eh_revalidate_and_attach(
/* PDIAG- should have been released, ask cable type if post-reset */
if (ata_is_host_link(link) && ap->ops->cable_detect &&
- (ehc->i.flags & ATA_EHI_DID_RESET))
+ (ehc->i.flags & ATA_EHI_DID_RESET)) {
ap->cbl = ap->ops->cable_detect(ap);
+ if (!(ap->flags & ATA_FLAG_SATA) && libata_force_cbl) {
+ switch (libata_force_cbl) {
+ case 40:
+ ata_port_printk(ap, KERN_INFO, "forcing 40c\n");
+ ap->cbl = ATA_CBL_PATA40;
+ break;
+ case 80:
+ ata_port_printk(ap, KERN_INFO, "forcing 80c\n");
+ ap->cbl = ATA_CBL_PATA80;
+ break;
+ default:
+ ata_port_printk(ap, KERN_WARNING,
+ "invalid force_cbl value %d\n",
+ libata_force_cbl);
+ }
+ }
+ }
+
/* Configure new devices forward such that user doesn't see
* device detection messages backwards.
*/
Index: linux-2.6.22-SL103_BRANCH/drivers/ata/libata.h
===================================================================
--- linux-2.6.22-SL103_BRANCH.orig/drivers/ata/libata.h
+++ linux-2.6.22-SL103_BRANCH/drivers/ata/libata.h
@@ -59,6 +59,7 @@ extern int atapi_dmadir;
extern int atapi_passthru16;
extern int libata_fua;
extern int libata_noacpi;
+extern int libata_force_cbl;
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev);
extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
u64 block, u32 n_block, unsigned int tf_flags,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-08 13:19 [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter Tejun Heo
@ 2008-01-08 14:40 ` Alan Cox
2008-01-09 1:19 ` Tejun Heo
0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2008-01-08 14:40 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, IDE/ATA development list
On Tue, 08 Jan 2008 22:19:38 +0900
Tejun Heo <htejun@gmail.com> wrote:
> Implement libata.force_cbl parameter to work around incorrect PATA
> cable detection.
This seems to be a pretty hopeless hack as it assumes all your devices
are on the same cable (most boxes now have SATA and PATA). If we are
going to do this we need a way to specify which controller/device as we
will do for geometry forcing and other stuff.
Alan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-08 14:40 ` Alan Cox
@ 2008-01-09 1:19 ` Tejun Heo
2008-01-09 1:37 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2008-01-09 1:19 UTC (permalink / raw)
To: Alan Cox; +Cc: Jeff Garzik, IDE/ATA development list
Alan Cox wrote:
> On Tue, 08 Jan 2008 22:19:38 +0900
> Tejun Heo <htejun@gmail.com> wrote:
>
>> Implement libata.force_cbl parameter to work around incorrect PATA
>> cable detection.
>
> This seems to be a pretty hopeless hack as it assumes all your devices
> are on the same cable (most boxes now have SATA and PATA). If we are
> going to do this we need a way to specify which controller/device as we
> will do for geometry forcing and other stuff.
This only forces PATA controllers to certain cable type. It's a last
resort method for installation or live media - just enough to get things
going.
--
tejun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-09 1:19 ` Tejun Heo
@ 2008-01-09 1:37 ` Alan Cox
2008-01-09 1:46 ` Tejun Heo
0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2008-01-09 1:37 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, IDE/ATA development list
> This only forces PATA controllers to certain cable type. It's a last
> resort method for installation or live media - just enough to get things
> going.
In which case we only need to be able to force UDMA33 or less ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-09 1:37 ` Alan Cox
@ 2008-01-09 1:46 ` Tejun Heo
2008-01-09 3:05 ` Alan Cox
0 siblings, 1 reply; 7+ messages in thread
From: Tejun Heo @ 2008-01-09 1:46 UTC (permalink / raw)
To: Alan Cox; +Cc: Jeff Garzik, IDE/ATA development list
Alan Cox wrote:
>> This only forces PATA controllers to certain cable type. It's a last
>> resort method for installation or live media - just enough to get things
>> going.
>
> In which case we only need to be able to force UDMA33 or less ?
Cable detection goes wrong and 40c is detected as 80c. However, we got
(un)lucky and all PIO and short transfers succeed however when large
UDMA transfer starts, the drive detects transmission error and
unfortunately does the right thing - reports transmission error via
check sense. libata EH currently doesn't analyze sense data and
simplify passes it to sr. sr knows transmission failure occurred but
there isn't much it can do.
--
tejun
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-09 1:46 ` Tejun Heo
@ 2008-01-09 3:05 ` Alan Cox
2008-01-09 5:07 ` Tejun Heo
0 siblings, 1 reply; 7+ messages in thread
From: Alan Cox @ 2008-01-09 3:05 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jeff Garzik, IDE/ATA development list
> > In which case we only need to be able to force UDMA33 or less ?
>
> Cable detection goes wrong and 40c is detected as 80c. However, we got
In which case we only (see first question). I don't see why we need to
force anything but "max speed UDMA 33"
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
2008-01-09 3:05 ` Alan Cox
@ 2008-01-09 5:07 ` Tejun Heo
0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2008-01-09 5:07 UTC (permalink / raw)
To: Alan Cox; +Cc: Jeff Garzik, IDE/ATA development list
Alan Cox wrote:
>>> In which case we only need to be able to force UDMA33 or less ?
>> Cable detection goes wrong and 40c is detected as 80c. However, we got
>
> In which case we only (see first question). I don't see why we need to
> force anything but "max speed UDMA 33"
Ah.. yeah, right. I somehow missed the negation in the question.
There's no need to force 80c usually. The parameter might be as well
force_40c and only force 40c limit.
--
tejun
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-01-09 5:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-08 13:19 [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter Tejun Heo
2008-01-08 14:40 ` Alan Cox
2008-01-09 1:19 ` Tejun Heo
2008-01-09 1:37 ` Alan Cox
2008-01-09 1:46 ` Tejun Heo
2008-01-09 3:05 ` Alan Cox
2008-01-09 5:07 ` Tejun Heo
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).