public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing
@ 2014-11-06 12:51 Soeren Moch
  2014-11-06 20:41 ` Marek Vasut
  2014-11-08  6:02 ` [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices Soeren Moch
  0 siblings, 2 replies; 8+ messages in thread
From: Soeren Moch @ 2014-11-06 12:51 UTC (permalink / raw)
  To: u-boot

Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).

This especially avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
---
 common/usb_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index eb7706c..0ac7b48 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
 	perq = usb_stor_buf[0];
 	modi = usb_stor_buf[1];
 
-	if ((perq & 0x1f) == 0x1f) {
+	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
 		/* skip unknown devices */
 		return 0;
 	}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing
  2014-11-06 12:51 [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing Soeren Moch
@ 2014-11-06 20:41 ` Marek Vasut
  2014-11-07  9:28   ` Soeren Moch
  2014-11-08  6:02 ` [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices Soeren Moch
  1 sibling, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2014-11-06 20:41 UTC (permalink / raw)
  To: u-boot

On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
> which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).
> 
> This especially avoids long timeouts when probing for external usb
> harddisks which provide "Enclosure Services".
> 
> Signed-off-by: Soeren Moch <smoch@web.de>
> --
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---
>  common/usb_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index eb7706c..0ac7b48 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev, struct
> us_data *ss, perq = usb_stor_buf[0];
>  	modi = usb_stor_buf[1];
> 
> -	if ((perq & 0x1f) == 0x1f) {
> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {

Why can't you just blacklist 0xd instead ? I mean, this patch would do a bulk
blacklisting of all the obscure devices with peripheral ID above 0x7, but might
still work with this layer (like 0xc ... the RAID controller ; or 0xe ... the
reduced block device).

Won't it make sense to just selectively blacklist the 0xd ?

>  		/* skip unknown devices */
>  		return 0;
>  	}

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing
  2014-11-06 20:41 ` Marek Vasut
@ 2014-11-07  9:28   ` Soeren Moch
  2014-11-07  9:29     ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Soeren Moch @ 2014-11-07  9:28 UTC (permalink / raw)
  To: u-boot

On 11/06/14 21:41, Marek Vasut wrote:
> On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
>> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all devices
>> which are unknown to u-boot (e.g., are not HARDDISK, TAPE, CDROM, OPDISK).
>>
>> This especially avoids long timeouts when probing for external usb
>> harddisks which provide "Enclosure Services".
>>
>> Signed-off-by: Soeren Moch <smoch@web.de>
>> --
>> Cc: Marek Vasut <marex@denx.de>
>> Cc: Tom Rini <trini@ti.com>
>> ---
>>   common/usb_storage.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/common/usb_storage.c b/common/usb_storage.c
>> index eb7706c..0ac7b48 100644
>> --- a/common/usb_storage.c
>> +++ b/common/usb_storage.c
>> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev, struct
>> us_data *ss, perq = usb_stor_buf[0];
>>   	modi = usb_stor_buf[1];
>>
>> -	if ((perq & 0x1f) == 0x1f) {
>> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
>
> Why can't you just blacklist 0xd instead ? I mean, this patch would do a bulk
> blacklisting of all the obscure devices with peripheral ID above 0x7, but might
> still work with this layer (like 0xc ... the RAID controller ; or 0xe ... the
> reduced block device).
>
> Won't it make sense to just selectively blacklist the 0xd ?

If you think it makes more sense to blacklist 0xd only, that is fine with me.
I will prepare a new patch for this.

Best regards,
Soeren Moch

>
>>   		/* skip unknown devices */
>>   		return 0;
>>   	}
>
> Best regards,
> Marek Vasut
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing
  2014-11-07  9:28   ` Soeren Moch
@ 2014-11-07  9:29     ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2014-11-07  9:29 UTC (permalink / raw)
  To: u-boot

On Friday, November 07, 2014 at 10:28:18 AM, Soeren Moch wrote:
> On 11/06/14 21:41, Marek Vasut wrote:
> > On Thursday, November 06, 2014 at 01:51:51 PM, Soeren Moch wrote:
> >> Not only skip storage devices with DEV_TYPE_UNKNOWN, but also all
> >> devices which are unknown to u-boot (e.g., are not HARDDISK, TAPE,
> >> CDROM, OPDISK).
> >> 
> >> This especially avoids long timeouts when probing for external usb
> >> harddisks which provide "Enclosure Services".
> >> 
> >> Signed-off-by: Soeren Moch <smoch@web.de>
> >> --
> >> Cc: Marek Vasut <marex@denx.de>
> >> Cc: Tom Rini <trini@ti.com>
> >> ---
> >> 
> >>   common/usb_storage.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/common/usb_storage.c b/common/usb_storage.c
> >> index eb7706c..0ac7b48 100644
> >> --- a/common/usb_storage.c
> >> +++ b/common/usb_storage.c
> >> @@ -1351,7 +1351,7 @@ int usb_stor_get_info(struct usb_device *dev,
> >> struct us_data *ss, perq = usb_stor_buf[0];
> >> 
> >>   	modi = usb_stor_buf[1];
> >> 
> >> -	if ((perq & 0x1f) == 0x1f) {
> >> +	if ((perq & 0x1f) > DEV_TYPE_OPDISK) {
> > 
> > Why can't you just blacklist 0xd instead ? I mean, this patch would do a
> > bulk blacklisting of all the obscure devices with peripheral ID above
> > 0x7, but might still work with this layer (like 0xc ... the RAID
> > controller ; or 0xe ... the reduced block device).
> > 
> > Won't it make sense to just selectively blacklist the 0xd ?
> 
> If you think it makes more sense to blacklist 0xd only, that is fine with
> me. I will prepare a new patch for this.

Please also make sure to document why this change is in place. (because the
Enclosure Services cause trouble). A simple comment in the code would be nice.

Thank you!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices
  2014-11-06 12:51 [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing Soeren Moch
  2014-11-06 20:41 ` Marek Vasut
@ 2014-11-08  6:02 ` Soeren Moch
  2014-11-08  6:28   ` Nikolay Dimitrov
  2014-11-08 11:04   ` Marek Vasut
  1 sibling, 2 replies; 8+ messages in thread
From: Soeren Moch @ 2014-11-08  6:02 UTC (permalink / raw)
  To: u-boot

Skip enclosure service devices when probing for usb storage devices.

This avoids long timeouts when probing for external usb harddisks
which provide "Enclosure Services".

Signed-off-by: Soeren Moch <smoch@web.de>
--

This is a new version of the patch
"usb_storage: skip all unknown devices when probing"
http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html

Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
---
 common/usb_storage.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/usb_storage.c b/common/usb_storage.c
index eb7706c..9198f73 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -1351,8 +1351,9 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
 	perq = usb_stor_buf[0];
 	modi = usb_stor_buf[1];
 
-	if ((perq & 0x1f) == 0x1f) {
-		/* skip unknown devices */
+	if (((perq & 0x1f) == 0x1f) || ((perq & 0x1f) == 0x0d)) {
+		/* skip unknown devices and enclosure service devices, */
+		/* they would not respond to test_unit_ready           */
 		return 0;
 	}
 	if ((modi&0x80) == 0x80) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices
  2014-11-08  6:02 ` [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices Soeren Moch
@ 2014-11-08  6:28   ` Nikolay Dimitrov
  2014-11-08 11:04   ` Marek Vasut
  1 sibling, 0 replies; 8+ messages in thread
From: Nikolay Dimitrov @ 2014-11-08  6:28 UTC (permalink / raw)
  To: u-boot

Hi Soeren,

On 11/08/2014 08:02 AM, Soeren Moch wrote:
> Skip enclosure service devices when probing for usb storage devices.
>
> This avoids long timeouts when probing for external usb harddisks
> which provide "Enclosure Services".
>
> Signed-off-by: Soeren Moch <smoch@web.de>
> --
>
> This is a new version of the patch
> "usb_storage: skip all unknown devices when probing"
> http://http://lists.denx.de/pipermail/u-boot/2014-November/194622.html
>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> ---
>   common/usb_storage.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/common/usb_storage.c b/common/usb_storage.c
> index eb7706c..9198f73 100644
> --- a/common/usb_storage.c
> +++ b/common/usb_storage.c
> @@ -1351,8 +1351,9 @@ int usb_stor_get_info(struct usb_device *dev, struct us_data *ss,
>   	perq = usb_stor_buf[0];
>   	modi = usb_stor_buf[1];
>
> -	if ((perq & 0x1f) == 0x1f) {
> -		/* skip unknown devices */
> +	if (((perq & 0x1f) == 0x1f) || ((perq & 0x1f) == 0x0d)) {
> +		/* skip unknown devices and enclosure service devices, */
> +		/* they would not respond to test_unit_ready           */
>   		return 0;
>   	}
>   	if ((modi&0x80) == 0x80) {
>

Is it possible to provide a configuration option and some default 
behavior, instead of just disabling it?

Regards,
Nikolay

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices
  2014-11-08  6:02 ` [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices Soeren Moch
  2014-11-08  6:28   ` Nikolay Dimitrov
@ 2014-11-08 11:04   ` Marek Vasut
  1 sibling, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2014-11-08 11:04 UTC (permalink / raw)
  To: u-boot

On Saturday, November 08, 2014 at 07:02:14 AM, Soeren Moch wrote:
> Skip enclosure service devices when probing for usb storage devices.
> 
> This avoids long timeouts when probing for external usb harddisks
> which provide "Enclosure Services".
> 
> Signed-off-by: Soeren Moch <smoch@web.de>

I tweaked the comment so it matches the patch guidelines [1] and applied. 
Thanks!

[1] http://www.denx.de/wiki/U-Boot/Patches

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices
       [not found] <mailman.3.1415444402.20423.u-boot@lists.denx.de>
@ 2014-11-08 12:49 ` Soeren Moch
  0 siblings, 0 replies; 8+ messages in thread
From: Soeren Moch @ 2014-11-08 12:49 UTC (permalink / raw)
  To: u-boot


>> > Skip enclosure service devices when probing for usb storage devices.
>> >
>> > This avoids long timeouts when probing for external usb harddisks
>> > which provide "Enclosure Services".
>> >
>> > Signed-off-by: Soeren Moch <smoch@web.de>

> Is it possible to provide a configuration option and some default 
> behavior, instead of just disabling it?
> 

Nikolay,

I don't understand your concern, why do you need some other default
behavior? Since the "block device" part of the harddisk keeps active,
why not skipping the "enclosure service" part? Is there any command to
access enclosure services from u-boot?

Please keep me (and maintainers) on cc when answering the mail. But
since the patch is already applied (thanks Marek!), it may be to late
for discussions anyway...

Regards,
Soeren

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-08 12:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-06 12:51 [U-Boot] [PATCH] usb_storage: skip all unknown devices when probing Soeren Moch
2014-11-06 20:41 ` Marek Vasut
2014-11-07  9:28   ` Soeren Moch
2014-11-07  9:29     ` Marek Vasut
2014-11-08  6:02 ` [U-Boot] [PATCH] usb_storage: blacklist Enclosure Service Devices Soeren Moch
2014-11-08  6:28   ` Nikolay Dimitrov
2014-11-08 11:04   ` Marek Vasut
     [not found] <mailman.3.1415444402.20423.u-boot@lists.denx.de>
2014-11-08 12:49 ` Soeren Moch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox