2008-09-02 18:06:22 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the libpayload project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008 coresystems GmbH
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __USB_H
|
|
|
|
#define __USB_H
|
|
|
|
#include <libpayload.h>
|
2013-05-03 01:16:41 +02:00
|
|
|
#include <pci/pci.h>
|
2008-09-02 18:06:22 +02:00
|
|
|
|
|
|
|
typedef enum { host_to_device = 0, device_to_host = 1 } dev_req_dir;
|
|
|
|
typedef enum { standard_type = 0, class_type = 1, vendor_type =
|
|
|
|
2, reserved_type = 3
|
|
|
|
} dev_req_type;
|
|
|
|
typedef enum { dev_recp = 0, iface_recp = 1, endp_recp = 2, other_recp = 3
|
|
|
|
} dev_req_recp;
|
|
|
|
|
2013-09-18 07:16:04 +02:00
|
|
|
enum {
|
|
|
|
DT_DEV = 1,
|
|
|
|
DT_CFG = 2,
|
|
|
|
DT_STR = 3,
|
|
|
|
DT_INTF = 4,
|
|
|
|
DT_ENDP = 5,
|
|
|
|
};
|
|
|
|
|
2008-09-02 18:06:22 +02:00
|
|
|
typedef enum {
|
|
|
|
GET_STATUS = 0,
|
|
|
|
CLEAR_FEATURE = 1,
|
|
|
|
SET_FEATURE = 3,
|
|
|
|
SET_ADDRESS = 5,
|
|
|
|
GET_DESCRIPTOR = 6,
|
|
|
|
SET_DESCRIPTOR = 7,
|
|
|
|
GET_CONFIGURATION = 8,
|
|
|
|
SET_CONFIGURATION = 9,
|
|
|
|
GET_INTERFACE = 10,
|
|
|
|
SET_INTERFACE = 11,
|
|
|
|
SYNCH_FRAME = 12
|
|
|
|
} bRequest_Codes;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ENDPOINT_HALT = 0,
|
|
|
|
DEVICE_REMOTE_WAKEUP = 1,
|
|
|
|
TEST_MODE = 2
|
|
|
|
} feature_selectors;
|
|
|
|
|
2013-09-25 05:03:54 +02:00
|
|
|
/* SetAddress() recovery interval (USB 2.0 specification 9.2.6.3 */
|
|
|
|
#define SET_ADDRESS_MDELAY 2
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char bDescLength;
|
|
|
|
unsigned char bDescriptorType;
|
|
|
|
unsigned char bNbrPorts;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
unsigned long logicalPowerSwitchingMode:2;
|
|
|
|
unsigned long isCompoundDevice:1;
|
|
|
|
unsigned long overcurrentProtectionMode:2;
|
|
|
|
unsigned long ttThinkTime:2;
|
|
|
|
unsigned long arePortIndicatorsSupported:1;
|
|
|
|
unsigned long:8;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
unsigned short wHubCharacteristics;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
unsigned char bPowerOn2PwrGood;
|
|
|
|
unsigned char bHubContrCurrent;
|
|
|
|
char DeviceRemovable[];
|
|
|
|
} __attribute__ ((packed)) hub_descriptor_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char bLength;
|
|
|
|
unsigned char bDescriptorType;
|
|
|
|
unsigned short bcdUSB;
|
|
|
|
unsigned char bDeviceClass;
|
|
|
|
unsigned char bDeviceSubClass;
|
|
|
|
unsigned char bDeviceProtocol;
|
|
|
|
unsigned char bMaxPacketSize0;
|
|
|
|
unsigned short idVendor;
|
|
|
|
unsigned short idProduct;
|
|
|
|
unsigned short bcdDevice;
|
|
|
|
unsigned char iManufacturer;
|
|
|
|
unsigned char iProduct;
|
|
|
|
unsigned char iSerialNumber;
|
|
|
|
unsigned char bNumConfigurations;
|
|
|
|
} __attribute__ ((packed)) device_descriptor_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char bLength;
|
|
|
|
unsigned char bDescriptorType;
|
|
|
|
unsigned short wTotalLength;
|
|
|
|
unsigned char bNumInterfaces;
|
|
|
|
unsigned char bConfigurationValue;
|
|
|
|
unsigned char iConfiguration;
|
|
|
|
unsigned char bmAttributes;
|
|
|
|
unsigned char bMaxPower;
|
|
|
|
} __attribute__ ((packed)) configuration_descriptor_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char bLength;
|
|
|
|
unsigned char bDescriptorType;
|
|
|
|
unsigned char bInterfaceNumber;
|
|
|
|
unsigned char bAlternateSetting;
|
|
|
|
unsigned char bNumEndpoints;
|
|
|
|
unsigned char bInterfaceClass;
|
|
|
|
unsigned char bInterfaceSubClass;
|
|
|
|
unsigned char bInterfaceProtocol;
|
|
|
|
unsigned char iInterface;
|
|
|
|
} __attribute__ ((packed)) interface_descriptor_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
unsigned char bLength;
|
|
|
|
unsigned char bDescriptorType;
|
|
|
|
unsigned char bEndpointAddress;
|
|
|
|
unsigned char bmAttributes;
|
|
|
|
unsigned short wMaxPacketSize;
|
|
|
|
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;
|
|
|
|
|
2008-09-02 18:06:22 +02:00
|
|
|
typedef struct {
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
dev_req_recp req_recp:5;
|
|
|
|
dev_req_type req_type:2;
|
|
|
|
dev_req_dir data_dir:1;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
unsigned char bmRequestType;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
unsigned char bRequest;
|
|
|
|
unsigned short wValue;
|
|
|
|
unsigned short wIndex;
|
|
|
|
unsigned short wLength;
|
|
|
|
} __attribute__ ((packed)) dev_req_t;
|
|
|
|
|
|
|
|
struct usbdev_hc;
|
|
|
|
typedef struct usbdev_hc hci_t;
|
|
|
|
|
|
|
|
struct usbdev;
|
|
|
|
typedef struct usbdev usbdev_t;
|
|
|
|
|
2010-06-07 15:58:17 +02:00
|
|
|
typedef enum { SETUP, IN, OUT } direction_t;
|
2008-09-02 18:06:22 +02:00
|
|
|
typedef enum { CONTROL = 0, ISOCHRONOUS = 1, BULK = 2, INTERRUPT = 3
|
|
|
|
} endpoint_type;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
usbdev_t *dev;
|
|
|
|
int endpoint;
|
2010-06-07 15:58:17 +02:00
|
|
|
direction_t direction;
|
2008-09-02 18:06:22 +02:00
|
|
|
int toggle;
|
|
|
|
int maxpacketsize;
|
|
|
|
endpoint_type type;
|
2013-06-06 10:20:35 +02:00
|
|
|
int interval; /* expressed as binary logarithm of the number
|
|
|
|
of microframes (i.e. t = 125us * 2^interval) */
|
2008-09-02 18:06:22 +02:00
|
|
|
} endpoint_t;
|
|
|
|
|
2013-09-25 05:03:54 +02:00
|
|
|
typedef enum {
|
|
|
|
FULL_SPEED = 0, LOW_SPEED = 1, HIGH_SPEED = 2, SUPER_SPEED = 3,
|
|
|
|
} usb_speed;
|
2008-09-02 18:06:22 +02:00
|
|
|
|
|
|
|
struct usbdev {
|
|
|
|
hci_t *controller;
|
|
|
|
endpoint_t endpoints[32];
|
|
|
|
int num_endp;
|
|
|
|
int address; // usb address
|
|
|
|
int hub; // hub, device is attached to
|
|
|
|
int port; // port where device is attached
|
2013-09-25 05:03:54 +02:00
|
|
|
usb_speed speed;
|
2010-03-25 23:17:36 +01:00
|
|
|
u32 quirks; // quirks field. got to love usb
|
2008-09-02 18:06:22 +02:00
|
|
|
void *data;
|
2013-09-18 07:16:04 +02:00
|
|
|
device_descriptor_t *descriptor;
|
|
|
|
configuration_descriptor_t *configuration;
|
2008-09-02 18:06:22 +02:00
|
|
|
void (*init) (usbdev_t *dev);
|
|
|
|
void (*destroy) (usbdev_t *dev);
|
|
|
|
void (*poll) (usbdev_t *dev);
|
|
|
|
};
|
|
|
|
|
2012-06-28 06:30:15 +02:00
|
|
|
typedef enum { OHCI = 0, UHCI = 1, EHCI = 2, XHCI = 3} hc_type;
|
|
|
|
|
2008-09-02 18:06:22 +02:00
|
|
|
struct usbdev_hc {
|
2013-05-24 15:48:56 +02:00
|
|
|
hci_t *next;
|
2008-09-02 18:06:22 +02:00
|
|
|
u32 reg_base;
|
2013-12-21 11:41:22 +01:00
|
|
|
pcidev_t pcidev; // 0 if not used (eg on ARM)
|
2012-06-28 06:30:15 +02:00
|
|
|
hc_type type;
|
libpayload: usb: Try to avoid reusing device addresses
We recently changed the USB stack to detach devices aggressively that we
don't intend to use. This alone is not really a problem, but it
exarcerbates the fact that our device detachment itself is not very
good. We destroy any local info about the device, but we don't properly
disable the offending port. The device keeps thinking that it's active,
and if we later try to reuse that device address for another device
things become confused.
The real fix would be to properly disable all ports that we don't intend
to use. Unfortunately, this isn't really possible in our current
device/hub polymorphism structure, and I don't want to hack a new
disable_port() callback into usbdev_t that really doesn't belong there.
We will only be able to fix this cleanly after we ported all root hubs
to the generic_hub interface.
Until then, an easy workaround is to just avoid reusing addresses as
long as possible. This is firmware, so the chance that we'll ever run
through 127 devices is really small in practice. Even if we ever fix the
underlying issue, it's probably a smart precaution to keep.
BRANCH=nyan,rambi
BUG=chrome-os-partner:28328
TEST=Boot from a hub that has an "unknown" device in an earlier port
than the stick you want to boot from, make sure you can still boot.
Original-Change-Id: I9b522dd8cbcd441e8c3b8781fcecd2effa0f23ee
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/197420
Original-Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
(cherry picked from commit 28b48aa69b55a983226edf2ea616f33cd4b959e2)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Change-Id: Id4c5c92e75d6b5a7e8f0ee3e396c69c4efd13176
Reviewed-on: http://review.coreboot.org/7881
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2014-04-29 01:04:24 +02:00
|
|
|
int latest_address;
|
2008-10-16 21:20:51 +02:00
|
|
|
usbdev_t *devices[128]; // dev 0 is root hub, 127 is last addressable
|
2012-11-12 15:12:35 +01:00
|
|
|
|
|
|
|
/* start(): Resume operation. */
|
2008-09-02 18:06:22 +02:00
|
|
|
void (*start) (hci_t *controller);
|
2012-11-12 15:12:35 +01:00
|
|
|
/* stop(): Stop operation but keep controller initialized. */
|
2008-09-02 18:06:22 +02:00
|
|
|
void (*stop) (hci_t *controller);
|
2012-11-12 15:12:35 +01:00
|
|
|
/* reset(): Perform a controller reset. The controller needs to
|
|
|
|
be (re)initialized afterwards to work (again). */
|
2008-09-02 18:06:22 +02:00
|
|
|
void (*reset) (hci_t *controller);
|
2012-11-12 16:20:32 +01:00
|
|
|
/* init(): Initialize a (previously reset) controller
|
|
|
|
to a working state. */
|
|
|
|
void (*init) (hci_t *controller);
|
2012-11-12 15:12:35 +01:00
|
|
|
/* shutdown(): Stop operation, detach host controller and shutdown
|
|
|
|
this driver instance. After calling shutdown() any
|
|
|
|
other usage of this hci_t* is invalid. */
|
2008-09-02 18:06:22 +02:00
|
|
|
void (*shutdown) (hci_t *controller);
|
2012-11-12 15:12:35 +01:00
|
|
|
|
2008-09-02 18:06:22 +02:00
|
|
|
int (*bulk) (endpoint_t *ep, int size, u8 *data, int finalize);
|
2010-06-07 15:58:17 +02:00
|
|
|
int (*control) (usbdev_t *dev, direction_t pid, int dr_length,
|
2008-09-02 18:06:22 +02:00
|
|
|
void *devreq, int data_length, u8 *data);
|
2008-10-16 21:20:51 +02:00
|
|
|
void* (*create_intr_queue) (endpoint_t *ep, int reqsize, int reqcount, int reqtiming);
|
|
|
|
void (*destroy_intr_queue) (endpoint_t *ep, void *queue);
|
|
|
|
u8* (*poll_intr_queue) (void *queue);
|
2008-09-02 18:06:22 +02:00
|
|
|
void *instance;
|
2013-05-24 15:48:56 +02:00
|
|
|
|
2013-09-18 07:16:04 +02:00
|
|
|
/* set_address(): Tell the usb device its address (xHCI
|
|
|
|
controllers want to do this by
|
|
|
|
themselves). Also, allocate the usbdev
|
|
|
|
structure, initialize enpoint 0
|
|
|
|
(including MPS) and return it. */
|
|
|
|
usbdev_t *(*set_address) (hci_t *controller, usb_speed speed,
|
2013-09-25 05:03:54 +02:00
|
|
|
int hubport, int hubaddr);
|
2013-05-24 15:48:56 +02:00
|
|
|
/* finish_device_config(): Another hook for xHCI,
|
|
|
|
returns 0 on success. */
|
|
|
|
int (*finish_device_config) (usbdev_t *dev);
|
|
|
|
/* destroy_device(): Finally, destroy all structures that
|
|
|
|
were allocated during set_address()
|
|
|
|
and finish_device_config(). */
|
|
|
|
void (*destroy_device) (hci_t *controller, int devaddr);
|
2008-09-02 18:06:22 +02:00
|
|
|
};
|
|
|
|
|
2013-09-05 02:20:32 +02:00
|
|
|
hci_t *usb_add_mmio_hc(hc_type type, void *bar);
|
2008-09-02 18:06:22 +02:00
|
|
|
hci_t *new_controller (void);
|
|
|
|
void detach_controller (hci_t *controller);
|
|
|
|
void usb_poll (void);
|
2013-09-18 07:16:04 +02:00
|
|
|
usbdev_t *init_device_entry (hci_t *controller, int num);
|
2008-09-02 18:06:22 +02:00
|
|
|
|
2013-09-25 05:03:54 +02:00
|
|
|
int usb_decode_mps0 (usb_speed speed, u8 bMaxPacketSize0);
|
2013-09-18 07:16:04 +02:00
|
|
|
int set_feature (usbdev_t *dev, int endp, int feature, int rtype);
|
|
|
|
int get_status (usbdev_t *dev, int endp, int rtype, int len, void *data);
|
|
|
|
int get_descriptor (usbdev_t *dev, int rtype, int descType, int descIdx,
|
|
|
|
void *data, size_t len);
|
|
|
|
int set_configuration (usbdev_t *dev);
|
2012-06-01 09:50:11 +02:00
|
|
|
int clear_feature (usbdev_t *dev, int endp, int feature, int rtype);
|
2008-09-02 18:06:22 +02:00
|
|
|
int clear_stall (endpoint_t *ep);
|
|
|
|
|
|
|
|
void usb_nop_init (usbdev_t *dev);
|
|
|
|
void usb_hub_init (usbdev_t *dev);
|
|
|
|
void usb_hid_init (usbdev_t *dev);
|
|
|
|
void usb_msc_init (usbdev_t *dev);
|
libpayload: Add usb_generic_(create|remove) functions for unrecognized devices
It might be useful to provide a USB driver in the payload itself instead of in
libpayload. For example there are multiple payloads being built and linked
against the same libpayload, and they might not need or even want to have the
same set of drivers installed.
This change adds two new functions, usb_generic_create and usb_generic_remove,
which behave like the usbdisk_create and usbdisk_remove functions which are
defined for USB mass storage devices. If a USB device isn't recognized and
claimed by one of the built in USB class drivers (currently hub, hid, and msc)
and the create function is defined, then it will be called to give the payload
a chance to use the device. Once it's removed, if usb_generic_remove is
defined it will be called, effectively giving the payload notice.
Built and booted depthcharge on Link. Built depthcharge for Daisy. Built
a netbooting payload, called usb_poll() with those functions implemented, and
verified that they were called and that the devices they were told about were
reasonable and the same as what was reported by lsusb in the booted system.
Change-Id: Ief7c0a513b60849fbf2986ef4ae5c9e7825fef16
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2666
Tested-by: build bot (Jenkins)
Reviewed-by: Kimarie Hoot <kimarie.hoot@se-eng.com>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-02 05:19:27 +01:00
|
|
|
void usb_generic_init (usbdev_t *dev);
|
2008-09-02 18:06:22 +02:00
|
|
|
|
|
|
|
static inline unsigned char
|
|
|
|
gen_bmRequestType (dev_req_dir dir, dev_req_type type, dev_req_recp recp)
|
|
|
|
{
|
|
|
|
return (dir << 7) | (type << 5) | recp;
|
|
|
|
}
|
|
|
|
|
2013-05-24 15:48:56 +02:00
|
|
|
/* default "set address" handler */
|
2013-09-18 07:16:04 +02:00
|
|
|
usbdev_t *generic_set_address (hci_t *controller, usb_speed speed,
|
2013-09-25 05:03:54 +02:00
|
|
|
int hubport, int hubaddr);
|
2013-05-24 15:48:56 +02:00
|
|
|
|
2008-10-16 21:20:51 +02:00
|
|
|
void usb_detach_device(hci_t *controller, int devno);
|
2013-09-25 05:03:54 +02:00
|
|
|
int usb_attach_device(hci_t *controller, int hubaddress, int port,
|
|
|
|
usb_speed speed);
|
2010-03-25 23:17:36 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-11-01 23:44:10 +01:00
|
|
|
static inline void usb_debug(const char *fmt, ...)
|
|
|
|
{
|
2010-03-25 23:17:36 +01:00
|
|
|
#ifdef USB_DEBUG
|
2012-11-01 23:44:10 +01:00
|
|
|
va_list ap;
|
|
|
|
va_start(ap, fmt);
|
|
|
|
vprintf(fmt, ap);
|
|
|
|
va_end(ap);
|
2010-03-25 23:17:36 +01:00
|
|
|
#endif
|
2012-11-01 23:44:10 +01:00
|
|
|
}
|
2009-07-31 13:39:55 +02:00
|
|
|
|
libpayload: Add usb_generic_(create|remove) functions for unrecognized devices
It might be useful to provide a USB driver in the payload itself instead of in
libpayload. For example there are multiple payloads being built and linked
against the same libpayload, and they might not need or even want to have the
same set of drivers installed.
This change adds two new functions, usb_generic_create and usb_generic_remove,
which behave like the usbdisk_create and usbdisk_remove functions which are
defined for USB mass storage devices. If a USB device isn't recognized and
claimed by one of the built in USB class drivers (currently hub, hid, and msc)
and the create function is defined, then it will be called to give the payload
a chance to use the device. Once it's removed, if usb_generic_remove is
defined it will be called, effectively giving the payload notice.
Built and booted depthcharge on Link. Built depthcharge for Daisy. Built
a netbooting payload, called usb_poll() with those functions implemented, and
verified that they were called and that the devices they were told about were
reasonable and the same as what was reported by lsusb in the booted system.
Change-Id: Ief7c0a513b60849fbf2986ef4ae5c9e7825fef16
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2666
Tested-by: build bot (Jenkins)
Reviewed-by: Kimarie Hoot <kimarie.hoot@se-eng.com>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
2013-02-02 05:19:27 +01:00
|
|
|
/**
|
|
|
|
* To be implemented by libpayload-client. It's called by the USB stack
|
|
|
|
* when a new USB device is found which isn't claimed by a built in driver,
|
|
|
|
* so the client has the chance to know about it.
|
|
|
|
*
|
|
|
|
* @param dev descriptor for the USB device
|
|
|
|
*/
|
|
|
|
void __attribute__((weak)) usb_generic_create (usbdev_t *dev);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be implemented by libpayload-client. It's called by the USB stack
|
|
|
|
* when it finds out that a USB device is removed which wasn't claimed by a
|
|
|
|
* built in driver.
|
|
|
|
*
|
|
|
|
* @param dev descriptor for the USB device
|
|
|
|
*/
|
|
|
|
void __attribute__((weak)) usb_generic_remove (usbdev_t *dev);
|
|
|
|
|
2008-09-02 18:06:22 +02:00
|
|
|
#endif
|