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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_USB_REGISTER_IMPL_H
28 #define	_SYS_USB_REGISTER_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /* For binary dump function */
37 #define	BINDUMP_BYTES_PER_LINE	16 /* For binary dump of class/vendor descr */
38 #define	INDENT_SPACE_STR	"    " /* Spaces for indentation */
39 #define	SPACES_PER_INDENT	(strlen(INDENT_SPACE_STR) - 1)
40 
41 #define	USBA_ALL	-1			/* Build all */
42 
43 /* State of the tree-building process */
44 typedef struct usba_reg_state {
45 	dev_info_t	*dip;			/* Dev info pointer */
46 	usb_cfg_data_t	*st_curr_cfg;	/* Current cfg being init'ed */
47 	usb_if_data_t	*st_curr_if;		/* Current if being init'ed */
48 	usb_alt_if_data_t *st_curr_alt;	/* Current alt being init'ed */
49 	usb_ep_data_t	*st_curr_ep;		/* Current ep being init'ed */
50 	int		st_last_processed_descr_type; /* Type of last descr */
51 					    /* processed for placing c/vs */
52 	int		st_if_to_build;		/* Interface to build */
53 	int		st_cfg_to_build;	/* Configuration to build */
54 	int		st_total_cfg_length;	/* Len of all descriptors */
55 						/* for the current config */
56 	uchar_t 	*st_curr_raw_descr;	/* Ptr to raw curr descr */
57 	uchar_t 	st_curr_raw_descr_type;    /* Type of curr descr */
58 	uchar_t 	st_curr_raw_descr_len;    /* Length of curr descr */
59 	char		*st_curr_cfg_str;    /* Cfg string from usba_device */
60 	usb_reg_parse_lvl_t st_dev_parse_level;	/* All, curr cfg, 1 iface */
61 	usb_cfg_data_t	*st_dev_cfg;		/* Cfg array, root of tree */
62 	uint_t		st_dev_n_cfg;		/* Number cfgs in tree */
63 } usba_reg_state_t;
64 
65 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usb_cvs_data))
66 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usb_ep_data))
67 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usb_alt_if_data))
68 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usb_if_data))
69 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usb_cfg_data))
70 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only", usba_reg_state))
71 
72 
73 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
74 					usb_client_dev_data::dev_cfg))
75 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
76 					usb_client_dev_data::dev_curr_cfg))
77 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
78 					usb_client_dev_data::dev_n_cfg))
79 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
80 					usb_client_dev_data::dev_parse_level))
81 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
82 					usb_client_dev_data::dev_curr_if))
83 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
84 					usb_client_dev_data::dev_default_ph))
85 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
86 					usb_client_dev_data::dev_descr))
87 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
88 					usb_client_dev_data::dev_iblock_cookie))
89 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
90 					usb_client_dev_data::dev_mfg))
91 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
92 					usb_client_dev_data::dev_product))
93 _NOTE(SCHEME_PROTECTS_DATA("chg at attach only",
94 					usb_client_dev_data::dev_serial))
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* _SYS_USB_REGISTER_IMPL_H */
101