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