hcdi.h revision 28cdc3d776761766afeb198769d1b70ed7e0f2e1
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_USB_HCDI_H
#define _SYS_USB_HCDI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* HCD ops structure
*
* - this structure defines all entry points into HCD
*
* - all client driver USBAI functions that require HCD
* involvement go through this ops table
*
* - at HCD attach time, the HCD ops are passed to
* to the USBA through usba_hcdi_attach()
*
* some of these ops implement the semantics of the corresponding
* USBAI interfaces. Refer to usbai.h for detailed description
*/
#define HCDI_OPS_VERSION_0 0
#define HCDI_OPS_VERSION_1 1
#define HCDI_OPS_VERSION HCDI_OPS_VERSION_1
typedef struct usba_hcdi_ops {
int usba_hcdi_ops_version; /* implementation version */
/* can this hcd support pm? */
/*
* usba_hcdi_pipe_open:
* implements the semantics of usb_pipe_open()
* USBA allocate the pipe_handle which contains
* pipe_policy and endpoint pointers
*/
int (*usba_hcdi_pipe_open)(
/*
* close a pipe
*/
int (*usba_hcdi_pipe_close)(
/*
* pipe management
*/
int (*usba_hcdi_pipe_reset)(
/*
* data transfer management
*/
int (*usba_hcdi_pipe_ctrl_xfer)(
/*
* get HCD limitation on bulk xfer at a time?
*/
int (*usba_hcdi_bulk_transfer_size)(
/*
*/
int (*usba_hcdi_pipe_bulk_xfer)(
/*
*/
int (*usba_hcdi_pipe_intr_xfer)(
/*
* stop interrupt pipe polling
*/
int (*usba_hcdi_pipe_stop_intr_polling)(
/*
*/
int (*usba_hcdi_pipe_isoc_xfer)(
/*
* stop isoc pipe polling
*/
int (*usba_hcdi_pipe_stop_isoc_polling)(
/* utility isoc functions */
/*
* Initialize OBP support for input
*/
int (*usba_hcdi_console_input_init)(
/*
* Free resources allocated by usba_hcdi_console_input_init
*/
int (*usba_hcdi_console_input_fini)(
/*
* Save controller state information
*/
int (*usba_hcdi_console_input_enter)(
/*
* Read character from controller
*/
int (*usba_hcdi_console_read)(
/*
* Restore controller state information
*/
int (*usba_hcdi_console_input_exit)(
/*
* VERSION 1 ops: support for polled output
*/
int (*usba_hcdi_console_output_init)(
int (*usba_hcdi_console_output_fini)(
int (*usba_hcdi_console_output_enter)(
int (*usba_hcdi_console_write)(
int (*usba_hcdi_console_output_exit)(
/*
* callback support:
* this function handles all HCD callbacks as follows:
* - USB_FLAGS_SLEEP determines whether the client driver made
* a synchronous or asynchronous USBAI call
* - for synchronous calls, the args are copied into the pipe handle
* and the sync cv of the pipe handle is signalled
* - for async calls and completion_reason = 0, the normal callback
* is invoked
* - for async calls and completion_reason != 0, the exception
* callback is invoked
*/
void
/*
*/
/* access to private member of requests */
/* data toggle get and set */
/*
* HCD Nexus driver support:
*/
/*
* hcd_ops allocator/deallocator
* USBA allocates the usba_hcdi_ops so we can easily handle
* versioning
*/
void usba_free_hcdi_ops(usba_hcdi_ops_t *);
/*
* Argument structure for usba_hcdi_register
*/
typedef struct usba_hcdi_register_args {
#define HCDI_REGISTER_VERS_0 0
/*
* make this instance known to USBA
*
* the HCD must initialize the hcdi_ops before calling this function
*/
/*
* detach support
*/
void usba_hcdi_unregister(dev_info_t *);
/*
* Hotplug kstats named structure
*
* Number of types of USB transfers
*/
#define USB_N_COUNT_KSTATS 4
typedef struct hcdi_hotplug_stats {
struct kstat_named hcdi_hotplug_success;
struct kstat_named hcdi_hotplug_failure;
struct kstat_named hcdi_device_count;
/*
* USB error kstats named structure
*/
typedef struct hcdi_error_stats {
/* transport completion codes */
struct kstat_named cc_crc;
struct kstat_named cc_bitstuffing;
struct kstat_named cc_data_toggle_mm;
struct kstat_named cc_stall;
struct kstat_named cc_dev_not_resp;
struct kstat_named cc_pid_checkfailure;
struct kstat_named cc_unexp_pid;
struct kstat_named cc_data_overrun;
struct kstat_named cc_data_underrun;
struct kstat_named cc_buffer_overrun;
struct kstat_named cc_buffer_underrun;
struct kstat_named cc_timeout;
struct kstat_named cc_not_accessed;
struct kstat_named cc_no_resources;
struct kstat_named cc_unspecified_err;
struct kstat_named cc_stopped_polling;
struct kstat_named cc_pipe_closing;
struct kstat_named cc_pipe_reset;
struct kstat_named cc_not_supported;
struct kstat_named cc_flushed;
#ifdef NOTYETNEEDED
/* USBA function return values */
struct kstat_named hcdi_usb_failure;
struct kstat_named hcdi_usb_no_resources;
struct kstat_named hcdi_usb_no_bandwidth;
struct kstat_named hcdi_usb_pipe_reserved;
struct kstat_named hcdi_usb_pipe_unshareable;
struct kstat_named hcdi_usb_not_supported;
struct kstat_named hcdi_usb_pipe_error;
struct kstat_named hcdi_usb_pipe_busy;
#endif
/*
* hcdi kstat defines
* XXX this needs to be a function
*/
#define HCDI_HOTPLUG_STATS_DATA(hcdi) \
#define HCDI_ERROR_STATS_DATA(hcdi) \
#ifdef __cplusplus
}
#endif
#endif /* _SYS_USB_HCDI_H */