isp_freebsd.h (46969) | isp_freebsd.h (48487) |
---|---|
1/* $Id: isp_freebsd.h,v 1.14 1999/04/04 01:34:06 mjacob Exp $ */ 2/* release_5_11_99 */ | 1/* $Id: isp_freebsd.h,v 1.15 1999/05/11 05:03:33 mjacob Exp $ */ 2/* release_6_2_99 */ |
3/* | 3/* |
4 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (non CAM version) | 4 * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (CAM version) |
5 *--------------------------------------- | 5 *--------------------------------------- |
6 * Copyright (c) 1997, 1998 by Matthew Jacob | 6 * Copyright (c) 1997, 1998, 1999 by Matthew Jacob |
7 * NASA/Ames Research Center 8 * All rights reserved. 9 *--------------------------------------- 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35#ifndef _ISP_FREEBSD_H 36#define _ISP_FREEBSD_H 37 38#define ISP_PLATFORM_VERSION_MAJOR 0 | 7 * NASA/Ames Research Center 8 * All rights reserved. 9 *--------------------------------------- 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 */ 35#ifndef _ISP_FREEBSD_H 36#define _ISP_FREEBSD_H 37 38#define ISP_PLATFORM_VERSION_MAJOR 0 |
39#define ISP_PLATFORM_VERSION_MINOR 991 | 39#define ISP_PLATFORM_VERSION_MINOR 992 |
40 | 40 |
41#include <sys/param.h> | |
42 | 41 |
43#ifndef __FreeBSD_version 44#define __FreeBSD_version 226000 45#endif 46 47#if __FreeBSD_version >= 300004 48#define MAXISPREQUEST 256 49#include <dev/isp/isp_freebsd_cam.h> 50#else 51#define MAXISPREQUEST 64 52#ifndef SCSI_ISP_PREFER_MEM_MAP 53#define SCSI_ISP_PREFER_MEM_MAP 0 54#endif 55 | 42#include <sys/param.h> 43#include <sys/param.h> |
56#include <sys/systm.h> | 44#include <sys/systm.h> |
57#include <sys/malloc.h> 58#include <sys/buf.h> 59#include <sys/proc.h> | 45#include <sys/kernel.h> 46#include <sys/queue.h> |
60 | 47 |
61#include <scsi/scsiconf.h> | 48#include <machine/bus_memio.h> 49#include <machine/bus_pio.h> 50#include <machine/bus.h> |
62#include <machine/clock.h> | 51#include <machine/clock.h> |
63#include <vm/vm.h> 64#include <vm/vm_param.h> 65#include <vm/pmap.h> 66#include <sys/kernel.h> | |
67 | 52 |
53#include <cam/cam.h> 54#include <cam/cam_debug.h> 55#include <cam/cam_ccb.h> 56#include <cam/cam_sim.h> 57#include <cam/cam_xpt.h> 58#include <cam/cam_xpt_sim.h> 59#include <cam/cam_debug.h> 60#include <cam/scsi/scsi_all.h> 61#include <cam/scsi/scsi_message.h> |
|
68 | 62 |
69#define ISP_SCSI_XFER_T struct scsi_xfer | 63#include "opt_isp.h" 64#ifdef SCSI_ISP_FABRIC 65#define ISP2100_FABRIC 1 66#define ISP2100_SCRLEN 0x400 67#else 68#define ISP2100_SCRLEN 0x1000 69#endif 70#ifdef SCSI_ISP_SCCLUN 71#define ISP2100_SCCLUN 1 72#endif |
70 | 73 |
74#ifndef SCSI_CHECK 75#define SCSI_CHECK SCSI_STATUS_CHECK_COND 76#endif 77#ifndef SCSI_BUSY 78#define SCSI_BUSY SCSI_STATUS_BUSY 79#endif 80#ifndef SCSI_QFULL 81#define SCSI_QFULL SCSI_STATUS_QUEUE_FULL 82#endif 83 84#define ISP_SCSI_XFER_T struct ccb_scsiio |
|
71struct isposinfo { 72 char name[8]; 73 int unit; | 85struct isposinfo { 86 char name[8]; 87 int unit; |
74 struct scsi_link _link; 75 int8_t delay_throttle_count; | 88 int seed; 89 struct cam_sim *sim; 90 struct cam_path *path; 91 struct cam_sim *sim2; 92 struct cam_path *path2; 93 volatile char simqfrozen; |
76}; | 94}; |
95#define SIMQFRZ_RESOURCE 0x1 96#define SIMQFRZ_LOOPDOWN 0x2 |
|
77 | 97 |
98#define isp_sim isp_osinfo.sim 99#define isp_path isp_osinfo.path 100#define isp_sim2 isp_osinfo.sim2 101#define isp_path2 isp_osinfo.path2 102#define isp_unit isp_osinfo.unit 103#define isp_name isp_osinfo.name 104 105#define MAXISPREQUEST 256 106 |
|
78#include <dev/isp/ispreg.h> 79#include <dev/isp/ispvar.h> 80#include <dev/isp/ispmbox.h> 81 | 107#include <dev/isp/ispreg.h> 108#include <dev/isp/ispvar.h> 109#include <dev/isp/ispmbox.h> 110 |
82#define PVS "Qlogic ISP Driver, FreeBSD Non-Cam" | 111#define PVS "Qlogic ISP Driver, FreeBSD CAM" 112#ifdef CAMDEBUG 113#define DFLT_DBLEVEL 2 114#else |
83#define DFLT_DBLEVEL 1 | 115#define DFLT_DBLEVEL 1 |
116#endif |
|
84#define ISP_LOCKVAL_DECL int isp_spl_save 85#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL 86#define ISP_UNLOCK(isp) (void) splx(isp_spl_save) | 117#define ISP_LOCKVAL_DECL int isp_spl_save 118#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL 119#define ISP_UNLOCK(isp) (void) splx(isp_spl_save) |
87#define ISP_LOCK(isp) isp_spl_save = splbio() | 120#define ISP_LOCK(isp) isp_spl_save = splcam() |
88#define ISP_ILOCK(isp) ISP_LOCK(isp) 89#define ISP_IUNLOCK(isp) ISP_UNLOCK(isp) | 121#define ISP_ILOCK(isp) ISP_LOCK(isp) 122#define ISP_IUNLOCK(isp) ISP_UNLOCK(isp) |
90#define IMASK bio_imask | 123#define IMASK cam_imask |
91 | 124 |
92#define XS_NULL(xs) xs == NULL || xs->sc_link == NULL 93#define XS_ISP(xs) \ 94 ((struct ispsoftc *) (xs)->sc_link->adapter_softc) 95#define XS_LUN(xs) ((int) (xs)->sc_link->lun) 96#define XS_TGT(xs) ((int) (xs)->sc_link->target) 97#define XS_CHANNEL(xs) ((int) (xs)->sc_link->adapter_bus) 98#define XS_RESID(xs) (xs)->resid 99#define XS_XFRLEN(xs) (xs)->datalen 100#define XS_CDBLEN(xs) (xs)->cmdlen 101#define XS_CDBP(xs) (xs)->cmd 102#define XS_STS(xs) (xs)->status 103#define XS_TIME(xs) (xs)->timeout 104#define XS_SNSP(xs) (&(xs)->sense) 105#define XS_SNSLEN(xs) (sizeof((xs)->sense)) 106#define XS_SNSKEY(xs) ((xs)->sense.ext.extended.flags) | 125#define XS_NULL(ccb) ccb == NULL 126#define XS_ISP(ccb) ((struct ispsoftc *) (ccb)->ccb_h.spriv_ptr1) |
107 | 127 |
108#define HBA_NOERROR XS_NOERROR 109#define HBA_BOTCH XS_DRIVER_STUFFUP 110#define HBA_CMDTIMEOUT XS_TIMEOUT 111#define HBA_SELTIMEOUT XS_SELTIMEOUT 112#define HBA_TGTBSY XS_BUSY 113#define HBA_BUSRESET XS_DRIVER_STUFFUP 114#define HBA_ABORTED XS_DRIVER_STUFFUP 115#define HBA_DATAOVR XS_DRIVER_STUFFUP 116#define HBA_ARQFAIL XS_DRIVER_STUFFUP | 128#define XS_LUN(ccb) (ccb)->ccb_h.target_lun 129#define XS_TGT(ccb) (ccb)->ccb_h.target_id 130#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) 131#define XS_RESID(ccb) (ccb)->resid 132#define XS_XFRLEN(ccb) (ccb)->dxfer_len 133#define XS_CDBLEN(ccb) (ccb)->cdb_len 134#define XS_CDBP(ccb) (((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \ 135 (ccb)->cdb_io.cdb_ptr : (ccb)->cdb_io.cdb_bytes) 136#define XS_STS(ccb) (ccb)->scsi_status 137#define XS_TIME(ccb) (ccb)->ccb_h.timeout 138#define XS_SNSP(ccb) (&(ccb)->sense_data) 139#define XS_SNSLEN(ccb) imin((sizeof((ccb)->sense_data)), ccb->sense_len) 140#define XS_SNSKEY(ccb) ((ccb)->sense_data.flags & 0xf) |
117 | 141 |
118#define XS_SNS_IS_VALID(xs) (xs)->error = XS_SENSE 119#define XS_IS_SNS_VALID(xs) ((xs)->error == XS_SENSE) | 142/* 143 * A little tricky- HBA_NOERROR is "in progress" so 144 * that XS_CMD_DONE can transition this to CAM_REQ_CMP. 145 */ 146#define HBA_NOERROR CAM_REQ_INPROG 147#define HBA_BOTCH CAM_UNREC_HBA_ERROR 148#define HBA_CMDTIMEOUT CAM_CMD_TIMEOUT 149#define HBA_SELTIMEOUT CAM_SEL_TIMEOUT 150#define HBA_TGTBSY CAM_SCSI_STATUS_ERROR 151#define HBA_BUSRESET CAM_SCSI_BUS_RESET 152#define HBA_ABORTED CAM_REQ_ABORTED 153#define HBA_DATAOVR CAM_DATA_RUN_ERR 154#define HBA_ARQFAIL CAM_AUTOSENSE_FAIL |
120 | 155 |
121#define XS_INITERR(xs) (xs)->error = 0 122#define XS_SETERR(xs, v) (xs)->error = v 123#define XS_ERR(xs) (xs)->error 124#define XS_NOERR(xs) (xs)->error == XS_NOERROR | 156#define XS_SNS_IS_VALID(ccb) ((ccb)->ccb_h.status |= CAM_AUTOSNS_VALID) 157#define XS_IS_SNS_VALID(ccb) (((ccb)->ccb_h.status & CAM_AUTOSNS_VALID) != 0) |
125 | 158 |
126#define XS_CMD_DONE(xs) (xs)->flags |= ITSDONE, scsi_done(xs) 127#define XS_IS_CMD_DONE(xs) (((xs)->flags & ITSDONE) != 0) | 159#define XS_INITERR(ccb) \ 160 (ccb)->ccb_h.status &= ~CAM_STATUS_MASK, \ 161 (ccb)->ccb_h.status |= CAM_REQ_INPROG, \ 162 (ccb)->ccb_h.spriv_field0 = CAM_REQ_INPROG 163#define XS_SETERR(ccb, v) (ccb)->ccb_h.spriv_field0 = v 164#define XS_ERR(ccb) (ccb)->ccb_h.spriv_field0 165#define XS_NOERR(ccb) \ 166 ((ccb)->ccb_h.spriv_field0 == CAM_REQ_INPROG) |
128 | 167 |
168extern void isp_done(struct ccb_scsiio *); 169#define XS_CMD_DONE(sccb) isp_done(sccb) 170 171#define XS_IS_CMD_DONE(ccb) \ 172 (((ccb)->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) 173 |
|
129/* | 174/* |
130 * We decide whether to use tags based upon whether we're polling. | 175 * Can we tag? |
131 */ | 176 */ |
132#define XS_CANTAG(xs) (((xs)->flags & SCSI_NOMASK) != 0) 133 | 177#define XS_CANTAG(ccb) (((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) \ 178 && (ccb)->tag_action != CAM_TAG_ACTION_NONE) |
134/* | 179/* |
135 * Our default tag | 180 * And our favorite tag is.... |
136 */ | 181 */ |
137#define XS_KINDOF_TAG(xs) REQFLAG_STAG | 182#define XS_KINDOF_TAG(ccb) \ 183 ((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \ 184 ((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG)) 185 |
138 139 | 186 187 |
140#define CMD_COMPLETE COMPLETE 141#define CMD_EAGAIN TRY_AGAIN_LATER 142#define CMD_QUEUED SUCCESSFULLY_QUEUED | 188#define CMD_COMPLETE 0 189#define CMD_EAGAIN 1 190#define CMD_QUEUED 2 191#define STOP_WATCHDOG(f, s) |
143 | 192 |
144#define isp_name isp_osinfo.name 145 146#define SCSI_QFULL 0x28 147 148#endif /* __FreeBSD_version >= 300004 */ 149 | |
150extern void isp_attach(struct ispsoftc *); 151extern void isp_uninit(struct ispsoftc *); 152 153#define MEMZERO bzero 154#define MEMCPY(dst, src, amt) bcopy((src), (dst), (amt)) 155#ifdef __alpha__ 156#define MemoryBarrier alpha_mb 157#else --- 5 unchanged lines hidden (view full) --- 163#define DMA_LSW(x) (((x) & 0xffff)) 164 165#define IDPRINTF(lev, x) if (isp->isp_dblev >= lev) printf x 166#define PRINTF printf 167 168#define SYS_DELAY(x) DELAY(x) 169 170#define FC_FW_READY_DELAY (5 * 1000000) | 193extern void isp_attach(struct ispsoftc *); 194extern void isp_uninit(struct ispsoftc *); 195 196#define MEMZERO bzero 197#define MEMCPY(dst, src, amt) bcopy((src), (dst), (amt)) 198#ifdef __alpha__ 199#define MemoryBarrier alpha_mb 200#else --- 5 unchanged lines hidden (view full) --- 206#define DMA_LSW(x) (((x) & 0xffff)) 207 208#define IDPRINTF(lev, x) if (isp->isp_dblev >= lev) printf x 209#define PRINTF printf 210 211#define SYS_DELAY(x) DELAY(x) 212 213#define FC_FW_READY_DELAY (5 * 1000000) |
214#define DEFAULT_LOOPID(x) 109 215#define DEFAULT_WWN(x) (0x0000feeb00000000LL + (x)->isp_osinfo.seed) |
|
171 172static __inline void isp_prtstst(ispstatusreq_t *sp); 173static __inline const char *isp2100_fw_statename(int state); 174static __inline const char *isp2100_pdb_statename(int pdb_state); 175 176static __inline void isp_prtstst(ispstatusreq_t *sp) 177{ 178 char buf[128]; --- 68 unchanged lines hidden (view full) --- 247 case PDB_STATE_PLOGO: return "Port Logout"; 248 case PDB_STATE_PLOG_ACK: return "Wait Port Logout ACK"; 249 default: 250 sprintf(buf, "0x%x", pdb_state); 251 return buf; 252 } 253} 254 | 216 217static __inline void isp_prtstst(ispstatusreq_t *sp); 218static __inline const char *isp2100_fw_statename(int state); 219static __inline const char *isp2100_pdb_statename(int pdb_state); 220 221static __inline void isp_prtstst(ispstatusreq_t *sp) 222{ 223 char buf[128]; --- 68 unchanged lines hidden (view full) --- 292 case PDB_STATE_PLOGO: return "Port Logout"; 293 case PDB_STATE_PLOG_ACK: return "Wait Port Logout ACK"; 294 default: 295 sprintf(buf, "0x%x", pdb_state); 296 return buf; 297 } 298} 299 |
255#define ISP_NO_FASTPOST_FC 1 | |
256#endif /* _ISP_FREEBSD_H */ | 300#endif /* _ISP_FREEBSD_H */ |