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-2010 Oracle Corporation. All rights reserved.
|
---|
23 | * Use is subject to license terms.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef _SYS_USB_USBA_USBAI_PRIVATE_H
|
---|
27 | #define _SYS_USB_USBA_USBAI_PRIVATE_H
|
---|
28 |
|
---|
29 | /*
|
---|
30 | * Unstable interfaces not part of USBAI but used by Solaris client drivers.
|
---|
31 | * These interfaces may not be present in future releases and are highly
|
---|
32 | * unstable.
|
---|
33 | *
|
---|
34 | * Status key:
|
---|
35 | * C = Remove from Sun client drivers before removing from this file
|
---|
36 | * D = May be needed by legacy (DDK) drivers.
|
---|
37 | */
|
---|
38 |
|
---|
39 | #ifdef __cplusplus
|
---|
40 | extern "C" {
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | /*
|
---|
44 | * convenience function for getting default config index
|
---|
45 | * as saved in usba_device structure
|
---|
46 | *
|
---|
47 | * Status: C
|
---|
48 | */
|
---|
49 | uint_t usb_get_current_cfgidx(dev_info_t *);
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Usb logging, debug and console message handling.
|
---|
53 | */
|
---|
54 | typedef struct usb_log_handle *usb_log_handle_t;
|
---|
55 |
|
---|
56 | #define USB_LOG_L0 0 /* warnings, console & syslog buffer */
|
---|
57 | #define USB_LOG_L1 1 /* errors, syslog buffer */
|
---|
58 | #define USB_LOG_L2 2 /* recoverable errors, debug only */
|
---|
59 | #define USB_LOG_L3 3 /* interesting data, debug only */
|
---|
60 | #define USB_LOG_L4 4 /* tracing, debug only */
|
---|
61 |
|
---|
62 | #define USB_CHK_BASIC 0 /* Empty mask. Basics always done. */
|
---|
63 | #define USB_CHK_SERIAL 0x00000001 /* Compare device serial numbers. */
|
---|
64 | #define USB_CHK_CFG 0x00000002 /* Compare raw config clouds. */
|
---|
65 | #define USB_CHK_VIDPID 0x00000004 /* Compare product and vendor ID. */
|
---|
66 | #define USB_CHK_ALL 0xFFFFFFFF /* Perform maximum checking. */
|
---|
67 |
|
---|
68 | int usb_check_same_device(dev_info_t *dip,
|
---|
69 | usb_log_handle_t log_handle,
|
---|
70 | int log_level,
|
---|
71 | int log_mask,
|
---|
72 | uint_t check_mask,
|
---|
73 | char *device_string);
|
---|
74 |
|
---|
75 | /*
|
---|
76 | * **************************************************************************
|
---|
77 | * Serialization functions remaining Contracted Consolidation Private
|
---|
78 | * **************************************************************************
|
---|
79 | */
|
---|
80 |
|
---|
81 | /* This whole section: status: C and D. */
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * opaque serialization handle.
|
---|
85 | * Used by all usb_serialization routines.
|
---|
86 | *
|
---|
87 | * This handle is opaque to the client driver.
|
---|
88 | */
|
---|
89 | typedef struct usb_serialization *usb_serialization_t;
|
---|
90 |
|
---|
91 | /*
|
---|
92 | * usb_init_serialization
|
---|
93 | * setup for serialization
|
---|
94 | *
|
---|
95 | * ARGUMENTS:
|
---|
96 | * s_dip - devinfo pointer
|
---|
97 | * flag - USB_INIT_SER_CHECK_SAME_THREAD
|
---|
98 | * when set, usb_release_access() will verify that the same
|
---|
99 | * thread releases access. If not, a console warning will
|
---|
100 | * be issued but access will be released anyways.
|
---|
101 | *
|
---|
102 | * RETURNS:
|
---|
103 | * usb_serialization handle
|
---|
104 | *
|
---|
105 | */
|
---|
106 | usb_serialization_t usb_init_serialization(dev_info_t *s_dip,
|
---|
107 | uint_t flag);
|
---|
108 |
|
---|
109 | #define USB_INIT_SER_CHECK_SAME_THREAD 1
|
---|
110 |
|
---|
111 | /* fini for serialization */
|
---|
112 | void usb_fini_serialization(usb_serialization_t usb_serp);
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * Various ways of calling usb_serialize_access. These correspond to
|
---|
116 | * their cv_*wait* function counterparts for usb_serialize_access.
|
---|
117 | */
|
---|
118 | #define USB_WAIT 0
|
---|
119 | #define USB_WAIT_SIG 1
|
---|
120 | #define USB_TIMEDWAIT 2
|
---|
121 | #define USB_TIMEDWAIT_SIG 3
|
---|
122 |
|
---|
123 | /*
|
---|
124 | * usb_serialize_access:
|
---|
125 | * acquire serialized access
|
---|
126 | *
|
---|
127 | * ARGUMENTS:
|
---|
128 | * usb_serp - usb_serialization handle
|
---|
129 | * how_to_wait - Which cv_*wait* function to wait for condition.
|
---|
130 | * USB_WAIT: use cv_wait
|
---|
131 | * USB_WAIT_SIG: use cv_wait_sig
|
---|
132 | * USB_TIMEDWAIT: use cv_timedwait
|
---|
133 | * USB_TIMEDWAIT_SIG: use cv_timedwait_sig
|
---|
134 | * delta_timeout - Time in ms from current time to timeout. Checked
|
---|
135 | * only if USB_TIMEDWAIT or USB_TIMEDWAIT_SIG
|
---|
136 | * specified in how_to_wait.
|
---|
137 | * RETURNS:
|
---|
138 | * Same as values returned by cv_*wait* functions,
|
---|
139 | * except for when how_to_wait == USB_WAIT, where 0 is always returned.
|
---|
140 | * For calls where a timeout or signal could be expected, use this value
|
---|
141 | * to tell whether a kill(2) signal or timeout occurred.
|
---|
142 | */
|
---|
143 | int usb_serialize_access(usb_serialization_t usb_serp,
|
---|
144 | uint_t how_to_wait,
|
---|
145 | uint_t delta_timeout);
|
---|
146 |
|
---|
147 | /*
|
---|
148 | * usb_release_access:
|
---|
149 | * release serialized access
|
---|
150 | *
|
---|
151 | * ARGUMENTS:
|
---|
152 | * usb_serp - usb_serialization handle
|
---|
153 | */
|
---|
154 | void usb_release_access(usb_serialization_t usb_serp);
|
---|
155 |
|
---|
156 | #ifdef __cplusplus
|
---|
157 | }
|
---|
158 | #endif
|
---|
159 |
|
---|
160 | #endif /* _SYS_USB_USBA_USBAI_PRIVATE_H */
|
---|
161 |
|
---|