All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@pobox.com>
To: Michal 'hramrach' Suchanek <hramrach@centrum.cz>
Cc: Eric Mudama <edmudama@gmail.com>,
	Brad Campbell <brad@wasp.net.au>,
	f@uvt316-2.ruk.cuni.cz, linux-ide@vger.kernel.org
Subject: Re: Via SATA not working here
Date: Tue, 14 Sep 2004 14:06:18 -0400	[thread overview]
Message-ID: <4147331A.8040907@pobox.com> (raw)
In-Reply-To: <20040914175448.GK18257@uvt316-2.ruk.cuni.cz>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Michal 'hramrach' Suchanek wrote:
> imho it did not query it, it is simply bogus. afaict the drive does not
> produce write errors so the code cannot query it whatever it does.
> But i do not know anything about ata or the kernel ata drivers, I did
> not even try to look.
> 
> Currently I have another drive attached to the sata dongle and neither
> bios nor Linux can see it. Perhaps it is because  the drive is switched
> to slave or it does not like the drive rack.


ahhhhhh, that may be a clue.  If you are attaching a PATA drive via a 
bridge, that is very different from attaching a SATA drive, in terms of 
field behavior across the controller spectrum.

There are limitations on bridges.  Does Brad Campbell's patch (attached) 
work for you?

	Jeff


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 2939 bytes --]

diff -ur orig/linux-2.6.0/drivers/scsi/libata-core.c linux-2.6.9-rc1/drivers/scsi/libata-core.c
--- orig/linux-2.6.0/drivers/scsi/libata-core.c	2004-08-30 20:48:35.000000000 +0400
+++ linux-2.6.9-rc1/drivers/scsi/libata-core.c	2004-08-30 21:02:42.000000000 +0400
@@ -1128,6 +1128,37 @@
 	DPRINTK("EXIT, err\n");
 }
 
+
+static inline u8 ata_dev_knobble(struct ata_port *ap)
+{
+	return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device)));
+}
+
+/**
+ * 	ata_dev_config - Run device specific handlers and check for
+ * 			 SATA->PATA bridges
+ * 	@ap: Bus 
+ * 	@i:  Device
+ *
+ * 	LOCKING:
+ */
+ 
+void ata_dev_config(struct ata_port *ap, unsigned int i)
+{
+	/* limit bridge transfers to udma5, 200 sectors */
+	if (ata_dev_knobble(ap)) {
+		printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
+			ap->id, ap->device->devno);
+		ap->udma_mask &= ATA_UDMA5;
+		ap->host->max_sectors = ATA_MAX_SECTORS;
+		ap->host->hostt->max_sectors = ATA_MAX_SECTORS;
+		ap->device->flags |= ATA_DFLAG_LOCK_SECTORS;
+	}
+
+	if (ap->ops->dev_config)
+		ap->ops->dev_config(ap, &ap->device[i]);
+}
+
 /**
  *	ata_bus_probe - Reset and probe ATA bus
  *	@ap: Bus to probe
@@ -1150,8 +1181,7 @@
 		ata_dev_identify(ap, i);
 		if (ata_dev_present(&ap->device[i])) {
 			found = 1;
-			if (ap->ops->dev_config)
-				ap->ops->dev_config(ap, &ap->device[i]);
+			ata_dev_config(ap,i);
 		}
 	}
 
@@ -1226,7 +1256,7 @@
 		ata_port_disable(ap);
 		return;
 	}
-
+	ap->cbl = ATA_CBL_SATA;
 	ata_bus_reset(ap);
 }
 
@@ -3567,3 +3597,4 @@
 EXPORT_SYMBOL_GPL(ata_scsi_release);
 EXPORT_SYMBOL_GPL(ata_host_intr);
 EXPORT_SYMBOL_GPL(ata_dev_id_string);
+EXPORT_SYMBOL_GPL(ata_dev_config);
nly in linux-2.6.9-rc1/include: config
diff -ur orig/linux-2.6.0/include/linux/ata.h linux-2.6.9-rc1/include/linux/ata.h
--- orig/linux-2.6.0/include/linux/ata.h	2004-08-30 20:48:35.000000000 +0400
+++ linux-2.6.9-rc1/include/linux/ata.h	2004-08-30 18:42:41.000000000 +0400
@@ -218,6 +218,7 @@
 };
 
 #define ata_id_is_ata(dev)	(((dev)->id[0] & (1 << 15)) == 0)
+#define ata_id_is_sata(dev)	((dev)->id[93] == 0)
 #define ata_id_rahead_enabled(dev) ((dev)->id[85] & (1 << 6))
 #define ata_id_wcache_enabled(dev) ((dev)->id[85] & (1 << 5))
 #define ata_id_has_flush(dev) ((dev)->id[83] & (1 << 12))
diff -ur orig/linux-2.6.0/include/linux/libata.h linux-2.6.9-rc1/include/linux/libata.h
--- orig/linux-2.6.0/include/linux/libata.h	2004-08-30 20:48:35.000000000 +0400
+++ linux-2.6.9-rc1/include/linux/libata.h	2004-08-30 20:42:05.000000000 +0400
@@ -400,6 +400,7 @@
 		 unsigned int n_elem);
 extern void ata_dev_id_string(struct ata_device *dev, unsigned char *s,
 			      unsigned int ofs, unsigned int len);
+extern void ata_dev_config(struct ata_port *ap, unsigned int i);
 extern void ata_bmdma_setup_mmio (struct ata_queued_cmd *qc);
 extern void ata_bmdma_start_mmio (struct ata_queued_cmd *qc);
 extern void ata_bmdma_setup_pio (struct ata_queued_cmd *qc);


  reply	other threads:[~2004-09-14 18:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-12 19:15 Via SATA not working here Michal 'hramrach' Suchanek
2004-09-13  4:23 ` Brad Campbell
2004-09-14  9:43   ` Michal 'hramrach' Suchanek
2004-09-14 15:03     ` Eric Mudama
2004-09-14 17:54       ` Michal 'hramrach' Suchanek
2004-09-14 18:06         ` Jeff Garzik [this message]
2004-09-14 19:57           ` Brad Campbell
2005-02-05 15:03             ` Michal 'hramrach' Suchanek
2005-02-05 15:33               ` Stefan Smietanowski
2005-02-05 23:41                 ` Michal 'hramrach' Suchanek
2004-09-14 20:15           ` Via SATA already working here [was: not working] Michal 'hramrach' Suchanek

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=4147331A.8040907@pobox.com \
    --to=jgarzik@pobox.com \
    --cc=brad@wasp.net.au \
    --cc=edmudama@gmail.com \
    --cc=f@uvt316-2.ruk.cuni.cz \
    --cc=hramrach@centrum.cz \
    --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 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.