Re: [RFC PATCH] ata: ahci: find eSATA ports and flag them as removable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> --
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux