usbai_private.h revision d29f5a711240f866521445b1656d114da090335e
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A * Unstable interfaces not part of USBAI but used by Solaris client drivers. 2N/A * These interfaces may not be present in future releases and are highly 2N/A * C = Remove from Sun client drivers before removing from this file 2N/A * D = May be needed by legacy (DDK) drivers. 2N/A * convenience function for getting default config index 2N/A * as saved in usba_device structure 2N/A * ************************************************************************** 2N/A * Error and status definitions, and reporting functions 2N/A * ************************************************************************** 2N/A * convenience functions to get string corresponding to value 2N/A * usb_cb_flags_name requires a workbuffer of sufficient length 2N/A * for the concatenation of all strings as usb_cb_flags_t is a bit /* function convert a USB return value to an errno */ * ************************************************************************** * Transfer-related definitions and functions * ************************************************************************** /* Status C and D for whole section. */ /* Serialize callbacks per interface or device. */ /* default timeout for control requests (in seconds) */ * usb_pipe_sync_ctrl_xfer(): * for simple synchronous control transactions this wrapper function * will perform the allocation, xfer, and deallocation. * USB_ATTRS_AUTOCLEARING will be enabled * dip - pointer to clients devinfo. * pipe_handle - control pipe pipehandle (obtained via usb_pipe_open(). * bmRequestType - characteristics of request. * bRequest - specific request. * wValue - varies according to request. * wIndex - index or offset. * wLength - number of bytes to xfer. * data - pointer to pointer to data * IN: HCD will allocate data * OUT: clients driver allocates data. * attrs - required request attributes. * completion_reason - completion status. * cb_flags - request completions flags. * USB_SUCCESS - request successfully executed. * USB_FAILURE - request failed. * - in the case of failure, the client should check completion_reason and * and cb_flags and determine further recovery action * - the client should check data and if non-zero, free the data on * ************************************************************************** * Event registration / pre-suspend and post-resume handling * ************************************************************************** /* Status: C and D for whole section. */ * callbacks. Eventually pre-suspend and post-resume callbacks will not be * needed, so this is for this OS release only and will go away in a /* notification that system is about to checkpoint */ /* notification that system resumed after a checkpoint */ * the callbacks should always return USB_SUCCESS. * A client driver must call this funtion in pre-suspend event handler * to inform the USBA framework that it can't suspend because * driver instance or device could not be quiesced. * ************************************************************************** * Logging functions remaining Contracted Consolidation Private * ************************************************************************** /* Status: C and D for whole section. */ * Usb logging, debug and console message handling. #
define USB_LOG_L0 0
/* warnings, console & syslog buffer */#
define USB_LOG_L2 2 /* recoverable errors, debug only */#
define USB_LOG_L3 3 /* interesting data, debug only *//* free the log handle */ * Check if the device connected to the port is the same as * the previous device that was in the port. The previous device is * represented by the dip on record for the port. Print a message * if the device is different. If device_string arg is not NULL, it is * included in the message. Can block. * dip - pointer to devinfo of the client * log_handle - handle to which messages are logged * log_level - one of USB_LOG_* * log_mask - logging mask * check_mask - one mask containing things to check: * USB_CHK_BASIC: empty mask; * these checks are always done. * USB_CHK_SERIAL: check match on device * USB_CHK_CFG: compare config clouds * USB_CHK_VIDPID: compare product * USB_CHK_ALL: perform all checks * NOTE: descr length and content always checked * device_string - Device string to appear in error message * USB_SUCCESS: same device * USB_INVALID_VERSION not same device * USB_FAILURE: Failure processing request * USB_INVALID_ARG: dip is invalid /* Checking bits for checks made by usb_check_same_device */ #
define USB_CHK_SERIAL 0x00000001 /* Compare device serial numbers. */#
define USB_CHK_CFG 0x00000002 /* Compare raw config clouds. */#
define USB_CHK_VIDPID 0x00000004 /* Compare product and vendor ID. */#
define USB_CHK_ALL 0xFFFFFFFF /* Perform maximum checking. */ * ************************************************************************** * Power management functions remaining Contracted Consolidation Private * ************************************************************************** * usb wrapper around pm_raise_power & pm_lower_power to allow for * dip - pointer to devinfo node of client. * flags - USB_FLAGS_SLEEP: * cb - function called on completion, may be NULL. * arg - callback argument. * rval - USB_SUCCESS or USB_FAILURE. * USB_SUCCESS - if no USB_FLAGS_SLEEP has been specified, the request * has been queued for async execution. If * USB_FLAGS_SLEEP has been specified, the raising or * USB_FAILURE - request could not be queued or raising or lowering * USB wrapper functions to set usb device power level. * Note : Power levels indicated here are USB power levels * and not OS power levels. * Note that these were never implemented, and are noops. However, they are * included here as the skeleton driver in DDK 0.8 and 0.9 mentioned them. * ************************************************************************** * Serialization functions remaining Contracted Consolidation Private * ************************************************************************** /* This whole section: status: C and D. */ * opaque serialization handle. * Used by all usb_serialization routines. * This handle is opaque to the client driver. * setup for serialization * s_dip - devinfo pointer * flag - USB_INIT_SER_CHECK_SAME_THREAD * when set, usb_release_access() will * verify that the same thread releases * access. If not, a console warning will * be issued but access will be released * usb_serialization handle /* fini for serialization */ * Various ways of calling usb_serialize_access. These correspond to * their cv_*wait* function counterparts for usb_serialize_access. * acquire serialized access * usb_serp - usb_serialization handle * how_to_wait - Which cv_*wait* function to wait for condition. * USB_WAIT_SIG: use cv_wait_sig * USB_TIMEDWAIT: use cv_timedwait * USB_TIMEDWAIT_SIG: use cv_timedwait_sig * delta_timeout - Time in ms from current time to timeout. Checked * only if USB_TIMEDWAIT or USB_TIMEDWAIT_SIG * specified in how_to_wait. * Same as values returned by cv_*wait* functions, * except for when how_to_wait == USB_WAIT, where 0 is always returned. * For calls where a timeout or signal could be expected, use this value * to tell whether a kill(2) signal or timeout occurred. * usb_try_serialize_access: * try acquiring serialized access * usb_serp - usb_serialization handle * USB_SUCCESS - access has been acquired * USB_FAILURE - access has not been acquired * release serialized access * usb_serp - usb_serialization handle * ************************************************************************** * Asynchronous functions remaining Contracted Consolidation Private * ************************************************************************** /* This whole section: status: C and D. */ /* For async_req functions. */ * Issue a request to the asynchronous request service * All async request functions return USB_SUCCESS or USB_FAILURE * dip - pointer to devinfo node * func - pointer of function to execute asynchronously * arg - argument to function * flag - USB_FLAGS_SLEEP or USB_FLAGS_NOSLEEP or * USB_SUCCESS - function was scheduled * USB_FAILURE - function could not be scheduled * SLEEP - block waiting for resources. always succeeds * NOSLEEP - do not wait for resources, may fail. * NOSLEEP+NOQUEUE - do not wait for resources, do not queue * SLEEP+NOQUEUE - block waiting for resources but may still fail * index for getting to usb_pipehandle_list in usba_device /* create an USB style M_CTL message */ #
endif /* _SYS_USB_USBA_USBAI_PRIVATE_H */