From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>,
IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter
Date: Tue, 08 Jan 2008 22:19:38 +0900 [thread overview]
Message-ID: <4783786A.6040608@gmail.com> (raw)
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,
next reply other threads:[~2008-01-08 13:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-08 13:19 Tejun Heo [this message]
2008-01-08 14:40 ` [PATCH #upstream-fixes] libata: implement libata.force_cbl parameter 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4783786A.6040608@gmail.com \
--to=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).