xref: /illumos-gate/usr/src/uts/common/io/comstar/stmf/stmf_state.h (revision d0698e0d179f97729cacdbc2f13446a6b0a3f22a)
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 (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 #ifndef	_STMF_STATE_H
25 #define	_STMF_STATE_H
26 
27 #ifdef	__cplusplus
28 extern "C" {
29 #endif
30 
31 typedef struct stmf_state {
32 	kmutex_t		stmf_lock;
33 	kcondvar_t		stmf_cv;
34 	dev_info_t		*stmf_dip;
35 	stmf_i_lu_provider_t	*stmf_ilplist;
36 	stmf_i_port_provider_t	*stmf_ipplist;
37 	stmf_i_lu_t		*stmf_ilulist;
38 	stmf_i_local_port_t	*stmf_ilportlist;
39 	id_space_t		*stmf_ilport_inst_space;
40 	avl_tree_t		stmf_irportlist;
41 	id_space_t		*stmf_irport_inst_space;
42 	avl_tree_t		stmf_itl_kstat_list;
43 	int			stmf_nlps;
44 	int			stmf_npps;
45 	int			stmf_nlus;
46 	int			stmf_nlports;
47 	uint8_t			stmf_service_running:1,
48 				stmf_inventory_locked:1,
49 				stmf_exclusive_open:1,
50 				stmf_opened:1,
51 				stmf_process_initial_luns:1,
52 				rsvd:3;
53 	uint8_t			stmf_config_state; /* See stmf_ioctl.h */
54 	uint8_t			stmf_alua_state;
55 	uint16_t		stmf_alua_node;
56 	uint8_t			stmf_default_lu_state;
57 	uint8_t			stmf_default_lport_state;
58 	ddi_taskq_t		*stmf_svc_taskq;
59 	uint32_t		stmf_svc_flags;
60 	stmf_i_lu_t		*stmf_svc_ilu_draining;
61 	stmf_i_lu_t		*stmf_svc_ilu_timing;
62 	struct stmf_svc_req	*stmf_svc_active;
63 	struct stmf_svc_req	*stmf_svc_waiting;
64 
65 	stmf_id_list_t		stmf_hg_list;
66 	stmf_id_list_t		stmf_tg_list;
67 	stmf_id_list_t		stmf_luid_list;
68 
69 	stmf_ver_tg_t		*stmf_ver_tg_head;
70 
71 	stmf_pp_data_t		*stmf_ppdlist;
72 } stmf_state_t;
73 
74 /*
75  * svc flags
76  */
77 #define	STMF_SVC_STARTED		1
78 #define	STMF_SVC_ACTIVE			2
79 #define	STMF_SVC_TERMINATE		4
80 
81 /*
82  * svc request. We probably have to modify it once more services (and probably
83  * different types of services) are added to the stmf_svc_thread.
84  */
85 typedef struct stmf_svc_req {
86 	struct stmf_svc_req		*svc_next;
87 	int				svc_req_alloc_size;
88 	int				svc_cmd;
89 	void				*svc_obj;
90 	struct stmf_state_change_info	svc_info;
91 } stmf_svc_req_t;
92 
93 extern stmf_state_t stmf_state;
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif /* _STMF_STATE_H */
100