isp_library.h revision 168240
1155228Smjacob/* $FreeBSD: head/sys/dev/isp/isp_library.h 168240 2007-04-02 01:04:20Z mjacob $ */ 2155228Smjacob/*- 3167403Smjacob * Copyright (c) 1997-2007 by Matthew Jacob 4167403Smjacob * All rights reserved. 5167403Smjacob * 6167403Smjacob * Redistribution and use in source and binary forms, with or without 7167403Smjacob * modification, are permitted provided that the following conditions 8167403Smjacob * are met: 9167403Smjacob * 10167403Smjacob * 1. Redistributions of source code must retain the above copyright 11167403Smjacob * notice, this list of conditions and the following disclaimer. 12167403Smjacob * 2. Redistributions in binary form must reproduce the above copyright 13167403Smjacob * notice, this list of conditions and the following disclaimer in the 14167403Smjacob * documentation and/or other materials provided with the distribution. 15167403Smjacob * 16167403Smjacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17167403Smjacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18167403Smjacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19167403Smjacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20167403Smjacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21167403Smjacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22167403Smjacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23167403Smjacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24167403Smjacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25167403Smjacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26167403Smjacob * SUCH DAMAGE. 27155228Smjacob */ 28155228Smjacob#ifndef _ISP_LIBRARY_H 29155228Smjacob#define _ISP_LIBRARY_H 30155228Smjacob 31163899Smjacobextern int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *); 32163899Smjacobextern XS_T *isp_find_xs(ispsoftc_t *, uint32_t); 33163899Smjacobextern uint32_t isp_find_handle(ispsoftc_t *, XS_T *); 34163899Smjacobextern uint32_t isp_handle_index(uint32_t); 35163899Smjacobextern void isp_destroy_handle(ispsoftc_t *, uint32_t); 36163899Smjacobextern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **); 37155228Smjacobextern void isp_print_qentry (ispsoftc_t *, char *, int, void *); 38167821Smjacobextern void isp_print_bytes(ispsoftc_t *, const char *, int, void *); 39155228Smjacobextern int isp_fc_runstate(ispsoftc_t *, int); 40164272Smjacobextern void isp_dump_portdb(ispsoftc_t *); 41163899Smjacobextern void isp_shutdown(ispsoftc_t *); 42163899Smjacobextern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *); 43163899Smjacobextern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *); 44155228Smjacobextern int isp_get_response_type(ispsoftc_t *, isphdr_t *); 45155228Smjacobextern void 46155228Smjacobisp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *); 47155228Smjacobextern void 48163899Smjacobisp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *); 49163899Smjacobextern void 50163899Smjacobisp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *); 51163899Smjacobextern void 52155228Smjacobisp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *); 53155228Smjacobextern void 54155228Smjacobisp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *); 55155228Smjacobextern void 56155228Smjacobisp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *); 57155228Smjacobextern void 58155228Smjacobisp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *); 59155228Smjacobextern void 60155228Smjacobisp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *); 61155228Smjacobextern void 62163899Smjacobisp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *); 63163899Smjacobextern void 64163899Smjacobisp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); 65163899Smjacobextern void 66155228Smjacobisp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *); 67155228Smjacobextern void 68155228Smjacobisp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *); 69155228Smjacobextern void 70155228Smjacobisp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *); 71163899Smjacobextern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *, 72163899Smjacob isp24xx_statusreq_t *); 73163899Smjacobvoid 74163899Smjacobisp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); 75155228Smjacobextern void 76155228Smjacobisp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *); 77155228Smjacobextern void 78155228Smjacobisp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *); 79155228Smjacobextern void 80163899Smjacobisp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *); 81155228Smjacobextern void 82163899Smjacobisp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *); 83155228Smjacobextern void 84163899Smjacobisp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *); 85163899Smjacobextern void 86163899Smjacobisp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *); 87163899Smjacobextern void 88163899Smjacobisp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *); 89163899Smjacobextern void 90163899Smjacobisp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *); 91163899Smjacobextern void 92164370Smjacobisp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *); 93164370Smjacobextern void 94163899Smjacobisp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *); 95163899Smjacobextern void 96164370Smjacobisp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *); 97164370Smjacobextern void 98155228Smjacobisp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *); 99155228Smjacobextern void 100155228Smjacobisp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *, 101155228Smjacob sns_gid_ft_req_t *); 102155228Smjacobextern void 103155228Smjacobisp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *, 104155228Smjacob sns_gxn_id_req_t *); 105155228Smjacobextern void 106155228Smjacobisp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int); 107155228Smjacobextern void 108155228Smjacobisp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *, 109155228Smjacob sns_gid_ft_rsp_t *, int); 110155228Smjacobextern void 111155228Smjacobisp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *, 112155228Smjacob sns_gxn_id_rsp_t *); 113155228Smjacobextern void 114155228Smjacobisp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *, 115155228Smjacob sns_gff_id_rsp_t *); 116155228Smjacobextern void 117155228Smjacobisp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *, 118155228Smjacob sns_ga_nxt_rsp_t *); 119163899Smjacobextern void 120163899Smjacobisp_get_els(ispsoftc_t *, els_t *, els_t *); 121163899Smjacobextern void 122163899Smjacobisp_put_els(ispsoftc_t *, els_t *, els_t *); 123163899Smjacobextern void 124163899Smjacobisp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *); 125163899Smjacobextern void 126163899Smjacobisp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *); 127163899Smjacobextern void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *); 128163899Smjacobextern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); 129163899Smjacobextern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); 130155228Smjacob 131168240Smjacob#define ISP_HANDLE_MASK 0x7fff 132168240Smjacob 133155228Smjacob#ifdef ISP_TARGET_MODE 134155704Smjacob#if defined(__NetBSD__) || defined(__OpenBSD__) 135155704Smjacob#include <dev/ic/isp_target.h> 136155704Smjacob#elif defined(__FreeBSD__) 137155228Smjacob#include <dev/isp/isp_target.h> 138155704Smjacob#else 139155704Smjacob#include "isp_target.h" 140155704Smjacob#endif 141155228Smjacob 142163899Smjacob#define IS_TARGET_HANDLE(x) ((x) & 0x8000) 143155228Smjacob 144163899Smjacobextern int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *); 145163899Smjacobextern void *isp_find_xs_tgt(ispsoftc_t *, uint32_t); 146163899Smjacobextern uint32_t isp_find_tgt_handle(ispsoftc_t *, void *); 147163899Smjacobextern void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t); 148163899Smjacob 149155228Smjacobextern void 150155228Smjacobisp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *); 151155228Smjacobextern void 152155228Smjacobisp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *); 153155228Smjacobextern void 154155228Smjacobisp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *); 155155228Smjacobextern void 156155228Smjacobisp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *); 157155228Smjacobextern void 158155228Smjacobisp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *); 159155228Smjacobextern void 160155228Smjacobisp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *); 161155228Smjacobextern void 162163899Smjacobisp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *); 163163899Smjacobextern void 164155228Smjacobisp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *); 165155228Smjacobextern void 166155228Smjacobisp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *); 167155228Smjacobextern void 168155228Smjacobisp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *); 169155228Smjacobextern void 170155228Smjacobisp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *); 171155228Smjacobextern void 172163899Smjacobisp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *); 173163899Smjacobextern void 174155228Smjacobisp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *); 175155228Smjacobextern void 176155228Smjacobisp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *); 177155228Smjacobextern void 178163899Smjacobisp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *); 179163899Smjacobextern void 180155228Smjacobisp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *); 181155228Smjacobextern void 182155228Smjacobisp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *); 183155228Smjacobextern void 184155228Smjacobisp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *); 185155228Smjacobextern void 186155228Smjacobisp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *); 187155228Smjacobextern void 188155228Smjacobisp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *); 189155228Smjacobextern void 190155228Smjacobisp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *); 191155228Smjacobextern void 192163899Smjacobisp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *); 193163899Smjacobextern void 194155228Smjacobisp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *); 195155228Smjacobextern void 196155228Smjacobisp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *); 197155228Smjacobextern void 198163899Smjacobisp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *); 199163899Smjacobextern void 200155228Smjacobisp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *); 201155228Smjacobextern void 202155228Smjacobisp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *); 203155228Smjacobextern void 204163899Smjacobisp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *); 205163899Smjacobextern void 206155228Smjacobisp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *); 207155228Smjacobextern void 208155228Smjacobisp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *); 209163899Smjacobextern void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, 210163899Smjacob na_fcentry_24xx_t *); 211155228Smjacobextern void 212155228Smjacobisp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *); 213155228Smjacobextern void 214155228Smjacobisp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *); 215163899Smjacobextern void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, 216163899Smjacob na_fcentry_24xx_t *); 217163899Smjacobextern void 218163899Smjacobisp_get_abts(ispsoftc_t *, abts_t *, abts_t *); 219163899Smjacobextern void 220163899Smjacobisp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *); 221163899Smjacobextern void 222163899Smjacobisp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *); 223155228Smjacob#endif /* ISP_TARGET_MODE */ 224155228Smjacob#endif /* _ISP_LIBRARY_H */ 225