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]

 



Hi Tejun,

On Mon, Sep 28, 2015 at 6:28 PM, Tejun Heo <tj@xxxxxxxxxx> wrote:
> 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.

I'm not sure either, but this is also how windows decides whether
a sata port should be treated as removable, i.e. add a "Safely
remove device" Icon on the taskbar for devices attached to it.
As I wrote, I haven't found another way to signal userspace (mainly
udisks) that everything attached to this port should be treated like
an USB stick.


>> @@ -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.

I'll update the patch.

Thank you!
        Manuel
--
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