isp_library.h revision 163899
1162271Srwatson/* $FreeBSD: head/sys/dev/isp/isp_library.h 163899 2006-11-02 03:21:32Z mjacob $ */
2162271Srwatson/*-
3172106Srwatson * Qlogic Host Adapter Library Functions
4162271Srwatson *
5162271Srwatson * Copyright (c) 1999-2006 by Matthew Jacob
6162271Srwatson * All rights reserved.
7162271Srwatson *
8162271Srwatson * Redistribution and use in source and binary forms, with or without
9162271Srwatson * modification, are permitted provided that the following conditions
10162271Srwatson * are met:
11162271Srwatson * 1. Redistributions of source code must retain the above copyright
12162271Srwatson *    notice immediately at the beginning of the file, without modification,
13162271Srwatson *    this list of conditions, and the following disclaimer.
14162271Srwatson * 2. The name of the author may not be used to endorse or promote products
15162271Srwatson *    derived from this software without specific prior written permission.
16162271Srwatson *
17162271Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18162271Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19162271Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20162271Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21162271Srwatson * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22162271Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23162271Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24162271Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25162271Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26162271Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27162271Srwatson * SUCH DAMAGE.
28162271Srwatson *
29162271Srwatson */
30162271Srwatson#ifndef	_ISP_LIBRARY_H
31162271Srwatson#define	_ISP_LIBRARY_H
32162271Srwatson
33162271Srwatsonextern int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *);
34172106Srwatsonextern XS_T *isp_find_xs(ispsoftc_t *, uint32_t);
35172106Srwatsonextern uint32_t isp_find_handle(ispsoftc_t *, XS_T *);
36162271Srwatsonextern uint32_t isp_handle_index(uint32_t);
37162271Srwatsonextern void isp_destroy_handle(ispsoftc_t *, uint32_t);
38172106Srwatsonextern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **);
39172106Srwatsonextern void isp_print_qentry (ispsoftc_t *, char *, int, void *);
40162271Srwatsonextern void isp_print_bytes(ispsoftc_t *, char *, int, void *);
41162271Srwatsonextern int isp_fc_runstate(ispsoftc_t *, int);
42162271Srwatsonextern void isp_shutdown(ispsoftc_t *);
43162271Srwatsonextern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
44162271Srwatsonextern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
45162271Srwatsonextern int isp_get_response_type(ispsoftc_t *, isphdr_t *);
46172106Srwatsonextern void
47172106Srwatsonisp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *);
48172106Srwatsonextern void
49172106Srwatsonisp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *);
50172106Srwatsonextern void
51172106Srwatsonisp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *);
52172106Srwatsonextern void
53172106Srwatsonisp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *);
54172106Srwatsonextern void
55172106Srwatsonisp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *);
56172106Srwatsonextern void
57172106Srwatsonisp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *);
58172106Srwatsonextern void
59172106Srwatsonisp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *);
60172106Srwatsonextern void
61172106Srwatsonisp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *);
62172106Srwatsonextern void
63172106Srwatsonisp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *);
64162271Srwatsonextern void
65172106Srwatsonisp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
66162271Srwatsonextern void
67162271Srwatsonisp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *);
68162271Srwatsonextern void
69162271Srwatsonisp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *);
70172106Srwatsonextern void
71172106Srwatsonisp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *);
72172106Srwatsonextern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *,
73172106Srwatson    isp24xx_statusreq_t *);
74172106Srwatsonvoid
75172106Srwatsonisp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
76172106Srwatsonextern void
77172106Srwatsonisp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *);
78172106Srwatsonextern void
79172106Srwatsonisp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *);
80172106Srwatsonextern void
81162271Srwatsonisp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *);
82172106Srwatsonextern void
83172106Srwatsonisp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *);
84172106Srwatsonextern void
85162271Srwatsonisp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *);
86172106Srwatsonextern void
87172106Srwatsonisp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
88162271Srwatsonextern void
89isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
90extern void
91isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
92extern void
93isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
94extern void
95isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
96extern void
97isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *,
98    sns_gid_ft_req_t *);
99extern void
100isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *,
101    sns_gxn_id_req_t *);
102extern void
103isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int);
104extern void
105isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *,
106    sns_gid_ft_rsp_t *, int);
107extern void
108isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *,
109    sns_gxn_id_rsp_t *);
110extern void
111isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *,
112    sns_gff_id_rsp_t *);
113extern void
114isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *,
115    sns_ga_nxt_rsp_t *);
116extern void
117isp_get_els(ispsoftc_t *, els_t *, els_t *);
118extern void
119isp_put_els(ispsoftc_t *, els_t *, els_t *);
120extern void
121isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
122extern void
123isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *);
124extern void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *);
125extern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
126extern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
127
128#ifdef	ISP_TARGET_MODE
129#if	defined(__NetBSD__) || defined(__OpenBSD__)
130#include <dev/ic/isp_target.h>
131#elif 	defined(__FreeBSD__)
132#include <dev/isp/isp_target.h>
133#else
134#include "isp_target.h"
135#endif
136
137#define	IS_TARGET_HANDLE(x)     ((x) & 0x8000)
138
139extern int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *);
140extern void *isp_find_xs_tgt(ispsoftc_t *, uint32_t);
141extern uint32_t isp_find_tgt_handle(ispsoftc_t *, void *);
142extern void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t);
143
144extern void
145isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
146extern void
147isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
148extern void
149isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
150extern void
151isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
152extern void
153isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
154extern void
155isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
156extern void
157isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
158extern void
159isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
160extern void
161isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
162extern void
163isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
164extern void
165isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
166extern void
167isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
168extern void
169isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
170extern void
171isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
172extern void
173isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
174extern void
175isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
176extern void
177isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
178extern void
179isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
180extern void
181isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
182extern void
183isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
184extern void
185isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
186extern void
187isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
188extern void
189isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
190extern void
191isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
192extern void
193isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
194extern void
195isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
196extern void
197isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
198extern void
199isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
200extern void
201isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
202extern void
203isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
204extern void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
205    na_fcentry_24xx_t *);
206extern void
207isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
208extern void
209isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
210extern void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
211    na_fcentry_24xx_t *);
212extern void
213isp_get_abts(ispsoftc_t *, abts_t *, abts_t *);
214extern void
215isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
216extern void
217isp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
218#endif	/* ISP_TARGET_MODE */
219#endif	/* _ISP_LIBRARY_H */
220