qemu-patch-raspberry4/hw/usb
Hans de Goede 49cfa2fdc9 uas: Fix response iu struct definition
This patch mirrors a patch to the Linux uas kernel driver which I've just
submitted. It looks like the qemu uas struct definitions were taken from
the Linux kernel driver, and have inherited the same mistake.

Besides fixing the response iu struct, the patch also drops the add_info
parameter from the usb_uas_queue_response() function, it is always 0 anyways,
and expressing 3 zero-bytes as a function argument is a bit hard.

Below is the long explanation for this change taken from the kernel commit:

The response iu struct before this patch has a size of 7 bytes, which is weird
since all other iu-s are explictly padded to a multiple of 4 bytes.

Submitting a 7 byte bulk transfer to the status endpoint of a real uasp device
when expecting a response iu results in an USB babble error, as the device
actually sends 8 bytes.

Up on closer reading of the UAS spec:
http://www.t10.org/cgi-bin/ac.pl?t=f&f=uas2r00.pdf

The reason for this becomes clear, the 2 entries in "Table 17 — RESPONSE IU"
are numbered 4 and 6, looking at other iu definitions in the spec, esp.
multi-byte fields, this indicates that the ADDITIONAL RESPONSE INFORMATION
field is not a 2 byte field as one might assume at a first look, but is
a multi-byte field containing 3 bytes.

This also aligns with the SCSI Architecture Model 4 spec, which UAS is based
on which states in paragraph "7.1 Task management function procedure calls"
that the "Additional Response Information" output argument for a Task
management function procedure call is 3 bytes.

Last but not least I've verified this by sending a logical unit reset task
management call with an invalid lun to an actual uasp device, and received
back a response-iu with byte 6 being 0, and byte 7 being 9, which is the
responce code for an invalid iu, which confirms that the response code is
being reported in byte 7 of the response iu rather then in byte 6.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2013-11-26 09:21:17 +01:00
..
bus.c qdev: Drop misleading qdev_free() function 2013-11-05 18:06:38 +01:00
ccid-card-emulated.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
ccid-card-passthru.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
ccid.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00
combined-packet.c usb: Fix iovec memleak on combined-packet free 2013-09-19 11:28:40 +02:00
core.c usb: Also reset max_packet_size on ep_reset 2013-09-19 11:28:40 +02:00
desc.c usb: add serial bus property 2013-06-24 08:41:07 +02:00
desc.h usb: split packet result into actual_length + status 2012-11-08 18:41:46 +01:00
dev-audio.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
dev-bluetooth.c Remove dev-bluetooth.c dependency from vl.c 2013-09-10 11:14:42 +02:00
dev-hid.c usb/dev-hid: Modified usb-tablet category from Misc to Input 2013-09-02 11:06:20 +02:00
dev-hub.c Revert "usb-hub: report status changes only once" 2013-09-02 11:06:20 +02:00
dev-network.c usb: drop unused USBNetState.inpkt field 2013-11-13 15:48:38 +04:00
dev-serial.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
dev-smartcard-reader.c qdev: Pass size to qbus_create_inplace() 2013-08-30 21:15:35 +02:00
dev-storage.c qdev: Drop misleading qdev_free() function 2013-11-05 18:06:38 +01:00
dev-uas.c uas: Fix response iu struct definition 2013-11-26 09:21:17 +01:00
dev-wacom.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
hcd-ehci-pci.c hw: set interrupts using pci irq wrappers 2013-10-14 17:11:45 +03:00
hcd-ehci-sysbus.c devices: Associate devices to their logical category 2013-07-29 10:37:09 -05:00
hcd-ehci.c ehci: save device pointer in EHCIState 2013-09-10 11:14:42 +02:00
hcd-ehci.h ehci: save device pointer in EHCIState 2013-09-10 11:14:42 +02:00
hcd-musb.c usb: Pass size to usb_bus_new() 2013-08-30 20:14:39 +02:00
hcd-ohci.c pci, pc, acpi fixes, enhancements 2013-10-31 16:58:32 +01:00
hcd-uhci.c hw: set interrupts using pci irq wrappers 2013-10-14 17:11:45 +03:00
hcd-xhci.c xhci: add support for suspend/resume 2013-11-26 09:21:17 +01:00
host-legacy.c qdev: Drop misleading qdev_free() function 2013-11-05 18:06:38 +01:00
host-libusb.c usb-host-libusb: Detach kernel drivers earlier 2013-10-22 16:28:49 +02:00
host-stub.c usb-host: remove usb_host_device_close 2013-02-19 12:30:05 +01:00
host.h usb-host: move legacy cmd line bits 2013-02-19 12:30:05 +01:00
libhw.c dma: eliminate DMAContext 2013-06-20 16:39:52 +02:00
Makefile.objs Remove dev-bluetooth.c dependency from vl.c 2013-09-10 11:14:42 +02:00
quirks-ftdi-ids.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
quirks-pl2303-ids.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
quirks.c usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
quirks.h usbredir: Add support for buffered bulk input (v2) 2013-01-08 10:56:58 +01:00
redirect.c aio / timers: Switch entire codebase to the new timer API 2013-08-22 19:14:24 +02:00