aboutsummaryrefslogtreecommitdiff
path: root/hw/usb.h
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2012-11-14 08:50:18 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-11-14 08:50:18 -0600
commitce5e5b522e8d3b848b6445c34226b69c77c46403 (patch)
tree9cd13246a20784e657c3d6d686e0282d1da5ffba /hw/usb.h
parentbf0dfb69f860a7894958068fba45f5268dddd6be (diff)
parent9d1530470bba5d8bec4796c0b43b874d5f9ef017 (diff)
Merge remote-tracking branch 'kraxel/usb.70' into staging
* kraxel/usb.70: ehci: fix migration xhci: Fix some DMA host endian bugs usb/combined-packet: Move freeing of combined to usb_combined_packet_remove() xhci: Add support for packets with both data and an error status ehci: Add support for packets with both data and an error status ehci: Get rid of the magical PROC_ERR status usb-redir: Allow packets to have both data and an error-status usb: split packet result into actual_length + status Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb.h')
-rw-r--r--hw/usb.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/hw/usb.h b/hw/usb.h
index aef07f4a07..7d6de69ec4 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -38,6 +38,7 @@
#define USB_TOKEN_IN 0x69 /* device -> host */
#define USB_TOKEN_OUT 0xe1 /* host -> device */
+#define USB_RET_SUCCESS (0)
#define USB_RET_NODEV (-1)
#define USB_RET_NAK (-2)
#define USB_RET_STALL (-3)
@@ -280,18 +281,20 @@ typedef struct USBDeviceClass {
* Process control request.
* Called from handle_packet().
*
- * Returns length or one of the USB_RET_ codes.
+ * Status gets stored in p->status, and if p->status == USB_RET_SUCCESS
+ * then the number of bytes transfered is stored in p->actual_length
*/
- int (*handle_control)(USBDevice *dev, USBPacket *p, int request, int value,
- int index, int length, uint8_t *data);
+ void (*handle_control)(USBDevice *dev, USBPacket *p, int request, int value,
+ int index, int length, uint8_t *data);
/*
* Process data transfers (both BULK and ISOC).
* Called from handle_packet().
*
- * Returns length or one of the USB_RET_ codes.
+ * Status gets stored in p->status, and if p->status == USB_RET_SUCCESS
+ * then the number of bytes transfered is stored in p->actual_length
*/
- int (*handle_data)(USBDevice *dev, USBPacket *p);
+ void (*handle_data)(USBDevice *dev, USBPacket *p);
void (*set_interface)(USBDevice *dev, int interface,
int alt_old, int alt_new);
@@ -354,7 +357,8 @@ struct USBPacket {
uint64_t parameter; /* control transfers */
bool short_not_ok;
bool int_req;
- int result; /* transfer length or USB_RET_* status code */
+ int status; /* USB_RET_* status code */
+ int actual_length; /* Number of bytes actually transfered */
/* Internal use by the USB layer. */
USBPacketState state;
USBCombinedPacket *combined;
@@ -388,7 +392,7 @@ static inline bool usb_packet_is_inflight(USBPacket *p)
USBDevice *usb_find_device(USBPort *port, uint8_t addr);
-int usb_handle_packet(USBDevice *dev, USBPacket *p);
+void usb_handle_packet(USBDevice *dev, USBPacket *p);
void usb_packet_complete(USBDevice *dev, USBPacket *p);
void usb_packet_complete_one(USBDevice *dev, USBPacket *p);
void usb_cancel_packet(USBPacket * p);
@@ -523,10 +527,10 @@ void usb_device_handle_attach(USBDevice *dev);
void usb_device_handle_reset(USBDevice *dev);
-int usb_device_handle_control(USBDevice *dev, USBPacket *p, int request, int value,
- int index, int length, uint8_t *data);
+void usb_device_handle_control(USBDevice *dev, USBPacket *p, int request,
+ int val, int index, int length, uint8_t *data);
-int usb_device_handle_data(USBDevice *dev, USBPacket *p);
+void usb_device_handle_data(USBDevice *dev, USBPacket *p);
void usb_device_set_interface(USBDevice *dev, int interface,
int alt_old, int alt_new);