1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Merge defunct isp_freebsd_cam.h into this file. Do some appropriate

changes like rolling minor revision levels and defines where we now
do default WWN seeding in the platform files.
This commit is contained in:
Matt Jacob 1999-07-02 23:10:34 +00:00
parent 83cdc1a2b0
commit b460c5c9a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48487

View File

@ -1,9 +1,9 @@
/* $Id: isp_freebsd.h,v 1.14 1999/04/04 01:34:06 mjacob Exp $ */
/* release_5_11_99 */
/* $Id: isp_freebsd.h,v 1.15 1999/05/11 05:03:33 mjacob Exp $ */
/* release_6_2_99 */
/*
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (non CAM version)
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions (CAM version)
*---------------------------------------
* Copyright (c) 1997, 1998 by Matthew Jacob
* Copyright (c) 1997, 1998, 1999 by Matthew Jacob
* NASA/Ames Research Center
* All rights reserved.
*---------------------------------------
@ -36,116 +36,159 @@
#define _ISP_FREEBSD_H
#define ISP_PLATFORM_VERSION_MAJOR 0
#define ISP_PLATFORM_VERSION_MINOR 991
#define ISP_PLATFORM_VERSION_MINOR 992
#include <sys/param.h>
#ifndef __FreeBSD_version
#define __FreeBSD_version 226000
#endif
#if __FreeBSD_version >= 300004
#define MAXISPREQUEST 256
#include <dev/isp/isp_freebsd_cam.h>
#else
#define MAXISPREQUEST 64
#ifndef SCSI_ISP_PREFER_MEM_MAP
#define SCSI_ISP_PREFER_MEM_MAP 0
#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <scsi/scsiconf.h>
#include <machine/clock.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <sys/kernel.h>
#include <sys/queue.h>
#include <machine/bus_memio.h>
#include <machine/bus_pio.h>
#include <machine/bus.h>
#include <machine/clock.h>
#define ISP_SCSI_XFER_T struct scsi_xfer
#include <cam/cam.h>
#include <cam/cam_debug.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
#include <cam/cam_xpt.h>
#include <cam/cam_xpt_sim.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
#include "opt_isp.h"
#ifdef SCSI_ISP_FABRIC
#define ISP2100_FABRIC 1
#define ISP2100_SCRLEN 0x400
#else
#define ISP2100_SCRLEN 0x1000
#endif
#ifdef SCSI_ISP_SCCLUN
#define ISP2100_SCCLUN 1
#endif
#ifndef SCSI_CHECK
#define SCSI_CHECK SCSI_STATUS_CHECK_COND
#endif
#ifndef SCSI_BUSY
#define SCSI_BUSY SCSI_STATUS_BUSY
#endif
#ifndef SCSI_QFULL
#define SCSI_QFULL SCSI_STATUS_QUEUE_FULL
#endif
#define ISP_SCSI_XFER_T struct ccb_scsiio
struct isposinfo {
char name[8];
int unit;
struct scsi_link _link;
int8_t delay_throttle_count;
int seed;
struct cam_sim *sim;
struct cam_path *path;
struct cam_sim *sim2;
struct cam_path *path2;
volatile char simqfrozen;
};
#define SIMQFRZ_RESOURCE 0x1
#define SIMQFRZ_LOOPDOWN 0x2
#define isp_sim isp_osinfo.sim
#define isp_path isp_osinfo.path
#define isp_sim2 isp_osinfo.sim2
#define isp_path2 isp_osinfo.path2
#define isp_unit isp_osinfo.unit
#define isp_name isp_osinfo.name
#define MAXISPREQUEST 256
#include <dev/isp/ispreg.h>
#include <dev/isp/ispvar.h>
#include <dev/isp/ispmbox.h>
#define PVS "Qlogic ISP Driver, FreeBSD Non-Cam"
#define PVS "Qlogic ISP Driver, FreeBSD CAM"
#ifdef CAMDEBUG
#define DFLT_DBLEVEL 2
#else
#define DFLT_DBLEVEL 1
#endif
#define ISP_LOCKVAL_DECL int isp_spl_save
#define ISP_ILOCKVAL_DECL ISP_LOCKVAL_DECL
#define ISP_UNLOCK(isp) (void) splx(isp_spl_save)
#define ISP_LOCK(isp) isp_spl_save = splbio()
#define ISP_LOCK(isp) isp_spl_save = splcam()
#define ISP_ILOCK(isp) ISP_LOCK(isp)
#define ISP_IUNLOCK(isp) ISP_UNLOCK(isp)
#define IMASK bio_imask
#define IMASK cam_imask
#define XS_NULL(xs) xs == NULL || xs->sc_link == NULL
#define XS_ISP(xs) \
((struct ispsoftc *) (xs)->sc_link->adapter_softc)
#define XS_LUN(xs) ((int) (xs)->sc_link->lun)
#define XS_TGT(xs) ((int) (xs)->sc_link->target)
#define XS_CHANNEL(xs) ((int) (xs)->sc_link->adapter_bus)
#define XS_RESID(xs) (xs)->resid
#define XS_XFRLEN(xs) (xs)->datalen
#define XS_CDBLEN(xs) (xs)->cmdlen
#define XS_CDBP(xs) (xs)->cmd
#define XS_STS(xs) (xs)->status
#define XS_TIME(xs) (xs)->timeout
#define XS_SNSP(xs) (&(xs)->sense)
#define XS_SNSLEN(xs) (sizeof((xs)->sense))
#define XS_SNSKEY(xs) ((xs)->sense.ext.extended.flags)
#define XS_NULL(ccb) ccb == NULL
#define XS_ISP(ccb) ((struct ispsoftc *) (ccb)->ccb_h.spriv_ptr1)
#define HBA_NOERROR XS_NOERROR
#define HBA_BOTCH XS_DRIVER_STUFFUP
#define HBA_CMDTIMEOUT XS_TIMEOUT
#define HBA_SELTIMEOUT XS_SELTIMEOUT
#define HBA_TGTBSY XS_BUSY
#define HBA_BUSRESET XS_DRIVER_STUFFUP
#define HBA_ABORTED XS_DRIVER_STUFFUP
#define HBA_DATAOVR XS_DRIVER_STUFFUP
#define HBA_ARQFAIL XS_DRIVER_STUFFUP
#define XS_SNS_IS_VALID(xs) (xs)->error = XS_SENSE
#define XS_IS_SNS_VALID(xs) ((xs)->error == XS_SENSE)
#define XS_INITERR(xs) (xs)->error = 0
#define XS_SETERR(xs, v) (xs)->error = v
#define XS_ERR(xs) (xs)->error
#define XS_NOERR(xs) (xs)->error == XS_NOERROR
#define XS_CMD_DONE(xs) (xs)->flags |= ITSDONE, scsi_done(xs)
#define XS_IS_CMD_DONE(xs) (((xs)->flags & ITSDONE) != 0)
#define XS_LUN(ccb) (ccb)->ccb_h.target_lun
#define XS_TGT(ccb) (ccb)->ccb_h.target_id
#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
#define XS_RESID(ccb) (ccb)->resid
#define XS_XFRLEN(ccb) (ccb)->dxfer_len
#define XS_CDBLEN(ccb) (ccb)->cdb_len
#define XS_CDBP(ccb) (((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \
(ccb)->cdb_io.cdb_ptr : (ccb)->cdb_io.cdb_bytes)
#define XS_STS(ccb) (ccb)->scsi_status
#define XS_TIME(ccb) (ccb)->ccb_h.timeout
#define XS_SNSP(ccb) (&(ccb)->sense_data)
#define XS_SNSLEN(ccb) imin((sizeof((ccb)->sense_data)), ccb->sense_len)
#define XS_SNSKEY(ccb) ((ccb)->sense_data.flags & 0xf)
/*
* We decide whether to use tags based upon whether we're polling.
* A little tricky- HBA_NOERROR is "in progress" so
* that XS_CMD_DONE can transition this to CAM_REQ_CMP.
*/
#define XS_CANTAG(xs) (((xs)->flags & SCSI_NOMASK) != 0)
#define HBA_NOERROR CAM_REQ_INPROG
#define HBA_BOTCH CAM_UNREC_HBA_ERROR
#define HBA_CMDTIMEOUT CAM_CMD_TIMEOUT
#define HBA_SELTIMEOUT CAM_SEL_TIMEOUT
#define HBA_TGTBSY CAM_SCSI_STATUS_ERROR
#define HBA_BUSRESET CAM_SCSI_BUS_RESET
#define HBA_ABORTED CAM_REQ_ABORTED
#define HBA_DATAOVR CAM_DATA_RUN_ERR
#define HBA_ARQFAIL CAM_AUTOSENSE_FAIL
#define XS_SNS_IS_VALID(ccb) ((ccb)->ccb_h.status |= CAM_AUTOSNS_VALID)
#define XS_IS_SNS_VALID(ccb) (((ccb)->ccb_h.status & CAM_AUTOSNS_VALID) != 0)
#define XS_INITERR(ccb) \
(ccb)->ccb_h.status &= ~CAM_STATUS_MASK, \
(ccb)->ccb_h.status |= CAM_REQ_INPROG, \
(ccb)->ccb_h.spriv_field0 = CAM_REQ_INPROG
#define XS_SETERR(ccb, v) (ccb)->ccb_h.spriv_field0 = v
#define XS_ERR(ccb) (ccb)->ccb_h.spriv_field0
#define XS_NOERR(ccb) \
((ccb)->ccb_h.spriv_field0 == CAM_REQ_INPROG)
extern void isp_done(struct ccb_scsiio *);
#define XS_CMD_DONE(sccb) isp_done(sccb)
#define XS_IS_CMD_DONE(ccb) \
(((ccb)->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG)
/*
* Our default tag
* Can we tag?
*/
#define XS_KINDOF_TAG(xs) REQFLAG_STAG
#define XS_CANTAG(ccb) (((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) \
&& (ccb)->tag_action != CAM_TAG_ACTION_NONE)
/*
* And our favorite tag is....
*/
#define XS_KINDOF_TAG(ccb) \
((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \
((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG))
#define CMD_COMPLETE COMPLETE
#define CMD_EAGAIN TRY_AGAIN_LATER
#define CMD_QUEUED SUCCESSFULLY_QUEUED
#define isp_name isp_osinfo.name
#define SCSI_QFULL 0x28
#endif /* __FreeBSD_version >= 300004 */
#define CMD_COMPLETE 0
#define CMD_EAGAIN 1
#define CMD_QUEUED 2
#define STOP_WATCHDOG(f, s)
extern void isp_attach(struct ispsoftc *);
extern void isp_uninit(struct ispsoftc *);
@ -168,6 +211,8 @@ extern void isp_uninit(struct ispsoftc *);
#define SYS_DELAY(x) DELAY(x)
#define FC_FW_READY_DELAY (5 * 1000000)
#define DEFAULT_LOOPID(x) 109
#define DEFAULT_WWN(x) (0x0000feeb00000000LL + (x)->isp_osinfo.seed)
static __inline void isp_prtstst(ispstatusreq_t *sp);
static __inline const char *isp2100_fw_statename(int state);
@ -252,5 +297,4 @@ static __inline const char *isp2100_pdb_statename(int pdb_state)
}
}
#define ISP_NO_FASTPOST_FC 1
#endif /* _ISP_FREEBSD_H */