summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorStefan Reinauer <stepan@coresystems.de>2010-03-25 22:17:36 +0000
committerStefan Reinauer <stepan@openbios.org>2010-03-25 22:17:36 +0000
commitb56f2d0ad4bfc81e7ef5ffd406c652f2c3bd954a (patch)
treeec2bbc0918ee3e1f2ee66491c7b87da204e607da /payloads/libpayload/include
parente5d30b78b7720ba3e511819b7fc51c11d642153b (diff)
USB updates from our internal tree
- support MMC2 devices - make usb stack more solid - drop some unused functions - fix lowspeed/speed naming - add support for "quirks" - improve usbhid driver Signed-off-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Joseph Smith <joe@settoplinux.org> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5299 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/usb/usb.h40
-rw-r--r--payloads/libpayload/include/usb/usbmsc.h7
2 files changed, 39 insertions, 8 deletions
diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h
index 9f38b845dd..3760eb3e78 100644
--- a/payloads/libpayload/include/usb/usb.h
+++ b/payloads/libpayload/include/usb/usb.h
@@ -101,7 +101,8 @@ struct usbdev {
int address; // usb address
int hub; // hub, device is attached to
int port; // port where device is attached
- int lowspeed; // 1 if lowspeed device
+ int speed; // 1: lowspeed, 0: fullspeed, 2: highspeed
+ u32 quirks; // quirks field. got to love usb
void *data;
u8 *descriptor;
u8 *configuration;
@@ -119,8 +120,6 @@ struct usbdev_hc {
void (*stop) (hci_t *controller);
void (*reset) (hci_t *controller);
void (*shutdown) (hci_t *controller);
- int (*packet) (usbdev_t *dev, int endp, int pid, int toggle,
- int length, u8 *data);
int (*bulk) (endpoint_t *ep, int size, u8 *data, int finalize);
int (*control) (usbdev_t *dev, pid_t pid, int dr_length,
void *devreq, int data_length, u8 *data);
@@ -199,6 +198,16 @@ typedef struct {
unsigned char bInterval;
} __attribute__ ((packed)) endpoint_descriptor_t;
+typedef struct {
+ unsigned char bLength;
+ unsigned char bDescriptorType;
+ unsigned short bcdHID;
+ unsigned char bCountryCode;
+ unsigned char bNumDescriptors;
+ unsigned char bReportDescriptorType;
+ unsigned short wReportDescriptorLength;
+} __attribute__ ((packed)) hid_descriptor_t;
+
hci_t *new_controller (void);
void detach_controller (hci_t *controller);
void usb_poll (void);
@@ -213,7 +222,7 @@ void usb_hub_init (usbdev_t *dev);
void usb_hid_init (usbdev_t *dev);
void usb_msc_init (usbdev_t *dev);
-int set_address (hci_t *controller, int lowspeed);
+int set_address (hci_t *controller, int speed);
u8 *get_descriptor (usbdev_t *dev, unsigned char bmRequestType,
int descType, int descIdx, int langID);
@@ -225,7 +234,28 @@ gen_bmRequestType (dev_req_dir dir, dev_req_type type, dev_req_recp recp)
}
void usb_detach_device(hci_t *controller, int devno);
-int usb_attach_device(hci_t *controller, int hubaddress, int port, int lowspeed);
+int usb_attach_device(hci_t *controller, int hubaddress, int port, int speed);
+
+u32 usb_quirk_check(u16 vendor, u16 device);
+int usb_interface_check(u16 vendor, u16 device);
+
+#define USB_QUIRK_MSC_FORCE_PROTO_SCSI (1 << 0)
+#define USB_QUIRK_MSC_FORCE_PROTO_ATAPI (1 << 1)
+#define USB_QUIRK_MSC_FORCE_PROTO_UFI (1 << 2)
+#define USB_QUIRK_MSC_FORCE_PROTO_RBC (1 << 3)
+#define USB_QUIRK_MSC_FORCE_TRANS_BBB (1 << 4)
+#define USB_QUIRK_MSC_FORCE_TRANS_CBI (1 << 5)
+#define USB_QUIRK_MSC_FORCE_TRANS_CBI_I (1 << 6)
+#define USB_QUIRK_MSC_NO_TEST_UNIT_READY (1 << 7)
+#define USB_QUIRK_MSC_SHORT_INQUIRY (1 << 8)
+#define USB_QUIRK_TEST (1 << 31)
+#define USB_QUIRK_NONE 0
+
+#ifdef USB_DEBUG
+#define debug(x...) printf(x);
+#else
+#define debug(x...)
+#endif
void usb_fatal(const char *message) __attribute__ ((noreturn));
#endif
diff --git a/payloads/libpayload/include/usb/usbmsc.h b/payloads/libpayload/include/usb/usbmsc.h
index e180d3e64a..b8a8ec13c9 100644
--- a/payloads/libpayload/include/usb/usbmsc.h
+++ b/payloads/libpayload/include/usb/usbmsc.h
@@ -1,7 +1,7 @@
/*
* This file is part of the libpayload project.
*
- * Copyright (C) 2008 coresystems GmbH
+ * Copyright (C) 2008-2010 coresystems GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,6 +32,7 @@
typedef struct {
unsigned int blocksize;
unsigned int numblocks;
+ unsigned int protocol;
endpoint_t *bulk_in;
endpoint_t *bulk_out;
} usbmsc_inst_t;
@@ -41,7 +42,7 @@ typedef struct {
typedef enum { cbw_direction_data_in = 0x80, cbw_direction_data_out = 0
} cbw_direction;
-int readwrite_blocks (usbdev_t *dev, int start, int n, cbw_direction dir,
- u8 *buf);
+int readwrite_blocks_512 (usbdev_t *dev, int start, int n, cbw_direction dir, u8 *buf);
+int readwrite_blocks (usbdev_t *dev, int start, int n, cbw_direction dir, u8 *buf);
#endif