Add 8Gb support (isp_2500). Fix a fair number of configuration and
firmware loading bugs. Target mode support has received some serious attention to make it more usable and stable. Some backward compatible additions to CAM have been made that make target mode async events easier to deal with have also been put into place. Further refinement and better support for NP-IV (N-port Virtualization) is now in place. Code for release prior to RELENG_7 has been stripped away for code clarity. Sponsored by: Copan Systems Reviewed by: scottl, ken, jung-uk kim Approved by: re
This commit is contained in:
parent
b965588786
commit
2df76c160b
@ -173,6 +173,15 @@ typedef enum {
|
||||
XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED,
|
||||
/* Execute the requested ATA I/O operation */
|
||||
|
||||
XPT_GET_SIM_KNOB = 0x18,
|
||||
/*
|
||||
* Get SIM specific knob values.
|
||||
*/
|
||||
|
||||
XPT_SET_SIM_KNOB = 0x19,
|
||||
/*
|
||||
* Set SIM specific knob values.
|
||||
*/
|
||||
/* HBA engine commands 0x20->0x2F */
|
||||
XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY,
|
||||
/* HBA engine feature inquiry */
|
||||
@ -189,8 +198,12 @@ typedef enum {
|
||||
XPT_CONT_TARGET_IO = 0x33 | XPT_FC_DEV_QUEUED,
|
||||
/* Continue Host Target I/O Connection */
|
||||
XPT_IMMED_NOTIFY = 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
/* Notify Host Target driver of event */
|
||||
/* Notify Host Target driver of event (obsolete) */
|
||||
XPT_NOTIFY_ACK = 0x35,
|
||||
/* Acknowledgement of event (obsolete) */
|
||||
XPT_IMMEDIATE_NOTIFY = 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
/* Notify Host Target driver of event */
|
||||
XPT_NOTIFY_ACKNOWLEDGE = 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
/* Acknowledgement of event */
|
||||
|
||||
/* Vendor Unique codes: 0x80->0x8F */
|
||||
@ -531,12 +544,14 @@ typedef enum {
|
||||
struct ccb_pathinq_settings_spi {
|
||||
u_int8_t ppr_options;
|
||||
};
|
||||
|
||||
struct ccb_pathinq_settings_fc {
|
||||
u_int64_t wwnn; /* world wide node name */
|
||||
u_int64_t wwpn; /* world wide port name */
|
||||
u_int32_t port; /* 24 bit port id, if known */
|
||||
u_int32_t bitrate; /* Mbps */
|
||||
};
|
||||
|
||||
struct ccb_pathinq_settings_sas {
|
||||
u_int32_t bitrate; /* Mbps */
|
||||
};
|
||||
@ -678,6 +693,7 @@ struct ccb_relsim {
|
||||
* Definitions for the asynchronous callback CCB fields.
|
||||
*/
|
||||
typedef enum {
|
||||
AC_CONTRACT = 0x1000,/* A contractual callback */
|
||||
AC_GETDEV_CHANGED = 0x800,/* Getdev info might have changed */
|
||||
AC_INQ_CHANGED = 0x400,/* Inquiry info might have changed */
|
||||
AC_TRANSFER_NEG = 0x200,/* New transfer settings in effect */
|
||||
@ -694,6 +710,26 @@ typedef enum {
|
||||
typedef void ac_callback_t (void *softc, u_int32_t code,
|
||||
struct cam_path *path, void *args);
|
||||
|
||||
/*
|
||||
* Generic Asynchronous callbacks.
|
||||
*
|
||||
* Generic arguments passed bac which are then interpreted between a per-system
|
||||
* contract number.
|
||||
*/
|
||||
#define AC_CONTRACT_DATA_MAX (128 - sizeof (u_int64_t))
|
||||
struct ac_contract {
|
||||
u_int64_t contract_number;
|
||||
u_int8_t contract_data[AC_CONTRACT_DATA_MAX];
|
||||
};
|
||||
|
||||
#define AC_CONTRACT_DEV_CHG 1
|
||||
struct ac_device_changed {
|
||||
u_int64_t wwpn;
|
||||
u_int32_t port;
|
||||
target_id_t target;
|
||||
u_int8_t arrived;
|
||||
};
|
||||
|
||||
/* Set Asynchronous Callback CCB */
|
||||
struct ccb_setasync {
|
||||
struct ccb_hdr ccb_h;
|
||||
@ -822,6 +858,50 @@ struct ccb_calc_geometry {
|
||||
u_int8_t secs_per_track;
|
||||
};
|
||||
|
||||
/*
|
||||
* Set or get SIM (and transport) specific knobs
|
||||
*/
|
||||
|
||||
#define KNOB_VALID_ADDRESS 0x1
|
||||
#define KNOB_VALID_ROLE 0x2
|
||||
|
||||
|
||||
#define KNOB_ROLE_NONE 0x0
|
||||
#define KNOB_ROLE_INITIATOR 0x1
|
||||
#define KNOB_ROLE_TARGET 0x2
|
||||
#define KNOB_ROLE_BOTH 0x3
|
||||
|
||||
struct ccb_sim_knob_settings_spi {
|
||||
u_int valid;
|
||||
u_int initiator_id;
|
||||
u_int role;
|
||||
};
|
||||
|
||||
struct ccb_sim_knob_settings_fc {
|
||||
u_int valid;
|
||||
u_int64_t wwnn; /* world wide node name */
|
||||
u_int64_t wwpn; /* world wide port name */
|
||||
u_int role;
|
||||
};
|
||||
|
||||
struct ccb_sim_knob_settings_sas {
|
||||
u_int valid;
|
||||
u_int64_t wwnn; /* world wide node name */
|
||||
u_int role;
|
||||
};
|
||||
#define KNOB_SETTINGS_SIZE 128
|
||||
|
||||
struct ccb_sim_knob {
|
||||
struct ccb_hdr ccb_h;
|
||||
union {
|
||||
u_int valid; /* Which fields to honor */
|
||||
struct ccb_sim_knob_settings_spi spi;
|
||||
struct ccb_sim_knob_settings_fc fc;
|
||||
struct ccb_sim_knob_settings_sas sas;
|
||||
char pad[KNOB_SETTINGS_SIZE];
|
||||
} xport_specific;
|
||||
};
|
||||
|
||||
/*
|
||||
* Rescan the given bus, or bus/target/lun
|
||||
*/
|
||||
@ -847,6 +927,7 @@ struct ccb_en_lun {
|
||||
u_int8_t enable;
|
||||
};
|
||||
|
||||
/* old, barely used immediate notify, binary compatibility */
|
||||
struct ccb_immed_notify {
|
||||
struct ccb_hdr ccb_h;
|
||||
struct scsi_sense_data sense_data;
|
||||
@ -861,6 +942,22 @@ struct ccb_notify_ack {
|
||||
u_int8_t event; /* Event flags */
|
||||
};
|
||||
|
||||
struct ccb_immediate_notify {
|
||||
struct ccb_hdr ccb_h;
|
||||
u_int tag_id; /* Tag for immediate notify */
|
||||
u_int seq_id; /* Tag for target of notify */
|
||||
u_int initiator_id; /* Initiator Identifier */
|
||||
u_int arg; /* Function specific */
|
||||
};
|
||||
|
||||
struct ccb_notify_acknowledge {
|
||||
struct ccb_hdr ccb_h;
|
||||
u_int tag_id; /* Tag for immediate notify */
|
||||
u_int seq_id; /* Tar for target of notify */
|
||||
u_int initiator_id; /* Initiator Identifier */
|
||||
u_int arg; /* Function specific */
|
||||
};
|
||||
|
||||
/* HBA engine structures. */
|
||||
|
||||
typedef enum {
|
||||
@ -935,6 +1032,7 @@ union ccb {
|
||||
struct ccb_dev_match cdm;
|
||||
struct ccb_trans_settings cts;
|
||||
struct ccb_calc_geometry ccg;
|
||||
struct ccb_sim_knob knob;
|
||||
struct ccb_abort cab;
|
||||
struct ccb_resetbus crb;
|
||||
struct ccb_resetdev crd;
|
||||
@ -944,6 +1042,8 @@ union ccb {
|
||||
struct ccb_en_lun cel;
|
||||
struct ccb_immed_notify cin;
|
||||
struct ccb_notify_ack cna;
|
||||
struct ccb_immediate_notify cin1;
|
||||
struct ccb_notify_acknowledge cna2;
|
||||
struct ccb_eng_inq cei;
|
||||
struct ccb_eng_exec cee;
|
||||
struct ccb_rescan crcn;
|
||||
|
@ -2565,6 +2565,10 @@ xpt_action_default(union ccb *start_ccb)
|
||||
case XPT_IMMED_NOTIFY:
|
||||
case XPT_NOTIFY_ACK:
|
||||
case XPT_RESET_BUS:
|
||||
case XPT_IMMEDIATE_NOTIFY:
|
||||
case XPT_NOTIFY_ACKNOWLEDGE:
|
||||
case XPT_GET_SIM_KNOB:
|
||||
case XPT_SET_SIM_KNOB:
|
||||
{
|
||||
struct cam_sim *sim;
|
||||
|
||||
|
4115
sys/dev/isp/isp.c
4115
sys/dev/isp/isp.c
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/*-
|
||||
* Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
|
||||
*
|
||||
* Copyright (c) 1997-2006 by Matthew Jacob
|
||||
* Copyright (c) 1997-2008 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -32,27 +32,19 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/endian.h>
|
||||
#if __FreeBSD_version < 500000
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/malloc.h>
|
||||
#else
|
||||
#include <sys/lock.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/condvar.h>
|
||||
#endif
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#if __FreeBSD_version < 500000
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#include <cam/cam.h>
|
||||
#include <cam/cam_debug.h>
|
||||
@ -67,13 +59,8 @@
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_isp.h"
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
#define ISP_PLATFORM_VERSION_MAJOR 4
|
||||
#define ISP_PLATFORM_VERSION_MINOR 17
|
||||
#else
|
||||
#define ISP_PLATFORM_VERSION_MAJOR 5
|
||||
#define ISP_PLATFORM_VERSION_MINOR 9
|
||||
#endif
|
||||
#define ISP_PLATFORM_VERSION_MAJOR 7
|
||||
#define ISP_PLATFORM_VERSION_MINOR 0
|
||||
|
||||
/*
|
||||
* Efficiency- get rid of SBus code && tests unless we need them.
|
||||
@ -84,28 +71,30 @@
|
||||
#define ISP_SBUS_SUPPORTED 0
|
||||
#endif
|
||||
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
#define ISP_IFLAGS INTR_TYPE_CAM
|
||||
#elif __FreeBSD_version < 700037
|
||||
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY
|
||||
#else
|
||||
#define ISP_IFLAGS INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version < 700000
|
||||
typedef void ispfwfunc(int, int, int, const void **);
|
||||
#endif
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#define ISP_TARGET_FUNCTIONS 1
|
||||
#define ATPDPSIZE 256
|
||||
#define ATPDPSIZE 4096
|
||||
|
||||
#include <dev/isp/isp_target.h>
|
||||
|
||||
typedef struct {
|
||||
void * next;
|
||||
uint32_t orig_datalen;
|
||||
uint32_t bytes_xfered;
|
||||
uint32_t last_xframt;
|
||||
uint32_t tag : 16,
|
||||
lun : 13, /* not enough */
|
||||
uint32_t tag;
|
||||
uint32_t lun;
|
||||
uint32_t nphdl;
|
||||
uint32_t sid;
|
||||
uint32_t portid;
|
||||
uint32_t
|
||||
oxid : 16,
|
||||
cdb0 : 8,
|
||||
: 1,
|
||||
dead : 1,
|
||||
tattr : 3,
|
||||
state : 3;
|
||||
} atio_private_data_t;
|
||||
#define ATPD_STATE_FREE 0
|
||||
@ -115,23 +104,34 @@ typedef struct {
|
||||
#define ATPD_STATE_LAST_CTIO 4
|
||||
#define ATPD_STATE_PDON 5
|
||||
|
||||
typedef union inot_private_data inot_private_data_t;
|
||||
union inot_private_data {
|
||||
inot_private_data_t *next;
|
||||
struct {
|
||||
isp_notify_t nt; /* must be first! */
|
||||
uint8_t data[64]; /* sb QENTRY_LEN, but order of definitions is wrong */
|
||||
uint32_t tag_id, seq_id;
|
||||
} rd;
|
||||
};
|
||||
|
||||
typedef struct tstate {
|
||||
struct tstate *next;
|
||||
SLIST_ENTRY(tstate) next;
|
||||
struct cam_path *owner;
|
||||
struct ccb_hdr_slist atios;
|
||||
struct ccb_hdr_slist inots;
|
||||
lun_id_t lun;
|
||||
int bus;
|
||||
uint32_t hold;
|
||||
int atio_count;
|
||||
int inot_count;
|
||||
inot_private_data_t * restart_queue;
|
||||
inot_private_data_t * ntfree;
|
||||
inot_private_data_t ntpool[ATPDPSIZE];
|
||||
atio_private_data_t * atfree;
|
||||
atio_private_data_t atpool[ATPDPSIZE];
|
||||
} tstate_t;
|
||||
|
||||
#define LUN_HASH_SIZE 32
|
||||
#define LUN_HASH_FUNC(isp, port, lun) \
|
||||
((IS_DUALBUS(isp)) ? \
|
||||
(((lun) & ((LUN_HASH_SIZE >> 1) - 1)) << (port)) : \
|
||||
((lun) & (LUN_HASH_SIZE - 1)))
|
||||
#define LUN_HASH_SIZE 32
|
||||
#define LUN_HASH_FUNC(lun) ((lun) & (LUN_HASH_SIZE - 1))
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -146,72 +146,162 @@ struct isp_pcmd {
|
||||
#define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1
|
||||
#define PISP_PCMD(ccb) ((struct isp_pcmd *)ISP_PCMD(ccb))
|
||||
|
||||
struct isposinfo {
|
||||
struct ispsoftc * next;
|
||||
bus_space_tag_t bus_tag;
|
||||
bus_space_handle_t bus_handle;
|
||||
bus_dma_tag_t dmat;
|
||||
uint64_t default_port_wwn;
|
||||
uint64_t default_node_wwn;
|
||||
uint32_t default_id;
|
||||
device_t dev;
|
||||
struct cam_sim *sim;
|
||||
struct cam_path *path;
|
||||
struct cam_sim *sim2;
|
||||
struct cam_path *path2;
|
||||
struct intr_config_hook ehook;
|
||||
uint32_t loop_down_time;
|
||||
uint32_t loop_down_limit;
|
||||
uint32_t gone_device_time;
|
||||
uint32_t : 5,
|
||||
/*
|
||||
* Per channel information
|
||||
*/
|
||||
SLIST_HEAD(tslist, tstate);
|
||||
|
||||
struct isp_fc {
|
||||
struct cam_sim *sim;
|
||||
struct cam_path *path;
|
||||
struct ispsoftc *isp;
|
||||
struct proc *kproc;
|
||||
bus_dma_tag_t tdmat;
|
||||
bus_dmamap_t tdmap;
|
||||
uint64_t def_wwpn;
|
||||
uint64_t def_wwnn;
|
||||
uint32_t loop_down_time;
|
||||
uint32_t loop_down_limit;
|
||||
uint32_t gone_device_time;
|
||||
uint32_t
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#ifdef ISP_INTERNAL_TARGET
|
||||
proc_active : 1,
|
||||
#endif
|
||||
tm_luns_enabled : 1,
|
||||
tm_enable_defer : 1,
|
||||
tm_enabled : 1,
|
||||
#endif
|
||||
simqfrozen : 3,
|
||||
default_id : 8,
|
||||
hysteresis : 8,
|
||||
role : 2,
|
||||
gdt_running : 1,
|
||||
ldt_running : 1,
|
||||
disabled : 1,
|
||||
fcbsy : 1,
|
||||
mbox_sleeping : 1,
|
||||
mbox_sleep_ok : 1,
|
||||
mboxcmd_done : 1,
|
||||
mboxbsy : 1;
|
||||
struct callout ldt; /* loop down timer */
|
||||
struct callout gdt; /* gone device timer */
|
||||
#if __FreeBSD_version < 500000
|
||||
uint32_t splcount;
|
||||
uint32_t splsaved;
|
||||
#else
|
||||
struct mtx lock;
|
||||
const struct firmware * fw;
|
||||
union {
|
||||
struct {
|
||||
char wwnn[19];
|
||||
char wwpn[19];
|
||||
} fc;
|
||||
} sysctl_info;
|
||||
loop_dead : 1,
|
||||
fcbsy : 1;
|
||||
struct callout ldt; /* loop down timer */
|
||||
struct callout gdt; /* gone device timer */
|
||||
#ifdef ISP_TARGET_MODE
|
||||
struct tslist lun_hash[LUN_HASH_SIZE];
|
||||
#ifdef ISP_INTERNAL_TARGET
|
||||
struct proc * target_proc;
|
||||
#endif
|
||||
struct proc *kproc;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct isp_spi {
|
||||
struct cam_sim *sim;
|
||||
struct cam_path *path;
|
||||
uint32_t
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#ifdef ISP_INTERNAL_TARGET
|
||||
proc_active : 1,
|
||||
#endif
|
||||
tm_luns_enabled : 1,
|
||||
tm_enable_defer : 1,
|
||||
tm_enabled : 1,
|
||||
#endif
|
||||
simqfrozen : 3,
|
||||
role : 3,
|
||||
iid : 4;
|
||||
#ifdef ISP_TARGET_MODE
|
||||
struct tslist lun_hash[LUN_HASH_SIZE];
|
||||
#ifdef ISP_INTERNAL_TARGET
|
||||
struct proc * target_proc;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
struct isposinfo {
|
||||
/*
|
||||
* Linkage, locking, and identity
|
||||
*/
|
||||
struct mtx lock;
|
||||
device_t dev;
|
||||
struct cdev * cdev;
|
||||
struct intr_config_hook ehook;
|
||||
struct cam_devq * devq;
|
||||
|
||||
/*
|
||||
* Firmware pointer
|
||||
*/
|
||||
const struct firmware * fw;
|
||||
|
||||
/*
|
||||
* DMA related sdtuff
|
||||
*/
|
||||
bus_space_tag_t bus_tag;
|
||||
bus_dma_tag_t dmat;
|
||||
bus_space_handle_t bus_handle;
|
||||
bus_dma_tag_t cdmat;
|
||||
bus_dmamap_t cdmap;
|
||||
#define isp_cdmat isp_osinfo.cdmat
|
||||
#define isp_cdmap isp_osinfo.cdmap
|
||||
|
||||
/*
|
||||
* Per command information.
|
||||
* Command and transaction related related stuff
|
||||
*/
|
||||
struct isp_pcmd * pcmd_pool;
|
||||
struct isp_pcmd * pcmd_free;
|
||||
|
||||
uint32_t
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#define TM_WILDCARD_ENABLED 0x02
|
||||
#define TM_TMODE_ENABLED 0x01
|
||||
uint8_t tmflags[2]; /* two busses */
|
||||
#define NLEACT 4
|
||||
union ccb * leact[NLEACT];
|
||||
tstate_t tsdflt[2]; /* two busses */
|
||||
tstate_t *lun_hash[LUN_HASH_SIZE];
|
||||
atio_private_data_t atpdp[ATPDPSIZE];
|
||||
tmwanted : 1,
|
||||
tmbusy : 1,
|
||||
#else
|
||||
: 2,
|
||||
#endif
|
||||
forcemulti : 1,
|
||||
timer_active : 1,
|
||||
autoconf : 1,
|
||||
ehook_active : 1,
|
||||
disabled : 1,
|
||||
mbox_sleeping : 1,
|
||||
mbox_sleep_ok : 1,
|
||||
mboxcmd_done : 1,
|
||||
mboxbsy : 1;
|
||||
|
||||
struct callout tmo; /* general timer */
|
||||
|
||||
/*
|
||||
* misc- needs to be sorted better XXXXXX
|
||||
*/
|
||||
int framesize;
|
||||
int exec_throttle;
|
||||
int cont_max;
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
cam_status * rptr;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Per-type private storage...
|
||||
*/
|
||||
union {
|
||||
struct isp_fc *fc;
|
||||
struct isp_spi *spi;
|
||||
void *ptr;
|
||||
} pc;
|
||||
};
|
||||
#define ISP_KT_WCHAN(isp) (&(isp)->isp_osinfo.kproc)
|
||||
#define ISP_FC_PC(isp, chan) (&(isp)->isp_osinfo.pc.fc[(chan)])
|
||||
#define ISP_SPI_PC(isp, chan) (&(isp)->isp_osinfo.pc.spi[(chan)])
|
||||
#define ISP_GET_PC(isp, chan, tag, rslt) \
|
||||
if (IS_SCSI(isp)) { \
|
||||
rslt = ISP_SPI_PC(isp, chan)-> tag; \
|
||||
} else { \
|
||||
rslt = ISP_FC_PC(isp, chan)-> tag; \
|
||||
}
|
||||
#define ISP_GET_PC_ADDR(isp, chan, tag, rp) \
|
||||
if (IS_SCSI(isp)) { \
|
||||
rp = &ISP_SPI_PC(isp, chan)-> tag; \
|
||||
} else { \
|
||||
rp = &ISP_FC_PC(isp, chan)-> tag; \
|
||||
}
|
||||
#define ISP_SET_PC(isp, chan, tag, val) \
|
||||
if (IS_SCSI(isp)) { \
|
||||
ISP_SPI_PC(isp, chan)-> tag = val; \
|
||||
} else { \
|
||||
ISP_FC_PC(isp, chan)-> tag = val; \
|
||||
}
|
||||
|
||||
#define isp_lock isp_osinfo.lock
|
||||
#define isp_bus_tag isp_osinfo.bus_tag
|
||||
@ -220,37 +310,26 @@ struct isposinfo {
|
||||
/*
|
||||
* Locking macros...
|
||||
*/
|
||||
#if __FreeBSD_version < 500000
|
||||
#define ISP_LOCK(isp) \
|
||||
if (isp->isp_osinfo.splcount++ == 0) { \
|
||||
isp->isp_osinfo.splsaved = splcam(); \
|
||||
}
|
||||
#define ISP_UNLOCK(isp) \
|
||||
if (isp->isp_osinfo.splcount > 1) { \
|
||||
isp->isp_osinfo.splcount--; \
|
||||
} else { \
|
||||
isp->isp_osinfo.splcount = 0; \
|
||||
splx(isp->isp_osinfo.splsaved); \
|
||||
}
|
||||
#elif __FreeBSD_version < 700037
|
||||
#define ISP_LOCK(isp) do {} while (0)
|
||||
#define ISP_UNLOCK(isp) do {} while (0)
|
||||
#else
|
||||
#define ISP_LOCK(isp) mtx_lock(&isp->isp_osinfo.lock)
|
||||
#define ISP_UNLOCK(isp) mtx_unlock(&isp->isp_osinfo.lock)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Required Macros/Defines
|
||||
*/
|
||||
|
||||
#define ISP2100_SCRLEN 0x1000
|
||||
#define ISP_FC_SCRLEN 0x1000
|
||||
|
||||
#define MEMZERO(a, b) memset(a, 0, b)
|
||||
#define MEMCPY memcpy
|
||||
#define SNPRINTF snprintf
|
||||
#define USEC_DELAY DELAY
|
||||
#define USEC_SLEEP(isp, x) DELAY(x)
|
||||
#define ISP_MEMZERO(a, b) memset(a, 0, b)
|
||||
#define ISP_MEMCPY memcpy
|
||||
#define ISP_SNPRINTF snprintf
|
||||
#define ISP_DELAY DELAY
|
||||
#define ISP_SLEEP(isp, x) DELAY(x)
|
||||
|
||||
#ifndef DIAGNOSTIC
|
||||
#define ISP_INLINE __inline
|
||||
#else
|
||||
#define ISP_INLINE
|
||||
#endif
|
||||
|
||||
#define NANOTIME_T struct timespec
|
||||
#define GET_NANOTIME nanotime
|
||||
@ -263,17 +342,19 @@ struct isposinfo {
|
||||
switch (type) { \
|
||||
case SYNC_SFORDEV: \
|
||||
case SYNC_REQUEST: \
|
||||
bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \
|
||||
bus_dmamap_sync(isp->isp_osinfo.cdmat, \
|
||||
isp->isp_osinfo.cdmap, \
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \
|
||||
break; \
|
||||
case SYNC_SFORCPU: \
|
||||
case SYNC_RESULT: \
|
||||
bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \
|
||||
bus_dmamap_sync(isp->isp_osinfo.cdmat, \
|
||||
isp->isp_osinfo.cdmap, \
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \
|
||||
break; \
|
||||
case SYNC_REG: \
|
||||
bus_space_barrier(isp->isp_bus_tag, \
|
||||
isp->isp_bus_handle, offset, size, \
|
||||
bus_space_barrier(isp->isp_osinfo.bus_tag, \
|
||||
isp->isp_osinfo.bus_handle, offset, size, \
|
||||
BUS_SPACE_BARRIER_READ); \
|
||||
break; \
|
||||
default: \
|
||||
@ -285,13 +366,8 @@ default: \
|
||||
#define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done
|
||||
#define MBOX_RELEASE isp_mbox_release
|
||||
|
||||
#define FC_SCRATCH_ACQUIRE(isp) \
|
||||
if (isp->isp_osinfo.fcbsy) { \
|
||||
isp_prt(isp, ISP_LOGWARN, \
|
||||
"FC scratch area busy (line %d)!", __LINE__); \
|
||||
} else \
|
||||
isp->isp_osinfo.fcbsy = 1
|
||||
#define FC_SCRATCH_RELEASE(isp) isp->isp_osinfo.fcbsy = 0
|
||||
#define FC_SCRATCH_ACQUIRE isp_fc_scratch_acquire
|
||||
#define FC_SCRATCH_RELEASE(isp, chan) isp->isp_osinfo.pc.fc[chan].fcbsy = 0
|
||||
|
||||
#ifndef SCSI_GOOD
|
||||
#define SCSI_GOOD SCSI_STATUS_OK
|
||||
@ -308,6 +384,25 @@ default: \
|
||||
|
||||
#define XS_T struct ccb_scsiio
|
||||
#define XS_DMA_ADDR_T bus_addr_t
|
||||
#define XS_GET_DMA64_SEG(a, b, c) \
|
||||
{ \
|
||||
ispds64_t *d = a; \
|
||||
bus_dma_segment_t *e = b; \
|
||||
uint32_t f = c; \
|
||||
e += f; \
|
||||
d->ds_base = DMA_LO32(e->ds_addr); \
|
||||
d->ds_basehi = DMA_HI32(e->ds_addr); \
|
||||
d->ds_count = e->ds_len; \
|
||||
}
|
||||
#define XS_GET_DMA_SEG(a, b, c) \
|
||||
{ \
|
||||
ispds_t *d = a; \
|
||||
bus_dma_segment_t *e = b; \
|
||||
uint32_t f = c; \
|
||||
e += f; \
|
||||
d->ds_base = DMA_LO32(e->ds_addr); \
|
||||
d->ds_count = e->ds_len; \
|
||||
}
|
||||
#define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path))
|
||||
#define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
|
||||
#define XS_TGT(ccb) (ccb)->ccb_h.target_id
|
||||
@ -320,7 +415,8 @@ default: \
|
||||
#define XS_CDBLEN(ccb) (ccb)->cdb_len
|
||||
#define XS_XFRLEN(ccb) (ccb)->dxfer_len
|
||||
#define XS_TIME(ccb) (ccb)->ccb_h.timeout
|
||||
#define XS_RESID(ccb) (ccb)->resid
|
||||
#define XS_GET_RESID(ccb) (ccb)->resid
|
||||
#define XS_SET_RESID(ccb, r) (ccb)->resid = r
|
||||
#define XS_STSP(ccb) (&(ccb)->scsi_status)
|
||||
#define XS_SNSP(ccb) (&(ccb)->sense_data)
|
||||
|
||||
@ -367,23 +463,27 @@ default: \
|
||||
|
||||
#define XS_SET_STATE_STAT(a, b, c)
|
||||
|
||||
#define DEFAULT_IID(x) (isp)->isp_osinfo.default_id
|
||||
#define DEFAULT_LOOPID(x) (isp)->isp_osinfo.default_id
|
||||
#define DEFAULT_NODEWWN(isp) (isp)->isp_osinfo.default_node_wwn
|
||||
#define DEFAULT_PORTWWN(isp) (isp)->isp_osinfo.default_port_wwn
|
||||
#define ISP_NODEWWN(isp) FCPARAM(isp)->isp_wwnn_nvram
|
||||
#define ISP_PORTWWN(isp) FCPARAM(isp)->isp_wwpn_nvram
|
||||
#define DEFAULT_FRAMESIZE(isp) isp->isp_osinfo.framesize
|
||||
#define DEFAULT_EXEC_THROTTLE(isp) isp->isp_osinfo.exec_throttle
|
||||
|
||||
#define GET_DEFAULT_ROLE(isp, chan) \
|
||||
(IS_FC(isp)? ISP_FC_PC(isp, chan)->role : ISP_SPI_PC(isp, chan)->role)
|
||||
#define SET_DEFAULT_ROLE(isp, chan, val) \
|
||||
if (IS_FC(isp)) { \
|
||||
ISP_FC_PC(isp, chan)->role = val; \
|
||||
} else { \
|
||||
ISP_SPI_PC(isp, chan)->role = val; \
|
||||
}
|
||||
|
||||
#define DEFAULT_IID(isp, chan) isp->isp_osinfo.pc.spi[chan].iid
|
||||
|
||||
#define DEFAULT_LOOPID(x, chan) isp->isp_osinfo.pc.fc[chan].default_id
|
||||
|
||||
#define DEFAULT_NODEWWN(isp, chan) isp_default_wwn(isp, chan, 0, 1)
|
||||
#define DEFAULT_PORTWWN(isp, chan) isp_default_wwn(isp, chan, 0, 0)
|
||||
#define ACTIVE_NODEWWN(isp, chan) isp_default_wwn(isp, chan, 1, 1)
|
||||
#define ACTIVE_PORTWWN(isp, chan) isp_default_wwn(isp, chan, 1, 0)
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#define bswap16 htobe16
|
||||
#define bswap32 htobe32
|
||||
#else
|
||||
#define bswap16 htole16
|
||||
#define bswap32 htole32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#ifdef ISP_SBUS_SUPPORTED
|
||||
@ -450,10 +550,6 @@ default: \
|
||||
#include <dev/isp/ispvar.h>
|
||||
#include <dev/isp/ispmbox.h>
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#include <dev/isp/isp_tpublic.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* isp_osinfo definiitions && shorthand
|
||||
*/
|
||||
@ -461,17 +557,15 @@ default: \
|
||||
#define SIMQFRZ_LOOPDOWN 0x2
|
||||
#define SIMQFRZ_TIMED 0x4
|
||||
|
||||
#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_dev isp_osinfo.dev
|
||||
|
||||
/*
|
||||
* prototypes for isp_pci && isp_freebsd to share
|
||||
*/
|
||||
extern void isp_attach(ispsoftc_t *);
|
||||
extern int isp_attach(ispsoftc_t *);
|
||||
extern void isp_detach(ispsoftc_t *);
|
||||
extern void isp_uninit(ispsoftc_t *);
|
||||
extern uint64_t isp_default_wwn(ispsoftc_t *, int, int, int);
|
||||
|
||||
/*
|
||||
* driver global data
|
||||
@ -481,23 +575,14 @@ extern int isp_fabric_hysteresis;
|
||||
extern int isp_loop_down_limit;
|
||||
extern int isp_gone_device_time;
|
||||
extern int isp_quickboot_time;
|
||||
extern int isp_autoconfig;
|
||||
|
||||
/*
|
||||
* Platform private flags
|
||||
*/
|
||||
#define ISP_SPRIV_ERRSET 0x1
|
||||
#define ISP_SPRIV_INWDOG 0x2
|
||||
#define ISP_SPRIV_GRACE 0x4
|
||||
#define ISP_SPRIV_DONE 0x8
|
||||
|
||||
#define XS_CMD_S_WDOG(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_INWDOG
|
||||
#define XS_CMD_C_WDOG(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_INWDOG
|
||||
#define XS_CMD_WDOG_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_INWDOG)
|
||||
|
||||
#define XS_CMD_S_GRACE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_GRACE
|
||||
#define XS_CMD_C_GRACE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE
|
||||
#define XS_CMD_GRACE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE)
|
||||
|
||||
#define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE
|
||||
#define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE
|
||||
#define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE)
|
||||
@ -513,6 +598,7 @@ int isp_mbox_acquire(ispsoftc_t *);
|
||||
void isp_mbox_wait_complete(ispsoftc_t *, mbreg_t *);
|
||||
void isp_mbox_notify_done(ispsoftc_t *);
|
||||
void isp_mbox_release(ispsoftc_t *);
|
||||
int isp_fc_scratch_acquire(ispsoftc_t *, int);
|
||||
int isp_mstohz(int);
|
||||
void isp_platform_intr(void *);
|
||||
void isp_common_dmateardown(ispsoftc_t *, struct ccb_scsiio *, uint32_t);
|
||||
@ -520,75 +606,27 @@ void isp_common_dmateardown(ispsoftc_t *, struct ccb_scsiio *, uint32_t);
|
||||
/*
|
||||
* Platform Version specific defines
|
||||
*/
|
||||
#if __FreeBSD_version < 500000
|
||||
#define BUS_DMA_ROOTARG(x) NULL
|
||||
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
||||
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)
|
||||
#elif __FreeBSD_version < 700020
|
||||
#define BUS_DMA_ROOTARG(x) NULL
|
||||
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
||||
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
|
||||
busdma_lock_mutex, &Giant, z)
|
||||
#elif __FreeBSD_version < 700037
|
||||
#define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x)
|
||||
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
||||
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
|
||||
busdma_lock_mutex, &Giant, z)
|
||||
#else
|
||||
#define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x)
|
||||
#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \
|
||||
bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
|
||||
busdma_lock_mutex, &isp->isp_osinfo.lock, z)
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version < 700031
|
||||
#define isp_setup_intr(d, i, f, U, if, ifa, hp) \
|
||||
bus_setup_intr(d, i, f, if, ifa, hp)
|
||||
#else
|
||||
#define isp_setup_intr bus_setup_intr
|
||||
#endif
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
#define isp_sim_alloc cam_sim_alloc
|
||||
#define isp_callout_init(x) callout_init(x)
|
||||
#elif __FreeBSD_version < 700037
|
||||
#define isp_callout_init(x) callout_init(x, 0)
|
||||
#define isp_sim_alloc cam_sim_alloc
|
||||
#else
|
||||
#define isp_callout_init(x) callout_init(x, 1)
|
||||
#define isp_sim_alloc(a, b, c, d, e, f, g, h) \
|
||||
cam_sim_alloc(a, b, c, d, e, &(d)->isp_osinfo.lock, f, g, h)
|
||||
#endif
|
||||
|
||||
/* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */
|
||||
#define ISP_MAXPHYS (128 * 1024)
|
||||
#define ISP_NSEGS ((ISP_MAXPHYS / PAGE_SIZE) + 1)
|
||||
#define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1)
|
||||
|
||||
#define ISP_PATH_PRT(i, l, p, ...) \
|
||||
if ((l) == ISP_LOGALL || ((l)& (i)->isp_dblev) != 0) { \
|
||||
xpt_print(p, __VA_ARGS__); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Platform specific inline functions
|
||||
*/
|
||||
static __inline int isp_get_pcmd(ispsoftc_t *, union ccb *);
|
||||
static __inline void isp_free_pcmd(ispsoftc_t *, union ccb *);
|
||||
|
||||
static __inline int
|
||||
isp_get_pcmd(ispsoftc_t *isp, union ccb *ccb)
|
||||
{
|
||||
ISP_PCMD(ccb) = isp->isp_osinfo.pcmd_free;
|
||||
if (ISP_PCMD(ccb) == NULL) {
|
||||
return (-1);
|
||||
}
|
||||
isp->isp_osinfo.pcmd_free = ((struct isp_pcmd *)ISP_PCMD(ccb))->next;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
isp_free_pcmd(ispsoftc_t *isp, union ccb *ccb)
|
||||
{
|
||||
((struct isp_pcmd *)ISP_PCMD(ccb))->next = isp->isp_osinfo.pcmd_free;
|
||||
isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb);
|
||||
ISP_PCMD(ccb) = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ISP General Library functions
|
||||
|
@ -54,6 +54,8 @@
|
||||
* This ioctl performs a reset and then will set the adapter to the
|
||||
* role that was passed in (the old role will be returned). It almost
|
||||
* goes w/o saying: use with caution.
|
||||
*
|
||||
* Channel selector stored in bits 8..32 as input to driver.
|
||||
*/
|
||||
#define ISP_SETROLE _IOWR(ISP_IOC, 4, int)
|
||||
|
||||
@ -64,6 +66,7 @@
|
||||
|
||||
/*
|
||||
* Get the current adapter role
|
||||
* Channel selector passed in first argument.
|
||||
*/
|
||||
#define ISP_GETROLE _IOR(ISP_IOC, 5, int)
|
||||
|
||||
@ -107,8 +110,9 @@ typedef struct {
|
||||
* only), 24 bit Port ID and Node and Port WWNs.
|
||||
*/
|
||||
struct isp_fc_device {
|
||||
uint32_t loopid; /* 0..255 */
|
||||
uint32_t : 6,
|
||||
uint32_t loopid; /* 0..255,2047 */
|
||||
uint32_t
|
||||
chan : 6,
|
||||
role : 2,
|
||||
portid : 24; /* 24 bit Port ID */
|
||||
uint64_t node_wwn;
|
||||
@ -129,18 +133,16 @@ struct isp_fc_device {
|
||||
struct isp_hba_device {
|
||||
uint32_t
|
||||
: 8,
|
||||
: 4,
|
||||
fc_speed : 4, /* Gbps */
|
||||
: 2,
|
||||
fc_class2 : 1,
|
||||
fc_ip_supported : 1,
|
||||
fc_scsi_supported : 1,
|
||||
: 1,
|
||||
fc_topology : 3,
|
||||
fc_loopid : 8;
|
||||
fc_channel : 8,
|
||||
fc_loopid : 16;
|
||||
uint8_t fc_fw_major;
|
||||
uint8_t fc_fw_minor;
|
||||
uint8_t fc_fw_micro;
|
||||
uint8_t reserved;
|
||||
uint8_t fc_nchannels; /* number of supported channels */
|
||||
uint16_t fc_nports; /* number of supported ports */
|
||||
uint64_t nvram_node_wwn;
|
||||
uint64_t nvram_port_wwn;
|
||||
uint64_t active_node_wwn;
|
||||
@ -153,14 +155,16 @@ struct isp_hba_device {
|
||||
#define ISP_TOPO_NPORT 3 /* N-port */
|
||||
#define ISP_TOPO_FPORT 4 /* F-port */
|
||||
|
||||
#define ISP_FC_GETHINFO _IOR(ISP_IOC, 12, struct isp_hba_device)
|
||||
/* don't use 12 any more */
|
||||
#define ISP_FC_GETHINFO _IOWR(ISP_IOC, 13, struct isp_hba_device)
|
||||
|
||||
/*
|
||||
* Various Reset Goodies
|
||||
*/
|
||||
struct isp_fc_tsk_mgmt {
|
||||
uint32_t loopid; /* 0..255 */
|
||||
uint32_t lun;
|
||||
uint32_t loopid; /* 0..255/2048 */
|
||||
uint16_t lun;
|
||||
uint16_t chan;
|
||||
enum {
|
||||
IPT_CLEAR_ACA,
|
||||
IPT_TARGET_RESET,
|
||||
@ -169,4 +173,18 @@ struct isp_fc_tsk_mgmt {
|
||||
IPT_ABORT_TASK_SET
|
||||
} action;
|
||||
};
|
||||
#define ISP_TSK_MGMT _IOWR(ISP_IOC, 97, struct isp_fc_tsk_mgmt)
|
||||
/* don't use 97 any more */
|
||||
#define ISP_TSK_MGMT _IOWR(ISP_IOC, 98, struct isp_fc_tsk_mgmt)
|
||||
|
||||
/*
|
||||
* Just gimme a list of WWPNs that are logged into us.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t count;
|
||||
uint16_t channel;
|
||||
struct wwnpair {
|
||||
uint64_t wwnn;
|
||||
uint64_t wwpn;
|
||||
} wwns[1];
|
||||
} isp_dlist_t;
|
||||
#define ISP_FC_GETDLIST _IO(ISP_IOC, 14)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* Copyright (c) 1997-2009 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -24,201 +24,190 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _ISP_LIBRARY_H
|
||||
#define _ISP_LIBRARY_H
|
||||
#ifndef _ISP_LIBRARY_H
|
||||
#define _ISP_LIBRARY_H
|
||||
|
||||
extern int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *);
|
||||
extern XS_T *isp_find_xs(ispsoftc_t *, uint32_t);
|
||||
extern uint32_t isp_find_handle(ispsoftc_t *, XS_T *);
|
||||
extern uint32_t isp_handle_index(uint32_t);
|
||||
extern void isp_destroy_handle(ispsoftc_t *, uint32_t);
|
||||
extern int isp_getrqentry(ispsoftc_t *, uint32_t *, uint32_t *, void **);
|
||||
extern void isp_print_qentry (ispsoftc_t *, char *, int, void *);
|
||||
extern void isp_print_bytes(ispsoftc_t *, const char *, int, void *);
|
||||
extern int isp_fc_runstate(ispsoftc_t *, int);
|
||||
extern void isp_dump_portdb(ispsoftc_t *);
|
||||
extern void isp_shutdown(ispsoftc_t *);
|
||||
extern void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
extern void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
extern int isp_get_response_type(ispsoftc_t *, isphdr_t *);
|
||||
extern void
|
||||
isp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *);
|
||||
extern void
|
||||
isp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *);
|
||||
extern void
|
||||
isp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *);
|
||||
extern void
|
||||
isp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *);
|
||||
extern void
|
||||
isp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *);
|
||||
extern void
|
||||
isp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *);
|
||||
extern void
|
||||
isp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *);
|
||||
extern void
|
||||
isp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *);
|
||||
extern void
|
||||
isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *);
|
||||
extern void
|
||||
isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
|
||||
extern void
|
||||
isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *);
|
||||
extern void
|
||||
isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *);
|
||||
extern void
|
||||
isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *);
|
||||
extern void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *,
|
||||
isp24xx_statusreq_t *);
|
||||
void
|
||||
isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
|
||||
extern void
|
||||
isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *);
|
||||
extern void
|
||||
isp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *);
|
||||
extern void
|
||||
isp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *);
|
||||
extern void
|
||||
isp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *);
|
||||
extern void
|
||||
isp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *);
|
||||
extern void
|
||||
isp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
|
||||
extern void
|
||||
isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
|
||||
extern void
|
||||
isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
|
||||
extern void
|
||||
isp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
|
||||
extern void
|
||||
isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
|
||||
extern void
|
||||
isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
|
||||
extern void
|
||||
isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
|
||||
extern void
|
||||
isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *,
|
||||
sns_gid_ft_req_t *);
|
||||
extern void
|
||||
isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *,
|
||||
sns_gxn_id_req_t *);
|
||||
extern void
|
||||
isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int);
|
||||
extern void
|
||||
isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *,
|
||||
sns_gid_ft_rsp_t *, int);
|
||||
extern void
|
||||
isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *,
|
||||
sns_gxn_id_rsp_t *);
|
||||
extern void
|
||||
isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *,
|
||||
sns_gff_id_rsp_t *);
|
||||
extern void
|
||||
isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *,
|
||||
sns_ga_nxt_rsp_t *);
|
||||
extern void
|
||||
isp_get_els(ispsoftc_t *, els_t *, els_t *);
|
||||
extern void
|
||||
isp_put_els(ispsoftc_t *, els_t *, els_t *);
|
||||
extern void
|
||||
isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
|
||||
extern void
|
||||
isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *);
|
||||
extern void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *);
|
||||
extern void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
|
||||
extern void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
|
||||
/*
|
||||
* Common command shipping routine.
|
||||
*
|
||||
* This used to be platform specific, but basically once you get the segment
|
||||
* stuff figured out, you can make all the code in one spot.
|
||||
*/
|
||||
typedef enum { ISP_TO_DEVICE, ISP_FROM_DEVICE, ISP_NOXFR} isp_ddir_t;
|
||||
int isp_send_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t);
|
||||
|
||||
#define ISP_HANDLE_MASK 0x7fff
|
||||
/*
|
||||
* Handle management functions.
|
||||
*
|
||||
* These handles are associate with a command.
|
||||
*/
|
||||
int isp_save_xs(ispsoftc_t *, XS_T *, uint32_t *);
|
||||
XS_T * isp_find_xs(ispsoftc_t *, uint32_t);
|
||||
uint32_t isp_find_handle(ispsoftc_t *, XS_T *);
|
||||
uint32_t isp_handle_index(uint32_t);
|
||||
void isp_destroy_handle(ispsoftc_t *, uint32_t);
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
/*
|
||||
* Request Queue allocation
|
||||
*/
|
||||
void *isp_getrqentry(ispsoftc_t *);
|
||||
|
||||
/*
|
||||
* Queue Entry debug functions
|
||||
*/
|
||||
void isp_print_qentry (ispsoftc_t *, const char *, int, void *);
|
||||
void isp_print_bytes(ispsoftc_t *, const char *, int, void *);
|
||||
|
||||
/*
|
||||
* Fibre Channel specific routines and data.
|
||||
*/
|
||||
extern const char *isp_class3_roles[4];
|
||||
int isp_fc_runstate(ispsoftc_t *, int, int);
|
||||
void isp_dump_portdb(ispsoftc_t *, int);
|
||||
|
||||
const char *isp_fc_fw_statename(int);
|
||||
const char *isp_fc_loop_statename(int);
|
||||
const char *isp_fc_toponame(fcparam *);
|
||||
|
||||
int isp_fc_change_role(ispsoftc_t *, int, int);
|
||||
|
||||
|
||||
/*
|
||||
* Cleanup
|
||||
*/
|
||||
void isp_clear_commands(ispsoftc_t *);
|
||||
|
||||
/*
|
||||
* Common chip shutdown function
|
||||
*/
|
||||
void isp_shutdown(ispsoftc_t *);
|
||||
|
||||
/*
|
||||
* Put/Get routines to push from CPU view to device view
|
||||
* or to pull from device view to CPU view for various
|
||||
* data structures (IOCB)
|
||||
*/
|
||||
void isp_put_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
void isp_get_hdr(ispsoftc_t *, isphdr_t *, isphdr_t *);
|
||||
int isp_get_response_type(ispsoftc_t *, isphdr_t *);
|
||||
void isp_put_request(ispsoftc_t *, ispreq_t *, ispreq_t *);
|
||||
void isp_put_marker(ispsoftc_t *, isp_marker_t *, isp_marker_t *);
|
||||
void isp_put_marker_24xx(ispsoftc_t *, isp_marker_24xx_t *, isp_marker_24xx_t *);
|
||||
void isp_put_request_t2(ispsoftc_t *, ispreqt2_t *, ispreqt2_t *);
|
||||
void isp_put_request_t2e(ispsoftc_t *, ispreqt2e_t *, ispreqt2e_t *);
|
||||
void isp_put_request_t3(ispsoftc_t *, ispreqt3_t *, ispreqt3_t *);
|
||||
void isp_put_request_t3e(ispsoftc_t *, ispreqt3e_t *, ispreqt3e_t *);
|
||||
void isp_put_extended_request(ispsoftc_t *, ispextreq_t *, ispextreq_t *);
|
||||
void isp_put_request_t7(ispsoftc_t *, ispreqt7_t *, ispreqt7_t *);
|
||||
void isp_put_24xx_tmf(ispsoftc_t *, isp24xx_tmf_t *, isp24xx_tmf_t *);
|
||||
void isp_put_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
|
||||
void isp_put_cont_req(ispsoftc_t *, ispcontreq_t *, ispcontreq_t *);
|
||||
void isp_put_cont64_req(ispsoftc_t *, ispcontreq64_t *, ispcontreq64_t *);
|
||||
void isp_get_response(ispsoftc_t *, ispstatusreq_t *, ispstatusreq_t *);
|
||||
void isp_get_24xx_response(ispsoftc_t *, isp24xx_statusreq_t *, isp24xx_statusreq_t *);
|
||||
void isp_get_24xx_abrt(ispsoftc_t *, isp24xx_abrt_t *, isp24xx_abrt_t *);
|
||||
void isp_get_rio2(ispsoftc_t *, isp_rio2_t *, isp_rio2_t *);
|
||||
void isp_put_icb(ispsoftc_t *, isp_icb_t *, isp_icb_t *);
|
||||
void isp_put_icb_2400(ispsoftc_t *, isp_icb_2400_t *, isp_icb_2400_t *);
|
||||
void isp_put_icb_2400_vpinfo(ispsoftc_t *, isp_icb_2400_vpinfo_t *, isp_icb_2400_vpinfo_t *);
|
||||
void isp_put_vp_port_info(ispsoftc_t *, vp_port_info_t *, vp_port_info_t *);
|
||||
void isp_get_vp_port_info(ispsoftc_t *, vp_port_info_t *, vp_port_info_t *);
|
||||
void isp_put_vp_ctrl_info(ispsoftc_t *, vp_ctrl_info_t *, vp_ctrl_info_t *);
|
||||
void isp_get_vp_ctrl_info(ispsoftc_t *, vp_ctrl_info_t *, vp_ctrl_info_t *);
|
||||
void isp_put_vp_modify(ispsoftc_t *, vp_modify_t *, vp_modify_t *);
|
||||
void isp_get_vp_modify(ispsoftc_t *, vp_modify_t *, vp_modify_t *);
|
||||
void isp_get_pdb_21xx(ispsoftc_t *, isp_pdb_21xx_t *, isp_pdb_21xx_t *);
|
||||
void isp_get_pdb_24xx(ispsoftc_t *, isp_pdb_24xx_t *, isp_pdb_24xx_t *);
|
||||
void isp_get_ridacq(ispsoftc_t *, isp_ridacq_t *, isp_ridacq_t *);
|
||||
void isp_get_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
|
||||
void isp_put_plogx(ispsoftc_t *, isp_plogx_t *, isp_plogx_t *);
|
||||
void isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
|
||||
void isp_get_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
|
||||
void isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *, isp_ct_pt_t *);
|
||||
void isp_put_ms(ispsoftc_t *isp, isp_ms_t *, isp_ms_t *);
|
||||
void isp_put_sns_request(ispsoftc_t *, sns_screq_t *, sns_screq_t *);
|
||||
void isp_put_gid_ft_request(ispsoftc_t *, sns_gid_ft_req_t *, sns_gid_ft_req_t *);
|
||||
void isp_put_gxn_id_request(ispsoftc_t *, sns_gxn_id_req_t *, sns_gxn_id_req_t *);
|
||||
void isp_get_sns_response(ispsoftc_t *, sns_scrsp_t *, sns_scrsp_t *, int);
|
||||
void isp_get_gid_ft_response(ispsoftc_t *, sns_gid_ft_rsp_t *, sns_gid_ft_rsp_t *, int);
|
||||
void isp_get_gxn_id_response(ispsoftc_t *, sns_gxn_id_rsp_t *, sns_gxn_id_rsp_t *);
|
||||
void isp_get_gff_id_response(ispsoftc_t *, sns_gff_id_rsp_t *, sns_gff_id_rsp_t *);
|
||||
void isp_get_ga_nxt_response(ispsoftc_t *, sns_ga_nxt_rsp_t *, sns_ga_nxt_rsp_t *);
|
||||
void isp_get_els(ispsoftc_t *, els_t *, els_t *);
|
||||
void isp_put_els(ispsoftc_t *, els_t *, els_t *);
|
||||
void isp_get_fc_hdr(ispsoftc_t *, fc_hdr_t *, fc_hdr_t *);
|
||||
void isp_get_fcp_cmnd_iu(ispsoftc_t *, fcp_cmnd_iu_t *, fcp_cmnd_iu_t *);
|
||||
void isp_put_rft_id(ispsoftc_t *, rft_id_t *, rft_id_t *);
|
||||
void isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
|
||||
void isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *, ct_hdr_t *);
|
||||
|
||||
#define ISP_HANDLE_MASK 0x7fff
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <dev/ic/isp_target.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
#elif defined(__FreeBSD__)
|
||||
#include <dev/isp/isp_target.h>
|
||||
#else
|
||||
#include "isp_target.h"
|
||||
#endif
|
||||
|
||||
#define IS_TARGET_HANDLE(x) ((x) & 0x8000)
|
||||
int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t);
|
||||
|
||||
extern int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *);
|
||||
extern void *isp_find_xs_tgt(ispsoftc_t *, uint32_t);
|
||||
extern uint32_t isp_find_tgt_handle(ispsoftc_t *, void *);
|
||||
extern void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t);
|
||||
#define IS_TARGET_HANDLE(x) ((x) & 0x8000)
|
||||
|
||||
extern void
|
||||
isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
|
||||
extern void
|
||||
isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
|
||||
extern void
|
||||
isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
|
||||
extern void
|
||||
isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
|
||||
extern void
|
||||
isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
|
||||
extern void
|
||||
isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
|
||||
extern void
|
||||
isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
|
||||
extern void
|
||||
isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
|
||||
extern void
|
||||
isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
|
||||
extern void
|
||||
isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
|
||||
extern void
|
||||
isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
|
||||
extern void
|
||||
isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
|
||||
extern void
|
||||
isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
|
||||
extern void
|
||||
isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
|
||||
extern void
|
||||
isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
|
||||
extern void
|
||||
isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
|
||||
extern void
|
||||
isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
|
||||
extern void
|
||||
isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
|
||||
extern void
|
||||
isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
|
||||
extern void
|
||||
isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
|
||||
extern void
|
||||
isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
|
||||
extern void
|
||||
isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
|
||||
extern void
|
||||
isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
|
||||
extern void
|
||||
isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
|
||||
extern void
|
||||
isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
|
||||
extern void
|
||||
isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
|
||||
extern void
|
||||
isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
|
||||
extern void
|
||||
isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
|
||||
extern void
|
||||
isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
|
||||
extern void
|
||||
isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
|
||||
extern void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
|
||||
na_fcentry_24xx_t *);
|
||||
extern void
|
||||
isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
|
||||
extern void
|
||||
isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
|
||||
extern void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *,
|
||||
na_fcentry_24xx_t *);
|
||||
extern void
|
||||
isp_get_abts(ispsoftc_t *, abts_t *, abts_t *);
|
||||
extern void
|
||||
isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
|
||||
extern void
|
||||
isp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
|
||||
#endif /* ISP_TARGET_MODE */
|
||||
#endif /* _ISP_LIBRARY_H */
|
||||
int isp_save_xs_tgt(ispsoftc_t *, void *, uint32_t *);
|
||||
void *isp_find_xs_tgt(ispsoftc_t *, uint32_t);
|
||||
uint32_t isp_find_tgt_handle(ispsoftc_t *, void *);
|
||||
void isp_destroy_tgt_handle(ispsoftc_t *, uint32_t);
|
||||
|
||||
int isp_find_pdb_by_wwn(ispsoftc_t *, int, uint64_t, fcportdb_t **);
|
||||
int isp_find_pdb_by_loopid(ispsoftc_t *, int, uint32_t, fcportdb_t **);
|
||||
int isp_find_pdb_by_sid(ispsoftc_t *, int, uint32_t, fcportdb_t **);
|
||||
void isp_find_chan_by_did(ispsoftc_t *, uint32_t, uint16_t *);
|
||||
void isp_add_wwn_entry(ispsoftc_t *, int, uint64_t, uint16_t, uint32_t);
|
||||
void isp_del_wwn_entry(ispsoftc_t *, int, uint64_t, uint16_t, uint32_t);
|
||||
void isp_del_all_wwn_entries(ispsoftc_t *, int);
|
||||
void isp_del_wwn_entries(ispsoftc_t *, isp_notify_t *);
|
||||
|
||||
void isp_put_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
|
||||
void isp_get_atio(ispsoftc_t *, at_entry_t *, at_entry_t *);
|
||||
void isp_put_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
|
||||
void isp_put_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
|
||||
void isp_get_atio2(ispsoftc_t *, at2_entry_t *, at2_entry_t *);
|
||||
void isp_get_atio2e(ispsoftc_t *, at2e_entry_t *, at2e_entry_t *);
|
||||
void isp_get_atio7(ispsoftc_t *isp, at7_entry_t *, at7_entry_t *);
|
||||
void isp_put_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
|
||||
void isp_get_ctio(ispsoftc_t *, ct_entry_t *, ct_entry_t *);
|
||||
void isp_put_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
|
||||
void isp_put_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
|
||||
void isp_put_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
|
||||
void isp_get_ctio2(ispsoftc_t *, ct2_entry_t *, ct2_entry_t *);
|
||||
void isp_get_ctio2e(ispsoftc_t *, ct2e_entry_t *, ct2e_entry_t *);
|
||||
void isp_get_ctio7(ispsoftc_t *, ct7_entry_t *, ct7_entry_t *);
|
||||
void isp_put_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
|
||||
void isp_get_enable_lun(ispsoftc_t *, lun_entry_t *, lun_entry_t *);
|
||||
void isp_put_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
|
||||
void isp_get_notify(ispsoftc_t *, in_entry_t *, in_entry_t *);
|
||||
void isp_put_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
|
||||
void isp_put_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
|
||||
void isp_put_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
|
||||
void isp_get_notify_fc(ispsoftc_t *, in_fcentry_t *, in_fcentry_t *);
|
||||
void isp_get_notify_fc_e(ispsoftc_t *, in_fcentry_e_t *, in_fcentry_e_t *);
|
||||
void isp_get_notify_24xx(ispsoftc_t *, in_fcentry_24xx_t *, in_fcentry_24xx_t *);
|
||||
void isp_put_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
|
||||
void isp_get_notify_ack(ispsoftc_t *, na_entry_t *, na_entry_t *);
|
||||
void isp_put_notify_24xx_ack(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
|
||||
void isp_put_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
|
||||
void isp_put_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
|
||||
void isp_put_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
|
||||
void isp_get_notify_ack_fc(ispsoftc_t *, na_fcentry_t *, na_fcentry_t *);
|
||||
void isp_get_notify_ack_fc_e(ispsoftc_t *, na_fcentry_e_t *, na_fcentry_e_t *);
|
||||
void isp_get_notify_ack_24xx(ispsoftc_t *, na_fcentry_24xx_t *, na_fcentry_24xx_t *);
|
||||
void isp_get_abts(ispsoftc_t *, abts_t *, abts_t *);
|
||||
void isp_put_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
|
||||
void isp_get_abts_rsp(ispsoftc_t *, abts_rsp_t *, abts_rsp_t *);
|
||||
#endif /* ISP_TARGET_MODE */
|
||||
#endif /* _ISP_LIBRARY_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,10 +33,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#if __FreeBSD_version >= 700000
|
||||
#include <sys/linker.h>
|
||||
#include <sys/firmware.h>
|
||||
#endif
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
@ -51,15 +49,12 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <dev/isp/isp_freebsd.h>
|
||||
|
||||
static uint32_t
|
||||
isp_sbus_rd_reg(ispsoftc_t *, int);
|
||||
static void
|
||||
isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t);
|
||||
static int
|
||||
isp_sbus_rd_isr(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
||||
static uint32_t isp_sbus_rd_reg(ispsoftc_t *, int);
|
||||
static void isp_sbus_wr_reg(ispsoftc_t *, int, uint32_t);
|
||||
static int isp_sbus_rd_isr(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
||||
static int isp_sbus_mbxdma(ispsoftc_t *);
|
||||
static int
|
||||
isp_sbus_dmasetup(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t);
|
||||
static int isp_sbus_dmasetup(ispsoftc_t *, XS_T *, void *);
|
||||
|
||||
|
||||
static void isp_sbus_reset0(ispsoftc_t *);
|
||||
static void isp_sbus_reset1(ispsoftc_t *);
|
||||
@ -91,6 +86,7 @@ struct isp_sbussoftc {
|
||||
void * ih;
|
||||
int16_t sbus_poff[_NREG_BLKS];
|
||||
sdparam sbus_param;
|
||||
struct isp_spi sbus_spi;
|
||||
struct ispmdvec sbus_mdvec;
|
||||
struct resource * sbus_ires;
|
||||
};
|
||||
@ -108,9 +104,6 @@ static driver_t isp_sbus_driver = {
|
||||
};
|
||||
static devclass_t isp_devclass;
|
||||
DRIVER_MODULE(isp, sbus, isp_sbus_driver, isp_devclass, 0, 0);
|
||||
#if __FreeBSD_version < 700000
|
||||
extern ispfwfunc *isp_get_firmware_p;
|
||||
#endif
|
||||
|
||||
static int
|
||||
isp_sbus_probe(device_t dev)
|
||||
@ -140,7 +133,7 @@ static int
|
||||
isp_sbus_attach(device_t dev)
|
||||
{
|
||||
struct resource *regs;
|
||||
int tval, iqd, isp_debug, role, rid, ispburst;
|
||||
int tval, iqd, isp_debug, role, rid, ispburst, default_id;
|
||||
struct isp_sbussoftc *sbs;
|
||||
ispsoftc_t *isp = NULL;
|
||||
int locksetup = 0;
|
||||
@ -165,11 +158,7 @@ isp_sbus_attach(device_t dev)
|
||||
((role & ~(ISP_ROLE_INITIATOR|ISP_ROLE_TARGET)) == 0)) {
|
||||
device_printf(dev, "setting role to 0x%x\n", role);
|
||||
} else {
|
||||
#ifdef ISP_TARGET_MODE
|
||||
role = ISP_ROLE_INITIATOR|ISP_ROLE_TARGET;
|
||||
#else
|
||||
role = ISP_DEFAULT_ROLES;
|
||||
#endif
|
||||
}
|
||||
|
||||
sbs = malloc(sizeof (*sbs), M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
@ -202,9 +191,9 @@ isp_sbus_attach(device_t dev)
|
||||
isp->isp_bustype = ISP_BT_SBUS;
|
||||
isp->isp_type = ISP_HA_SCSI_UNKNOWN;
|
||||
isp->isp_param = &sbs->sbus_param;
|
||||
isp->isp_osinfo.pc.ptr = &sbs->sbus_spi;
|
||||
isp->isp_revision = 0; /* XXX */
|
||||
isp->isp_role = role;
|
||||
isp->isp_dev = dev;
|
||||
ISP_SET_PC(isp, 0, role, role);
|
||||
|
||||
/*
|
||||
* Get the clock frequency and convert it from HZ to MHz,
|
||||
@ -246,11 +235,10 @@ isp_sbus_attach(device_t dev)
|
||||
*/
|
||||
if (strcmp("PTI,ptisp", ofw_bus_get_name(dev)) == 0 ||
|
||||
strcmp("ptisp", ofw_bus_get_name(dev)) == 0) {
|
||||
SDPARAM(isp)->isp_ptisp = 1;
|
||||
SDPARAM(isp, 0)->isp_ptisp = 1;
|
||||
}
|
||||
|
||||
|
||||
#if __FreeBSD_version >= 700000
|
||||
isp->isp_osinfo.fw = firmware_get("isp_1000");
|
||||
if (isp->isp_osinfo.fw) {
|
||||
union {
|
||||
@ -260,14 +248,6 @@ isp_sbus_attach(device_t dev)
|
||||
stupid.cp = isp->isp_osinfo.fw->data;
|
||||
isp->isp_mdvec->dv_ispfw = stupid.sp;
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* Try and find firmware for this device.
|
||||
*/
|
||||
if (isp_get_firmware_p) {
|
||||
(*isp_get_firmware_p)(0, 0, 0x1000, &sbs->sbus_mdvec.dv_ispfw);
|
||||
}
|
||||
#endif
|
||||
|
||||
tval = 0;
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
@ -275,19 +255,20 @@ isp_sbus_attach(device_t dev)
|
||||
isp->isp_confopts |= ISP_CFG_NORELOAD;
|
||||
}
|
||||
|
||||
isp->isp_osinfo.default_id = -1;
|
||||
default_id = -1;
|
||||
if (resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
"iid", &tval) == 0) {
|
||||
isp->isp_osinfo.default_id = tval;
|
||||
default_id = tval;
|
||||
isp->isp_confopts |= ISP_CFG_OWNLOOPID;
|
||||
}
|
||||
if (isp->isp_osinfo.default_id == -1) {
|
||||
if (default_id == -1) {
|
||||
/*
|
||||
* XXX: should be a way to get properties w/o having
|
||||
* XXX: to call OF_xxx functions
|
||||
*/
|
||||
isp->isp_osinfo.default_id = 7;
|
||||
default_id = 7;
|
||||
}
|
||||
ISP_SPI_PC(isp, 0)->iid = default_id;
|
||||
|
||||
isp_debug = 0;
|
||||
(void) resource_int_value(device_get_name(dev), device_get_unit(dev),
|
||||
@ -328,20 +309,20 @@ isp_sbus_attach(device_t dev)
|
||||
* Make sure we're in reset state.
|
||||
*/
|
||||
ISP_LOCK(isp);
|
||||
isp_reset(isp);
|
||||
isp_reset(isp, 1);
|
||||
if (isp->isp_state != ISP_RESETSTATE) {
|
||||
isp_uninit(isp);
|
||||
ISP_UNLOCK(isp);
|
||||
goto bad;
|
||||
}
|
||||
isp_init(isp);
|
||||
if (isp->isp_role != ISP_ROLE_NONE && isp->isp_state != ISP_INITSTATE) {
|
||||
if (role != ISP_ROLE_NONE && isp->isp_state != ISP_INITSTATE) {
|
||||
isp_uninit(isp);
|
||||
ISP_UNLOCK(isp);
|
||||
goto bad;
|
||||
}
|
||||
isp_attach(isp);
|
||||
if (isp->isp_role != ISP_ROLE_NONE && isp->isp_state != ISP_RUNSTATE) {
|
||||
if (role != ISP_ROLE_NONE && isp->isp_state != ISP_RUNSTATE) {
|
||||
isp_uninit(isp);
|
||||
ISP_UNLOCK(isp);
|
||||
goto bad;
|
||||
@ -507,7 +488,7 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN,
|
||||
BUS_SPACE_MAXADDR_24BIT+1, BUS_SPACE_MAXADDR_32BIT,
|
||||
BUS_SPACE_MAXADDR_32BIT, NULL, NULL, len, ns,
|
||||
BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_cdmat)) {
|
||||
BUS_SPACE_MAXADDR_24BIT, 0, &isp->isp_osinfo.cdmat)) {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"cannot create a dma tag for control spaces");
|
||||
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
||||
@ -516,11 +497,11 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (bus_dmamem_alloc(isp->isp_cdmat, (void **)&base, BUS_DMA_NOWAIT,
|
||||
&isp->isp_cdmap) != 0) {
|
||||
if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT,
|
||||
&isp->isp_osinfo.cdmap) != 0) {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"cannot allocate %d bytes of CCB memory", len);
|
||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||
bus_dma_tag_destroy(isp->isp_osinfo.cdmat);
|
||||
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
||||
free(isp->isp_xflist, M_DEVBUF);
|
||||
ISP_LOCK(isp);
|
||||
@ -539,7 +520,7 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
}
|
||||
goto bad;
|
||||
}
|
||||
isp_callout_init(&pcmd->wdog);
|
||||
callout_init_mtx(&pcmd->wdog, &isp->isp_osinfo.lock, 0);
|
||||
if (i == isp->isp_maxcmds-1) {
|
||||
pcmd->next = NULL;
|
||||
} else {
|
||||
@ -550,7 +531,7 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
|
||||
im.isp = isp;
|
||||
im.error = 0;
|
||||
bus_dmamap_load(isp->isp_cdmat, isp->isp_cdmap, base, len, imc, &im, 0);
|
||||
bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0);
|
||||
if (im.error) {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"error %d loading dma map for control areas", im.error);
|
||||
@ -564,8 +545,8 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
return (0);
|
||||
|
||||
bad:
|
||||
bus_dmamem_free(isp->isp_cdmat, base, isp->isp_cdmap);
|
||||
bus_dma_tag_destroy(isp->isp_cdmat);
|
||||
bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap);
|
||||
bus_dma_tag_destroy(isp->isp_osinfo.cdmat);
|
||||
free(isp->isp_xflist, M_DEVBUF);
|
||||
free(isp->isp_osinfo.pcmd_pool, M_DEVBUF);
|
||||
isp->isp_rquest = NULL;
|
||||
@ -576,15 +557,13 @@ isp_sbus_mbxdma(ispsoftc_t *isp)
|
||||
typedef struct {
|
||||
ispsoftc_t *isp;
|
||||
void *cmd_token;
|
||||
void *rq;
|
||||
uint32_t *nxtip;
|
||||
uint32_t optr;
|
||||
void *rq; /* original request */
|
||||
int error;
|
||||
bus_size_t mapsize;
|
||||
} mush_t;
|
||||
|
||||
#define MUSHERR_NOQENTRIES -2
|
||||
|
||||
|
||||
static void dma2(void *, bus_dma_segment_t *, int, int);
|
||||
|
||||
static void
|
||||
@ -593,154 +572,84 @@ dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error)
|
||||
mush_t *mp;
|
||||
ispsoftc_t *isp;
|
||||
struct ccb_scsiio *csio;
|
||||
bus_dma_segment_t *eseg;
|
||||
isp_ddir_t ddir;
|
||||
ispreq_t *rq;
|
||||
int seglim, datalen;
|
||||
uint16_t nxti;
|
||||
|
||||
mp = (mush_t *) arg;
|
||||
if (error) {
|
||||
mp->error = error;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nseg < 1) {
|
||||
isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg);
|
||||
mp->error = EFAULT;
|
||||
return;
|
||||
}
|
||||
csio = mp->cmd_token;
|
||||
isp = mp->isp;
|
||||
rq = mp->rq;
|
||||
nxti = *mp->nxtip;
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
||||
bus_dmamap_sync(isp->isp_osinfo.dmat,
|
||||
PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD);
|
||||
} else {
|
||||
bus_dmamap_sync(isp->isp_osinfo.dmat,
|
||||
PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE);
|
||||
}
|
||||
|
||||
datalen = XS_XFRLEN(csio);
|
||||
|
||||
/*
|
||||
* We're passed an initial partially filled in entry that
|
||||
* has most fields filled in except for data transfer
|
||||
* related values.
|
||||
*
|
||||
* Our job is to fill in the initial request queue entry and
|
||||
* then to start allocating and filling in continuation entries
|
||||
* until we've covered the entire transfer.
|
||||
*/
|
||||
|
||||
if (csio->cdb_len > 12) {
|
||||
seglim = 0;
|
||||
} else {
|
||||
seglim = ISP_RQDSEG;
|
||||
}
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
||||
rq->req_flags |= REQFLAG_DATA_IN;
|
||||
} else {
|
||||
rq->req_flags |= REQFLAG_DATA_OUT;
|
||||
}
|
||||
|
||||
eseg = dm_segs + nseg;
|
||||
|
||||
while (datalen != 0 && rq->req_seg_count < seglim && dm_segs != eseg) {
|
||||
rq->req_dataseg[rq->req_seg_count].ds_base = dm_segs->ds_addr;
|
||||
rq->req_dataseg[rq->req_seg_count].ds_count = dm_segs->ds_len;
|
||||
datalen -= dm_segs->ds_len;
|
||||
rq->req_seg_count++;
|
||||
dm_segs++;
|
||||
}
|
||||
|
||||
while (datalen > 0 && dm_segs != eseg) {
|
||||
uint16_t onxti;
|
||||
ispcontreq_t local, *crq = &local, *cqe;
|
||||
|
||||
cqe = (ispcontreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, nxti);
|
||||
onxti = nxti;
|
||||
nxti = ISP_NXT_QENTRY(onxti, RQUEST_QUEUE_LEN(isp));
|
||||
if (nxti == mp->optr) {
|
||||
isp_prt(isp, ISP_LOGDEBUG0, "Request Queue Overflow++");
|
||||
mp->error = MUSHERR_NOQENTRIES;
|
||||
return;
|
||||
if (nseg) {
|
||||
if (sizeof (bus_addr_t) > 4) {
|
||||
if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) {
|
||||
rq->req_header.rqs_entry_type = RQSTYPE_T3RQS;
|
||||
} else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) {
|
||||
rq->req_header.rqs_entry_type = RQSTYPE_A64;
|
||||
}
|
||||
}
|
||||
rq->req_header.rqs_entry_count++;
|
||||
MEMZERO((void *)crq, sizeof (*crq));
|
||||
crq->req_header.rqs_entry_count = 1;
|
||||
crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
|
||||
|
||||
seglim = 0;
|
||||
while (datalen > 0 && seglim < ISP_CDSEG && dm_segs != eseg) {
|
||||
crq->req_dataseg[seglim].ds_base =
|
||||
dm_segs->ds_addr;
|
||||
crq->req_dataseg[seglim].ds_count =
|
||||
dm_segs->ds_len;
|
||||
rq->req_seg_count++;
|
||||
dm_segs++;
|
||||
seglim++;
|
||||
datalen -= dm_segs->ds_len;
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
||||
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD);
|
||||
ddir = ISP_FROM_DEVICE;
|
||||
} else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
|
||||
bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE);
|
||||
ddir = ISP_TO_DEVICE;
|
||||
} else {
|
||||
ddir = ISP_NOXFR;
|
||||
}
|
||||
isp_put_cont_req(isp, crq, cqe);
|
||||
MEMORYBARRIER(isp, SYNC_REQUEST, onxti, QENTRY_LEN);
|
||||
} else {
|
||||
dm_segs = NULL;
|
||||
nseg = 0;
|
||||
ddir = ISP_NOXFR;
|
||||
}
|
||||
|
||||
if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir) != CMD_QUEUED) {
|
||||
mp->error = MUSHERR_NOQENTRIES;
|
||||
}
|
||||
*mp->nxtip = nxti;
|
||||
}
|
||||
|
||||
static int
|
||||
isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, ispreq_t *rq,
|
||||
uint32_t *nxtip, uint32_t optr)
|
||||
isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff)
|
||||
{
|
||||
ispreq_t *qep;
|
||||
mush_t mush, *mp;
|
||||
void (*eptr)(void *, bus_dma_segment_t *, int, int);
|
||||
|
||||
qep = (ispreq_t *) ISP_QUEUE_ENTRY(isp->isp_rquest, isp->isp_reqidx);
|
||||
eptr = dma2;
|
||||
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE ||
|
||||
(csio->dxfer_len == 0)) {
|
||||
rq->req_seg_count = 1;
|
||||
goto mbxsync;
|
||||
}
|
||||
|
||||
/*
|
||||
* Do a virtual grapevine step to collect info for
|
||||
* the callback dma allocation that we have to use...
|
||||
*/
|
||||
mp = &mush;
|
||||
mp->isp = isp;
|
||||
mp->cmd_token = csio;
|
||||
mp->rq = rq;
|
||||
mp->nxtip = nxtip;
|
||||
mp->optr = optr;
|
||||
mp->rq = ff;
|
||||
mp->error = 0;
|
||||
mp->mapsize = 0;
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
|
||||
eptr = dma2;
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE || (csio->dxfer_len == 0)) {
|
||||
(*eptr)(mp, NULL, 0, 0);
|
||||
} else if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) {
|
||||
if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) {
|
||||
int error = bus_dmamap_load(isp->isp_osinfo.dmat,
|
||||
PISP_PCMD(csio)->dmap, csio->data_ptr,
|
||||
csio->dxfer_len, eptr, mp, 0);
|
||||
int error;
|
||||
error = bus_dmamap_load(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, csio->data_ptr, csio->dxfer_len, eptr, mp, 0);
|
||||
#if 0
|
||||
xpt_print(csio->ccb_h.path, "%s: bus_dmamap_load " "ptr %p len %d returned %d\n", __func__, csio->data_ptr, csio->dxfer_len, error);
|
||||
#endif
|
||||
|
||||
if (error == EINPROGRESS) {
|
||||
bus_dmamap_unload(isp->isp_osinfo.dmat,
|
||||
PISP_PCMD(csio)->dmap);
|
||||
bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap);
|
||||
mp->error = EINVAL;
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"deferred dma allocation not supported");
|
||||
isp_prt(isp, ISP_LOGERR, "deferred dma allocation not supported");
|
||||
} else if (error && mp->error == 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"error %d in dma mapping code", error);
|
||||
isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error);
|
||||
#endif
|
||||
mp->error = error;
|
||||
}
|
||||
} else {
|
||||
/* Pointer to physical buffer */
|
||||
struct bus_dma_segment seg;
|
||||
seg.ds_addr = (bus_addr_t)csio->data_ptr;
|
||||
seg.ds_addr = (bus_addr_t)(vm_offset_t)csio->data_ptr;
|
||||
seg.ds_len = csio->dxfer_len;
|
||||
(*eptr)(mp, &seg, 1, 0);
|
||||
}
|
||||
@ -748,12 +657,10 @@ isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, ispreq_t *rq,
|
||||
struct bus_dma_segment *segs;
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DATA_PHYS) != 0) {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"Physical segment pointers unsupported");
|
||||
isp_prt(isp, ISP_LOGERR, "Physical segment pointers unsupported");
|
||||
mp->error = EINVAL;
|
||||
} else if ((csio->ccb_h.flags & CAM_SG_LIST_PHYS) == 0) {
|
||||
isp_prt(isp, ISP_LOGERR,
|
||||
"Virtual segment addresses unsupported");
|
||||
isp_prt(isp, ISP_LOGERR, "Physical SG/LIST Phys segment pointers unsupported");
|
||||
mp->error = EINVAL;
|
||||
} else {
|
||||
/* Just use the segments provided */
|
||||
@ -774,19 +681,6 @@ isp_sbus_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, ispreq_t *rq,
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
mbxsync:
|
||||
if (isp->isp_dblev & ISP_LOGDEBUG1) {
|
||||
isp_print_bytes(isp, "Request Queue Entry", QENTRY_LEN, rq);
|
||||
}
|
||||
switch (rq->req_header.rqs_entry_type) {
|
||||
case RQSTYPE_REQUEST:
|
||||
isp_put_request(isp, rq, qep);
|
||||
break;
|
||||
case RQSTYPE_CMDONLY:
|
||||
isp_put_extended_request(isp, (ispextreq_t *)rq,
|
||||
(ispextreq_t *)qep);
|
||||
break;
|
||||
}
|
||||
return (CMD_QUEUED);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* Copyright (c) 1997-2009 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -24,6 +24,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Structures that derive directly from public standards.
|
||||
@ -43,7 +44,7 @@ typedef struct {
|
||||
uint8_t cs_ctl;
|
||||
uint8_t s_id[3];
|
||||
uint8_t type;
|
||||
uint8_t f_ctl;
|
||||
uint8_t f_ctl[3];
|
||||
uint8_t seq_id;
|
||||
uint8_t df_ctl;
|
||||
uint16_t seq_cnt;
|
||||
@ -136,9 +137,19 @@ typedef struct {
|
||||
uint32_t rftid_fc4types[8];
|
||||
} rft_id_t;
|
||||
|
||||
/*
|
||||
* FCP Response IU Bits of interest
|
||||
* Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
|
||||
*/
|
||||
#define FCP_CONF_REQ 0x10
|
||||
#define FCP_RESID_UNDERFLOW 0x08
|
||||
#define FCP_RESID_OVERFLOW 0x04
|
||||
#define FCP_SNSLEN_VALID 0x02
|
||||
#define FCP_RSPLEN_VALID 0x01
|
||||
|
||||
/*
|
||||
* FCP Response Code Definitions
|
||||
* Source: NCITS T10, Project 1144D, Revision 07a (aka FCP2r07a)
|
||||
* Source: NCITS T10, Project 1144D, Revision 08 (aka FCP2r08)
|
||||
*/
|
||||
#define FCP_RSPNS_CODE_OFFSET 3
|
||||
|
||||
@ -176,7 +187,10 @@ typedef struct {
|
||||
#define ABTX 0x06
|
||||
#define PRLI 0x20
|
||||
#define PRLO 0x21
|
||||
#define SCN 0x22
|
||||
#define TPRLO 0x24
|
||||
#define PDISC 0x50
|
||||
#define ADISC 0x52
|
||||
#define RNC 0x53
|
||||
|
||||
/*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* Copyright (c) 1997-2009 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -24,6 +24,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Qlogic Target Mode Structure and Flag Definitions
|
||||
@ -31,858 +32,56 @@
|
||||
#ifndef _ISP_TARGET_H
|
||||
#define _ISP_TARGET_H
|
||||
|
||||
#define QLTM_SENSELEN 18 /* non-FC cards only */
|
||||
#define QLTM_SVALID 0x80
|
||||
|
||||
/*
|
||||
* Structure for Enable Lun and Modify Lun queue entries
|
||||
* Notify structure- these are for asynchronous events that need to be sent
|
||||
* as notifications to the outer layer. It should be pretty self-explanatory.
|
||||
*/
|
||||
typedef struct {
|
||||
isphdr_t le_header;
|
||||
uint32_t le_reserved;
|
||||
uint8_t le_lun;
|
||||
uint8_t le_rsvd;
|
||||
uint8_t le_ops; /* Modify LUN only */
|
||||
uint8_t le_tgt; /* Not for FC */
|
||||
uint32_t le_flags; /* Not for FC */
|
||||
uint8_t le_status;
|
||||
uint8_t le_reserved2;
|
||||
uint8_t le_cmd_count;
|
||||
uint8_t le_in_count;
|
||||
uint8_t le_cdb6len; /* Not for FC */
|
||||
uint8_t le_cdb7len; /* Not for FC */
|
||||
uint16_t le_timeout;
|
||||
uint16_t le_reserved3[20];
|
||||
} lun_entry_t;
|
||||
|
||||
/*
|
||||
* le_flags values
|
||||
*/
|
||||
#define LUN_TQAE 0x00000002 /* bit1 Tagged Queue Action Enable */
|
||||
#define LUN_DSSM 0x01000000 /* bit24 Disable Sending SDP Message */
|
||||
#define LUN_DISAD 0x02000000 /* bit25 Disable autodisconnect */
|
||||
#define LUN_DM 0x40000000 /* bit30 Disconnects Mandatory */
|
||||
|
||||
/*
|
||||
* le_ops values
|
||||
*/
|
||||
#define LUN_CCINCR 0x01 /* increment command count */
|
||||
#define LUN_CCDECR 0x02 /* decrement command count */
|
||||
#define LUN_ININCR 0x40 /* increment immed. notify count */
|
||||
#define LUN_INDECR 0x80 /* decrement immed. notify count */
|
||||
|
||||
/*
|
||||
* le_status values
|
||||
*/
|
||||
#define LUN_OK 0x01 /* we be rockin' */
|
||||
#define LUN_ERR 0x04 /* request completed with error */
|
||||
#define LUN_INVAL 0x06 /* invalid request */
|
||||
#define LUN_NOCAP 0x16 /* can't provide requested capability */
|
||||
#define LUN_ENABLED 0x3E /* LUN already enabled */
|
||||
|
||||
/*
|
||||
* Immediate Notify Entry structure
|
||||
*/
|
||||
#define IN_MSGLEN 8 /* 8 bytes */
|
||||
#define IN_RSVDLEN 8 /* 8 words */
|
||||
typedef struct {
|
||||
isphdr_t in_header;
|
||||
uint32_t in_reserved;
|
||||
uint8_t in_lun; /* lun */
|
||||
uint8_t in_iid; /* initiator */
|
||||
uint8_t in_reserved2;
|
||||
uint8_t in_tgt; /* target */
|
||||
uint32_t in_flags;
|
||||
uint8_t in_status;
|
||||
uint8_t in_rsvd2;
|
||||
uint8_t in_tag_val; /* tag value */
|
||||
uint8_t in_tag_type; /* tag type */
|
||||
uint16_t in_seqid; /* sequence id */
|
||||
uint8_t in_msg[IN_MSGLEN]; /* SCSI message bytes */
|
||||
uint16_t in_reserved3[IN_RSVDLEN];
|
||||
uint8_t in_sense[QLTM_SENSELEN];/* suggested sense data */
|
||||
} in_entry_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t in_header;
|
||||
uint32_t in_reserved;
|
||||
uint8_t in_lun; /* lun */
|
||||
uint8_t in_iid; /* initiator */
|
||||
uint16_t in_scclun;
|
||||
uint32_t in_reserved2;
|
||||
uint16_t in_status;
|
||||
uint16_t in_task_flags;
|
||||
uint16_t in_seqid; /* sequence id */
|
||||
} in_fcentry_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t in_header;
|
||||
uint32_t in_reserved;
|
||||
uint16_t in_iid; /* initiator */
|
||||
uint16_t in_scclun;
|
||||
uint32_t in_reserved2;
|
||||
uint16_t in_status;
|
||||
uint16_t in_task_flags;
|
||||
uint16_t in_seqid; /* sequence id */
|
||||
} in_fcentry_e_t;
|
||||
|
||||
/*
|
||||
* Values for the in_status field
|
||||
*/
|
||||
#define IN_REJECT 0x0D /* Message Reject message received */
|
||||
#define IN_RESET 0x0E /* Bus Reset occurred */
|
||||
#define IN_NO_RCAP 0x16 /* requested capability not available */
|
||||
#define IN_IDE_RECEIVED 0x33 /* Initiator Detected Error msg received */
|
||||
#define IN_RSRC_UNAVAIL 0x34 /* resource unavailable */
|
||||
#define IN_MSG_RECEIVED 0x36 /* SCSI message received */
|
||||
#define IN_ABORT_TASK 0x20 /* task named in RX_ID is being aborted (FC) */
|
||||
#define IN_PORT_LOGOUT 0x29 /* port has logged out (FC) */
|
||||
#define IN_PORT_CHANGED 0x2A /* port changed */
|
||||
#define IN_GLOBAL_LOGO 0x2E /* all ports logged out */
|
||||
#define IN_NO_NEXUS 0x3B /* Nexus not established */
|
||||
|
||||
/*
|
||||
* Values for the in_task_flags field- should only get one at a time!
|
||||
*/
|
||||
#define TASK_FLAGS_RESERVED_MASK (0xe700)
|
||||
#define TASK_FLAGS_CLEAR_ACA (1<<14)
|
||||
#define TASK_FLAGS_TARGET_RESET (1<<13)
|
||||
#define TASK_FLAGS_LUN_RESET (1<<12)
|
||||
#define TASK_FLAGS_CLEAR_TASK_SET (1<<10)
|
||||
#define TASK_FLAGS_ABORT_TASK_SET (1<<9)
|
||||
|
||||
/*
|
||||
* ISP24XX Immediate Notify
|
||||
*/
|
||||
typedef struct {
|
||||
isphdr_t in_header;
|
||||
uint32_t in_reserved;
|
||||
uint16_t in_nphdl;
|
||||
uint16_t in_reserved1;
|
||||
uint16_t in_flags;
|
||||
uint16_t in_srr_rxid;
|
||||
uint16_t in_status;
|
||||
uint8_t in_status_subcode;
|
||||
uint8_t in_reserved2;
|
||||
uint32_t in_rxid;
|
||||
uint16_t in_srr_reloff_lo;
|
||||
uint16_t in_srr_reloff_hi;
|
||||
uint16_t in_srr_iu;
|
||||
uint16_t in_srr_oxid;
|
||||
uint8_t in_reserved3[18];
|
||||
uint8_t in_reserved4;
|
||||
uint8_t in_vpindex;
|
||||
uint32_t in_reserved5;
|
||||
uint16_t in_portid_lo;
|
||||
uint8_t in_portid_hi;
|
||||
uint8_t in_reserved6;
|
||||
uint16_t in_reserved7;
|
||||
uint16_t in_oxid;
|
||||
} in_fcentry_24xx_t;
|
||||
|
||||
#define IN24XX_FLAG_PUREX_IOCB 0x1
|
||||
#define IN24XX_FLAG_GLOBAL_LOGOUT 0x2
|
||||
|
||||
#define IN24XX_LIP_RESET 0x0E
|
||||
#define IN24XX_LINK_RESET 0x0F
|
||||
#define IN24XX_PORT_LOGOUT 0x29
|
||||
#define IN24XX_PORT_CHANGED 0x2A
|
||||
#define IN24XX_LINK_FAILED 0x2E
|
||||
#define IN24XX_SRR_RCVD 0x45
|
||||
#define IN24XX_ELS_RCVD 0x46 /*
|
||||
* login-affectin ELS received- check
|
||||
* subcode for specific opcode
|
||||
*/
|
||||
/*
|
||||
* Notify Acknowledge Entry structure
|
||||
*/
|
||||
#define NA_RSVDLEN 22
|
||||
typedef struct {
|
||||
isphdr_t na_header;
|
||||
uint32_t na_reserved;
|
||||
uint8_t na_lun; /* lun */
|
||||
uint8_t na_iid; /* initiator */
|
||||
uint8_t na_reserved2;
|
||||
uint8_t na_tgt; /* target */
|
||||
uint32_t na_flags;
|
||||
uint8_t na_status;
|
||||
uint8_t na_event;
|
||||
uint16_t na_seqid; /* sequence id */
|
||||
uint16_t na_reserved3[NA_RSVDLEN];
|
||||
} na_entry_t;
|
||||
|
||||
/*
|
||||
* Value for the na_event field
|
||||
*/
|
||||
#define NA_RST_CLRD 0x80 /* Clear an async event notification */
|
||||
#define NA_OK 0x01 /* Notify Acknowledge Succeeded */
|
||||
#define NA_INVALID 0x06 /* Invalid Notify Acknowledge */
|
||||
|
||||
#define NA2_RSVDLEN 21
|
||||
typedef struct {
|
||||
isphdr_t na_header;
|
||||
uint32_t na_reserved;
|
||||
uint8_t na_reserved1;
|
||||
uint8_t na_iid; /* initiator loop id */
|
||||
uint16_t na_response;
|
||||
uint16_t na_flags;
|
||||
uint16_t na_reserved2;
|
||||
uint16_t na_status;
|
||||
uint16_t na_task_flags;
|
||||
uint16_t na_seqid; /* sequence id */
|
||||
uint16_t na_reserved3[NA2_RSVDLEN];
|
||||
} na_fcentry_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t na_header;
|
||||
uint32_t na_reserved;
|
||||
uint16_t na_iid; /* initiator loop id */
|
||||
uint16_t na_response; /* response code */
|
||||
uint16_t na_flags;
|
||||
uint16_t na_reserved2;
|
||||
uint16_t na_status;
|
||||
uint16_t na_task_flags;
|
||||
uint16_t na_seqid; /* sequence id */
|
||||
uint16_t na_reserved3[NA2_RSVDLEN];
|
||||
} na_fcentry_e_t;
|
||||
|
||||
#define NAFC_RCOUNT 0x80 /* increment resource count */
|
||||
#define NAFC_RST_CLRD 0x20 /* Clear LIP Reset */
|
||||
#define NAFC_TVALID 0x10 /* task mangement response code is valid */
|
||||
|
||||
/*
|
||||
* ISP24XX Notify Acknowledge
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
isphdr_t na_header;
|
||||
uint32_t na_handle;
|
||||
uint16_t na_nphdl;
|
||||
uint16_t na_reserved1;
|
||||
uint16_t na_flags;
|
||||
uint16_t na_srr_rxid;
|
||||
uint16_t na_status;
|
||||
uint8_t na_status_subcode;
|
||||
uint8_t na_reserved2;
|
||||
uint32_t na_rxid;
|
||||
uint16_t na_srr_reloff_lo;
|
||||
uint16_t na_srr_reloff_hi;
|
||||
uint16_t na_srr_iu;
|
||||
uint16_t na_srr_flags;
|
||||
uint8_t na_reserved3[18];
|
||||
uint8_t na_reserved4;
|
||||
uint8_t na_vpindex;
|
||||
uint8_t na_srr_reject_vunique;
|
||||
uint8_t na_srr_reject_explanation;
|
||||
uint8_t na_srr_reject_code;
|
||||
uint8_t na_reserved5;
|
||||
uint8_t na_reserved6[6];
|
||||
uint16_t na_oxid;
|
||||
} na_fcentry_24xx_t;
|
||||
|
||||
/*
|
||||
* Accept Target I/O Entry structure
|
||||
*/
|
||||
#define ATIO_CDBLEN 26
|
||||
|
||||
typedef struct {
|
||||
isphdr_t at_header;
|
||||
uint16_t at_reserved;
|
||||
uint16_t at_handle;
|
||||
uint8_t at_lun; /* lun */
|
||||
uint8_t at_iid; /* initiator */
|
||||
uint8_t at_cdblen; /* cdb length */
|
||||
uint8_t at_tgt; /* target */
|
||||
uint32_t at_flags;
|
||||
uint8_t at_status; /* firmware status */
|
||||
uint8_t at_scsi_status; /* scsi status */
|
||||
uint8_t at_tag_val; /* tag value */
|
||||
uint8_t at_tag_type; /* tag type */
|
||||
uint8_t at_cdb[ATIO_CDBLEN]; /* received CDB */
|
||||
uint8_t at_sense[QLTM_SENSELEN];/* suggested sense data */
|
||||
} at_entry_t;
|
||||
|
||||
/*
|
||||
* at_flags values
|
||||
*/
|
||||
#define AT_NODISC 0x00008000 /* disconnect disabled */
|
||||
#define AT_TQAE 0x00000002 /* Tagged Queue Action enabled */
|
||||
|
||||
/*
|
||||
* at_status values
|
||||
*/
|
||||
#define AT_PATH_INVALID 0x07 /* ATIO sent to firmware for disabled lun */
|
||||
#define AT_RESET 0x0E /* SCSI Bus Reset Occurred */
|
||||
#define AT_PHASE_ERROR 0x14 /* Bus phase sequence error */
|
||||
#define AT_NOCAP 0x16 /* Requested capability not available */
|
||||
#define AT_BDR_MSG 0x17 /* Bus Device Reset msg received */
|
||||
#define AT_CDB 0x3D /* CDB received */
|
||||
/*
|
||||
* Macros to create and fetch and test concatenated handle and tag value macros
|
||||
*/
|
||||
|
||||
#define AT_MAKE_TAGID(tid, bus, inst, aep) \
|
||||
tid = aep->at_handle; \
|
||||
if (aep->at_flags & AT_TQAE) { \
|
||||
tid |= (aep->at_tag_val << 16); \
|
||||
tid |= (1 << 24); \
|
||||
} \
|
||||
tid |= (bus << 25); \
|
||||
tid |= (inst << 26)
|
||||
|
||||
#define CT_MAKE_TAGID(tid, bus, inst, ct) \
|
||||
tid = ct->ct_fwhandle; \
|
||||
if (ct->ct_flags & CT_TQAE) { \
|
||||
tid |= (ct->ct_tag_val << 16); \
|
||||
tid |= (1 << 24); \
|
||||
} \
|
||||
tid |= ((bus & 0x1) << 25); \
|
||||
tid |= (inst << 26)
|
||||
|
||||
#define AT_HAS_TAG(val) ((val) & (1 << 24))
|
||||
#define AT_GET_TAG(val) (((val) >> 16) & 0xff)
|
||||
#define AT_GET_INST(val) (((val) >> 26) & 0x3f)
|
||||
#define AT_GET_BUS(val) (((val) >> 25) & 0x1)
|
||||
#define AT_GET_HANDLE(val) ((val) & 0xffff)
|
||||
|
||||
#define IN_MAKE_TAGID(tid, bus, inst, inp) \
|
||||
tid = inp->in_seqid; \
|
||||
tid |= (inp->in_tag_val << 16); \
|
||||
tid |= (1 << 24); \
|
||||
tid |= (bus << 25); \
|
||||
tid |= (inst << 26)
|
||||
|
||||
#define TAG_INSERT_INST(tid, inst) \
|
||||
tid &= ~(0x3ffffff); \
|
||||
tid |= (inst << 26)
|
||||
|
||||
#define TAG_INSERT_BUS(tid, bus) \
|
||||
tid &= ~(1 << 25); \
|
||||
tid |= (bus << 25)
|
||||
|
||||
/*
|
||||
* Accept Target I/O Entry structure, Type 2
|
||||
*/
|
||||
#define ATIO2_CDBLEN 16
|
||||
|
||||
typedef struct {
|
||||
isphdr_t at_header;
|
||||
uint32_t at_reserved;
|
||||
uint8_t at_lun; /* lun or reserved */
|
||||
uint8_t at_iid; /* initiator */
|
||||
uint16_t at_rxid; /* response ID */
|
||||
uint16_t at_flags;
|
||||
uint16_t at_status; /* firmware status */
|
||||
uint8_t at_crn; /* command reference number */
|
||||
uint8_t at_taskcodes;
|
||||
uint8_t at_taskflags;
|
||||
uint8_t at_execodes;
|
||||
uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
|
||||
uint32_t at_datalen; /* allocated data len */
|
||||
uint16_t at_scclun; /* SCC Lun or reserved */
|
||||
uint16_t at_wwpn[4]; /* WWPN of initiator */
|
||||
uint16_t at_reserved2[6];
|
||||
uint16_t at_oxid;
|
||||
} at2_entry_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t at_header;
|
||||
uint32_t at_reserved;
|
||||
uint16_t at_iid; /* initiator */
|
||||
uint16_t at_rxid; /* response ID */
|
||||
uint16_t at_flags;
|
||||
uint16_t at_status; /* firmware status */
|
||||
uint8_t at_crn; /* command reference number */
|
||||
uint8_t at_taskcodes;
|
||||
uint8_t at_taskflags;
|
||||
uint8_t at_execodes;
|
||||
uint8_t at_cdb[ATIO2_CDBLEN]; /* received CDB */
|
||||
uint32_t at_datalen; /* allocated data len */
|
||||
uint16_t at_scclun; /* SCC Lun or reserved */
|
||||
uint16_t at_wwpn[4]; /* WWPN of initiator */
|
||||
uint16_t at_reserved2[6];
|
||||
uint16_t at_oxid;
|
||||
} at2e_entry_t;
|
||||
|
||||
#define ATIO2_WWPN_OFFSET 0x2A
|
||||
#define ATIO2_OXID_OFFSET 0x3E
|
||||
|
||||
#define ATIO2_TC_ATTR_MASK 0x7
|
||||
#define ATIO2_TC_ATTR_SIMPLEQ 0
|
||||
#define ATIO2_TC_ATTR_HEADOFQ 1
|
||||
#define ATIO2_TC_ATTR_ORDERED 2
|
||||
#define ATIO2_TC_ATTR_ACAQ 4
|
||||
#define ATIO2_TC_ATTR_UNTAGGED 5
|
||||
|
||||
#define ATIO2_EX_WRITE 0x1
|
||||
#define ATIO2_EX_READ 0x2
|
||||
/*
|
||||
* Macros to create and fetch and test concatenated handle and tag value macros
|
||||
*/
|
||||
#define AT2_MAKE_TAGID(tid, bus, inst, aep) \
|
||||
tid = aep->at_rxid; \
|
||||
tid |= (((uint64_t)inst) << 32); \
|
||||
tid |= (((uint64_t)bus) << 48)
|
||||
|
||||
#define CT2_MAKE_TAGID(tid, bus, inst, ct) \
|
||||
tid = ct->ct_rxid; \
|
||||
tid |= (((uint64_t)inst) << 32); \
|
||||
tid |= (((uint64_t)(bus & 0xff)) << 48)
|
||||
|
||||
#define AT2_HAS_TAG(val) 1
|
||||
#define AT2_GET_TAG(val) ((val) & 0xffffffff)
|
||||
#define AT2_GET_INST(val) ((val) >> 32)
|
||||
#define AT2_GET_HANDLE AT2_GET_TAG
|
||||
#define AT2_GET_BUS(val) (((val) >> 48) & 0xff)
|
||||
|
||||
#define FC_HAS_TAG AT2_HAS_TAG
|
||||
#define FC_GET_TAG AT2_GET_TAG
|
||||
#define FC_GET_INST AT2_GET_INST
|
||||
#define FC_GET_HANDLE AT2_GET_HANDLE
|
||||
|
||||
#define IN_FC_MAKE_TAGID(tid, bus, inst, seqid) \
|
||||
tid = seqid; \
|
||||
tid |= (((uint64_t)inst) << 32); \
|
||||
tid |= (((uint64_t)(bus & 0xff)) << 48)
|
||||
|
||||
#define FC_TAG_INSERT_INST(tid, inst) \
|
||||
tid &= ~0xffff00000000ull; \
|
||||
tid |= (((uint64_t)inst) << 32)
|
||||
|
||||
/*
|
||||
* 24XX ATIO Definition
|
||||
*
|
||||
* This is *quite* different from other entry types.
|
||||
* First of all, it has its own queue it comes in on.
|
||||
*
|
||||
* Secondly, it doesn't have a normal header.
|
||||
*
|
||||
* Thirdly, it's just a passthru of the FCP CMND IU
|
||||
* which is recorded in big endian mode.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t at_type;
|
||||
uint8_t at_count;
|
||||
/*
|
||||
* Task attribute in high four bits,
|
||||
* the rest is the FCP CMND IU Length.
|
||||
* NB: the command can extend past the
|
||||
* length for a single queue entry.
|
||||
*/
|
||||
uint16_t at_ta_len;
|
||||
uint32_t at_rxid;
|
||||
fc_hdr_t at_hdr;
|
||||
fcp_cmnd_iu_t at_cmnd;
|
||||
} at7_entry_t;
|
||||
|
||||
|
||||
/*
|
||||
* Continue Target I/O Entry structure
|
||||
* Request from driver. The response from the
|
||||
* ISP firmware is the same except that the last 18
|
||||
* bytes are overwritten by suggested sense data if
|
||||
* the 'autosense valid' bit is set in the status byte.
|
||||
*/
|
||||
typedef struct {
|
||||
isphdr_t ct_header;
|
||||
uint16_t ct_syshandle;
|
||||
uint16_t ct_fwhandle; /* required by f/w */
|
||||
uint8_t ct_lun; /* lun */
|
||||
uint8_t ct_iid; /* initiator id */
|
||||
uint8_t ct_reserved2;
|
||||
uint8_t ct_tgt; /* our target id */
|
||||
uint32_t ct_flags;
|
||||
uint8_t ct_status; /* isp status */
|
||||
uint8_t ct_scsi_status; /* scsi status */
|
||||
uint8_t ct_tag_val; /* tag value */
|
||||
uint8_t ct_tag_type; /* tag type */
|
||||
uint32_t ct_xfrlen; /* transfer length */
|
||||
uint32_t ct_resid; /* residual length */
|
||||
uint16_t ct_timeout;
|
||||
uint16_t ct_seg_count;
|
||||
ispds_t ct_dataseg[ISP_RQDSEG];
|
||||
} ct_entry_t;
|
||||
|
||||
/*
|
||||
* For some of the dual port SCSI adapters, port (bus #) is reported
|
||||
* in the MSbit of ct_iid. Bit fields are a bit too awkward here.
|
||||
*
|
||||
* Note that this does not apply to FC adapters at all which can and
|
||||
* do report IIDs between 0x81 && 0xfe (or 0x7ff) which represent devices
|
||||
* that have logged in across a SCSI fabric.
|
||||
*/
|
||||
#define GET_IID_VAL(x) (x & 0x3f)
|
||||
#define GET_BUS_VAL(x) ((x >> 7) & 0x1)
|
||||
#define SET_IID_VAL(y, x) y = ((y & ~0x3f) | (x & 0x3f))
|
||||
#define SET_BUS_VAL(y, x) y = ((y & 0x3f) | ((x & 0x1) << 7))
|
||||
|
||||
/*
|
||||
* ct_flags values
|
||||
*/
|
||||
#define CT_TQAE 0x00000002 /* bit 1, Tagged Queue Action enable */
|
||||
#define CT_DATA_IN 0x00000040 /* bits 6&7, Data direction */
|
||||
#define CT_DATA_OUT 0x00000080 /* bits 6&7, Data direction */
|
||||
#define CT_NO_DATA 0x000000C0 /* bits 6&7, Data direction */
|
||||
#define CT_CCINCR 0x00000100 /* bit 8, autoincrement atio count */
|
||||
#define CT_DATAMASK 0x000000C0 /* bits 6&7, Data direction */
|
||||
#define CT_INISYNCWIDE 0x00004000 /* bit 14, Do Sync/Wide Negotiation */
|
||||
#define CT_NODISC 0x00008000 /* bit 15, Disconnects disabled */
|
||||
#define CT_DSDP 0x01000000 /* bit 24, Disable Save Data Pointers */
|
||||
#define CT_SENDRDP 0x04000000 /* bit 26, Send Restore Pointers msg */
|
||||
#define CT_SENDSTATUS 0x80000000 /* bit 31, Send SCSI status byte */
|
||||
|
||||
/*
|
||||
* ct_status values
|
||||
* - set by the firmware when it returns the CTIO
|
||||
*/
|
||||
#define CT_OK 0x01 /* completed without error */
|
||||
#define CT_ABORTED 0x02 /* aborted by host */
|
||||
#define CT_ERR 0x04 /* see sense data for error */
|
||||
#define CT_INVAL 0x06 /* request for disabled lun */
|
||||
#define CT_NOPATH 0x07 /* invalid ITL nexus */
|
||||
#define CT_INVRXID 0x08 /* (FC only) Invalid RX_ID */
|
||||
#define CT_DATA_OVER 0x09 /* (FC only) Data Overrun */
|
||||
#define CT_RSELTMO 0x0A /* reselection timeout after 2 tries */
|
||||
#define CT_TIMEOUT 0x0B /* timed out */
|
||||
#define CT_RESET 0x0E /* SCSI Bus Reset occurred */
|
||||
#define CT_PARITY 0x0F /* Uncorrectable Parity Error */
|
||||
#define CT_BUS_ERROR 0x10 /* (FC Only) DMA PCI Error */
|
||||
#define CT_PANIC 0x13 /* Unrecoverable Error */
|
||||
#define CT_PHASE_ERROR 0x14 /* Bus phase sequence error */
|
||||
#define CT_DATA_UNDER 0x15 /* (FC only) Data Underrun */
|
||||
#define CT_BDR_MSG 0x17 /* Bus Device Reset msg received */
|
||||
#define CT_TERMINATED 0x19 /* due to Terminate Transfer mbox cmd */
|
||||
#define CT_PORTUNAVAIL 0x28 /* port not available */
|
||||
#define CT_LOGOUT 0x29 /* port logout */
|
||||
#define CT_PORTCHANGED 0x2A /* port changed */
|
||||
#define CT_IDE 0x33 /* Initiator Detected Error */
|
||||
#define CT_NOACK 0x35 /* Outstanding Immed. Notify. entry */
|
||||
#define CT_SRR 0x45 /* SRR Received */
|
||||
#define CT_LUN_RESET 0x48 /* Lun Reset Received */
|
||||
|
||||
/*
|
||||
* When the firmware returns a CTIO entry, it may overwrite the last
|
||||
* part of the structure with sense data. This starts at offset 0x2E
|
||||
* into the entry, which is in the middle of ct_dataseg[1]. Rather
|
||||
* than define a new struct for this, I'm just using the sense data
|
||||
* offset.
|
||||
*/
|
||||
#define CTIO_SENSE_OFFSET 0x2E
|
||||
|
||||
/*
|
||||
* Entry length in u_longs. All entries are the same size so
|
||||
* any one will do as the numerator.
|
||||
*/
|
||||
#define UINT32_ENTRY_SIZE (sizeof(at_entry_t)/sizeof(uint32_t))
|
||||
|
||||
/*
|
||||
* QLA2100 CTIO (type 2) entry
|
||||
*/
|
||||
#define MAXRESPLEN 26
|
||||
typedef struct {
|
||||
isphdr_t ct_header;
|
||||
uint32_t ct_syshandle;
|
||||
uint8_t ct_lun; /* lun */
|
||||
uint8_t ct_iid; /* initiator id */
|
||||
uint16_t ct_rxid; /* response ID */
|
||||
uint16_t ct_flags;
|
||||
uint16_t ct_status; /* isp status */
|
||||
uint16_t ct_timeout;
|
||||
uint16_t ct_seg_count;
|
||||
uint32_t ct_reloff; /* relative offset */
|
||||
int32_t ct_resid; /* residual length */
|
||||
union {
|
||||
/*
|
||||
* The three different modes that the target driver
|
||||
* can set the CTIO{2,3,4} up as.
|
||||
*
|
||||
* The first is for sending FCP_DATA_IUs as well as
|
||||
* (optionally) sending a terminal SCSI status FCP_RSP_IU.
|
||||
*
|
||||
* The second is for sending SCSI sense data in an FCP_RSP_IU.
|
||||
* Note that no FCP_DATA_IUs will be sent.
|
||||
*
|
||||
* The third is for sending FCP_RSP_IUs as built specifically
|
||||
* in system memory as located by the isp_dataseg.
|
||||
*/
|
||||
struct {
|
||||
uint32_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t ct_scsi_status;
|
||||
uint32_t ct_xfrlen;
|
||||
union {
|
||||
ispds_t ct_dataseg[ISP_RQDSEG_T2];
|
||||
ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
|
||||
ispdslist_t ct_dslist;
|
||||
} u;
|
||||
} m0;
|
||||
struct {
|
||||
uint16_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t ct_senselen;
|
||||
uint16_t ct_scsi_status;
|
||||
uint16_t ct_resplen;
|
||||
uint8_t ct_resp[MAXRESPLEN];
|
||||
} m1;
|
||||
struct {
|
||||
uint32_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t _reserved3;
|
||||
uint32_t ct_datalen;
|
||||
ispds_t ct_fcp_rsp_iudata;
|
||||
} m2;
|
||||
} rsp;
|
||||
} ct2_entry_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t ct_header;
|
||||
uint32_t ct_syshandle;
|
||||
uint16_t ct_iid; /* initiator id */
|
||||
uint16_t ct_rxid; /* response ID */
|
||||
uint16_t ct_flags;
|
||||
uint16_t ct_status; /* isp status */
|
||||
uint16_t ct_timeout;
|
||||
uint16_t ct_seg_count;
|
||||
uint32_t ct_reloff; /* relative offset */
|
||||
int32_t ct_resid; /* residual length */
|
||||
union {
|
||||
struct {
|
||||
uint32_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t ct_scsi_status;
|
||||
uint32_t ct_xfrlen;
|
||||
union {
|
||||
ispds_t ct_dataseg[ISP_RQDSEG_T2];
|
||||
ispds64_t ct_dataseg64[ISP_RQDSEG_T3];
|
||||
ispdslist_t ct_dslist;
|
||||
} u;
|
||||
} m0;
|
||||
struct {
|
||||
uint16_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t ct_senselen;
|
||||
uint16_t ct_scsi_status;
|
||||
uint16_t ct_resplen;
|
||||
uint8_t ct_resp[MAXRESPLEN];
|
||||
} m1;
|
||||
struct {
|
||||
uint32_t _reserved;
|
||||
uint16_t _reserved2;
|
||||
uint16_t _reserved3;
|
||||
uint32_t ct_datalen;
|
||||
ispds_t ct_fcp_rsp_iudata;
|
||||
} m2;
|
||||
} rsp;
|
||||
} ct2e_entry_t;
|
||||
|
||||
/*
|
||||
* ct_flags values for CTIO2
|
||||
*/
|
||||
#define CT2_FLAG_MODE0 0x0000
|
||||
#define CT2_FLAG_MODE1 0x0001
|
||||
#define CT2_FLAG_MODE2 0x0002
|
||||
#define CT2_FLAG_MMASK 0x0003
|
||||
#define CT2_DATA_IN 0x0040
|
||||
#define CT2_DATA_OUT 0x0080
|
||||
#define CT2_NO_DATA 0x00C0
|
||||
#define CT2_DATAMASK 0x00C0
|
||||
#define CT2_CCINCR 0x0100
|
||||
#define CT2_FASTPOST 0x0200
|
||||
#define CT2_CONFIRM 0x2000
|
||||
#define CT2_TERMINATE 0x4000
|
||||
#define CT2_SENDSTATUS 0x8000
|
||||
|
||||
/*
|
||||
* ct_status values are (mostly) the same as that for ct_entry.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ct_scsi_status values- the low 8 bits are the normal SCSI status
|
||||
* we know and love. The upper 8 bits are validity markers for FCP_RSP_IU
|
||||
* fields.
|
||||
*/
|
||||
#define CT2_RSPLEN_VALID 0x0100
|
||||
#define CT2_SNSLEN_VALID 0x0200
|
||||
#define CT2_DATA_OVER 0x0400
|
||||
#define CT2_DATA_UNDER 0x0800
|
||||
|
||||
/*
|
||||
* ISP24XX CTIO
|
||||
*/
|
||||
#define MAXRESPLEN_24XX 24
|
||||
typedef struct {
|
||||
isphdr_t ct_header;
|
||||
uint32_t ct_syshandle;
|
||||
uint16_t ct_nphdl; /* status on returned CTIOs */
|
||||
uint16_t ct_timeout;
|
||||
uint16_t ct_seg_count;
|
||||
uint8_t ct_vpindex;
|
||||
uint8_t ct_xflags;
|
||||
uint16_t ct_iid_lo; /* low 16 bits of portid */
|
||||
uint8_t ct_iid_hi; /* hi 8 bits of portid */
|
||||
uint8_t ct_reserved;
|
||||
uint32_t ct_rxid;
|
||||
uint16_t ct_senselen; /* mode 0 only */
|
||||
uint16_t ct_flags;
|
||||
int32_t ct_resid; /* residual length */
|
||||
uint16_t ct_oxid;
|
||||
uint16_t ct_scsi_status; /* modes 0 && 1 only */
|
||||
union {
|
||||
struct {
|
||||
uint32_t reloff;
|
||||
uint32_t reserved0;
|
||||
uint32_t ct_xfrlen;
|
||||
uint32_t reserved1;
|
||||
ispds64_t ds;
|
||||
} m0;
|
||||
struct {
|
||||
uint16_t ct_resplen;
|
||||
uint16_t reserved;
|
||||
uint8_t ct_resp[MAXRESPLEN_24XX];
|
||||
} m1;
|
||||
struct {
|
||||
uint32_t reserved0;
|
||||
uint32_t ct_datalen;
|
||||
uint32_t reserved1;
|
||||
ispds64_t ct_fcp_rsp_iudata;
|
||||
} m2;
|
||||
} rsp;
|
||||
} ct7_entry_t;
|
||||
|
||||
/*
|
||||
* ct_flags values for CTIO7
|
||||
*/
|
||||
#define CT7_DATA_IN 0x0002
|
||||
#define CT7_DATA_OUT 0x0001
|
||||
#define CT7_NO_DATA 0x0000
|
||||
#define CT7_DATAMASK 0x003
|
||||
#define CT7_DSD_ENABLE 0x0004
|
||||
#define CT7_CONF_STSFD 0x0010
|
||||
#define CT7_EXPLCT_CONF 0x0020
|
||||
#define CT7_FLAG_MODE0 0x0000
|
||||
#define CT7_FLAG_MODE1 0x0040
|
||||
#define CT7_FLAG_MODE7 0x0080
|
||||
#define CT7_FLAG_MMASK 0x00C0
|
||||
#define CT7_FASTPOST 0x0100
|
||||
#define CT7_ATTR_MASK 0x1e00 /* task attributes from atio7 */
|
||||
#define CT7_CONFIRM 0x2000
|
||||
#define CT7_TERMINATE 0x4000
|
||||
#define CT7_SENDSTATUS 0x8000
|
||||
|
||||
/*
|
||||
* Type 7 CTIO status codes
|
||||
*/
|
||||
#define CT7_OK 0x01 /* completed without error */
|
||||
#define CT7_ABORTED 0x02 /* aborted by host */
|
||||
#define CT7_ERR 0x04 /* see sense data for error */
|
||||
#define CT7_INVAL 0x06 /* request for disabled lun */
|
||||
#define CT7_INVRXID 0x08 /* (FC only) Invalid RX_ID */
|
||||
#define CT7_DATA_OVER 0x09 /* (FC only) Data Overrun */
|
||||
#define CT7_TIMEOUT 0x0B /* timed out */
|
||||
#define CT7_RESET 0x0E /* LIP Rset Received */
|
||||
#define CT7_BUS_ERROR 0x10 /* DMA PCI Error */
|
||||
#define CT7_REASSY_ERR 0x11 /* DMA reassembly error */
|
||||
#define CT7_DATA_UNDER 0x15 /* (FC only) Data Underrun */
|
||||
#define CT7_PORTUNAVAIL 0x28 /* port not available */
|
||||
#define CT7_LOGOUT 0x29 /* port logout */
|
||||
#define CT7_PORTCHANGED 0x2A /* port changed */
|
||||
#define CT7_SRR 0x45 /* SRR Received */
|
||||
|
||||
/*
|
||||
* Other 24XX related target IOCBs
|
||||
*/
|
||||
|
||||
/*
|
||||
* ABTS Received
|
||||
*/
|
||||
typedef struct {
|
||||
isphdr_t abts_header;
|
||||
uint8_t abts_reserved0[6];
|
||||
uint16_t abts_nphdl;
|
||||
uint16_t abts_reserved1;
|
||||
uint16_t abts_sof;
|
||||
uint32_t abts_rxid_abts;
|
||||
uint16_t abts_did_lo;
|
||||
uint8_t abts_did_hi;
|
||||
uint8_t abts_r_ctl;
|
||||
uint16_t abts_sid_lo;
|
||||
uint8_t abts_sid_hi;
|
||||
uint8_t abts_cs_ctl;
|
||||
uint16_t abts_fs_ctl;
|
||||
uint8_t abts_f_ctl;
|
||||
uint8_t abts_type;
|
||||
uint16_t abts_seq_cnt;
|
||||
uint8_t abts_df_ctl;
|
||||
uint8_t abts_seq_id;
|
||||
uint16_t abts_rx_id;
|
||||
uint16_t abts_ox_id;
|
||||
uint32_t abts_param;
|
||||
uint8_t abts_reserved2[16];
|
||||
uint32_t abts_rxid_task;
|
||||
} abts_t;
|
||||
|
||||
typedef struct {
|
||||
isphdr_t abts_rsp_header;
|
||||
uint32_t abts_rsp_handle;
|
||||
uint16_t abts_rsp_status;
|
||||
uint16_t abts_rsp_nphdl;
|
||||
uint16_t abts_rsp_ctl_flags;
|
||||
uint16_t abts_rsp_sof;
|
||||
uint32_t abts_rsp_rxid_abts;
|
||||
uint16_t abts_rsp_did_lo;
|
||||
uint8_t abts_rsp_did_hi;
|
||||
uint8_t abts_rsp_r_ctl;
|
||||
uint16_t abts_rsp_sid_lo;
|
||||
uint8_t abts_rsp_sid_hi;
|
||||
uint8_t abts_rsp_cs_ctl;
|
||||
uint16_t abts_rsp_f_ctl_lo;
|
||||
uint8_t abts_rsp_f_ctl_hi;
|
||||
uint8_t abts_rsp_type;
|
||||
uint16_t abts_rsp_seq_cnt;
|
||||
uint8_t abts_rsp_df_ctl;
|
||||
uint8_t abts_rsp_seq_id;
|
||||
uint16_t abts_rsp_rx_id;
|
||||
uint16_t abts_rsp_ox_id;
|
||||
uint32_t abts_rsp_param;
|
||||
union {
|
||||
struct {
|
||||
uint16_t reserved;
|
||||
uint8_t last_seq_id;
|
||||
uint8_t seq_id_valid;
|
||||
uint16_t aborted_rx_id;
|
||||
uint16_t aborted_ox_id;
|
||||
uint16_t high_seq_cnt;
|
||||
uint16_t low_seq_cnt;
|
||||
uint8_t reserved2[4];
|
||||
} ba_acc;
|
||||
struct {
|
||||
uint8_t vendor_unique;
|
||||
uint8_t explanation;
|
||||
uint8_t reason;
|
||||
uint8_t reserved;
|
||||
uint8_t reserved2[12];
|
||||
} ba_rjt;
|
||||
struct {
|
||||
uint8_t reserved[8];
|
||||
uint32_t subcode1;
|
||||
uint32_t subcode2;
|
||||
} rsp;
|
||||
uint8_t reserved[16];
|
||||
} abts_rsp_payload;
|
||||
uint32_t abts_rsp_rxid_task;
|
||||
} abts_rsp_t;
|
||||
|
||||
/* terminate this ABTS exchange */
|
||||
#define ISP24XX_ABTS_RSP_TERMINATE 0x01
|
||||
|
||||
#define ISP24XX_ABTS_RSP_COMPLETE 0x00
|
||||
#define ISP24XX_ABTS_RSP_RESET 0x04
|
||||
#define ISP24XX_ABTS_RSP_ABORTED 0x05
|
||||
#define ISP24XX_ABTS_RSP_TIMEOUT 0x06
|
||||
#define ISP24XX_ABTS_RSP_INVXID 0x08
|
||||
#define ISP24XX_ABTS_RSP_LOGOUT 0x29
|
||||
#define ISP24XX_ABTS_RSP_SUBCODE 0x31
|
||||
typedef enum {
|
||||
NT_UNKNOWN=0x999,
|
||||
NT_ABORT_TASK=0x1000,
|
||||
NT_ABORT_TASK_SET,
|
||||
NT_CLEAR_ACA,
|
||||
NT_CLEAR_TASK_SET,
|
||||
NT_LUN_RESET,
|
||||
NT_TARGET_RESET,
|
||||
NT_BUS_RESET,
|
||||
NT_LIP_RESET,
|
||||
NT_LINK_UP,
|
||||
NT_LINK_DOWN,
|
||||
NT_LOGOUT,
|
||||
NT_GLOBAL_LOGOUT,
|
||||
NT_ARRIVED,
|
||||
NT_DEPARTED,
|
||||
NT_HBA_RESET
|
||||
} isp_ncode_t;
|
||||
|
||||
typedef struct isp_notify {
|
||||
void * nt_hba; /* HBA tag */
|
||||
void * nt_tmd;
|
||||
void * nt_lreserved;
|
||||
void * nt_hreserved;
|
||||
uint64_t nt_wwn; /* source (wwn) */
|
||||
uint64_t nt_tgt; /* destination (wwn) */
|
||||
uint64_t nt_tagval; /* tag value */
|
||||
uint32_t
|
||||
nt_sid : 24; /* source port id */
|
||||
uint32_t
|
||||
nt_failed : 1, /* notify operation failed */
|
||||
nt_need_ack : 1, /* this notify needs an ACK */
|
||||
nt_did : 24; /* destination port id */
|
||||
uint32_t
|
||||
nt_lun : 16, /* logical unit */
|
||||
nt_nphdl : 16; /* n-port handle */
|
||||
uint8_t nt_channel; /* channel id */
|
||||
isp_ncode_t nt_ncode; /* action */
|
||||
} isp_notify_t;
|
||||
#define MATCH_TMD(tmd, iid, lun, tag) \
|
||||
( \
|
||||
(tmd) && \
|
||||
(iid == INI_ANY || iid == tmd->cd_iid) && \
|
||||
(lun == LUN_ANY || lun == tmd->cd_lun) && \
|
||||
(tag == TAG_ANY || tag == tmd->cd_tagval) \
|
||||
)
|
||||
/*
|
||||
* Debug macros
|
||||
*/
|
||||
@ -890,56 +89,12 @@ typedef struct {
|
||||
#define ISP_TDQE(isp, msg, idx, arg) \
|
||||
if (isp->isp_dblev & ISP_LOGTDEBUG2) isp_print_qentry(isp, msg, idx, arg)
|
||||
|
||||
#ifndef ISP_TOOLS
|
||||
/*
|
||||
* The functions below are for the publicly available
|
||||
* target mode functions that are internal to the Qlogic driver.
|
||||
* Special Constatns
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function handles new response queue entry appropriate for target mode.
|
||||
*/
|
||||
int isp_target_notify(ispsoftc_t *, void *, uint32_t *);
|
||||
|
||||
/*
|
||||
* This function externalizes the ability to acknowledge an Immediate Notify
|
||||
* request.
|
||||
*/
|
||||
void isp_notify_ack(ispsoftc_t *, void *);
|
||||
|
||||
/*
|
||||
* Enable/Disable/Modify a logical unit.
|
||||
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt, opaque)
|
||||
*/
|
||||
#define DFLT_CMND_CNT 0xfe /* unmonitored */
|
||||
#define DFLT_INOT_CNT 0xfe /* unmonitored */
|
||||
int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int, int, uint32_t);
|
||||
|
||||
/*
|
||||
* General request queue 'put' routine for target mode entries.
|
||||
*/
|
||||
int isp_target_put_entry(ispsoftc_t *isp, void *);
|
||||
|
||||
/*
|
||||
* General routine to put back an ATIO entry-
|
||||
* used for replenishing f/w resource counts.
|
||||
* The argument is a pointer to a source ATIO
|
||||
* or ATIO2.
|
||||
*/
|
||||
int isp_target_put_atio(ispsoftc_t *, void *);
|
||||
|
||||
/*
|
||||
* General routine to send a final CTIO for a command- used mostly for
|
||||
* local responses.
|
||||
*/
|
||||
int isp_endcmd(ispsoftc_t *, void *, uint32_t, uint32_t);
|
||||
#define ECMD_SVALID 0x100
|
||||
|
||||
/*
|
||||
* Handle an asynchronous event
|
||||
*
|
||||
* Return nonzero if the interrupt that generated this event has been dismissed.
|
||||
*/
|
||||
int isp_target_async(ispsoftc_t *, int, int);
|
||||
#endif
|
||||
#define INI_ANY ((uint64_t) -1)
|
||||
#define VALID_INI(ini) (ini != INI_NONE && ini != INI_ANY)
|
||||
#define LUN_ANY 0xffff
|
||||
#define TGT_ANY ((uint64_t) -1)
|
||||
#define TAG_ANY ((uint64_t) 0)
|
||||
#endif /* _ISP_TARGET_H */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* Copyright (c) 1997-2009 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -24,6 +24,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Machine Independent (well, as best as possible) register
|
||||
@ -362,11 +363,12 @@
|
||||
#define BIU2400_REQOUTP (BIU_BLOCK+0x20) /* Request Queue Out */
|
||||
#define BIU2400_RSPINP (BIU_BLOCK+0x24) /* Response Queue In */
|
||||
#define BIU2400_RSPOUTP (BIU_BLOCK+0x28) /* Response Queue Out */
|
||||
#define BIU2400_PRI_RQINP (BIU_BLOCK+0x2C) /* Priority Request Q In */
|
||||
#define BIU2400_PRI_RSPINP (BIU_BLOCK+0x30) /* Priority Request Q Out */
|
||||
|
||||
#define BIU2400_ATIO_RSPINP (BIU_BLOCK+0x3C) /* ATIO Queue In */
|
||||
#define BIU2400_ATIO_REQINP (BIU_BLOCK+0x40) /* ATIO Queue Out */
|
||||
#define BIU2400_PRI_REQINP (BIU_BLOCK+0x2C) /* Priority Request Q In */
|
||||
#define BIU2400_PRI_REQOUTP (BIU_BLOCK+0x30) /* Priority Request Q Out */
|
||||
|
||||
#define BIU2400_ATIO_RSPINP (BIU_BLOCK+0x3C) /* ATIO Queue In */
|
||||
#define BIU2400_ATIO_RSPOUTP (BIU_BLOCK+0x40) /* ATIO Queue Out */
|
||||
|
||||
#define BIU2400_R2HSTSLO (BIU_BLOCK+0x44)
|
||||
#define BIU2400_R2HSTSHI (BIU_BLOCK+0x46)
|
||||
@ -469,10 +471,21 @@ typedef struct {
|
||||
uint16_t param[MAILBOX_STORAGE];
|
||||
uint16_t ibits;
|
||||
uint16_t obits;
|
||||
uint32_t : 28,
|
||||
uint32_t
|
||||
lineno : 16,
|
||||
: 12,
|
||||
logval : 4;
|
||||
uint32_t timeout;
|
||||
const char *func;
|
||||
} mbreg_t;
|
||||
#define MBSINIT(mbxp, code, loglev, timo) \
|
||||
ISP_MEMZERO((mbxp), sizeof (mbreg_t)); \
|
||||
(mbxp)->param[0] = code; \
|
||||
(mbxp)->lineno = __LINE__; \
|
||||
(mbxp)->func = __func__; \
|
||||
(mbxp)->logval = loglev; \
|
||||
(mbxp)->timeout = timo
|
||||
|
||||
|
||||
/*
|
||||
* Fibre Protocol Module and Frame Buffer Register Offsets/Definitions (2X00).
|
||||
|
@ -1,18 +1,18 @@
|
||||
/* $FreeBSD$ */
|
||||
/*-
|
||||
* Copyright (c) 1997-2007 by Matthew Jacob
|
||||
* Copyright (c) 1997-2009 by Matthew Jacob
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@ -24,6 +24,7 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Soft Definitions for for Qlogic ISP SCSI adapters.
|
||||
@ -49,7 +50,7 @@
|
||||
#include "ispmbox.h"
|
||||
#endif
|
||||
|
||||
#define ISP_CORE_VERSION_MAJOR 3
|
||||
#define ISP_CORE_VERSION_MAJOR 6
|
||||
#define ISP_CORE_VERSION_MINOR 0
|
||||
|
||||
/*
|
||||
@ -57,13 +58,11 @@
|
||||
*/
|
||||
typedef struct ispsoftc ispsoftc_t;
|
||||
struct ispmdvec {
|
||||
int (*dv_rd_isr)
|
||||
(ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
||||
int (*dv_rd_isr) (ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *);
|
||||
uint32_t (*dv_rd_reg) (ispsoftc_t *, int);
|
||||
void (*dv_wr_reg) (ispsoftc_t *, int, uint32_t);
|
||||
int (*dv_mbxdma) (ispsoftc_t *);
|
||||
int (*dv_dmaset)
|
||||
(ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t);
|
||||
int (*dv_dmaset) (ispsoftc_t *, XS_T *, void *);
|
||||
void (*dv_dmaclr) (ispsoftc_t *, XS_T *, uint32_t);
|
||||
void (*dv_reset0) (ispsoftc_t *);
|
||||
void (*dv_reset1) (ispsoftc_t *);
|
||||
@ -77,7 +76,9 @@ struct ispmdvec {
|
||||
* Overall parameters
|
||||
*/
|
||||
#define MAX_TARGETS 16
|
||||
#ifndef MAX_FC_TARG
|
||||
#define MAX_FC_TARG 512
|
||||
#endif
|
||||
#define ISP_MAX_TARGETS(isp) (IS_FC(isp)? MAX_FC_TARG : MAX_TARGETS)
|
||||
#define ISP_MAX_LUNS(isp) (isp)->isp_maxluns
|
||||
|
||||
@ -97,8 +98,8 @@ struct ispmdvec {
|
||||
#define ISP_MBOXDMASETUP(isp) \
|
||||
(*(isp)->isp_mdvec->dv_mbxdma)((isp))
|
||||
|
||||
#define ISP_DMASETUP(isp, xs, req, iptrp, optr) \
|
||||
(*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req), (iptrp), (optr))
|
||||
#define ISP_DMASETUP(isp, xs, req) \
|
||||
(*(isp)->isp_mdvec->dv_dmaset)((isp), (xs), (req))
|
||||
|
||||
#define ISP_DMAFREE(isp, xs, hndl) \
|
||||
if ((isp)->isp_mdvec->dv_dmaclr) \
|
||||
@ -158,13 +159,19 @@ struct ispmdvec {
|
||||
ISP_WRITE(isp, isp->isp_rqstinrp, nxti); \
|
||||
isp->isp_reqidx = nxti
|
||||
|
||||
#define ISP_SYNC_REQUEST(isp) \
|
||||
MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN); \
|
||||
isp->isp_reqidx = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); \
|
||||
ISP_WRITE(isp, isp->isp_rqstinrp, isp->isp_reqidx)
|
||||
|
||||
/*
|
||||
* SCSI Specific Host Adapter Parameters- per bus, per target
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t : 10,
|
||||
isp_bad_nvram : 1,
|
||||
isp_gotdparms : 1,
|
||||
uint32_t : 8,
|
||||
update : 1,
|
||||
sendmarker : 1,
|
||||
role : 2,
|
||||
isp_req_ack_active_neg : 1,
|
||||
isp_data_line_active_neg: 1,
|
||||
isp_cmd_dma_burst_enable: 1,
|
||||
@ -184,7 +191,7 @@ typedef struct {
|
||||
uint8_t isp_retry_count;
|
||||
uint8_t isp_retry_delay;
|
||||
struct {
|
||||
uint32_t
|
||||
uint32_t
|
||||
exc_throttle : 8,
|
||||
: 1,
|
||||
dev_enable : 1, /* ignored */
|
||||
@ -237,11 +244,16 @@ typedef struct {
|
||||
#define SNS_ID 0x80 /* SNS Server Special ID */
|
||||
#define NPH_MAX 0xfe
|
||||
|
||||
/* Use this handle for the base for multi-id firmware SNS logins */
|
||||
#define NPH_SNS_HDLBASE 0x400
|
||||
|
||||
/* These are for 2K Login Firmware cards */
|
||||
#define NPH_RESERVED 0x7F0 /* begin of reserved N-port handles */
|
||||
#define NPH_MGT_ID 0x7FA /* Management Server Special ID */
|
||||
#define NPH_SNS_ID 0x7FC /* SNS Server Special ID */
|
||||
#define NPH_FL_ID 0x7FE /* FL Port Special ID */
|
||||
#define NPH_FABRIC_CTLR 0x7FD /* Fabric Controller (0xFFFFFD) */
|
||||
#define NPH_FL_ID 0x7FE /* F Port Special ID (0xFFFFFE) */
|
||||
#define NPH_IP_BCST 0x7ff /* IP Broadcast Special ID (0xFFFFFF) */
|
||||
#define NPH_MAX_2K 0x800
|
||||
|
||||
/*
|
||||
@ -254,12 +266,27 @@ typedef struct {
|
||||
*/
|
||||
#define LOCAL_LOOP_LIM 126
|
||||
|
||||
/*
|
||||
* Limit for (2K login) N-port handle amounts
|
||||
*/
|
||||
#define MAX_NPORT_HANDLE 2048
|
||||
|
||||
/*
|
||||
* Special Constants
|
||||
*/
|
||||
#define INI_NONE ((uint64_t) 0)
|
||||
#define ISP_NOCHAN 0xff
|
||||
|
||||
/*
|
||||
* Special Port IDs
|
||||
*/
|
||||
#define MANAGEMENT_PORT_ID 0xFFFFFA
|
||||
#define SNS_PORT_ID 0xFFFFFC
|
||||
#define FABRIC_PORT_ID 0xFFFFFE
|
||||
#define PORT_ANY 0xFFFFFF
|
||||
#define PORT_NONE 0
|
||||
#define DOMAIN_CONTROLLER_BASE 0xFFFC00
|
||||
#define DOMAIN_CONTROLLER_END 0xFFFCFF
|
||||
|
||||
|
||||
/*
|
||||
@ -271,11 +298,11 @@ typedef struct {
|
||||
*
|
||||
* It has a state. If the state if VALID, that means that we've logged into
|
||||
* the device. We also *may* have a initiator map index entry. This is a value
|
||||
* from 0..MAX_FC_TARG that is used to index into the isp_ini_map array. If
|
||||
* from 0..MAX_FC_TARG that is used to index into the isp_dev_map array. If
|
||||
* the value therein is non-zero, then that value minus one is used to index
|
||||
* into the Port Database to find the handle for forming commands. There is
|
||||
* back-index minus one value within to Port Database entry that tells us
|
||||
* which entry in isp_ini_map points to us (to avoid searching).
|
||||
* back-index minus one value within to Port Database entry that tells us
|
||||
* which entry in isp_dev_map points to us (to avoid searching).
|
||||
*
|
||||
* Local loop devices the firmware automatically performs PLOGI on for us
|
||||
* (which is why that handle is imposed upon us). Fabric devices we assign
|
||||
@ -308,7 +335,7 @@ typedef struct {
|
||||
*
|
||||
* + There can never be two non-NIL entries with the same handle.
|
||||
*
|
||||
* + There can never be two non-NIL entries which have the same ini_map_idx
|
||||
* + There can never be two non-NIL entries which have the same dev_map_idx
|
||||
* value.
|
||||
*/
|
||||
typedef struct {
|
||||
@ -318,27 +345,36 @@ typedef struct {
|
||||
* the 'loopid'.
|
||||
*/
|
||||
uint16_t handle;
|
||||
|
||||
/*
|
||||
* The ini_map_idx, if nonzero, is the system virtual target ID (+1)
|
||||
* as a cross-reference with the isp_ini_map.
|
||||
* The dev_map_idx, if nonzero, is the system virtual target ID (+1)
|
||||
* as a cross-reference with the isp_dev_map.
|
||||
*
|
||||
* A device is 'autologin' if the firmware automatically logs into
|
||||
* it (re-logins as needed). Basically, local private loop devices.
|
||||
*
|
||||
* The state is the current state of thsi entry.
|
||||
* The state is the current state of this entry.
|
||||
*
|
||||
* Role is Initiator, Target, Both
|
||||
*
|
||||
* Portid is obvious, as or node && port WWNs. The new_role and
|
||||
* Portid is obvious, as are node && port WWNs. The new_role and
|
||||
* new_portid is for when we are pending a change.
|
||||
*
|
||||
* The 'target_mode' tag means that this entry arrived via a
|
||||
* target mode command and is immune from normal flushing rules.
|
||||
* You should also never see anything with an initiator role
|
||||
* with this set.
|
||||
*/
|
||||
uint16_t ini_map_idx : 12,
|
||||
uint16_t dev_map_idx : 12,
|
||||
autologin : 1, /* F/W does PLOGI/PLOGO */
|
||||
state : 3;
|
||||
uint32_t reserved : 6,
|
||||
uint32_t reserved : 5,
|
||||
target_mode : 1,
|
||||
roles : 2,
|
||||
portid : 24;
|
||||
uint32_t new_reserved : 6,
|
||||
uint32_t
|
||||
dirty : 1, /* commands have been run */
|
||||
new_reserved : 5,
|
||||
new_roles : 2,
|
||||
new_portid : 24;
|
||||
uint64_t node_wwn;
|
||||
@ -356,34 +392,47 @@ typedef struct {
|
||||
|
||||
/*
|
||||
* FC card specific information
|
||||
*
|
||||
* This structure is replicated across multiple channels for multi-id
|
||||
* capapble chipsets, with some entities different on a per-channel basis.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t : 10,
|
||||
isp_tmode : 1,
|
||||
isp_2klogin : 1,
|
||||
isp_sccfw : 1,
|
||||
isp_gbspeed : 3,
|
||||
: 1,
|
||||
: 1,
|
||||
isp_gotdparms : 1,
|
||||
isp_bad_nvram : 1,
|
||||
uint32_t
|
||||
link_active : 1,
|
||||
npiv_fabric : 1,
|
||||
inorder : 1,
|
||||
sendmarker : 1,
|
||||
role : 2,
|
||||
isp_gbspeed : 4,
|
||||
isp_loopstate : 4, /* Current Loop State */
|
||||
isp_fwstate : 4, /* ISP F/W state */
|
||||
isp_topo : 3,
|
||||
isp_topo : 3, /* Connection Type */
|
||||
loop_seen_once : 1;
|
||||
|
||||
uint32_t : 8,
|
||||
isp_portid : 24; /* S_ID */
|
||||
|
||||
|
||||
uint16_t isp_fwoptions;
|
||||
uint16_t isp_xfwoptions;
|
||||
uint16_t isp_zfwoptions;
|
||||
uint16_t isp_loopid; /* hard loop id */
|
||||
uint16_t isp_fwattr; /* firmware attributes */
|
||||
uint16_t isp_execthrottle;
|
||||
uint16_t isp_loopid; /* hard loop id */
|
||||
uint16_t isp_sns_hdl; /* N-port handle for SNS */
|
||||
uint16_t isp_lasthdl; /* only valid for channel 0 */
|
||||
uint16_t isp_maxalloc;
|
||||
uint8_t isp_retry_delay;
|
||||
uint8_t isp_retry_count;
|
||||
uint8_t isp_reserved;
|
||||
uint16_t isp_maxalloc;
|
||||
uint16_t isp_maxfrmlen;
|
||||
|
||||
/*
|
||||
* Current active WWNN/WWPN
|
||||
*/
|
||||
uint64_t isp_wwnn;
|
||||
uint64_t isp_wwpn;
|
||||
|
||||
/*
|
||||
* NVRAM WWNN/WWPN
|
||||
*/
|
||||
uint64_t isp_wwnn_nvram;
|
||||
uint64_t isp_wwpn_nvram;
|
||||
|
||||
@ -399,16 +448,25 @@ typedef struct {
|
||||
* subtract one to get the portdb index. This means that
|
||||
* entries which are zero are unmapped (i.e., don't exist).
|
||||
*/
|
||||
uint16_t isp_ini_map[MAX_FC_TARG];
|
||||
uint16_t isp_dev_map[MAX_FC_TARG];
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
/*
|
||||
* This maps N-Port Handle to portdb entry so we
|
||||
* don't have to search for every incoming command.
|
||||
*
|
||||
* The mapping function is to take any non-zero entry and
|
||||
* subtract one to get the portdb index. This means that
|
||||
* entries which are zero are unmapped (i.e., don't exist).
|
||||
*/
|
||||
uint16_t isp_tgt_map[MAX_NPORT_HANDLE];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Scratch DMA mapped in area to fetch Port Database stuff, etc.
|
||||
*/
|
||||
void * isp_scratch;
|
||||
XS_DMA_ADDR_T isp_scdma;
|
||||
#ifdef ISP_FW_CRASH_DUMP
|
||||
uint16_t * isp_dump_data;
|
||||
#endif
|
||||
} fcparam;
|
||||
|
||||
#define FW_CONFIG_WAIT 0
|
||||
@ -457,7 +515,6 @@ struct ispsoftc {
|
||||
|
||||
void * isp_param; /* type specific */
|
||||
uint16_t isp_fwrev[3]; /* Loaded F/W revision */
|
||||
uint16_t isp_romfw_rev[3]; /* PROM F/W revision */
|
||||
uint16_t isp_maxcmds; /* max possible I/O cmds */
|
||||
uint8_t isp_type; /* HBA Chip Type */
|
||||
uint8_t isp_revision; /* HBA Chip H/W Revision */
|
||||
@ -466,22 +523,20 @@ struct ispsoftc {
|
||||
uint32_t isp_clock : 8, /* input clock */
|
||||
: 4,
|
||||
isp_port : 1, /* 23XX/24XX only */
|
||||
isp_failed : 1, /* board failed */
|
||||
isp_open : 1, /* opened (ioctl) */
|
||||
isp_touched : 1, /* board ever seen? */
|
||||
isp_bustype : 1, /* SBus or PCI */
|
||||
isp_loaded_fw : 1, /* loaded firmware */
|
||||
isp_role : 2, /* roles supported */
|
||||
isp_dblev : 12; /* debug log mask */
|
||||
isp_dblev : 16; /* debug log mask */
|
||||
|
||||
uint32_t isp_confopts; /* config options */
|
||||
uint16_t isp_fwattr; /* firmware attributes */
|
||||
uint16_t isp_nchan; /* number of channels */
|
||||
|
||||
uint32_t isp_confopts; /* config options */
|
||||
|
||||
uint32_t isp_rqstinrp; /* register for REQINP */
|
||||
uint32_t isp_rqstoutrp; /* register for REQOUTP */
|
||||
uint32_t isp_respinrp; /* register for RESINP */
|
||||
uint32_t isp_respoutrp; /* register for RESOUTP */
|
||||
uint32_t isp_atioinrp; /* register for ATIOINP */
|
||||
uint32_t isp_atiooutrp; /* register for ATIOOUTP */
|
||||
|
||||
/*
|
||||
* Instrumentation
|
||||
@ -494,24 +549,26 @@ struct ispsoftc {
|
||||
uint64_t isp_fphccmplt; /* CMDs via fastpost */
|
||||
uint16_t isp_rscchiwater;
|
||||
uint16_t isp_fpcchiwater;
|
||||
NANOTIME_T isp_init_time; /* time were last initialized */
|
||||
|
||||
/*
|
||||
* Volatile state
|
||||
*/
|
||||
|
||||
volatile uint32_t : 8,
|
||||
: 2,
|
||||
isp_dead : 1,
|
||||
: 1,
|
||||
isp_mboxbsy : 1, /* mailbox command active */
|
||||
isp_state : 3,
|
||||
isp_sendmarker : 2, /* send a marker entry */
|
||||
isp_update : 2, /* update parameters */
|
||||
isp_nactive : 16; /* how many commands active */
|
||||
volatile uint32_t isp_reqodx; /* index of last ISP pickup */
|
||||
volatile uint32_t isp_reqidx; /* index of next request */
|
||||
volatile uint32_t isp_residx; /* index of next result */
|
||||
volatile uint32_t isp_resodx; /* index of next result */
|
||||
volatile uint32_t isp_rspbsy;
|
||||
volatile uint32_t isp_lasthdls; /* last handle seed */
|
||||
volatile uint32_t isp_obits; /* mailbox command output */
|
||||
volatile uint32_t isp_serno; /* rolling serial number */
|
||||
volatile uint16_t isp_mboxtmp[MAILBOX_STORAGE];
|
||||
volatile uint16_t isp_lastmbxcmd; /* last mbox command sent */
|
||||
volatile uint16_t isp_mbxwrk0;
|
||||
@ -527,7 +584,7 @@ struct ispsoftc {
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
/*
|
||||
* Active target commands are stored here, indexed by handle function.
|
||||
* Active target commands are stored here, indexed by handle functions.
|
||||
*/
|
||||
void **isp_tgtlist;
|
||||
#endif
|
||||
@ -546,8 +603,20 @@ struct ispsoftc {
|
||||
#endif
|
||||
};
|
||||
|
||||
#define SDPARAM(isp) ((sdparam *) (isp)->isp_param)
|
||||
#define FCPARAM(isp) ((fcparam *) (isp)->isp_param)
|
||||
#define SDPARAM(isp, chan) (&((sdparam *)(isp)->isp_param)[(chan)])
|
||||
#define FCPARAM(isp, chan) (&((fcparam *)(isp)->isp_param)[(chan)])
|
||||
|
||||
#define ISP_SET_SENDMARKER(isp, chan, val) \
|
||||
if (IS_FC(isp)) { \
|
||||
FCPARAM(isp, chan)->sendmarker = val; \
|
||||
} else { \
|
||||
SDPARAM(isp, chan)->sendmarker = val; \
|
||||
}
|
||||
|
||||
#define ISP_TST_SENDMARKER(isp, chan) \
|
||||
(IS_FC(isp)? \
|
||||
FCPARAM(isp, chan)->sendmarker != 0 : \
|
||||
SDPARAM(isp, chan)->sendmarker != 0)
|
||||
|
||||
/*
|
||||
* ISP Driver Run States
|
||||
@ -571,23 +640,22 @@ struct ispsoftc {
|
||||
#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */
|
||||
#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */
|
||||
#define ISP_CFG_LPORT_ONLY 0x0C /* insist on {N/F}L-Port connection */
|
||||
#define ISP_CFG_OWNWWPN 0x100 /* override NVRAM wwpn */
|
||||
#define ISP_CFG_OWNWWNN 0x200 /* override NVRAM wwnn */
|
||||
#define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */
|
||||
#define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */
|
||||
#define ISP_CFG_OWNEXCTHROTTLE 0x1000 /* override NVRAM execution throttle */
|
||||
#define ISP_CFG_FOURGB 0x2000 /* force 4GB connection (24XX only) */
|
||||
|
||||
/*
|
||||
* Prior to calling isp_reset for the first time, the outer layer
|
||||
* should set isp_role to one of NONE, INITIATOR, TARGET, BOTH.
|
||||
* For each channel, the outer layers should know what role that channel
|
||||
* will take: ISP_ROLE_NONE, ISP_ROLE_INITIATOR, ISP_ROLE_TARGET,
|
||||
* ISP_ROLE_BOTH.
|
||||
*
|
||||
* If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded,
|
||||
* NVRAM read, and defaults set, but any further initialization (e.g.
|
||||
* INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done.
|
||||
*
|
||||
* If INITIATOR MODE isn't set, attempts to run commands will be stopped
|
||||
* at isp_start and completed with the moral equivalent of SELECTION TIMEOUT.
|
||||
* at isp_start and completed with the equivalent of SELECTION TIMEOUT.
|
||||
*
|
||||
* If TARGET MODE is set, it doesn't mean that the rest of target mode support
|
||||
* needs to be enabled, or will even work. What happens with the 2X00 cards
|
||||
@ -665,8 +733,10 @@ struct ispsoftc {
|
||||
#define ISP_HA_FC_2312 0x40
|
||||
#define ISP_HA_FC_2322 0x50
|
||||
#define ISP_HA_FC_2400 0x60
|
||||
#define ISP_HA_FC_2500 0x70
|
||||
|
||||
#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI)
|
||||
#define IS_1020(isp) (isp->isp_type < ISP_HA_SCSI_1240)
|
||||
#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240)
|
||||
#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080)
|
||||
#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280)
|
||||
@ -688,6 +758,7 @@ struct ispsoftc {
|
||||
#define IS_2312(isp) ((isp)->isp_type == ISP_HA_FC_2312)
|
||||
#define IS_2322(isp) ((isp)->isp_type == ISP_HA_FC_2322)
|
||||
#define IS_24XX(isp) ((isp)->isp_type >= ISP_HA_FC_2400)
|
||||
#define IS_25XX(isp) ((isp)->isp_type >= ISP_HA_FC_2500)
|
||||
|
||||
/*
|
||||
* DMA related macros
|
||||
@ -705,10 +776,9 @@ struct ispsoftc {
|
||||
*/
|
||||
|
||||
/*
|
||||
* Reset Hardware. Totally. Assumes that you'll follow this with
|
||||
* a call to isp_init.
|
||||
* Reset Hardware. Totally. Assumes that you'll follow this with a call to isp_init.
|
||||
*/
|
||||
void isp_reset(ispsoftc_t *);
|
||||
void isp_reset(ispsoftc_t *, int);
|
||||
|
||||
/*
|
||||
* Initialize Hardware to known state
|
||||
@ -718,14 +788,7 @@ void isp_init(ispsoftc_t *);
|
||||
/*
|
||||
* Reset the ISP and call completion for any orphaned commands.
|
||||
*/
|
||||
void isp_reinit(ispsoftc_t *);
|
||||
|
||||
#ifdef ISP_FW_CRASH_DUMP
|
||||
/*
|
||||
* Dump firmware entry point.
|
||||
*/
|
||||
void isp_fw_dump(ispsoftc_t *isp);
|
||||
#endif
|
||||
void isp_reinit(ispsoftc_t *, int);
|
||||
|
||||
/*
|
||||
* Internal Interrupt Service Routine
|
||||
@ -757,27 +820,34 @@ void isp_done(XS_T *);
|
||||
* Platform Dependent to External to Internal Control Function
|
||||
*
|
||||
* Assumes locks are held on entry. You should note that with many of
|
||||
* these commands and locks may be released while this is occurring.
|
||||
* these commands locks may be released while this function is called.
|
||||
*
|
||||
* A few notes about some of these functions:
|
||||
*
|
||||
* ISPCTL_FCLINK_TEST tests to make sure we have good fibre channel link.
|
||||
* The argument is a pointer to an integer which is the time, in microseconds,
|
||||
* we should wait to see whether we have good link. This test, if successful,
|
||||
* lets us know our connection topology and our Loop ID/AL_PA and so on.
|
||||
* You can't get anywhere without this.
|
||||
*
|
||||
* ISPCTL_SCAN_FABRIC queries the name server (if we're on a fabric) for
|
||||
* all entities using the FC Generic Services subcommand GET ALL NEXT.
|
||||
* For each found entity, an ISPASYNC_FABRICDEV event is generated (see
|
||||
* below).
|
||||
*
|
||||
* ISPCTL_SCAN_LOOP does a local loop scan. This is only done if the connection
|
||||
* topology is NL or FL port (private or public loop). Since the Qlogic f/w
|
||||
* 'automatically' manages local loop connections, this function essentially
|
||||
* notes the arrival, departure, and possible shuffling around of local loop
|
||||
* entities. Thus for each arrival and departure this generates an isp_async
|
||||
* event of ISPASYNC_PROMENADE (see below).
|
||||
* ... ISPCTL_RESET_BUS, int channel);
|
||||
* Reset BUS on this channel
|
||||
* ... ISPCTL_RESET_DEV, int channel, int target);
|
||||
* Reset Device on this channel at this target.
|
||||
* ... ISPCTL_ABORT_CMD, XS_T *xs);
|
||||
* Abort active transaction described by xs.
|
||||
* ... IPCTL_UPDATE_PARAMS);
|
||||
* Update any operating parameters (speed, etc.)
|
||||
* ... ISPCTL_FCLINK_TEST, int channel);
|
||||
* Test FC link status on this channel
|
||||
* ... ISPCTL_SCAN_FABRIC, int channel);
|
||||
* Scan fabric on this channel
|
||||
* ... ISPCTL_SCAN_LOOP, int channel);
|
||||
* Scan local loop on this channel
|
||||
* ... ISPCTL_PDB_SYNC, int channel);
|
||||
* Synchronize port database on this channel
|
||||
* ... ISPCTL_SEND_LIP, int channel);
|
||||
* Send a LIP on this channel
|
||||
* ... ISPCTL_GET_NAMES, int channel, int np, uint64_t *wwnn, uint64_t *wwpn)
|
||||
* Get a WWNN/WWPN for this N-port handle on this channel
|
||||
* ... ISPCTL_RUN_MBOXCMD, mbreg_t *mbp)
|
||||
* Run this mailbox command
|
||||
* ... ISPCTL_GET_PDB, int channel, int nphandle, isp_pdb_t *pdb)
|
||||
* Get PDB on this channel for this N-port handle
|
||||
* ... ISPCTL_PLOGX, isp_plcmd_t *)
|
||||
* Performa a port login/logout
|
||||
*
|
||||
* ISPCTL_PDB_SYNC is somewhat misnamed. It actually is the final step, in
|
||||
* order, of ISPCTL_FCLINK_TEST, ISPCTL_SCAN_FABRIC, and ISPCTL_SCAN_LOOP.
|
||||
@ -788,89 +858,48 @@ void isp_done(XS_T *);
|
||||
* part of this function. It's now been separated to allow for finer control.
|
||||
*/
|
||||
typedef enum {
|
||||
ISPCTL_RESET_BUS, /* Reset Bus */
|
||||
ISPCTL_RESET_DEV, /* Reset Device */
|
||||
ISPCTL_ABORT_CMD, /* Abort Command */
|
||||
ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */
|
||||
ISPCTL_FCLINK_TEST, /* Test FC Link Status */
|
||||
ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */
|
||||
ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */
|
||||
ISPCTL_PDB_SYNC, /* Synchronize Port Database */
|
||||
ISPCTL_SEND_LIP, /* Send a LIP */
|
||||
ISPCTL_GET_PORTNAME, /* get portname from an N-port handle */
|
||||
ISPCTL_RUN_MBOXCMD, /* run a mailbox command */
|
||||
ISPCTL_TOGGLE_TMODE, /* toggle target mode */
|
||||
ISPCTL_GET_PDB, /* get a single port database entry */
|
||||
ISPCTL_PLOGX /* do a port login/logout */
|
||||
ISPCTL_RESET_BUS,
|
||||
ISPCTL_RESET_DEV,
|
||||
ISPCTL_ABORT_CMD,
|
||||
ISPCTL_UPDATE_PARAMS,
|
||||
ISPCTL_FCLINK_TEST,
|
||||
ISPCTL_SCAN_FABRIC,
|
||||
ISPCTL_SCAN_LOOP,
|
||||
ISPCTL_PDB_SYNC,
|
||||
ISPCTL_SEND_LIP,
|
||||
ISPCTL_GET_NAMES,
|
||||
ISPCTL_RUN_MBOXCMD,
|
||||
ISPCTL_GET_PDB,
|
||||
ISPCTL_PLOGX
|
||||
} ispctl_t;
|
||||
int isp_control(ispsoftc_t *, ispctl_t, void *);
|
||||
|
||||
int isp_control(ispsoftc_t *, ispctl_t, ...);
|
||||
|
||||
/*
|
||||
* Platform Dependent to Internal to External Control Function
|
||||
* (each platform must provide such a function)
|
||||
*
|
||||
* Assumes locks are held.
|
||||
*
|
||||
* A few notes about some of these functions:
|
||||
*
|
||||
* ISPASYNC_CHANGE_NOTIFY notifies the outer layer that a change has
|
||||
* occurred that invalidates the list of fabric devices known and/or
|
||||
* the list of known loop devices. The argument passed is a pointer
|
||||
* whose values are defined below (local loop change, name server
|
||||
* change, other). 'Other' may simply be a LIP, or a change in
|
||||
* connection topology.
|
||||
*
|
||||
* ISPASYNC_FABRIC_DEV announces the next element in a list of
|
||||
* fabric device names we're getting out of the name server. The
|
||||
* argument points to a GET ALL NEXT response structure. The list
|
||||
* is known to terminate with an entry that refers to ourselves.
|
||||
* One of the main purposes of this function is to allow outer
|
||||
* layers, which are OS dependent, to set policy as to which fabric
|
||||
* devices might actually be logged into (and made visible) later
|
||||
* at ISPCTL_PDB_SYNC time. Since there's a finite number of fabric
|
||||
* devices that we can log into (256 less 3 'reserved' for F-port
|
||||
* topologies), and fabrics can grow up to 8 million or so entries
|
||||
* (24 bits of Port Address, less a wad of reserved spaces), clearly
|
||||
* we had better let the OS determine login policy.
|
||||
*
|
||||
* ISPASYNC_PROMENADE has an argument that is a pointer to an integer which
|
||||
* is an index into the portdb in the softc ('target'). Whether that entry's
|
||||
* valid tag is set or not says whether something has arrived or departed.
|
||||
* The name refers to a favorite pastime of many city dwellers- watching
|
||||
* people come and go, talking of Michaelangelo, and so on..
|
||||
*
|
||||
* ISPASYNC_UNHANDLED_RESPONSE gives outer layers a chance to parse a
|
||||
* response queue entry not otherwise handled. The outer layer should
|
||||
* return non-zero if it handled it. The 'arg' points to an unmassaged
|
||||
* response queue entry.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
ISPASYNC_NEW_TGT_PARAMS, /* New Target Parameters Negotiated */
|
||||
ISPASYNC_BUS_RESET, /* Bus Was Reset */
|
||||
ISPASYNC_NEW_TGT_PARAMS, /* SPI New Target Parameters */
|
||||
ISPASYNC_BUS_RESET, /* All Bus Was Reset */
|
||||
ISPASYNC_LOOP_DOWN, /* FC Loop Down */
|
||||
ISPASYNC_LOOP_UP, /* FC Loop Up */
|
||||
ISPASYNC_LIP, /* LIP Received */
|
||||
ISPASYNC_LOOP_RESET, /* Loop Reset Received */
|
||||
ISPASYNC_LIP, /* FC LIP Received */
|
||||
ISPASYNC_LOOP_RESET, /* FC Loop Reset Received */
|
||||
ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */
|
||||
ISPASYNC_DEV_ARRIVED, /* FC Device Arrival */
|
||||
ISPASYNC_DEV_CHANGED, /* FC Device Change */
|
||||
ISPASYNC_DEV_STAYED, /* FC Device Stayed the Same */
|
||||
ISPASYNC_DEV_GONE, /* FC Device Depart */
|
||||
ISPASYNC_TARGET_NOTIFY, /* target asynchronous notification event */
|
||||
ISPASYNC_TARGET_ACTION, /* target action requested */
|
||||
ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */
|
||||
ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */
|
||||
ISPASYNC_FW_CRASH, /* Firmware has crashed */
|
||||
ISPASYNC_FW_DUMPED, /* Firmware crashdump taken */
|
||||
ISPASYNC_FW_RESTARTED /* Firmware has been restarted */
|
||||
ISPASYNC_DEV_ARRIVED, /* FC Device Arrived */
|
||||
ISPASYNC_DEV_CHANGED, /* FC Device Changed */
|
||||
ISPASYNC_DEV_STAYED, /* FC Device Stayed */
|
||||
ISPASYNC_DEV_GONE, /* FC Device Departure */
|
||||
ISPASYNC_TARGET_NOTIFY, /* All target async notification */
|
||||
ISPASYNC_TARGET_ACTION, /* All target action requested */
|
||||
ISPASYNC_FW_CRASH, /* All Firmware has crashed */
|
||||
ISPASYNC_FW_RESTARTED /* All Firmware has been restarted */
|
||||
} ispasync_t;
|
||||
int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
void isp_async(ispsoftc_t *, ispasync_t, ...);
|
||||
|
||||
#define ISPASYNC_CHANGE_PDB ((void *) 0)
|
||||
#define ISPASYNC_CHANGE_SNS ((void *) 1)
|
||||
#define ISPASYNC_CHANGE_OTHER ((void *) 2)
|
||||
#define ISPASYNC_CHANGE_PDB 0
|
||||
#define ISPASYNC_CHANGE_SNS 1
|
||||
#define ISPASYNC_CHANGE_OTHER 2
|
||||
|
||||
/*
|
||||
* Platform Dependent Error and Debug Printout
|
||||
@ -893,9 +922,10 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
#define ISP_LOGDEBUG2 0x40 /* log most debug messages */
|
||||
#define ISP_LOGDEBUG3 0x80 /* log high frequency debug messages */
|
||||
#define ISP_LOGSANCFG 0x100 /* log SAN configuration */
|
||||
#define ISP_LOGTDEBUG0 0x200 /* log simple debug messages (target mode) */
|
||||
#define ISP_LOGTDEBUG1 0x400 /* log intermediate debug messages (target) */
|
||||
#define ISP_LOGTDEBUG2 0x800 /* log all debug messages (target) */
|
||||
#define ISP_LOGTINFO 0x1000 /* log informational messages (target mode) */
|
||||
#define ISP_LOGTDEBUG0 0x2000 /* log simple debug messages (target mode) */
|
||||
#define ISP_LOGTDEBUG1 0x4000 /* log intermediate debug messages (target) */
|
||||
#define ISP_LOGTDEBUG2 0x8000 /* log all debug messages (target) */
|
||||
|
||||
/*
|
||||
* Each Platform provides it's own isposinfo substructure of the ispsoftc
|
||||
@ -904,13 +934,16 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
* Each platform must also provide the following macros/defines:
|
||||
*
|
||||
*
|
||||
* ISP2100_SCRLEN - length for the Fibre Channel scratch DMA area
|
||||
* ISP_FC_SCRLEN FC scratch area DMA length
|
||||
*
|
||||
* MEMZERO(dst, src) platform zeroing function
|
||||
* MEMCPY(dst, src, count) platform copying function
|
||||
* SNPRINTF(buf, bufsize, fmt, ...) snprintf
|
||||
* USEC_DELAY(usecs) microsecond spindelay function
|
||||
* USEC_SLEEP(isp, usecs) microsecond sleep function
|
||||
* ISP_MEMZERO(dst, src) platform zeroing function
|
||||
* ISP_MEMCPY(dst, src, count) platform copying function
|
||||
* ISP_SNPRINTF(buf, bufsize, fmt, ...) snprintf
|
||||
* ISP_DELAY(usecs) microsecond spindelay function
|
||||
* ISP_SLEEP(isp, usecs) microsecond sleep function
|
||||
*
|
||||
* ISP_INLINE ___inline or not- depending on how
|
||||
* good your debugger is
|
||||
*
|
||||
* NANOTIME_T nanosecond time type
|
||||
*
|
||||
@ -921,8 +954,7 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
* NANOTIME_SUB(NANOTIME_T *, NANOTIME_T *)
|
||||
* subtract two NANOTIME_T values
|
||||
*
|
||||
*
|
||||
* MAXISPREQUEST(ispsoftc_t *) maximum request queue size
|
||||
* MAXISPREQUEST(ispsoftc_t *) maximum request queue size
|
||||
* for this particular board type
|
||||
*
|
||||
* MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size)
|
||||
@ -936,32 +968,36 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
* MBOX_NOTIFY_COMPLETE(ispsoftc_t *) notification of mbox cmd donee
|
||||
* MBOX_RELEASE(ispsoftc_t *) release lock on mailbox regs
|
||||
*
|
||||
* FC_SCRATCH_ACQUIRE(ispsoftc_t *) acquire lock on FC scratch area
|
||||
* FC_SCRATCH_RELEASE(ispsoftc_t *) acquire lock on FC scratch area
|
||||
* FC_SCRATCH_ACQUIRE(ispsoftc_t *, chan) acquire lock on FC scratch area
|
||||
* return -1 if you cannot
|
||||
* FC_SCRATCH_RELEASE(ispsoftc_t *, chan) acquire lock on FC scratch area
|
||||
*
|
||||
* SCSI_GOOD SCSI 'Good' Status
|
||||
* SCSI_CHECK SCSI 'Check Condition' Status
|
||||
* SCSI_BUSY SCSI 'Busy' Status
|
||||
* SCSI_QFULL SCSI 'Queue Full' Status
|
||||
*
|
||||
* XS_T Platform SCSI transaction type (i.e., command for HBA)
|
||||
* XS_DMA_ADDR_T Platform PCI DMA Address Type
|
||||
* XS_ISP(xs) gets an instance out of an XS_T
|
||||
* XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) ""
|
||||
* XS_TGT(xs) gets the target ""
|
||||
* XS_LUN(xs) gets the lun ""
|
||||
* XS_CDBP(xs) gets a pointer to the scsi CDB ""
|
||||
* XS_CDBLEN(xs) gets the CDB's length ""
|
||||
* XS_XFRLEN(xs) gets the associated data transfer length ""
|
||||
* XS_TIME(xs) gets the time (in milliseconds) for this command
|
||||
* XS_RESID(xs) gets the current residual count
|
||||
* XS_STSP(xs) gets a pointer to the SCSI status byte ""
|
||||
* XS_SNSP(xs) gets a pointer to the associate sense data
|
||||
* XS_SNSLEN(xs) gets the length of sense data storage
|
||||
* XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key
|
||||
* XS_TAG_P(xs) predicate of whether this command should be tagged
|
||||
* XS_TAG_TYPE(xs) which type of tag to use
|
||||
* XS_SETERR(xs) set error state
|
||||
* XS_T Platform SCSI transaction type (i.e., command for HBA)
|
||||
* XS_DMA_ADDR_T Platform PCI DMA Address Type
|
||||
* XS_GET_DMA_SEG(..) Get 32 bit dma segment list value
|
||||
* XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value
|
||||
* XS_ISP(xs) gets an instance out of an XS_T
|
||||
* XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) ""
|
||||
* XS_TGT(xs) gets the target ""
|
||||
* XS_LUN(xs) gets the lun ""
|
||||
* XS_CDBP(xs) gets a pointer to the scsi CDB ""
|
||||
* XS_CDBLEN(xs) gets the CDB's length ""
|
||||
* XS_XFRLEN(xs) gets the associated data transfer length ""
|
||||
* XS_TIME(xs) gets the time (in milliseconds) for this command
|
||||
* XS_GET_RESID(xs) gets the current residual count
|
||||
* XS_GET_RESID(xs, resid) sets the current residual count
|
||||
* XS_STSP(xs) gets a pointer to the SCSI status byte ""
|
||||
* XS_SNSP(xs) gets a pointer to the associate sense data
|
||||
* XS_SNSLEN(xs) gets the length of sense data storage
|
||||
* XS_SNSKEY(xs) dereferences XS_SNSP to get the current stored Sense Key
|
||||
* XS_TAG_P(xs) predicate of whether this command should be tagged
|
||||
* XS_TAG_TYPE(xs) which type of tag to use
|
||||
* XS_SETERR(xs) set error state
|
||||
*
|
||||
* HBA_NOERROR command has no erros
|
||||
* HBA_BOTCH hba botched something
|
||||
@ -979,32 +1015,31 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
*
|
||||
* XS_SAVE_SENSE(xs, sp, len) save sense data
|
||||
*
|
||||
* XS_SET_STATE_STAT(isp, sp, xs) platform dependent interpreter of
|
||||
* response queue entry status bits
|
||||
*
|
||||
*
|
||||
* DEFAULT_IID(ispsoftc_t *) Default SCSI initiator ID
|
||||
* DEFAULT_LOOPID(ispsoftc_t *) Default FC Loop ID
|
||||
* DEFAULT_NODEWWN(ispsoftc_t *) Default Node WWN
|
||||
* DEFAULT_PORTWWN(ispsoftc_t *) Default Port WWN
|
||||
* DEFAULT_FRAMESIZE(ispsoftc_t *) Default Frame Size
|
||||
* DEFAULT_EXEC_THROTTLE(ispsoftc_t *) Default Execution Throttle
|
||||
* DEFAULT_EXEC_THROTTLE(ispsoftc_t *) Default Execution Throttle
|
||||
*
|
||||
* GET_DEFAULT_ROLE(ispsoftc_t *, int) Get Default Role for a channel
|
||||
* SET_DEFAULT_ROLE(ispsoftc_t *, int, int) Set Default Role for a channel
|
||||
* DEFAULT_IID(ispsoftc_t *, int) Default SCSI initiator ID
|
||||
* DEFAULT_LOOPID(ispsoftc_t *, int) Default FC Loop ID
|
||||
*
|
||||
* These establish reasonable defaults for each platform.
|
||||
* These must be available independent of card NVRAM and are
|
||||
* to be used should NVRAM not be readable.
|
||||
*
|
||||
* ISP_NODEWWN(ispsoftc_t *) FC Node WWN to use
|
||||
* ISP_PORTWWN(ispsoftc_t *) FC Port WWN to use
|
||||
* DEFAULT_NODEWWN(ispsoftc_t *, chan) Default FC Node WWN to use
|
||||
* DEFAULT_PORTWWN(ispsoftc_t *, chan) Default FC Port WWN to use
|
||||
*
|
||||
* These are to be used after NVRAM is read. The tags
|
||||
* in fcparam.isp_ww{n,p}n_nvram reflect the values
|
||||
* read from NVRAM (possibly corrected for card botches).
|
||||
* Each platform can take that information and override
|
||||
* it or ignore and return the Node and Port WWNs to be
|
||||
* used when sending the Qlogic f/w the Initialization
|
||||
* Control Block.
|
||||
* These defines are hooks to allow the setting of node and
|
||||
* port WWNs when NVRAM cannot be read or is to be overriden.
|
||||
*
|
||||
* ACTIVE_NODEWWN(ispsoftc_t *, chan) FC Node WWN to use
|
||||
* ACTIVE_PORTWWN(ispsoftc_t *, chan) FC Port WWN to use
|
||||
*
|
||||
* After NVRAM is read, these will be invoked to get the
|
||||
* node and port WWNs that will actually be used for this
|
||||
* channel.
|
||||
*
|
||||
* (XXX these do endian specific transformations- in transition XXX)
|
||||
*
|
||||
* ISP_IOXPUT_8(ispsoftc_t *, uint8_t srcval, uint8_t *dstptr)
|
||||
* ISP_IOXPUT_16(ispsoftc_t *, uint16_t srcval, uint16_t *dstptr)
|
||||
@ -1020,4 +1055,61 @@ int isp_async(ispsoftc_t *, ispasync_t, void *);
|
||||
* ISP_SWAP32(ispsoftc_t *, uint32_t srcval)
|
||||
*/
|
||||
|
||||
#ifdef ISP_TARGET_MODE
|
||||
/*
|
||||
* The functions below are for the publicly available
|
||||
* target mode functions that are internal to the Qlogic driver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function handles new response queue entry appropriate for target mode.
|
||||
*/
|
||||
int isp_target_notify(ispsoftc_t *, void *, uint32_t *);
|
||||
|
||||
/*
|
||||
* This function externalizes the ability to acknowledge an Immediate Notify request.
|
||||
*/
|
||||
int isp_notify_ack(ispsoftc_t *, void *);
|
||||
|
||||
/*
|
||||
* This function externalized acknowledging (success/fail) an ABTS frame
|
||||
*/
|
||||
int isp_acknak_abts(ispsoftc_t *, void *, int);
|
||||
|
||||
/*
|
||||
* Enable/Disable/Modify a logical unit.
|
||||
* (softc, cmd, bus, tgt, lun, cmd_cnt, inotify_cnt)
|
||||
*/
|
||||
#define DFLT_CMND_CNT 0xfe /* unmonitored */
|
||||
#define DFLT_INOT_CNT 0xfe /* unmonitored */
|
||||
int isp_lun_cmd(ispsoftc_t *, int, int, int, int, int);
|
||||
|
||||
/*
|
||||
* General request queue 'put' routine for target mode entries.
|
||||
*/
|
||||
int isp_target_put_entry(ispsoftc_t *isp, void *);
|
||||
|
||||
/*
|
||||
* General routine to put back an ATIO entry-
|
||||
* used for replenishing f/w resource counts.
|
||||
* The argument is a pointer to a source ATIO
|
||||
* or ATIO2.
|
||||
*/
|
||||
int isp_target_put_atio(ispsoftc_t *, void *);
|
||||
|
||||
/*
|
||||
* General routine to send a final CTIO for a command- used mostly for
|
||||
* local responses.
|
||||
*/
|
||||
int isp_endcmd(ispsoftc_t *, ...);
|
||||
#define ECMD_SVALID 0x100
|
||||
#define ECMD_TERMINATE 0x200
|
||||
|
||||
/*
|
||||
* Handle an asynchronous event
|
||||
*
|
||||
* Return nonzero if the interrupt that generated this event has been dismissed.
|
||||
*/
|
||||
int isp_target_async(ispsoftc_t *, int, int);
|
||||
#endif
|
||||
#endif /* _ISPVAR_H */
|
||||
|
Loading…
Reference in New Issue
Block a user