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 #ifndef _SYS_USB_HWARC_H 27 #define _SYS_USB_HWARC_H 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 #include <sys/usb/usba/usbai_private.h> 34 #include <sys/uwb/uwbai.h> 35 36 /* Power Management support */ 37 typedef struct hwarc_power { 38 39 void *hrc_state; /* Hwarc state */ 40 uint8_t hrc_pwr_states; /* Hwarc power state */ 41 int hrc_pm_busy; /* Hwarc busy counter */ 42 43 uint8_t hrc_pm_capabilities; /* PM capabilities */ 44 uint8_t hrc_current_power; /* Hwarc power value */ 45 46 uint8_t hrc_wakeup_enabled; /* Remote Wakeup */ 47 } hwarc_power_t; 48 49 /* Hwarc State structure */ 50 typedef struct hwarc_state { 51 dev_info_t *hrc_dip; /* Dip of Hwarc */ 52 53 usb_client_dev_data_t *hrc_reg; /* Usb dev data */ 54 usb_if_data_t *hrc_if_descr; /* Interface descr */ 55 56 usb_pipe_handle_t hrc_default_ph; /* Default pipe */ 57 usb_ep_descr_t hrc_intr_ep_descr; /* Inter ep descr */ 58 usb_pipe_handle_t hrc_intr_ph; /* Inter pipe hdl */ 59 char *hrc_devinst; /* Device instance */ 60 61 int hrc_dev_state; /* USB device state */ 62 uint_t hrc_open_count; 63 64 kmutex_t hrc_mutex; /* Global hwarc mutex */ 65 66 kcondvar_t hrc_serial_cv; /* Serial access cond */ 67 boolean_t hrc_serial_inuse; /* Serial access flag */ 68 69 70 boolean_t hrc_locks_initialized; /* Init status flag */ 71 72 hwarc_power_t *hrc_pm; /* PM state of hwarc */ 73 74 usb_log_handle_t hrc_log_hdl; /* Hwarc log handle */ 75 uwb_dev_handle_t hrc_dev_hdl; /* Uwb dev handle */ 76 } hwarc_state_t; 77 78 _NOTE(MUTEX_PROTECTS_DATA(hwarc_state_t::hrc_mutex, hwarc_state_t)) 79 _NOTE(DATA_READABLE_WITHOUT_LOCK(hwarc_state_t::{ 80 hrc_dev_hdl 81 hrc_dev_state 82 hrc_intr_ep_descr 83 hrc_default_ph 84 hrc_reg 85 hrc_intr_ph 86 hrc_log_hdl 87 hrc_dip 88 hrc_if_descr 89 90 })) 91 92 93 #define USB_DEV_DESCR_SIZE 18 /* Hwarc device descr size */ 94 95 96 #define HWA_EXEC_RC_CMD 40 /* UWB Radio cmd request code */ 97 98 #define HWARC_SER_NOSIG B_FALSE /* Hwarc serialization */ 99 #define HWARC_SER_SIG B_TRUE 100 101 #define HWARC_SET_IF 0x21 /* Hwarc bmRequestType */ 102 #define HWARC_GET_IF 0xA1 103 104 105 /* HWARC masks for debug printing */ 106 #define PRINT_MASK_ATTA 0x00000001 107 #define PRINT_MASK_OPEN 0x00000002 108 #define PRINT_MASK_CLOSE 0x00000004 109 #define PRINT_MASK_READ 0x00000008 110 #define PRINT_MASK_IOCTL 0x00000010 111 #define PRINT_MASK_PM 0x00000020 112 #define PRINT_MASK_CB 0x00000040 113 #define PRINT_MASK_HOTPLUG 0x00000080 114 #define PRINT_MASK_DEVCTRL 0x00000100 115 #define PRINT_MASK_DEVMAP 0x00000200 116 #define PRINT_MASK_ALL 0xFFFFFFFF 117 118 #ifdef __cplusplus 119 } 120 #endif 121 122 #endif /* _SYS_USB_HWARC_H */