wusb_ca_priv.h revision 9430:637732b28916
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26/* 27 * WUSB cable association driver private data structures and definitions. 28 */ 29#ifndef _SYS_USB_WUSB_CA_PRIV_H 30#define _SYS_USB_WUSB_CA_PRIV_H 31 32 33#ifdef __cplusplus 34extern "C" { 35#endif 36 37#include <sys/usb/usba/usbai_private.h> 38 39/* 40 * Power Management support 41 */ 42typedef struct wusb_ca_power { 43 44 void *wusb_ca_state; /* points back to wusb_ca_state */ 45 uint8_t wusb_ca_pwr_states; /* bit mask of device pwr states */ 46 int wusb_ca_pm_busy; 47 48 /* wakeup and power transistion capabilites of an interface */ 49 uint8_t wusb_ca_pm_capabilities; 50 51 /* flag to indicate if driver is about to raise power level */ 52 boolean_t wusb_ca_raise_power; 53 54 uint8_t wusb_ca_current_power; 55 uint8_t wusb_ca_remote_wakeup; 56} wusb_ca_power_t; 57 58 59/* 60 * State structure 61 */ 62typedef struct wusb_ca_state { 63 dev_info_t *wusb_ca_dip; /* per-device info handle */ 64 usb_client_dev_data_t *wusb_ca_reg; /* registration data */ 65 char *wusb_ca_devinst; /* Dev and instance */ 66 int wusb_ca_dev_state; /* USB device states. */ 67 int wusb_ca_drv_state; /* driver states. */ 68 kmutex_t wusb_ca_mutex; 69 kcondvar_t wusb_ca_serial_cv; 70 boolean_t wusb_ca_serial_inuse; 71 boolean_t wusb_ca_locks_initialized; 72 wusb_ca_power_t *wusb_ca_pm; 73 usb_log_handle_t wusb_ca_log_hdl; 74} wusb_ca_state_t; 75 76_NOTE(MUTEX_PROTECTS_DATA(wusb_ca_state::wusb_ca_mutex, wusb_ca_state)) 77 78_NOTE(DATA_READABLE_WITHOUT_LOCK(wusb_ca_state_t::{ 79 wusb_ca_log_hdl 80 wusb_ca_dip 81 wusb_ca_reg 82})) 83/* Macros */ 84#define WUSB_CA_OPEN 0x00000001 85 86#define WUSB_CA_REQUEST_SIZE 65535 /* Read request size maximum */ 87#define USB_DEV_DESCR_SIZE 18 /* device descr size */ 88 89/* Other */ 90#define WUSB_CA_DRAIN_TMO 15 91 92/* For serialization. */ 93#define WUSB_CA_SER_NOSIG B_FALSE 94#define WUSB_CA_SER_SIG B_TRUE 95 96/* For logging. */ 97#define WUSB_CA_LOG_LOG 1 98#define WUSB_CA_LOG_CONSOLE 0 99 100#define PRINT_MASK_ALL 0xFFFFFFFF 101#define PRINT_MASK_ATTA 0x00000001 102#define PRINT_MASK_CLOSE 0x00000002 103#define PRINT_MASK_OPEN 0x00000004 104#define PRINT_MASK_EVENTS 0x00000008 105#define PRINT_MASK_PM 0x00000010 106#define PRINT_MASK_CB 0x00000020 107#define PRINT_MASK_CPR 0x00000040 108 109int wusb_cbaf_get_asso_info(wusb_ca_state_t *, intptr_t, int); 110int wusb_cbaf_get_asso_reqs(wusb_ca_state_t *, intptr_t, int); 111int wusb_cbaf_set_host_info(wusb_ca_state_t *, intptr_t, int); 112int wusb_cbaf_get_device_info(wusb_ca_state_t *, intptr_t, int); 113int wusb_cbaf_set_connection(wusb_ca_state_t *, intptr_t, int); 114int wusb_cbaf_set_failure(wusb_ca_state_t *, intptr_t, int); 115 116 117#ifdef __cplusplus 118} 119#endif 120 121#endif /* _SYS_USB_WUSB_CA_PRIV_H */ 122