/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/
#ifndef _SYS_USB_USBA_USBA_TYPES_H
#define _SYS_USB_USBA_USBA_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/* backup structure for opaque usb_pipe_handle_t */
typedef struct usba_ph_impl {
/*
* usba_ph_ref_count is a count of the number of
* concurrent activities on this pipe
*/
int usba_ph_ref_count;
/* pipe state management */
/* for usba_ph_flags */
/*
* usba_pipe_handle_data
* allocated by USBA and used by USBA and HCD but opaque to
* client driver
*
* pipes can be shared but pipe_handles are unique
*
* p_hcd_private is a pointer to private data for HCD. This space
* is allocated and maintained by HCD
*/
typedef struct usba_pipe_handle_data {
/* For linking pipe requests on the pipe */
/* shared usba_device structure */
/* pipe policy and endpoint descriptor for this pipe */
/* passed during open. needed for reset etc. */
/* access control */
/* per-pipe private data for HCD */
/* per-pipe private data for client */
/*
* p_req_count is the count of number requests active
* on this pipe
*/
int p_req_count;
/* private use by USBA */
/*
* each pipe handle has its own taskq for callbacks and async reqs
* Note that this will not be used for normal callbacks if
* USB_FLAGS_SERIALIZED_CB is passed to usb_pipe_open().
*/
/* thread currently serving the queue */
/* cb queue serviced by taskq thread */
/* count for soft interrupts */
/* flag for special things */
/* macro to get the endpoint descriptor */
(((state) == USB_PIPE_STATE_CLOSING) || \
((state) == USB_PIPE_STATE_CLOSED))
/* these should be really stable data */
/*
* usb_addr:
* This is the USB address of a device
*/
#define USBA_DEFAULT_ADDR 0
/*
* number of endpoint per device, 16 IN and 16 OUT.
* this define is used for pipehandle list, pipe reserved list
* and pipe open count array.
* these lists are indexed by endpoint number * ((address & direction)? 2 : 1)
*
* We use a bit mask for exclusive open tracking and therefore
* USB_N_ENDPOINTS must be equal to the bit size of int.
*
*/
/*
* USB spec defines 4 different power states of any usb device.
* They are D0, D1, D2 & D3. So, we need a total of 5 pm-components
* 4 for power and 1 for name.
*/
/*
* usb port status
*/
/*
* NDI event is registered on a per-dip basis. usba_device can be
* shared by multiple dips, hence the following structure is
* need to keep per-dip event info.
*/
typedef struct usba_evdata {
/* NDI evetn service callback ids */
/*
* a client may request dev_data multiple times (eg. for
* ugen support) so we need a linked list
*/
typedef struct usb_client_dev_data_list {
/*
* This structure uniquely identifies a USB device
* with all interfaces, or just one interface of a USB device.
* usba_device is associated with a devinfo node
*
* This structure is allocated and maintained by USBA and
* read-only for HCD
*
* There can be multiple clients per device (multi-class
* device) in which case this structure is shared.
*/
typedef struct usba_device {
/* for linking all usba_devices on this bus */
/* linked list of all pipe handles on this device per endpoint */
/* To support split transactions */
/* For high speed hub bandwidth allocation scheme */
/* store all config cloud here */
char **usb_cfg_str_descr;
/*
* power drawn from hub, if > 0, the power has been
* subtracted from the parent hub's power budget
*/
/* ref count, if > 0, this structure is in use */
int usb_ref_count;
/* list of requests allocated for this device, detects leaks */
/* NDI event service cookies */
/* linked list of callid (per-devinfo) */
/* client cleanup checks */
struct {
struct {
/* Shared task queue implementation. */
/* this should be really stable data */
/*
* serialization in drivers
*/
typedef struct usba_serialization_impl {
int s_count;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_USBA_USBA_TYPES_H */