|
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) |
|
static const char * | efi_usb_direction_name (EFI_USB_DATA_DIRECTION direction) |
| Transcribe data direction (for debugging) More...
|
|
static VOID EFIAPI | efi_usb_timer (EFI_EVENT event __unused, VOID *context) |
| Poll USB bus (from endpoint event timer) More...
|
|
static int | efi_usb_mtu (struct efi_usb_interface *usbintf, unsigned int endpoint) |
| Get endpoint MTU. More...
|
|
static int | efi_usb_is_open (struct efi_usb_interface *usbintf, unsigned int endpoint) |
| Check if endpoint is open. More...
|
|
static int | efi_usb_open (struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int interval, struct usb_endpoint_driver_operations *driver) |
| Open endpoint. More...
|
|
static void | efi_usb_close (struct efi_usb_endpoint *usbep) |
| Close endpoint. More...
|
|
static void | efi_usb_close_all (struct efi_usb_interface *usbintf) |
| Close all endpoints. More...
|
|
static void | efi_usb_free_all (struct efi_usb_interface *usbintf) |
| Free all endpoints. More...
|
|
static void | efi_usb_sync_complete (struct usb_endpoint *ep, struct io_buffer *iobuf __unused, int rc) |
| Complete synchronous transfer. More...
|
|
static int | efi_usb_sync_transfer (struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int timeout, void *data, size_t *len) |
| Perform synchronous transfer. More...
|
|
static void | efi_usb_async_complete (struct usb_endpoint *ep, struct io_buffer *iobuf, int rc) |
| Complete asynchronous transfer. More...
|
|
static int | efi_usb_async_start (struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int interval, size_t len, EFI_ASYNC_USB_TRANSFER_CALLBACK callback, void *context) |
| Start asynchronous transfer. More...
|
|
static void | efi_usb_async_stop (struct efi_usb_interface *usbintf, unsigned int endpoint) |
| Stop asynchronous transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_control_transfer (EFI_USB_IO_PROTOCOL *usbio, EFI_USB_DEVICE_REQUEST *packet, EFI_USB_DATA_DIRECTION direction, UINT32 timeout, VOID *data, UINTN len, UINT32 *status) |
| Perform control transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_bulk_transfer (EFI_USB_IO_PROTOCOL *usbio, UINT8 endpoint, VOID *data, UINTN *len, UINTN timeout, UINT32 *status) |
| Perform bulk transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_sync_interrupt_transfer (EFI_USB_IO_PROTOCOL *usbio, UINT8 endpoint, VOID *data, UINTN *len, UINTN timeout, UINT32 *status) |
| Perform synchronous interrupt transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_async_interrupt_transfer (EFI_USB_IO_PROTOCOL *usbio, UINT8 endpoint, BOOLEAN start, UINTN interval, UINTN len, EFI_ASYNC_USB_TRANSFER_CALLBACK callback, VOID *context) |
| Perform asynchronous interrupt transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_isochronous_transfer (EFI_USB_IO_PROTOCOL *usbio, UINT8 endpoint, VOID *data, UINTN len, UINT32 *status) |
| Perform synchronous isochronous transfer. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_async_isochronous_transfer (EFI_USB_IO_PROTOCOL *usbio, UINT8 endpoint, VOID *data, UINTN len, EFI_ASYNC_USB_TRANSFER_CALLBACK callback, VOID *context) |
| Perform asynchronous isochronous transfers. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_device_descriptor (EFI_USB_IO_PROTOCOL *usbio, EFI_USB_DEVICE_DESCRIPTOR *efidesc) |
| Get device descriptor. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_config_descriptor (EFI_USB_IO_PROTOCOL *usbio, EFI_USB_CONFIG_DESCRIPTOR *efidesc) |
| Get configuration descriptor. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_interface_descriptor (EFI_USB_IO_PROTOCOL *usbio, EFI_USB_INTERFACE_DESCRIPTOR *efidesc) |
| Get interface descriptor. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_endpoint_descriptor (EFI_USB_IO_PROTOCOL *usbio, UINT8 index, EFI_USB_ENDPOINT_DESCRIPTOR *efidesc) |
| Get endpoint descriptor. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_string_descriptor (EFI_USB_IO_PROTOCOL *usbio, UINT16 language, UINT8 index, CHAR16 **string) |
| Get string descriptor. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_get_supported_languages (EFI_USB_IO_PROTOCOL *usbio, UINT16 **languages, UINT16 *len) |
| Get supported languages. More...
|
|
static EFI_STATUS EFIAPI | efi_usb_port_reset (EFI_USB_IO_PROTOCOL *usbio) |
| Reset port. More...
|
|
static int | efi_usb_install (struct efi_usb_device *usbdev, unsigned int interface) |
| Install interface. More...
|
|
static void | efi_usb_uninstall (struct efi_usb_interface *usbintf) |
| Uninstall interface. More...
|
|
static void | efi_usb_uninstall_all (struct efi_usb_device *efiusb) |
| Uninstall all interfaces. More...
|
|
static int | efi_usb_probe (struct usb_function *func, struct usb_configuration_descriptor *config) |
| Probe device. More...
|
|
static void | efi_usb_remove (struct usb_function *func) |
| Remove device. More...
|
|
EFI USB I/O PROTOCOL.
Definition in file efi_usb.c.
Open endpoint.
- Parameters
-
usbintf | EFI USB interface |
endpoint | Endpoint address |
attributes | Endpoint attributes |
interval | Interval (in milliseconds) |
driver | Driver operations |
- Return values
-
Definition at line 147 of file efi_usb.c.
166 usbep =
zalloc (
sizeof ( *usbep ) );
189 DBGC ( usbdev,
"USBDEV %s %s could not open: %s\n",
194 DBGC ( usbdev,
"USBDEV %s %s opened\n",
200 &usbep->
event ) ) != 0 ) {
202 DBGC ( usbdev,
"USBDEV %s %s could not create event: %s\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void usb_endpoint_describe(struct usb_endpoint *ep, unsigned int address, unsigned int attributes, size_t mtu, unsigned int burst, unsigned int interval)
Describe USB endpoint.
struct usb_function * func
The underlying USB function.
static VOID EFIAPI efi_usb_timer(EFI_EVENT event __unused, VOID *context)
Poll USB bus (from endpoint event timer)
int usb_endpoint_open(struct usb_endpoint *ep)
Open USB endpoint.
EFI_CLOSE_EVENT CloseEvent
void usb_endpoint_close(struct usb_endpoint *ep)
Close USB endpoint.
struct efi_usb_endpoint * endpoint[32]
Opened endpoints.
#define ENOMEM
Not enough space.
EFI_EVENT event
Asynchronous timer event.
EFI_CREATE_EVENT CreateEvent
struct efi_usb_interface * usbintf
EFI USB device interface.
char * strerror(int errno)
Retrieve string representation of error number.
An EFI USB device endpoint.
void * zalloc(size_t size)
Allocate cleared memory.
#define EVT_NOTIFY_SIGNAL
struct usb_device * usb
USB device.
static void usb_endpoint_init(struct usb_endpoint *ep, struct usb_device *usb, struct usb_endpoint_driver_operations *driver)
Initialise USB endpoint.
#define USB_ENDPOINT_IDX(address)
Construct endpoint index from endpoint address.
const char * usb_endpoint_name(struct usb_endpoint *ep)
Get USB endpoint name (for debugging)
struct usb_endpoint ep
USB endpoint.
static int efi_usb_mtu(struct efi_usb_interface *usbintf, unsigned int endpoint)
Get endpoint MTU.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
EFI_SYSTEM_TABLE * efi_systab
uint64_t index
Index of the first segment within the content.
struct efi_usb_device * usbdev
Containing USB device.
References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, EFI_BOOT_SERVICES::CreateEvent, DBGC, EEFI, efi_systab, efi_usb_mtu(), efi_usb_timer(), efi_usb_interface::endpoint, ENOMEM, efi_usb_endpoint::ep, efi_usb_endpoint::event, EVT_NOTIFY_SIGNAL, EVT_TIMER, efi_usb_device::func, index, mtu, efi_usb_interface::name, rc, strerror(), TPL_CALLBACK, usb_function::usb, usb_endpoint_close(), usb_endpoint_describe(), USB_ENDPOINT_IDX, usb_endpoint_init(), usb_endpoint_name(), usb_endpoint_open(), efi_usb_interface::usbdev, efi_usb_endpoint::usbintf, and zalloc().
Referenced by efi_usb_async_start(), and efi_usb_sync_transfer().
Close endpoint.
- Parameters
-
Definition at line 224 of file efi_usb.c.
239 DBGC ( usbdev,
"USBDEV %s %s closed\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
EFI_CLOSE_EVENT CloseEvent
void usb_endpoint_close(struct usb_endpoint *ep)
Close USB endpoint.
struct efi_usb_endpoint * endpoint[32]
Opened endpoints.
An EFI USB device interface.
An event's timer settings is to be cancelled and not trigger time is to be set/.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
EFI_EVENT event
Asynchronous timer event.
struct efi_usb_interface * usbintf
EFI USB device interface.
#define USB_ENDPOINT_IDX(address)
Construct endpoint index from endpoint address.
const char * usb_endpoint_name(struct usb_endpoint *ep)
Get USB endpoint name (for debugging)
struct usb_endpoint ep
USB endpoint.
EFI_SYSTEM_TABLE * efi_systab
uint64_t index
Index of the first segment within the content.
struct efi_usb_device * usbdev
Containing USB device.
unsigned int address
Endpoint address.
References usb_endpoint::address, assert(), EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, DBGC, efi_systab, efi_usb_interface::endpoint, efi_usb_endpoint::ep, efi_usb_endpoint::event, index, efi_usb_interface::name, EFI_BOOT_SERVICES::SetTimer, TimerCancel, usb_endpoint_close(), USB_ENDPOINT_IDX, usb_endpoint_name(), efi_usb_interface::usbdev, and efi_usb_endpoint::usbintf.
Referenced by efi_usb_async_start(), efi_usb_close_all(), and efi_usb_sync_transfer().
static int efi_usb_sync_transfer |
( |
struct efi_usb_interface * |
usbintf, |
|
|
unsigned int |
endpoint, |
|
|
unsigned int |
attributes, |
|
|
unsigned int |
timeout, |
|
|
void * |
data, |
|
|
size_t * |
len |
|
) |
| |
|
static |
Perform synchronous transfer.
- Parameters
-
usbintf | USB endpoint |
endpoint | Endpoint address |
attributes | Endpoint attributes |
timeout | Timeout (in milliseconds) |
data | Data buffer |
len | Length of data buffer |
- Return values
-
Definition at line 312 of file efi_usb.c.
347 DBGC ( usbdev,
"USBDEV %s %s could not enqueue: %s\n",
372 DBGC ( usbdev,
"USBDEV %s %s failed: %s\n", usbintf->
name,
static void efi_usb_close(struct efi_usb_endpoint *usbep)
Close endpoint.
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
struct usb_function * func
The underlying USB function.
static struct usb_endpoint_driver_operations efi_usb_sync_driver
Synchronous endpoint operations.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
int usb_stream(struct usb_endpoint *ep, struct io_buffer *iobuf, int terminate)
Enqueue USB stream transfer.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct efi_usb_endpoint * endpoint[32]
Opened endpoints.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct usb_port * port
USB port.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
int rc
Most recent synchronous completion status.
static int efi_usb_is_open(struct efi_usb_interface *usbintf, unsigned int endpoint)
Check if endpoint is open.
#define EINPROGRESS
Operation in progress.
static void usb_poll(struct usb_bus *bus)
Poll USB bus.
#define USB_ENDPOINT_IN
Endpoint direction is in.
char * strerror(int errno)
Retrieve string representation of error number.
static int efi_usb_open(struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int interval, struct usb_endpoint_driver_operations *driver)
Open endpoint.
An EFI USB device endpoint.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
struct usb_device * usb
USB device.
#define USB_ENDPOINT_IDX(address)
Construct endpoint index from endpoint address.
const char * usb_endpoint_name(struct usb_endpoint *ep)
Get USB endpoint name (for debugging)
struct usb_endpoint ep
USB endpoint.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
void * data
Start of data.
struct usb_hub * hub
USB hub.
uint8_t data[48]
Additional event data.
uint64_t index
Index of the first segment within the content.
struct efi_usb_device * usbdev
Containing USB device.
struct usb_bus * bus
USB bus.
#define ETIMEDOUT
Connection timed out.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
References alloc_iob(), assert(), usb_hub::bus, data, io_buffer::data, DBGC, efi_usb_close(), efi_usb_is_open(), efi_usb_open(), efi_usb_sync_driver, EFIRC, EINPROGRESS, efi_usb_interface::endpoint, ENOMEM, efi_usb_endpoint::ep, ETIMEDOUT, free_iob(), efi_usb_device::func, usb_port::hub, index, iob_len(), iob_put, len, mdelay(), memcpy(), efi_usb_interface::name, usb_device::port, efi_usb_endpoint::rc, rc, strerror(), timeout(), usb_function::usb, USB_ENDPOINT_IDX, USB_ENDPOINT_IN, usb_endpoint_name(), usb_poll(), usb_stream(), and efi_usb_interface::usbdev.
Referenced by efi_usb_bulk_transfer(), and efi_usb_sync_interrupt_transfer().
Start asynchronous transfer.
- Parameters
-
usbintf | EFI USB interface |
endpoint | Endpoint address |
interval | Interval (in milliseconds) |
len | Transfer length |
callback | Callback function |
context | Context for callback function |
- Return values
-
Definition at line 449 of file efi_usb.c.
479 DBGC ( usbdev,
"USBDEV %s %s could not prefill: %s\n",
487 ( interval * 10000 ) ) ) != 0 ) {
489 DBGC ( usbdev,
"USBDEV %s %s could not set timer: %s\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
static void efi_usb_close(struct efi_usb_endpoint *usbep)
Close endpoint.
struct arbelprm_rc_send_wqe rc
#define EFI_USB_ASYNC_FILL
Asynchronous transfer fill level.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
An event is to be signaled periodically at a specified interval from the current time.
static struct usb_endpoint_driver_operations efi_usb_async_driver
Asynchronous endpoint operations.
int usb_prefill(struct usb_endpoint *ep)
Prefill endpoint recycled buffer list.
struct efi_usb_endpoint * endpoint[32]
Opened endpoints.
An event's timer settings is to be cancelled and not trigger time is to be set/.
EFI_EVENT event
Asynchronous timer event.
static void usb_refill_init(struct usb_endpoint *ep, size_t reserve, size_t len, unsigned int max)
Initialise USB endpoint refill.
void * context
Asynchronous callback context.
struct efi_usb_interface * usbintf
EFI USB device interface.
EFI_ASYNC_USB_TRANSFER_CALLBACK callback
Asynchronous callback handler.
static int efi_usb_is_open(struct efi_usb_interface *usbintf, unsigned int endpoint)
Check if endpoint is open.
#define USB_ENDPOINT_ATTR_INTERRUPT
Interrupt endpoint transfer type.
char * strerror(int errno)
Retrieve string representation of error number.
static int efi_usb_open(struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int interval, struct usb_endpoint_driver_operations *driver)
Open endpoint.
An EFI USB device endpoint.
#define USB_ENDPOINT_IDX(address)
Construct endpoint index from endpoint address.
const char * usb_endpoint_name(struct usb_endpoint *ep)
Get USB endpoint name (for debugging)
struct usb_endpoint ep
USB endpoint.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
EFI_SYSTEM_TABLE * efi_systab
uint64_t index
Index of the first segment within the content.
struct efi_usb_device * usbdev
Containing USB device.
#define NULL
NULL pointer (VOID *)
References EFI_SYSTEM_TABLE::BootServices, efi_usb_endpoint::callback, efi_usb_endpoint::context, DBGC, EEFI, efi_systab, efi_usb_async_driver, EFI_USB_ASYNC_FILL, efi_usb_close(), efi_usb_is_open(), efi_usb_open(), efi_usb_interface::endpoint, efi_usb_endpoint::ep, efi_usb_endpoint::event, index, len, efi_usb_interface::name, NULL, rc, EFI_BOOT_SERVICES::SetTimer, strerror(), TimerCancel, TimerPeriodic, USB_ENDPOINT_ATTR_INTERRUPT, USB_ENDPOINT_IDX, usb_endpoint_name(), usb_prefill(), usb_refill_init(), efi_usb_interface::usbdev, and efi_usb_endpoint::usbintf.
Referenced by efi_usb_async_interrupt_transfer().
Perform control transfer.
- Parameters
-
usbio | USB I/O protocol |
packet | Setup packet |
direction | Data direction |
timeout | Timeout (in milliseconds) |
data | Data buffer |
len | Length of data |
- Return values
-
status | Transfer status |
efirc | EFI status code |
Definition at line 552 of file efi_usb.c.
567 DBGC2 ( usbdev,
"USBDEV %s control %04x:%04x:%04x:%04x %s %dms " 571 ( (
size_t )
len ) );
585 DBGC ( usbdev,
"USBDEV %s cannot set configuration %d: not " 586 "logically possible\n", usbintf->
name,
index );
588 goto err_change_config;
601 DBGC ( usbdev,
"USBDEV %s control %04x:%04x:%04x:%04x %p+%zx " 612 DBGC ( usbdev,
"USBDEV %s alt %d selected\n",
struct arbelprm_rc_send_wqe rc
unsigned int alternate
Alternate setting.
static void efi_usb_close_all(struct efi_usb_interface *usbintf)
Close all endpoints.
struct usb_function * func
The underlying USB function.
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
uint8_t direction
Direction.
int usb_control(struct usb_device *usb, unsigned int request, unsigned int value, unsigned int index, void *data, size_t len)
Issue USB control transaction.
#define ENOTSUP
Operation not supported.
#define EFI_USB_ERR_SYSTEM
An EFI USB device interface.
#define container_of(ptr, type, field)
Get containing structure.
static const char * efi_usb_direction_name(EFI_USB_DATA_DIRECTION direction)
Transcribe data direction (for debugging)
pseudo_bit_t value[0x00020]
#define USB_SET_INTERFACE
Set interface.
char * strerror(int errno)
Retrieve string representation of error number.
struct usb_configuration_descriptor * config
Configuration descriptor.
struct usb_device * usb
USB device.
#define le16_to_cpu(value)
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
#define USB_REQUEST_TYPE(type)
Construct USB request type.
An EFI saved task priority level.
uint8_t config
Configuration value.
u8 request[0]
List of IEs requested.
uint8_t data[48]
Additional event data.
uint64_t index
Index of the first segment within the content.
struct efi_usb_device * usbdev
Containing USB device.
#define USB_SET_CONFIGURATION
Set configuration.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
References efi_usb_interface::alternate, efi_usb_device::config, usb_configuration_descriptor::config, container_of, data, DBGC, DBGC2, direction, efi_raise_tpl(), efi_restore_tpl(), efi_usb_close_all(), efi_usb_direction_name(), EFI_USB_ERR_SYSTEM, EFIRC, ENOTSUP, efi_usb_device::func, index, USB_DEVICE_REQUEST::Index, le16_to_cpu, len, USB_DEVICE_REQUEST::Length, efi_usb_interface::name, rc, request, USB_DEVICE_REQUEST::Request, USB_DEVICE_REQUEST::RequestType, status, strerror(), timeout(), usb_function::usb, usb_control(), USB_REQUEST_TYPE, USB_SET_CONFIGURATION, USB_SET_INTERFACE, efi_usb_interface::usbdev, efi_usb_interface::usbio, value, and USB_DEVICE_REQUEST::Value.
Perform bulk transfer.
- Parameters
-
usbio | USB I/O protocol |
endpoint | Endpoint address |
data | Data buffer |
len | Length of data |
timeout | Timeout (in milliseconds) |
- Return values
-
status | Transfer status |
efirc | EFI status code |
Definition at line 634 of file efi_usb.c.
639 size_t actual = *
len;
643 DBGC2 ( usbdev,
"USBDEV %s bulk %s %p+%zx %dms\n", usbintf->
name,
645 ( (
size_t ) *
len ), ( (
unsigned int )
timeout ) );
656 data, &actual ) ) != 0 ) {
struct arbelprm_rc_send_wqe rc
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
#define USB_ENDPOINT_ATTR_BULK
Bulk endpoint transfer type.
An EFI USB device interface.
#define container_of(ptr, type, field)
Get containing structure.
#define USB_ENDPOINT_IN
Endpoint direction is in.
#define EFI_USB_ERR_TIMEOUT
static int efi_usb_sync_transfer(struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int timeout, void *data, size_t *len)
Perform synchronous transfer.
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
An EFI saved task priority level.
uint8_t data[48]
Additional event data.
struct efi_usb_device * usbdev
Containing USB device.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
References container_of, data, DBGC2, efi_raise_tpl(), efi_restore_tpl(), EFI_USB_ERR_TIMEOUT, efi_usb_sync_transfer(), EFIRC, len, efi_usb_interface::name, rc, status, timeout(), USB_ENDPOINT_ATTR_BULK, USB_ENDPOINT_IN, efi_usb_interface::usbdev, and efi_usb_interface::usbio.
Perform synchronous interrupt transfer.
- Parameters
-
usbio | USB I/O protocol |
endpoint | Endpoint address |
data | Data buffer |
len | Length of data |
timeout | Timeout (in milliseconds) |
- Return values
-
status | Transfer status |
efirc | EFI status code |
Definition at line 679 of file efi_usb.c.
685 size_t actual = *
len;
689 DBGC2 ( usbdev,
"USBDEV %s sync intr %s %p+%zx %dms\n", usbintf->
name,
691 ( (
size_t ) *
len ), ( (
unsigned int )
timeout ) );
struct arbelprm_rc_send_wqe rc
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
An EFI USB device interface.
#define container_of(ptr, type, field)
Get containing structure.
#define USB_ENDPOINT_IN
Endpoint direction is in.
#define USB_ENDPOINT_ATTR_INTERRUPT
Interrupt endpoint transfer type.
#define EFI_USB_ERR_TIMEOUT
static int efi_usb_sync_transfer(struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int attributes, unsigned int timeout, void *data, size_t *len)
Perform synchronous transfer.
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
An EFI saved task priority level.
uint8_t data[48]
Additional event data.
struct efi_usb_device * usbdev
Containing USB device.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
References container_of, data, DBGC2, efi_raise_tpl(), efi_restore_tpl(), EFI_USB_ERR_TIMEOUT, efi_usb_sync_transfer(), EFIRC, len, efi_usb_interface::name, rc, status, timeout(), USB_ENDPOINT_ATTR_INTERRUPT, USB_ENDPOINT_IN, efi_usb_interface::usbdev, and efi_usb_interface::usbio.
Perform asynchronous interrupt transfer.
- Parameters
-
usbio | USB I/O protocol |
endpoint | Endpoint address |
start | Start (rather than stop) transfer |
interval | Polling interval (in milliseconds) |
len | Data length |
callback | Callback function |
context | Context for callback function |
- Return values
-
Definition at line 726 of file efi_usb.c.
736 DBGC2 ( usbdev,
"USBDEV %s async intr %s len %#zx int %d %p/%p\n",
739 ( (
size_t )
len ), ( (
unsigned int ) interval ),
struct arbelprm_rc_send_wqe rc
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
static void efi_usb_async_stop(struct efi_usb_interface *usbintf, unsigned int endpoint)
Stop asynchronous transfer.
uint32_t start
Starting offset.
An EFI USB device interface.
#define container_of(ptr, type, field)
Get containing structure.
static int efi_usb_async_start(struct efi_usb_interface *usbintf, unsigned int endpoint, unsigned int interval, size_t len, EFI_ASYNC_USB_TRANSFER_CALLBACK callback, void *context)
Start asynchronous transfer.
#define USB_ENDPOINT_IN
Endpoint direction is in.
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
An EFI saved task priority level.
struct efi_usb_device * usbdev
Containing USB device.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
References container_of, DBGC2, efi_raise_tpl(), efi_restore_tpl(), efi_usb_async_start(), efi_usb_async_stop(), EFIRC, len, efi_usb_interface::name, rc, start, USB_ENDPOINT_IN, efi_usb_interface::usbdev, and efi_usb_interface::usbio.
Get string descriptor.
- Parameters
-
usbio | USB I/O protocol |
language | Language ID |
index | String index |
- Return values
-
string | String |
efirc | EFI status code |
Definition at line 954 of file efi_usb.c.
967 DBGC2 ( usbdev,
"USBDEV %s get string %d:%d descriptor\n",
977 sizeof (
header ) ) ) != 0 ) {
978 DBGC ( usbdev,
"USBDEV %s could not get string %d:%d " 979 "descriptor header: %s\n", usbintf->
name, language,
985 DBGC ( usbdev,
"USBDEV %s underlength string %d:%d\n",
1002 DBGC ( usbdev,
"USBDEV %s could not get string %d:%d " 1003 "descriptor: %s\n", usbintf->
name, language,
1005 goto err_get_descriptor;
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct usb_function * func
The underlying USB function.
#define USB_STRING_DESCRIPTOR
A USB string descriptor.
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
An EFI USB device interface.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
struct usb_device * usb
USB device.
#define VOID
Undeclared type.
void * memmove(void *dest, const void *src, size_t len) __nonnull
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
An EFI saved task priority level.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
struct ena_aq_header header
Header.
EFI_SYSTEM_TABLE * efi_systab
static int usb_get_descriptor(struct usb_device *usb, unsigned int type, unsigned int desc, unsigned int index, unsigned int language, struct usb_descriptor_header *data, size_t len)
Get USB descriptor.
uint64_t index
Index of the first segment within the content.
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
struct efi_usb_device * usbdev
Containing USB device.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
EFI_ALLOCATE_POOL AllocatePool
void * memset(void *dest, int character, size_t len) __nonnull
References EFI_BOOT_SERVICES::AllocatePool, EFI_SYSTEM_TABLE::BootServices, buffer, container_of, DBGC, DBGC2, EEFI, efi_raise_tpl(), efi_restore_tpl(), efi_systab, EfiBootServicesData, EFIRC, EINVAL, EFI_BOOT_SERVICES::FreePool, efi_usb_device::func, header, index, len, memmove(), memset(), efi_usb_interface::name, rc, strerror(), usb_function::usb, usb_get_descriptor(), USB_STRING_DESCRIPTOR, efi_usb_interface::usbdev, efi_usb_interface::usbio, and VOID.
static int efi_usb_install |
( |
struct efi_usb_device * |
usbdev, |
|
|
unsigned int |
interface |
|
) |
| |
|
static |
Install interface.
- Parameters
-
usbdev | EFI USB device |
interface | Interface number |
- Return values
-
Definition at line 1107 of file efi_usb.c.
1117 usbintf =
zalloc (
sizeof ( *usbintf ) );
1127 sizeof ( usbintf->
usbio ) );
1131 if ( ! usbintf->
path ) {
1146 DBGC (
usbdev,
"USBDEV %s could not install protocols: %s\n",
1148 goto err_install_protocol;
1151 DBGC (
usbdev,
"USBDEV %s installed as %s\n",
1160 DBGC (
usbdev,
"USBDEV %s could not uninstall: %s\n",
1165 err_install_protocol:
1176 DBGC (
usbdev,
"USBDEV %s nullified and leaked\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
static EFI_USB_IO_PROTOCOL efi_usb_io_protocol
USB I/O protocol.
struct arbelprm_rc_send_wqe rc
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void efi_usb_close_all(struct efi_usb_interface *usbintf)
Close all endpoints.
struct usb_function * func
The underlying USB function.
EFI_DEVICE_PATH_PROTOCOL * path
Device path.
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
An EFI USB device interface.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void efi_nullify_usbio(EFI_USB_IO_PROTOCOL *usbio)
Nullify USB I/O protocol.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
struct list_head interfaces
List of interfaces.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
unsigned int interface
Interface number.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_GUID efi_usb_io_protocol_guid
USB I/O protocol GUID.
static void(* free)(struct refcnt *refcnt))
EFI_DEVICE_PATH_PROTOCOL * efi_usb_path(struct usb_function *func)
Construct EFI device path for USB function.
void * zalloc(size_t size)
Allocate cleared memory.
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
#define ENODEV
No such device.
static void efi_usb_free_all(struct efi_usb_interface *usbintf)
Free all endpoints.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
struct list_head list
List of interfaces.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
EFI_HANDLE handle
EFI handle.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
EFI_SYSTEM_TABLE * efi_systab
struct efi_usb_device * usbdev
Containing USB device.
#define NULL
NULL pointer (VOID *)
References EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_device_path_protocol_guid, efi_handle_name(), efi_nullify_usbio(), efi_systab, efi_usb_close_all(), efi_usb_free_all(), efi_usb_io_protocol, efi_usb_io_protocol_guid, efi_usb_path(), ENODEV, ENOMEM, free, efi_usb_device::func, efi_usb_interface::handle, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, efi_usb_interface::interface, efi_usb_device::interfaces, efi_usb_interface::list, list_add_tail, list_del, memcpy(), efi_usb_device::name, efi_usb_interface::name, NULL, efi_usb_interface::path, rc, snprintf(), strerror(), EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, efi_usb_interface::usbdev, efi_usb_interface::usbio, and zalloc().
Referenced by efi_usb_probe().
Uninstall interface.
- Parameters
-
Definition at line 1187 of file efi_usb.c.
1193 DBGC ( usbdev,
"USBDEV %s uninstalling %s\n",
1210 DBGC ( usbdev,
"USBDEV %s could not uninstall: %s\n",
1233 DBGC ( usbdev,
"USBDEV %s nullified and leaked\n",
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
static void efi_usb_close_all(struct efi_usb_interface *usbintf)
Close all endpoints.
EFI_DEVICE_PATH_PROTOCOL * path
Device path.
#define list_del(list)
Delete an entry from a list.
void efi_nullify_usbio(EFI_USB_IO_PROTOCOL *usbio)
Nullify USB I/O protocol.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_GUID efi_usb_io_protocol_guid
USB I/O protocol GUID.
static void(* free)(struct refcnt *refcnt))
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
static void efi_usb_free_all(struct efi_usb_interface *usbintf)
Free all endpoints.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
EFI_USB_IO_PROTOCOL usbio
USB I/O protocol.
struct list_head list
List of interfaces.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
EFI_HANDLE handle
EFI handle.
EFI_SYSTEM_TABLE * efi_systab
struct efi_usb_device * usbdev
Containing USB device.
#define NULL
NULL pointer (VOID *)
int efi_shutdown_in_progress
EFI shutdown is in progress.
EFI_DISCONNECT_CONTROLLER DisconnectController
References EFI_SYSTEM_TABLE::BootServices, DBGC, EFI_BOOT_SERVICES::DisconnectController, EEFI, efi_device_path_protocol_guid, efi_handle_name(), efi_nullify_usbio(), efi_shutdown_in_progress, efi_systab, efi_usb_close_all(), efi_usb_free_all(), efi_usb_io_protocol_guid, free, efi_usb_interface::handle, efi_usb_interface::list, list_del, efi_usb_interface::name, NULL, efi_usb_interface::path, strerror(), EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, efi_usb_interface::usbdev, and efi_usb_interface::usbio.
Referenced by efi_usb_uninstall_all().
Probe device.
- Parameters
-
func | USB function |
config | Configuration descriptor |
- Return values
-
Definition at line 1261 of file efi_usb.c.
1287 usbdev =
zalloc (
sizeof ( *usbdev ) + config_len +
1288 sizeof ( *lang ) + lang_len );
1295 usbdev->
func = func;
1296 usbdev->
config = ( ( (
void * ) usbdev ) +
sizeof ( *usbdev ) );
1298 lang = ( ( (
void * ) usbdev->
config ) + config_len );
1299 usbdev->
lang = ( ( (
void * ) lang ) +
sizeof ( *lang ) );
1306 0, 0, lang,
header.len ) ) != 0 ) ) {
1307 DBGC ( usbdev,
"USBDEV %s could not get supported languages: " 1309 goto err_get_languages;
1313 for ( i = 0 ; i < func->
desc.
count ; i++ ) {
uint16_t * lang
Supported languages.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
struct arbelprm_rc_send_wqe rc
size_t lang_len
Length of supported languages.
uint8_t interface[0]
List of interface numbers.
struct usb_function * func
The underlying USB function.
unsigned int count
Number of interfaces.
#define USB_STRING_DESCRIPTOR
A USB string descriptor.
#define list_empty(list)
Test whether a list is empty.
#define ENOMEM
Not enough space.
An EFI USB device interface.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
static void usb_func_set_drvdata(struct usb_function *func, void *priv)
Set USB function driver private data.
struct list_head interfaces
List of interfaces.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
EFI_CONNECT_CONTROLLER ConnectController
struct usb_configuration_descriptor * config
Configuration descriptor.
static void efi_usb_uninstall_all(struct efi_usb_device *efiusb)
Uninstall all interfaces.
struct usb_device * usb
USB device.
#define le16_to_cpu(value)
#define INIT_LIST_HEAD(list)
Initialise a list head.
static int efi_usb_install(struct efi_usb_device *usbdev, unsigned int interface)
Install interface.
EFI_HANDLE handle
EFI handle.
struct ena_aq_header header
Header.
uint16_t len
Total length.
struct usb_function_descriptor desc
Function descriptor.
EFI_SYSTEM_TABLE * efi_systab
static int usb_get_descriptor(struct usb_device *usb, unsigned int type, unsigned int desc, unsigned int index, unsigned int language, struct usb_descriptor_header *data, size_t len)
Get USB descriptor.
#define NULL
NULL pointer (VOID *)
References assert(), EFI_SYSTEM_TABLE::BootServices, efi_usb_device::config, EFI_BOOT_SERVICES::ConnectController, usb_function_descriptor::count, DBGC, usb_function::desc, efi_systab, efi_usb_install(), efi_usb_uninstall_all(), ENOMEM, free, efi_usb_device::func, efi_usb_interface::handle, header, INIT_LIST_HEAD, usb_function::interface, efi_usb_device::interfaces, efi_usb_device::lang, efi_usb_device::lang_len, le16_to_cpu, usb_configuration_descriptor::len, list_empty, list_for_each_entry, memcpy(), efi_usb_device::name, usb_function::name, NULL, rc, strerror(), TRUE, usb_function::usb, usb_func_set_drvdata(), usb_get_descriptor(), USB_STRING_DESCRIPTOR, and zalloc().