isp_library.h revision 164272
1228753Smm/* $FreeBSD: head/sys/dev/isp/isp_library.h 164272 2006-11-14 08:45:48Z mjacob $ */
2228753Smm/*-
3228753Smm * Qlogic Host Adapter Library Functions
4228753Smm *
5228753Smm * Copyright (c) 1999-2006 by Matthew Jacob
6228753Smm * All rights reserved.
7228753Smm *
8228753Smm * Redistribution and use in source and binary forms, with or without
9228753Smm * modification, are permitted provided that the following conditions
10228753Smm * are met:
11228753Smm * 1. Redistributions of source code must retain the above copyright
12228753Smm *    notice immediately at the beginning of the file, without modification,
13228753Smm *    this list of conditions, and the following disclaimer.
14228753Smm * 2. The name of the author may not be used to endorse or promote products
15228753Smm *    derived from this software without specific prior written permission.
16228753Smm *
17228753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18228753Smm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19228753Smm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20228753Smm * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21228753Smm * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22228753Smm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23228753Smm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24228753Smm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25228753Smm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26228753Smm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27228753Smm * SUCH DAMAGE.
28228753Smm *
29228753Smm */
30228753Smm#ifndef	_ISP_LIBRARY_H
31228753Smm#define	_ISP_LIBRARY_H
32228753Smm
33228753Smmextern int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *);
34228753Smmextern XS_T *isp_find_xs(ispsoftc_t *, uint32_t);
35228753Smmextern uint32_t isp_find_handle(ispsoftc_t *, XS_T *);
36228753Smmextern uint32_t isp_handle_index(uint32_t);
37228753Smmextern void isp_destroy_handle(ispsoftc_t *, uint32_t);
38228753Smmextern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **);
39228753Smmextern void isp_print_qentry (ispsoftc_t *, char *, int, void *);
40228753Smmextern void isp_print_bytes(ispsoftc_t *, char *, int, void *);
41228753Smmextern int isp_fc_runstate(ispsoftc_t *, int);
42228753Smmextern void isp_dump_portdb(ispsoftc_t *);
43248616Smmextern void isp_shutdown(ispsoftc_t *);
44248616Smmextern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
45228753Smmextern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
46228753Smmextern int isp_get_response_type(ispsoftc_t *, isphdr_t *);
47228753Smmextern void
48228753Smmisp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *);
49228753Smmextern void
50228753Smmisp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *);
51228753Smmextern void
52228753Smmisp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *);
53228753Smmextern void
54228753Smmisp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *);
55228753Smmextern void
56isp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *);
57extern void
58isp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *);
59extern void
60isp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *);
61extern void
62isp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *);
63extern void
64isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *);
65extern void
66isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
67extern void
68isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *);
69extern void
70isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *);
71extern void
72isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *);
73extern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *,
74    isp24xx_statusreq_t *);
75void
76isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
77extern void
78isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *);
79extern void
80isp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *);
81extern void
82isp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *);
83extern void
84isp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *);
85extern void
86isp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *);
87extern void
88isp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
89extern void
90isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
91extern void
92isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
93extern void
94isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
95extern void
96isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
97extern void
98isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *,
99    sns_gid_ft_req_t *);
100extern void
101isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *,
102    sns_gxn_id_req_t *);
103extern void
104isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int);
105extern void
106isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *,
107    sns_gid_ft_rsp_t *, int);
108extern void
109isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *,
110    sns_gxn_id_rsp_t *);
111extern void
112isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *,
113    sns_gff_id_rsp_t *);
114extern void
115isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *,
116    sns_ga_nxt_rsp_t *);
117extern void
118isp_get_els(ispsoftc_t *, els_t *, els_t *);
119extern void
120isp_put_els(ispsoftc_t *, els_t *, els_t *);
121extern void
122isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
123extern void
124isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *);
125extern void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *);
126extern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
127extern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
128
129#ifdef	ISP_TARGET_MODE
130#if	defined(__NetBSD__) || defined(__OpenBSD__)
131#include <dev/ic/isp_target.h>
132#elif 	defined(__FreeBSD__)
133#include <dev/isp/isp_target.h>
134#else
135#include "isp_target.h"
136#endif
137
138#define	IS_TARGET_HANDLE(x)     ((x) & 0x8000)
139
140extern int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *);
141extern void *isp_find_xs_tgt(ispsoftc_t *, uint32_t);
142extern uint32_t isp_find_tgt_handle(ispsoftc_t *, void *);
143extern void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t);
144
145extern void
146isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
147extern void
148isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
149extern void
150isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
151extern void
152isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
153extern void
154isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
155extern void
156isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
157extern void
158isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
159extern void
160isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
161extern void
162isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
163extern void
164isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
165extern void
166isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
167extern void
168isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
169extern void
170isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
171extern void
172isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
173extern void
174isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
175extern void
176isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
177extern void
178isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
179extern void
180isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
181extern void
182isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
183extern void
184isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
185extern void
186isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
187extern void
188isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
189extern void
190isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
191extern void
192isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
193extern void
194isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
195extern void
196isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
197extern void
198isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
199extern void
200isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
201extern void
202isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
203extern void
204isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
205extern void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
206    na_fcentry_24xx_t *);
207extern void
208isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
209extern void
210isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
211extern void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
212    na_fcentry_24xx_t *);
213extern void
214isp_get_abts(ispsoftc_t *, abts_t *, abts_t *);
215extern void
216isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
217extern void
218isp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
219#endif	/* ISP_TARGET_MODE */
220#endif	/* _ISP_LIBRARY_H */
221