Linux ATA/IDE development
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-IDE <linux-ide@vger.kernel.org>
Subject: Re: [RFC PATCH] ata: ahci: find eSATA ports and flag them as removable
Date: Mon, 28 Sep 2015 12:28:34 -0400	[thread overview]
Message-ID: <20150928162834.GE2589@mtj.duckdns.org> (raw)
In-Reply-To: <1443179101-9870-1-git-send-email-manuel.lauss@gmail.com>

Hello, Manuel.

On Fri, Sep 25, 2015 at 01:05:01PM +0200, Manuel Lauss wrote:
> If the AHCI ports' HPCP or ESP bits are set, the port
> should be considered external (e.g. eSATA) and is marked
> as removable.  Userspace tools like udisks then treat it
> like an usb drive.
> 
> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
> --
> This is a crude hack, but works fine on my laptop. If I plug something in
> on the eSATA port, KDE pops up a windows asking me what to do with the
> new drive(s), just like it does for any random usb stick.
> 
> I didn't know how else to communicate to userspace that the drive is
> removable other than adding it to the removable-bit-test of ATA IDENTIFY data.

It'd probably be better if you include the above two paragraphs in the
patch description proper.

Heh, does a port being marked external indicate that it should be
treated as a removable device?  Hmmm... maybe.  I'm not sure either
way.  The other thing is that marking a device removeable cause
internal behavior changes in the SCSI layer.  It constantly checks to
detect media change events which should be fine but noteworthy.

> @@ -1484,6 +1485,11 @@ static void ahci_postreset(struct ata_link *link, unsigned int *class)
>  		writel(new_tmp, port_mmio + PORT_CMD);
>  		readl(port_mmio + PORT_CMD); /* flush */
>  	}
> +
> +	/* mark esata ports */
> +	if ((tmp & PORT_CMD_HPCP) ||
> +	    ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS)))
> +		ap->pflags |= ATA_PFLAG_EXTERNAL;

We probably should do this during port initialization rather than in
the reset path.

Thanks.

-- 
tejun

  reply	other threads:[~2015-09-28 16:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 11:05 [RFC PATCH] ata: ahci: find eSATA ports and flag them as removable Manuel Lauss
2015-09-28 16:28 ` Tejun Heo [this message]
2015-09-28 17:26   ` Manuel Lauss

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=20150928162834.GE2589@mtj.duckdns.org \
    --to=tj@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=manuel.lauss@gmail.com \
    /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