From: Matthew Garrett <mjg@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 4/4] libata: Allow AHCI to flag ports as not hotpluggable
Date: Thu, 16 Jul 2009 00:43:58 +0100 [thread overview]
Message-ID: <1247701438-18266-4-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1247701438-18266-3-git-send-email-mjg@redhat.com>
Some SATA ports are fully internal and unlikely to be hotplugged. The
AHCI spec allows vendors to flag these ports differently, allowing
hotplug bays and eSATA ports to be treated differently. Ensure that
this information is exposed to userspace so policy decisions can be
made.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/ata/ahci.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index de84054..51d8350 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -77,6 +77,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf,
size_t size);
static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state,
ssize_t size);
+static int ahci_is_hotplug_capable(struct ata_port *ap);
enum {
AHCI_PCI_BAR = 5,
@@ -193,6 +194,8 @@ enum {
PORT_CMD_ASP = (1 << 27), /* Aggressive Slumber/Partial */
PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */
PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */
+ PORT_CMD_ESP = (1 << 21), /* port is esata capable */
+ PORT_CMD_HPCP = (1 << 18), /* port is hot plug capable */
PORT_CMD_PMP = (1 << 17), /* PMP attached */
PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */
PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */
@@ -373,6 +376,8 @@ static struct ata_port_operations ahci_ops = {
.pmp_attach = ahci_pmp_attach,
.pmp_detach = ahci_pmp_detach,
+ .is_hotpluggable = ahci_is_hotplug_capable,
+
.enable_pm = ahci_enable_alpm,
.disable_pm = ahci_disable_alpm,
.em_show = ahci_led_show,
@@ -876,6 +881,15 @@ static int ahci_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val)
return -EINVAL;
}
+static int ahci_is_hotplug_capable(struct ata_port *ap)
+{
+ void __iomem *port_mmio = ahci_port_base(ap);
+ u8 cmd;
+
+ cmd = readl(port_mmio + PORT_CMD);
+ return cmd & (PORT_CMD_HPCP | PORT_CMD_ESP);
+}
+
static void ahci_start_engine(struct ata_port *ap)
{
void __iomem *port_mmio = ahci_port_base(ap);
--
1.6.2.5
next prev parent reply other threads:[~2009-07-15 23:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-15 23:43 [PATCH 1/4] scsi: Allow hosts to be flagged as hotpluggable Matthew Garrett
2009-07-15 23:43 ` [PATCH 2/4] libata: Flag most SATA ports " Matthew Garrett
2009-07-15 23:43 ` [PATCH 3/4] libata: Make it possible for host drivers to flag hotplug ports Matthew Garrett
2009-07-15 23:43 ` Matthew Garrett [this message]
2009-07-16 1:12 ` [PATCH 1/4] scsi: Allow hosts to be flagged as hotpluggable James Bottomley
2009-07-16 1:26 ` Matthew Garrett
2009-07-16 7:59 ` Alan Cox
2009-07-16 11:59 ` Matthew Wilcox
2009-07-16 14:30 ` Stefan Richter
2009-07-16 14:36 ` Stefan Richter
2009-07-16 14:44 ` Matthew Garrett
2009-07-16 14:38 ` Matthew Garrett
2009-07-16 14:43 ` James Bottomley
2009-07-16 14:45 ` Matthew Garrett
2009-07-16 14:53 ` James Bottomley
2009-07-16 14:55 ` Matthew Garrett
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=1247701438-18266-4-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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).