usba_private.h revision 036aa26189b72905886e39d76d63352185cfd9d2
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_USBA_USBA_PRIVATE_H
#define _SYS_USB_USBA_USBA_PRIVATE_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Header file for items to be shared within usba but not to be used
* by drivers
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* **************************************************************************
* DDK version 0.8 binaries are supported.
* **************************************************************************
*/
#define USBA_LEG_MAJOR_VER 0
#define USBA_LEG_MINOR_VER 8
/*
* **************************************************************************
* Descriptor definitions and parsing functions.
* **************************************************************************
*/
/*
* functions to return a pre-processed device descriptor to the client driver.
* These all extract data from the raw config cloud returned by a
* usb_get_raw_cfg_data()
*
* The pre-processed descriptor is returned into a buffer supplied by
* the caller
* The size of the buffer should allow for padding
*
* In the following:
* buf buffer containing data returned by GET_DESCRIPTOR
* buflen length of the data at buf
* ret_descr buffer the data is to be returned in
* ret_buf_len size of the buffer at ret_descr
*
* first_if the first interace associated with current iad
* if_index the index in the array of concurrent interfaces
* supported by this configuration
* alt_if_setting alternate setting for the interface identified
* by if_index
* ep_index the index in the array of endpoints supported by
* this configuration
*
* These functions return the length of the returned descriptor structure,
* or USB_PARSE_ERROR on error.
*
* No error is returned if ret_buf_len is too small but
* the data is truncated
* This allows successful parsing of descriptors that have been
* extended in a later rev of the spec.
*/
/*
* the endpoint index is relative to the interface. index 0 is
* the first endpoint
*/
/*
* functions to handle arbitrary descriptors. USBA doesn't know the format
* and therefore cannot do any automatic pre-processing.
*
* In the following:
* buf buffer containing data returned by GET_DESCRIPTOR
* buflen length of the data at buf allowing for padding
* fmt a null terminated string describing the format of
* the data structure for general-purpose byte swapping,
* use NULL for raw access.
* The letters "c", "s", "l", and "L"
* represent 1, 2, 4, and 8 byte quantities,
* respectively. A descriptor that consists of a
* short and two bytes would be described by "scc\0".
* descr_type type of the desired descriptor, USB_DESCR_TYPE_ANY
* to get any type.
* descr_index index of the desired descriptor
* ret_descr buffer the data is to be returned in
* ret_buf_len size of the buffer at ret_descr
*
* Specifying descr_index=0 returns the first descriptor of the specified
* type, specifying descr_index=1 returns the second, and so on.
*
* No error is returned if ret_buf_len is too small. This allows successful
* parsing of descriptors that have been extended in a later rev of the spec.
*/
char *fmt,
void *ret_descr,
char *fmt,
void *ret_descr,
char *fmt,
void *ret_descr,
/*
* for unpacking any kind of LE data
*/
char *format,
void *structure,
/*
* Returns pointer to the raw config cloud. The client should
* not free this space.
*/
/*
* Return pointer to device descriptor
*/
dev_info_t *dip);
/*
* **************************************************************************
* List entry functions and definitions
* **************************************************************************
*/
/*
* Data structure for maintaining lists
* This data structure private to USBA and not exposed to HCD or client
* driver or hub driver
*/
typedef struct usba_list_entry {
int count; /* for head of the list */
/* counts of entries */
/* list entry functions. */
void usba_destroy_list(usba_list_entry_t *);
int usba_list_entry_leaks(usba_list_entry_t *, char *);
/*
* **************************************************************************
* Kernel interface definitions and functionality
* **************************************************************************
*/
/*
* USBA private event definitions
*/
typedef enum usba_event {
USBA_EVENT_TAG_CPR = -1
} usba_event_t;
#define USBA_PRE_SUSPEND_EVENT "SUNW,USBA:USBA_PRE_SUSPEND"
#define USBA_POST_RESUME_EVENT "SUNW,USBA:USBA_POST_RESUME"
/*
* Get dma attributes from HC.
*/
/*
* This function calls ndi_devi_bind_driver() to bind the
* driver to the device. If the call fails it reports an
* error on the console. Attaching of the driver is done
* later by devfs framework.
*/
int usba_bind_driver(dev_info_t *);
/* check whether the dip owns an interface-associaiton */
/*
* Driver binding functions
*/
/* Some Nexus driver functions. */
/*
* Common bus ctl for hcd, usb_mid and hubd.
*/
void *, void *);
void usb_enable_parent_notification(dev_info_t *);
/*
*/
/* extract NDI event registration info */
/*
* **************************************************************************
* Misc private USBA functions
* **************************************************************************
*/
/*
* Get policy of a pipe while holding only opaque pipe handle.
*/
/*
* Check interrupt context and or in USB_CB_INTR_CONTEXT to cb_flags as needed.
*/
/* returns interface number, zero if driver owns the device */
/*
* **************************************************************************
* Misc private descriptor definitions and functionality
* **************************************************************************
*/
/* default endpoint descriptor */
extern usb_ep_descr_t usba_default_ep_descr;
/*
* The compiler pads the above structures; the following represent the
* unpadded, aggregate data sizes.
*/
/*
* For compatibility with old code.
*/
#define USBA_DESCR_TYPE_CFG_PWR_1_1 0xfe
#define USBA_DESCR_TYPE_IF_PWR_1_1 0xff
/*
* Configuration Power Descriptor
* This reports the power consuption of the device core
* for all types of USB devices.
*/
typedef struct usba_cfg_pwr_descr {
/*
* Interface Power Descriptor
* This reports the power states implemented by the interface
* and its wake-up capabilities.
*/
typedef struct usba_if_pwr_descr {
size_t);
/*
* Returns (at ret_descr) a null-terminated string. Null termination is
* guaranteed, even if the string is longer than the buffer. Thus, a
* maximum of (ret_buf_len - 1) characters are returned.
*
* XXX is this needed when there is usb_get_string_descriptor
* If so, then more comments about how it differs?
*/
/*
* usb common power management, for usb_mid, usb_ia and maybe other simple
* drivers.
*/
typedef struct usb_common_power_struct {
void *uc_usb_statep; /* points back to state structure */
/* this is the bit mask of the power states that device has */
/* wakeup and power transition capabilites of an interface */
/* warlock directives, stable data */
/* power management */
/*
* usb common events handler for usb_mid, usb_ia and maybe other nexus
* drivers.
*/
void (*)(dev_info_t *, ddi_eventcookie_t, void *, void *));
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_USBA_USBA_PRIVATE_H */