153af7d22SMatt Jacob /* $FreeBSD$ */ 253af7d22SMatt Jacob /*- 3e48b2487SMatt Jacob * Copyright (c) 1997-2007 by Matthew Jacob 453af7d22SMatt Jacob * All rights reserved. 553af7d22SMatt Jacob * 653af7d22SMatt Jacob * Redistribution and use in source and binary forms, with or without 753af7d22SMatt Jacob * modification, are permitted provided that the following conditions 853af7d22SMatt Jacob * are met: 953af7d22SMatt Jacob * 10e48b2487SMatt Jacob * 1. Redistributions of source code must retain the above copyright 11e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer. 12e48b2487SMatt Jacob * 2. Redistributions in binary form must reproduce the above copyright 13e48b2487SMatt Jacob * notice, this list of conditions and the following disclaimer in the 14e48b2487SMatt Jacob * documentation and/or other materials provided with the distribution. 15e48b2487SMatt Jacob * 16e48b2487SMatt Jacob * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1753af7d22SMatt Jacob * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1853af7d22SMatt Jacob * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19e48b2487SMatt Jacob * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 20e48b2487SMatt Jacob * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2153af7d22SMatt Jacob * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2253af7d22SMatt Jacob * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2353af7d22SMatt Jacob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2453af7d22SMatt Jacob * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2553af7d22SMatt Jacob * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2653af7d22SMatt Jacob * SUCH DAMAGE. 2753af7d22SMatt Jacob */ 2853af7d22SMatt Jacob #ifndef _ISP_LIBRARY_H 2953af7d22SMatt Jacob #define _ISP_LIBRARY_H 3053af7d22SMatt Jacob 3110365e5aSMatt Jacob extern int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *); 3210365e5aSMatt Jacob extern XS_T *isp_find_xs(ispsoftc_t *, uint32_t); 3310365e5aSMatt Jacob extern uint32_t isp_find_handle(ispsoftc_t *, XS_T *); 3410365e5aSMatt Jacob extern uint32_t isp_handle_index(uint32_t); 3510365e5aSMatt Jacob extern void isp_destroy_handle(ispsoftc_t *, uint32_t); 3610365e5aSMatt Jacob extern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **); 3753af7d22SMatt Jacob extern void isp_print_qentry (ispsoftc_t *, char *, int, void *); 3853af7d22SMatt Jacob extern void isp_print_bytes(ispsoftc_t *, char *, int, void *); 3953af7d22SMatt Jacob extern int isp_fc_runstate(ispsoftc_t *, int); 40f7c631bcSMatt Jacob extern void isp_dump_portdb(ispsoftc_t *); 4110365e5aSMatt Jacob extern void isp_shutdown(ispsoftc_t *); 4210365e5aSMatt Jacob extern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *); 4310365e5aSMatt Jacob extern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *); 4453af7d22SMatt Jacob extern int isp_get_response_type(ispsoftc_t *, isphdr_t *); 4553af7d22SMatt Jacob extern void 4653af7d22SMatt Jacob isp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *); 4753af7d22SMatt Jacob extern void 4810365e5aSMatt Jacob isp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *); 4910365e5aSMatt Jacob extern void 5010365e5aSMatt Jacob isp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *); 5110365e5aSMatt Jacob extern void 5253af7d22SMatt Jacob isp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *); 5353af7d22SMatt Jacob extern void 5453af7d22SMatt Jacob isp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *); 5553af7d22SMatt Jacob extern void 5653af7d22SMatt Jacob isp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *); 5753af7d22SMatt Jacob extern void 5853af7d22SMatt Jacob isp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *); 5953af7d22SMatt Jacob extern void 6053af7d22SMatt Jacob isp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *); 6153af7d22SMatt Jacob extern void 6210365e5aSMatt Jacob isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *); 6310365e5aSMatt Jacob extern void 6410365e5aSMatt Jacob isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); 6510365e5aSMatt Jacob extern void 6653af7d22SMatt Jacob isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *); 6753af7d22SMatt Jacob extern void 6853af7d22SMatt Jacob isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *); 6953af7d22SMatt Jacob extern void 7053af7d22SMatt Jacob isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *); 7110365e5aSMatt Jacob extern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *, 7210365e5aSMatt Jacob isp24xx_statusreq_t *); 7310365e5aSMatt Jacob void 7410365e5aSMatt Jacob isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *); 7553af7d22SMatt Jacob extern void 7653af7d22SMatt Jacob isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *); 7753af7d22SMatt Jacob extern void 7853af7d22SMatt Jacob isp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *); 7953af7d22SMatt Jacob extern void 8010365e5aSMatt Jacob isp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *); 8153af7d22SMatt Jacob extern void 8210365e5aSMatt Jacob isp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *); 8310365e5aSMatt Jacob extern void 8410365e5aSMatt Jacob isp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *); 8510365e5aSMatt Jacob extern void 8610365e5aSMatt Jacob isp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *); 8710365e5aSMatt Jacob extern void 8810365e5aSMatt Jacob isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *); 8910365e5aSMatt Jacob extern void 9010365e5aSMatt Jacob isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *); 9110365e5aSMatt Jacob extern void 9204697f7aSMatt Jacob isp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *); 9304697f7aSMatt Jacob extern void 9410365e5aSMatt Jacob isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *); 9553af7d22SMatt Jacob extern void 9604697f7aSMatt Jacob isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *); 9704697f7aSMatt Jacob extern void 9853af7d22SMatt Jacob isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *); 9953af7d22SMatt Jacob extern void 10053af7d22SMatt Jacob isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *, 10153af7d22SMatt Jacob sns_gid_ft_req_t *); 10253af7d22SMatt Jacob extern void 10353af7d22SMatt Jacob isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *, 10453af7d22SMatt Jacob sns_gxn_id_req_t *); 10553af7d22SMatt Jacob extern void 10653af7d22SMatt Jacob isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int); 10753af7d22SMatt Jacob extern void 10853af7d22SMatt Jacob isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *, 10953af7d22SMatt Jacob sns_gid_ft_rsp_t *, int); 11053af7d22SMatt Jacob extern void 11153af7d22SMatt Jacob isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *, 11253af7d22SMatt Jacob sns_gxn_id_rsp_t *); 11353af7d22SMatt Jacob extern void 11453af7d22SMatt Jacob isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *, 11553af7d22SMatt Jacob sns_gff_id_rsp_t *); 11653af7d22SMatt Jacob extern void 11753af7d22SMatt Jacob isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *, 11853af7d22SMatt Jacob sns_ga_nxt_rsp_t *); 11910365e5aSMatt Jacob extern void 12010365e5aSMatt Jacob isp_get_els(ispsoftc_t *, els_t *, els_t *); 12110365e5aSMatt Jacob extern void 12210365e5aSMatt Jacob isp_put_els(ispsoftc_t *, els_t *, els_t *); 12310365e5aSMatt Jacob extern void 12410365e5aSMatt Jacob isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *); 12510365e5aSMatt Jacob extern void 12610365e5aSMatt Jacob isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *); 12710365e5aSMatt Jacob extern void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *); 12810365e5aSMatt Jacob extern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); 12910365e5aSMatt Jacob extern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *); 13053af7d22SMatt Jacob 13153af7d22SMatt Jacob #ifdef ISP_TARGET_MODE 1321dae40ebSMatt Jacob #if defined(__NetBSD__) || defined(__OpenBSD__) 1331dae40ebSMatt Jacob #include <dev/ic/isp_target.h> 1341dae40ebSMatt Jacob #elif defined(__FreeBSD__) 13553af7d22SMatt Jacob #include <dev/isp/isp_target.h> 1361dae40ebSMatt Jacob #else 1371dae40ebSMatt Jacob #include "isp_target.h" 1381dae40ebSMatt Jacob #endif 13953af7d22SMatt Jacob 14010365e5aSMatt Jacob #define IS_TARGET_HANDLE(x) ((x) & 0x8000) 14110365e5aSMatt Jacob 14210365e5aSMatt Jacob extern int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *); 14310365e5aSMatt Jacob extern void *isp_find_xs_tgt(ispsoftc_t *, uint32_t); 14410365e5aSMatt Jacob extern uint32_t isp_find_tgt_handle(ispsoftc_t *, void *); 14510365e5aSMatt Jacob extern void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t); 14653af7d22SMatt Jacob 14753af7d22SMatt Jacob extern void 14853af7d22SMatt Jacob isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *); 14953af7d22SMatt Jacob extern void 15053af7d22SMatt Jacob isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *); 15153af7d22SMatt Jacob extern void 15253af7d22SMatt Jacob isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *); 15353af7d22SMatt Jacob extern void 15453af7d22SMatt Jacob isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *); 15553af7d22SMatt Jacob extern void 15653af7d22SMatt Jacob isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *); 15753af7d22SMatt Jacob extern void 15853af7d22SMatt Jacob isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *); 15953af7d22SMatt Jacob extern void 16010365e5aSMatt Jacob isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *); 16110365e5aSMatt Jacob extern void 16253af7d22SMatt Jacob isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *); 16353af7d22SMatt Jacob extern void 16453af7d22SMatt Jacob isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *); 16553af7d22SMatt Jacob extern void 16653af7d22SMatt Jacob isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *); 16753af7d22SMatt Jacob extern void 16853af7d22SMatt Jacob isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *); 16953af7d22SMatt Jacob extern void 17010365e5aSMatt Jacob isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *); 17110365e5aSMatt Jacob extern void 17253af7d22SMatt Jacob isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *); 17353af7d22SMatt Jacob extern void 17453af7d22SMatt Jacob isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *); 17553af7d22SMatt Jacob extern void 17610365e5aSMatt Jacob isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *); 17710365e5aSMatt Jacob extern void 17853af7d22SMatt Jacob isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *); 17953af7d22SMatt Jacob extern void 18053af7d22SMatt Jacob isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *); 18153af7d22SMatt Jacob extern void 18253af7d22SMatt Jacob isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *); 18353af7d22SMatt Jacob extern void 18453af7d22SMatt Jacob isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *); 18553af7d22SMatt Jacob extern void 18653af7d22SMatt Jacob isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *); 18753af7d22SMatt Jacob extern void 18853af7d22SMatt Jacob isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *); 18953af7d22SMatt Jacob extern void 19010365e5aSMatt Jacob isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *); 19110365e5aSMatt Jacob extern void 19253af7d22SMatt Jacob isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *); 19353af7d22SMatt Jacob extern void 19453af7d22SMatt Jacob isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *); 19553af7d22SMatt Jacob extern void 19610365e5aSMatt Jacob isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *); 19710365e5aSMatt Jacob extern void 19853af7d22SMatt Jacob isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *); 19953af7d22SMatt Jacob extern void 20053af7d22SMatt Jacob isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *); 20153af7d22SMatt Jacob extern void 20210365e5aSMatt Jacob isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *); 20310365e5aSMatt Jacob extern void 20453af7d22SMatt Jacob isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *); 20553af7d22SMatt Jacob extern void 20653af7d22SMatt Jacob isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *); 20710365e5aSMatt Jacob extern void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, 20810365e5aSMatt Jacob na_fcentry_24xx_t *); 20953af7d22SMatt Jacob extern void 21053af7d22SMatt Jacob isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *); 21153af7d22SMatt Jacob extern void 21253af7d22SMatt Jacob isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *); 21310365e5aSMatt Jacob extern void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, 21410365e5aSMatt Jacob na_fcentry_24xx_t *); 21510365e5aSMatt Jacob extern void 21610365e5aSMatt Jacob isp_get_abts(ispsoftc_t *, abts_t *, abts_t *); 21710365e5aSMatt Jacob extern void 21810365e5aSMatt Jacob isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *); 21910365e5aSMatt Jacob extern void 22010365e5aSMatt Jacob isp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *); 22153af7d22SMatt Jacob #endif /* ISP_TARGET_MODE */ 22253af7d22SMatt Jacob #endif /* _ISP_LIBRARY_H */ 223