xref: /illumos-gate/usr/src/uts/sun4u/opl/sys/oplmsu/oplmsu_proto.h (revision 1a220b56b93ff1dc80855691548503117af4cc10)
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  * All Rights Reserved, Copyright (c) FUJITSU LIMITED 2006
23  */
24 
25 #ifndef _OPLMSU_PROTO_H
26 #define	_OPLMSU_PROTO_H
27 
28 #pragma ident	"%Z%%M%	%I%	%E% SMI"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  *	PROTOTYPE DECLARATIONS
36  */
37 
38 int	oplmsu_attach(dev_info_t *, ddi_attach_cmd_t);
39 int	oplmsu_detach(dev_info_t *, ddi_detach_cmd_t);
40 int	oplmsu_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
41 int	oplmsu_open(queue_t *, dev_t *, int, int, cred_t *);
42 int	oplmsu_close(queue_t *, int, cred_t *);
43 int	oplmsu_uwput(queue_t *, mblk_t *);
44 int	oplmsu_uwsrv(queue_t *);
45 int	oplmsu_lwsrv(queue_t *);
46 int	oplmsu_lrput(queue_t *, mblk_t *);
47 int	oplmsu_lrsrv(queue_t *);
48 int	oplmsu_ursrv(queue_t *);
49 
50 int	oplmsu_open_msu(dev_info_t *, ldi_ident_t *, ldi_handle_t *);
51 int	oplmsu_plink_serial(dev_info_t *, ldi_handle_t, int *);
52 int	oplmsu_set_lpathnum(int, int);
53 int	oplmsu_dr_attach(dev_info_t *);
54 int	oplmsu_dr_detach(dev_info_t *);
55 int	oplmsu_find_serial(ser_devl_t **);
56 dev_info_t *oplmsu_find_ser_dip(dev_info_t *);
57 void	oplmsu_conf_stream(uinst_t *);
58 void	oplmsu_unlinks(ldi_handle_t, int *, int);
59 void	oplmsu_setup(uinst_t *);
60 int	oplmsu_create_upath(dev_info_t *);
61 int	oplmsu_config_new(struct msu_path *);
62 int	oplmsu_config_add(dev_info_t *);
63 int	oplmsu_config_del(struct msu_path *);
64 int	oplmsu_config_stop(int);
65 int	oplmsu_config_start(int);
66 int	oplmsu_config_disc(int);
67 
68 /*
69  *	UPPER WRITE SERVICE PROCEDURE
70  */
71 int	oplmsu_uwioctl_iplink(queue_t *, mblk_t *);
72 int	oplmsu_uwioctl_ipunlink(queue_t *, mblk_t *);
73 int	oplmsu_uwioctl_termios(queue_t *, mblk_t *);
74 
75 /*
76  *	LOWER READ SERVICE PROCEDURE
77  */
78 int	oplmsu_lrioctl_termios(queue_t *, mblk_t *);
79 int	oplmsu_lrmsg_error(queue_t *, mblk_t *);
80 int	oplmsu_lrdata_xoffxon(queue_t *, mblk_t *);
81 
82 /*
83  *	COMMON FUNCTIONS
84  */
85 void	oplmsu_link_upath(upath_t *);
86 void	oplmsu_unlink_upath(upath_t *);
87 void	oplmsu_link_lpath(lpath_t *);
88 void	oplmsu_unlink_lpath(lpath_t *);
89 void	oplmsu_link_high_primsg(mblk_t **, mblk_t **, mblk_t *);
90 int	oplmsu_check_lpath_usable(void);
91 upath_t	*oplmsu_search_upath_info(int);
92 
93 void	oplmsu_iocack(queue_t *, mblk_t *, int);
94 void	oplmsu_delete_upath_info(void);
95 int 	oplmsu_set_ioctl_path(lpath_t *, queue_t *, mblk_t *);
96 void	oplmsu_clear_ioctl_path(lpath_t *);
97 
98 int	oplmsu_get_inst_status(void);
99 upath_t	*oplmsu_search_standby(void);
100 void	oplmsu_search_min_stop_path(void);
101 int	oplmsu_get_pathnum(void);
102 int	oplmsu_cmn_put_xoffxon(queue_t *, int);
103 void	oplmsu_cmn_putxoff_standby(void);
104 void	oplmsu_cmn_set_mflush(mblk_t *);
105 void	oplmsu_cmn_set_upath_sts(upath_t *, int, int, ulong_t);
106 int	oplmsu_cmn_allocmb(queue_t *, mblk_t *, mblk_t **, size_t, int);
107 int	oplmsu_cmn_copymb(queue_t *, mblk_t *, mblk_t **, mblk_t *, int);
108 void	oplmsu_cmn_bufcall(queue_t *, mblk_t *, size_t, int);
109 int	oplmsu_cmn_prechg(queue_t *, mblk_t *, int, mblk_t **, int *, int *);
110 int	oplmsu_stop_prechg(mblk_t **, int *, int *);
111 int	oplmsu_cmn_prechg_termio(queue_t *, mblk_t *, int, int, mblk_t **,
112 	    int *);
113 int	oplmsu_cmn_pullup_msg(queue_t *, mblk_t *);
114 
115 void	oplmsu_cmn_wakeup(queue_t *);
116 void	oplmsu_cmn_bufcb(void *);
117 void	oplmsu_wbufcb_posthndl(ctrl_t *);
118 
119 /*
120  *	common functions for write stream
121  */
122 int	oplmsu_wcmn_chknode(queue_t *, int, mblk_t *);
123 void	oplmsu_wcmn_flush_hndl(queue_t *, mblk_t *, krw_t);
124 int	oplmsu_wcmn_through_hndl(queue_t *, mblk_t *, int, krw_t);
125 mblk_t	*oplmsu_wcmn_high_getq(queue_t *);
126 void	oplmsu_wcmn_norm_putbq(queue_t *, mblk_t *, queue_t *);
127 void	oplmsu_wcmn_high_qenable(queue_t *, krw_t);
128 
129 /*
130  *	common functions for read stream
131  */
132 void	oplmsu_rcmn_flush_hndl(queue_t *, mblk_t *);
133 int	oplmsu_rcmn_through_hndl(queue_t *, mblk_t *, int);
134 void	oplmsu_rcmn_high_qenable(queue_t *);
135 
136 
137 #ifdef DEBUG
138 void	oplmsu_cmn_trace(queue_t *, mblk_t *, int);
139 void	oplmsu_cmn_msglog(mblk_t *, int);
140 void	oplmsu_cmn_prt_pathname(dev_info_t *);
141 #endif
142 
143 
144 /*
145  *	GLOBAL VARIABLES
146  */
147 extern	uinst_t		*oplmsu_uinst;
148 extern	int		oplmsu_queue_flag;
149 extern	int		oplmsu_check_su;
150 
151 #ifdef DEBUG
152 extern	int		oplmsu_debug_mode;
153 extern	int		oplmsu_trace_on;
154 extern	uint_t		oplmsu_ltrc_size;
155 extern	msu_trc_t	*oplmsu_ltrc_top;
156 extern	msu_trc_t	*oplmsu_ltrc_tail;
157 extern	msu_trc_t	*oplmsu_ltrc_cur;
158 extern	ulong_t		oplmsu_ltrc_ccnt;
159 extern	kmutex_t	oplmsu_ltrc_lock;
160 #endif
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif	/* _OPLMSU_PROTO_H */
167