mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-19 10:53:58 +00:00
Remove isp_prtstst (now in case statement in isp.c). Remove
isp2100_fw_statename as an INLINE (now a function in isp.c). Remove isp2100_pdb_statename (unused). Redo all ISP_SCSI_XFER_T as XS_T types. Change all RQUEST_QUEUE_LEN/RESULT_QUEUE_LEN macros to take a parameter. Add isp_print_bytes function.
This commit is contained in:
parent
10549c059a
commit
16dd34376c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64091
@ -35,109 +35,6 @@
|
|||||||
#ifndef _ISP_INLINE_H
|
#ifndef _ISP_INLINE_H
|
||||||
#define _ISP_INLINE_H
|
#define _ISP_INLINE_H
|
||||||
|
|
||||||
static INLINE void isp_prtstst __P((ispstatusreq_t *));
|
|
||||||
static INLINE char *isp2100_fw_statename __P((int));
|
|
||||||
static INLINE char *isp2100_pdb_statename __P((int));
|
|
||||||
|
|
||||||
|
|
||||||
static INLINE void
|
|
||||||
isp_prtstst(sp)
|
|
||||||
ispstatusreq_t *sp;
|
|
||||||
{
|
|
||||||
char buf[172];
|
|
||||||
buf[0] = 0;
|
|
||||||
STRNCAT(buf, "states=>", sizeof buf);
|
|
||||||
if (sp->req_state_flags & RQSF_GOT_BUS) {
|
|
||||||
STRNCAT(buf, " GOT_BUS", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_GOT_TARGET) {
|
|
||||||
STRNCAT(buf, " GOT_TGT", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_SENT_CDB) {
|
|
||||||
STRNCAT(buf, " SENT_CDB", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_XFRD_DATA) {
|
|
||||||
STRNCAT(buf, " XFRD_DATA", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_GOT_STATUS) {
|
|
||||||
STRNCAT(buf, " GOT_STS", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_GOT_SENSE) {
|
|
||||||
STRNCAT(buf, " GOT_SNS", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_state_flags & RQSF_XFER_COMPLETE) {
|
|
||||||
STRNCAT(buf, " XFR_CMPLT", sizeof buf);
|
|
||||||
}
|
|
||||||
STRNCAT(buf, "\nstatus=>", sizeof buf);
|
|
||||||
if (sp->req_status_flags & RQSTF_DISCONNECT) {
|
|
||||||
STRNCAT(buf, " Disconnect", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_SYNCHRONOUS) {
|
|
||||||
STRNCAT(buf, " Sync_xfr", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_PARITY_ERROR) {
|
|
||||||
STRNCAT(buf, " Parity", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_BUS_RESET) {
|
|
||||||
STRNCAT(buf, " Bus_Reset", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_DEVICE_RESET) {
|
|
||||||
STRNCAT(buf, " Device_Reset", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_ABORTED) {
|
|
||||||
STRNCAT(buf, " Aborted", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_TIMEOUT) {
|
|
||||||
STRNCAT(buf, " Timeout", sizeof buf);
|
|
||||||
}
|
|
||||||
if (sp->req_status_flags & RQSTF_NEGOTIATION) {
|
|
||||||
STRNCAT(buf, " Negotiation", sizeof buf);
|
|
||||||
}
|
|
||||||
PRINTF(buf, "%s\n", buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE char *
|
|
||||||
isp2100_fw_statename(state)
|
|
||||||
int state;
|
|
||||||
{
|
|
||||||
static char buf[16];
|
|
||||||
switch(state) {
|
|
||||||
case FW_CONFIG_WAIT: return "Config Wait";
|
|
||||||
case FW_WAIT_AL_PA: return "Waiting for AL_PA";
|
|
||||||
case FW_WAIT_LOGIN: return "Wait Login";
|
|
||||||
case FW_READY: return "Ready";
|
|
||||||
case FW_LOSS_OF_SYNC: return "Loss Of Sync";
|
|
||||||
case FW_ERROR: return "Error";
|
|
||||||
case FW_REINIT: return "Re-Init";
|
|
||||||
case FW_NON_PART: return "Nonparticipating";
|
|
||||||
default:
|
|
||||||
sprintf(buf, "0x%x", state);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE char *isp2100_pdb_statename(int pdb_state)
|
|
||||||
{
|
|
||||||
static char buf[16];
|
|
||||||
switch(pdb_state) {
|
|
||||||
case PDB_STATE_DISCOVERY: return "Port Discovery";
|
|
||||||
case PDB_STATE_WDISC_ACK: return "Waiting Port Discovery ACK";
|
|
||||||
case PDB_STATE_PLOGI: return "Port Login";
|
|
||||||
case PDB_STATE_PLOGI_ACK: return "Wait Port Login ACK";
|
|
||||||
case PDB_STATE_PRLI: return "Process Login";
|
|
||||||
case PDB_STATE_PRLI_ACK: return "Wait Process Login ACK";
|
|
||||||
case PDB_STATE_LOGGED_IN: return "Logged In";
|
|
||||||
case PDB_STATE_PORT_UNAVAIL: return "Port Unavailable";
|
|
||||||
case PDB_STATE_PRLO: return "Process Logout";
|
|
||||||
case PDB_STATE_PRLO_ACK: return "Wait Process Logout ACK";
|
|
||||||
case PDB_STATE_PLOGO: return "Port Logout";
|
|
||||||
case PDB_STATE_PLOG_ACK: return "Wait Port Logout ACK";
|
|
||||||
default:
|
|
||||||
sprintf(buf, "0x%x", pdb_state);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle Functions.
|
* Handle Functions.
|
||||||
* For each outstanding command there will be a non-zero handle.
|
* For each outstanding command there will be a non-zero handle.
|
||||||
@ -146,13 +43,13 @@ static INLINE char *isp2100_pdb_statename(int pdb_state)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static INLINE int
|
static INLINE int
|
||||||
isp_save_xs __P((struct ispsoftc *, ISP_SCSI_XFER_T *, u_int32_t *));
|
isp_save_xs __P((struct ispsoftc *, XS_T *, u_int32_t *));
|
||||||
|
|
||||||
static INLINE ISP_SCSI_XFER_T *
|
static INLINE XS_T *
|
||||||
isp_find_xs __P((struct ispsoftc *, u_int32_t));
|
isp_find_xs __P((struct ispsoftc *, u_int32_t));
|
||||||
|
|
||||||
static INLINE u_int32_t
|
static INLINE u_int32_t
|
||||||
isp_find_handle __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
|
isp_find_handle __P((struct ispsoftc *, XS_T *));
|
||||||
|
|
||||||
static INLINE int
|
static INLINE int
|
||||||
isp_handle_index __P((u_int32_t));
|
isp_handle_index __P((u_int32_t));
|
||||||
@ -161,12 +58,12 @@ static INLINE void
|
|||||||
isp_destroy_handle __P((struct ispsoftc *, u_int32_t));
|
isp_destroy_handle __P((struct ispsoftc *, u_int32_t));
|
||||||
|
|
||||||
static INLINE void
|
static INLINE void
|
||||||
isp_remove_handle __P((struct ispsoftc *, ISP_SCSI_XFER_T *));
|
isp_remove_handle __P((struct ispsoftc *, XS_T *));
|
||||||
|
|
||||||
static INLINE int
|
static INLINE int
|
||||||
isp_save_xs(isp, xs, handlep)
|
isp_save_xs(isp, xs, handlep)
|
||||||
struct ispsoftc *isp;
|
struct ispsoftc *isp;
|
||||||
ISP_SCSI_XFER_T *xs;
|
XS_T *xs;
|
||||||
u_int32_t *handlep;
|
u_int32_t *handlep;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@ -190,7 +87,7 @@ isp_save_xs(isp, xs, handlep)
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE ISP_SCSI_XFER_T *
|
static INLINE XS_T *
|
||||||
isp_find_xs(isp, handle)
|
isp_find_xs(isp, handle)
|
||||||
struct ispsoftc *isp;
|
struct ispsoftc *isp;
|
||||||
u_int32_t handle;
|
u_int32_t handle;
|
||||||
@ -205,7 +102,7 @@ isp_find_xs(isp, handle)
|
|||||||
static INLINE u_int32_t
|
static INLINE u_int32_t
|
||||||
isp_find_handle(isp, xs)
|
isp_find_handle(isp, xs)
|
||||||
struct ispsoftc *isp;
|
struct ispsoftc *isp;
|
||||||
ISP_SCSI_XFER_T *xs;
|
XS_T *xs;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (xs != NULL) {
|
if (xs != NULL) {
|
||||||
@ -238,7 +135,7 @@ isp_destroy_handle(isp, handle)
|
|||||||
static INLINE void
|
static INLINE void
|
||||||
isp_remove_handle(isp, xs)
|
isp_remove_handle(isp, xs)
|
||||||
struct ispsoftc *isp;
|
struct ispsoftc *isp;
|
||||||
ISP_SCSI_XFER_T *xs;
|
XS_T *xs;
|
||||||
{
|
{
|
||||||
isp_destroy_handle(isp, isp_find_handle(isp, xs));
|
isp_destroy_handle(isp, isp_find_handle(isp, xs));
|
||||||
}
|
}
|
||||||
@ -258,7 +155,7 @@ isp_getrqentry(isp, iptrp, optrp, resultp)
|
|||||||
optr = isp->isp_reqodx = ISP_READ(isp, OUTMAILBOX4);
|
optr = isp->isp_reqodx = ISP_READ(isp, OUTMAILBOX4);
|
||||||
iptr = isp->isp_reqidx;
|
iptr = isp->isp_reqidx;
|
||||||
*resultp = ISP_QUEUE_ENTRY(isp->isp_rquest, iptr);
|
*resultp = ISP_QUEUE_ENTRY(isp->isp_rquest, iptr);
|
||||||
iptr = ISP_NXT_QENTRY(iptr, RQUEST_QUEUE_LEN);
|
iptr = ISP_NXT_QENTRY(iptr, RQUEST_QUEUE_LEN(isp));
|
||||||
if (iptr == optr) {
|
if (iptr == optr) {
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
@ -272,6 +169,8 @@ isp_getrqentry(isp, iptrp, optrp, resultp)
|
|||||||
static INLINE void
|
static INLINE void
|
||||||
isp_print_qentry __P((struct ispsoftc *, char *, int, void *));
|
isp_print_qentry __P((struct ispsoftc *, char *, int, void *));
|
||||||
|
|
||||||
|
|
||||||
|
#define TBA (4 * (((QENTRY_LEN >> 2) * 3) + 1) + 1)
|
||||||
static INLINE void
|
static INLINE void
|
||||||
isp_print_qentry(isp, msg, idx, arg)
|
isp_print_qentry(isp, msg, idx, arg)
|
||||||
struct ispsoftc *isp;
|
struct ispsoftc *isp;
|
||||||
@ -279,14 +178,46 @@ isp_print_qentry(isp, msg, idx, arg)
|
|||||||
int idx;
|
int idx;
|
||||||
void *arg;
|
void *arg;
|
||||||
{
|
{
|
||||||
|
char buf[TBA];
|
||||||
int amt, i, j;
|
int amt, i, j;
|
||||||
u_int8_t *ptr = arg;
|
u_int8_t *ptr = arg;
|
||||||
PRINTF("%s %s index %d:\n", isp->isp_name, msg, idx);
|
|
||||||
for (amt = i = 0; i < 4; i++) {
|
for (buf[0] = 0, amt = i = 0; i < 4; i++) {
|
||||||
|
buf[0] = 0;
|
||||||
for (j = 0; j < (QENTRY_LEN >> 2); j++) {
|
for (j = 0; j < (QENTRY_LEN >> 2); j++) {
|
||||||
PRINTF(" %02x", ptr[amt++] & 0xff);
|
SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff);
|
||||||
}
|
}
|
||||||
PRINTF("\n");
|
STRNCAT(buf, "\n", TBA);
|
||||||
|
}
|
||||||
|
isp_prt(isp, ISP_LOGALL, "%s index %d:%s", msg, idx, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
static INLINE void
|
||||||
|
isp_print_bytes __P((struct ispsoftc *, char *, int, void *));
|
||||||
|
|
||||||
|
static INLINE void
|
||||||
|
isp_print_bytes(isp, msg, amt, arg)
|
||||||
|
struct ispsoftc *isp;
|
||||||
|
char *msg;
|
||||||
|
int amt;
|
||||||
|
void *arg;
|
||||||
|
{
|
||||||
|
char buf[128];
|
||||||
|
u_int8_t *ptr = arg;
|
||||||
|
int off;
|
||||||
|
|
||||||
|
off = 0;
|
||||||
|
while (off < amt) {
|
||||||
|
int j, to;
|
||||||
|
to = off;
|
||||||
|
SNPRINTF(buf, 128, "<");
|
||||||
|
for (j = 0; j < 16; j++) {
|
||||||
|
SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] & 0xff);
|
||||||
|
if (off == amt)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
isp_prt(isp, ISP_LOGALL,
|
||||||
|
"<%s>offset=0x%x:\n%s>", msg, to, buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* _ISP_INLINE_H */
|
#endif /* _ISP_INLINE_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user