summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/iha.c89
-rw-r--r--sys/dev/ic/iha.h40
2 files changed, 49 insertions, 80 deletions
diff --git a/sys/dev/ic/iha.c b/sys/dev/ic/iha.c
index b4ac2a02379..38c39c7b3db 100644
--- a/sys/dev/ic/iha.c
+++ b/sys/dev/ic/iha.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iha.c,v 1.1 2001/01/23 04:19:41 krw Exp $ */
+/* $OpenBSD: iha.c,v 1.2 2001/02/08 17:35:05 krw Exp $ */
/*
* Initio INI-9xxxU/UW SCSI Device Driver
*
@@ -52,6 +52,7 @@
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
+#include <scsi/scsi_message.h>
#include <dev/ic/iha.h>
@@ -331,11 +332,12 @@ iha_scsi_cmd(xs)
pScb->SCB_Lun = sc_link->lun;
pScb->SCB_Tcs = &sc->HCS_Tcs[pScb->SCB_Target];
pScb->SCB_Flags = xs->flags;
- pScb->SCB_Ident = IDENT_IDENTITY | (pScb->SCB_Lun & IDENT_LUN);
+ pScb->SCB_Ident = MSG_IDENTIFYFLAG |
+ (pScb->SCB_Lun & MSG_IDENTIFY_LUNMASK);
if ((xs->cmd->opcode != REQUEST_SENSE)
&& ((pScb->SCB_Flags & SCSI_POLL) == 0))
- pScb->SCB_Ident |= IDENT_DISC_PRIV;
+ pScb->SCB_Ident |= MSG_IDENTIFY_DISCFLAG;
pScb->SCB_Xs = xs;
pScb->SCB_CDBLen = xs->cmdlen;
@@ -908,7 +910,7 @@ tul_push_sense_request(sc, pScb)
pScb->SCB_Flags &= ~(FLAG_SG | FLAG_DIR);
pScb->SCB_Flags |= FLAG_RSENS | SCSI_DATA_IN;
- pScb->SCB_Ident &= ~IDENT_DISC_PRIV;
+ pScb->SCB_Ident &= ~MSG_IDENTIFY_DISCFLAG;
pScb->SCB_TagMsg = 0;
pScb->SCB_TaStat = SCSI_OK;
@@ -1341,7 +1343,7 @@ tul_state_3(sc, iot, ioh)
case PHASE_MSG_OUT:
flags = pScb->SCB_Tcs->TCS_Flags;
if ((flags & FLAG_NO_NEG_SYNC) != 0) {
- if (tul_msgout(sc, iot, ioh, MSG_NOP) == -1)
+ if (tul_msgout(sc, iot, ioh, MSG_NOOP) == -1)
return (-1);
} else if (tul_msgout_sync(sc, iot, ioh) == -1)
return (-1);
@@ -1394,12 +1396,13 @@ tul_state_4(sc, iot, ioh)
if ((sc->HCS_JSStatus0 & SPERR) != 0) {
pScb->SCB_BufLen = 0;
pScb->SCB_HaStat = HOST_SPERR;
- if (tul_msgout(sc, iot, ioh, MSG_IDE) == -1)
+ if (tul_msgout(sc, iot, ioh,
+ MSG_INITIATOR_DET_ERR) == -1)
return (-1);
else
return (6);
} else {
- if (tul_msgout(sc, iot, ioh, MSG_NOP) == -1)
+ if (tul_msgout(sc, iot, ioh, MSG_NOOP) == -1)
return (-1);
}
break;
@@ -1544,7 +1547,7 @@ tul_state_6(sc, iot, ioh)
break;
case PHASE_MSG_OUT:
- if ((tul_msgout(sc, iot, ioh, MSG_NOP)) == -1)
+ if ((tul_msgout(sc, iot, ioh, MSG_NOOP)) == -1)
return (-1);
break;
@@ -1578,7 +1581,7 @@ tul_state_8(sc, iot, ioh)
u_int8_t tar;
if (sc->HCS_Phase == PHASE_MSG_OUT) {
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_DEVRST);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_BUS_DEV_RESET);
pScb = sc->HCS_ActScb;
@@ -1739,9 +1742,11 @@ tul_status_msg(sc, iot, ioh)
if (phase == PHASE_MSG_OUT) {
if ((sc->HCS_JSStatus0 & SPERR) == 0)
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_NOP);
+ bus_space_write_1(iot, ioh, TUL_SFIFO,
+ MSG_NOOP);
else
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_PARITY);
+ bus_space_write_1(iot, ioh, TUL_SFIFO,
+ MSG_PARITY_ERROR);
return (tul_wait(sc, iot, ioh, XF_FIFO_OUT));
@@ -1754,14 +1759,14 @@ tul_status_msg(sc, iot, ioh)
return (-1);
case PHASE_MSG_OUT:
bus_space_write_1(iot, ioh, TUL_SFIFO,
- MSG_PARITY);
+ MSG_PARITY_ERROR);
return (tul_wait(sc, iot, ioh, XF_FIFO_OUT));
default:
tul_bad_seq(sc);
return (-1);
}
- if (msg == MSG_COMP) {
+ if (msg == MSG_CMDCOMPLETE) {
if ((pScb->SCB_TaStat
& (SCSI_INTERM | SCSI_BUSY)) == SCSI_INTERM) {
tul_bad_seq(sc);
@@ -1772,7 +1777,8 @@ tul_status_msg(sc, iot, ioh)
return (tul_wait(sc, iot, ioh, MSG_ACCEPT));
}
- if ((msg == MSG_LINK_COMP) || (msg == MSG_LINK_FLAG)) {
+ if ((msg == MSG_LINK_CMD_COMPLETE)
+ || (msg == MSG_LINK_CMD_COMPLETEF)) {
if ((pScb->SCB_TaStat
& (SCSI_INTERM | SCSI_BUSY)) == SCSI_INTERM)
return (tul_wait(sc, iot, ioh, MSG_ACCEPT));
@@ -1868,7 +1874,7 @@ tul_resel(sc, iot, ioh)
}
target = bus_space_read_1(iot, ioh, TUL_SBID);
- lun = bus_space_read_1(iot, ioh, TUL_SALVC) & IDENT_LUN;
+ lun = bus_space_read_1(iot, ioh, TUL_SALVC) & MSG_IDENTIFY_LUNMASK;
pTcs = &sc->HCS_Tcs[target];
@@ -1903,7 +1909,7 @@ tul_resel(sc, iot, ioh)
msg = bus_space_read_1(iot, ioh, TUL_SFIFO); /* Read Tag Msg */
- if ((msg < MSG_STAG) || (msg > MSG_OTAG))
+ if ((msg < MSG_SIMPLE_Q_TAG) || (msg > MSG_ORDERED_Q_TAG))
goto abort;
switch (tul_wait(sc, iot, ioh, MSG_ACCEPT)) {
@@ -1960,18 +1966,18 @@ tul_msgin(sc, iot, ioh)
msg = bus_space_read_1(iot, ioh, TUL_SFIFO);
switch (msg) {
- case MSG_DISC:
+ case MSG_DISCONNECT:
sc->HCS_Flags |= FLAG_EXPECT_DISC;
if (tul_wait(sc, iot, ioh, MSG_ACCEPT) != -1)
tul_bad_seq(sc);
phase = -1;
break;
- case MSG_SDP:
- case MSG_RESTORE:
- case MSG_NOP:
+ case MSG_SAVEDATAPOINTER:
+ case MSG_RESTOREPOINTERS:
+ case MSG_NOOP:
phase = tul_wait(sc, iot, ioh, MSG_ACCEPT);
break;
- case MSG_REJ:
+ case MSG_MESSAGE_REJECT:
/* XXX - need to clear FIFO like other 'Clear ATN'?*/
tul_set_ssig(iot, ioh, REQ | BSY | SEL | ATN, 0);
flags = sc->HCS_ActScb->SCB_Tcs->TCS_Flags;
@@ -1979,13 +1985,13 @@ tul_msgin(sc, iot, ioh)
tul_set_ssig(iot, ioh, REQ | BSY | SEL, ATN);
phase = tul_wait(sc, iot, ioh, MSG_ACCEPT);
break;
- case MSG_EXTEND:
+ case MSG_EXTENDED:
phase = tul_msgin_extend(sc, iot, ioh);
break;
- case MSG_IGNOREWIDE:
+ case MSG_IGN_WIDE_RESIDUE:
phase = tul_msgin_ignore_wid_resid(sc, iot, ioh);
break;
- case MSG_COMP:
+ case MSG_CMDCOMPLETE:
sc->HCS_Flags |= FLAG_EXPECT_DONE_DISC;
bus_space_write_1(iot, ioh, TUL_SCTRL0, RSFIFO);
phase = tul_wait(sc, iot, ioh, MSG_ACCEPT);
@@ -2062,7 +2068,7 @@ tul_msgin_extend(sc, iot, ioh)
msglen = sc->HCS_Msg[0];
msgcode = sc->HCS_Msg[1];
- if ((msglen == MSG_LEN_SYNC_XFER) && (msgcode == MSG_CODE_SYNC_XFER)) {
+ if ((msglen == MSG_EXT_SDTR_LEN) && (msgcode == MSG_EXT_SDTR)) {
if (tul_msgin_sync(sc) == 0) {
tul_sync_done(sc, iot, ioh);
return (tul_wait(sc, iot, ioh, MSG_ACCEPT));
@@ -2079,14 +2085,13 @@ tul_msgin_extend(sc, iot, ioh)
tul_sync_done(sc, iot, ioh); /* This is our final offer */
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTEND);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 3);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 1);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTENDED);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_SDTR_LEN);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_SDTR);
bus_space_write_1(iot, ioh, TUL_SFIFO, sc->HCS_Msg[2]);
bus_space_write_1(iot, ioh, TUL_SFIFO, sc->HCS_Msg[3]);
- } else if ((msglen == MSG_LEN_WIDE_XFER)
- && (msgcode == MSG_CODE_WIDE_XFER)) {
+ } else if ((msglen == MSG_EXT_WDTR_LEN) && (msgcode == MSG_EXT_WDTR)) {
flags = sc->HCS_ActScb->SCB_Tcs->TCS_Flags;
@@ -2113,9 +2118,9 @@ tul_msgin_extend(sc, iot, ioh)
return (phase);
/* WDTR msg out */
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTEND);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 2);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 3);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTENDED);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_WDTR_LEN);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_WDTR);
bus_space_write_1(iot, ioh, TUL_SFIFO, sc->HCS_Msg[2]);
} else
@@ -2224,7 +2229,7 @@ tul_msgout_reject(sc, iot, ioh)
return (-1);
if (phase == PHASE_MSG_OUT) {
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_REJ);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_MESSAGE_REJECT);
return (tul_wait(sc, iot, ioh, XF_FIFO_OUT));
}
@@ -2241,10 +2246,10 @@ tul_msgout_wide(sc, iot, ioh)
sc->HCS_ActScb->SCB_Tcs->TCS_Flags |= FLAG_WIDE_DONE;
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTEND);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 2); /* Message length*/
- bus_space_write_1(iot, ioh, TUL_SFIFO, 3); /* WDTR request */
- bus_space_write_1(iot, ioh, TUL_SFIFO, 1); /* 16 bits xfer */
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTENDED);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_WDTR_LEN);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_WDTR);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_WDTR_BUS_16_BIT);
phase = tul_wait(sc, iot, ioh, XF_FIFO_OUT);
@@ -2268,10 +2273,10 @@ tul_msgout_sync(sc, iot, ioh)
sync_rate = tul_rate_tbl[rateindex];
- bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTEND);
- bus_space_write_1(iot, ioh, TUL_SFIFO, 3); /* Msg len*/
- bus_space_write_1(iot, ioh, TUL_SFIFO, 1); /* SDTR */
- bus_space_write_1(iot, ioh, TUL_SFIFO, sync_rate);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXTENDED);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_SDTR_LEN);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, MSG_EXT_SDTR);
+ bus_space_write_1(iot, ioh, TUL_SFIFO, sync_rate);
bus_space_write_1(iot, ioh, TUL_SFIFO, IHA_MAX_TARGETS-1); /* REQ/ACK*/
phase = tul_wait(sc, iot, ioh, XF_FIFO_OUT);
diff --git a/sys/dev/ic/iha.h b/sys/dev/ic/iha.h
index 6ba6fe18761..27f8e8e02fd 100644
--- a/sys/dev/ic/iha.h
+++ b/sys/dev/ic/iha.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iha.h,v 1.1 2001/01/23 04:19:42 krw Exp $ */
+/* $OpenBSD: iha.h,v 1.2 2001/02/08 17:35:05 krw Exp $ */
/*
* Initio INI-9xxxU/UW SCSI Device Driver
*
@@ -102,10 +102,7 @@ struct iha_scsi_req_q {
u_int8_t SCB_SGLen; /* # of valid entries in SGList */
u_int8_t SCB_SenseLen; /* Sense Data Allocation Length */
u_int8_t SCB_CDBLen; /* CDB Length */
- u_int8_t SCB_Ident; /* Identity */
-#define IDENT_IDENTITY 0x80 /* Must ALWAYS be set */
-#define IDENT_DISC_PRIV 0x40 /* Disconnect allowed */
-#define IDENT_LUN 0x3f /* Target LUN */
+ u_int8_t SCB_Ident; /* Identity Message */
u_int8_t SCB_TagMsg; /* Tag Message */
u_int8_t SCB_TagId; /* Queue Tag */
u_int8_t SCB_CDB[12]; /* SCSI Command */
@@ -185,10 +182,6 @@ struct iha_softc {
u_int8_t HCS_JSStatus1;
u_int8_t HCS_SConf1;
u_int8_t HCS_Msg[IHA_MAX_EXTENDED_MSG]; /* [0] len, [1] Msg Code */
-#define MSG_LEN_SYNC_XFER 0x03
-#define MSG_CODE_SYNC_XFER 0x01
-#define MSG_LEN_WIDE_XFER 0x02
-#define MSG_CODE_WIDE_XFER 0x03
struct iha_scsi_req_q *HCS_Scb; /* SCB array */
struct iha_scsi_req_q *HCS_ActScb; /* SCB using SCSI bus */
@@ -365,35 +358,6 @@ struct nvram {
#define TUL_SDATI 0x8B /* R SCSI Bus contents */
#define TUL_SDAT0 0x8B /* W SCSI Data Out */
#define TUL_SFIFO 0x8C /* R/W FIFO */
-#define MSG_COMP 0x00 /* Command Complete */
-#define MSG_EXTEND 0x01 /* Extended Message */
-#define MSG_SDP 0x02 /* Save Data Pointer */
-#define MSG_RESTORE 0x03 /* Restore Pointers */
-#define MSG_DISC 0x04 /* Disconnect */
-#define MSG_IDE 0x05 /* Initiator Detected Error */
-#define MSG_ABORT 0x06 /* Abort */
-#define MSG_REJ 0x07 /* Message Reject */
-#define MSG_NOP 0x08 /* No Operation */
-#define MSG_PARITY 0x09 /* Message Parity Error */
-#define MSG_LINK_COMP 0x0A /* Linked Command Complete */
-#define MSG_LINK_FLAG 0x0B /* Linked Command Complete w Flag */
-#define MSG_DEVRST 0x0C /* Bus Device Reset */
-#define MSG_ABORT_TAG 0x0D /* Abort Tag */
-#define MSG_CLEAR_QUEUE 0x0E /* Clear Queue */
-#define MSG_INIT_RCVRY 0x0F /* Initiate Recovery */
-#define MSG_RLSE_RCVRY 0x10 /* Release Recovery */
-#define MSG_TERM_IO 0x11 /* Terminate I/O Process */
-#define MSG_CONT_IO 0x12 /* Continue I/O */
-#define MSG_TARG_XF_DIS 0x13 /* Target Transfer Disable */
- /* 0x14 -> 0x15 are reserved */
-#define MSG_CLEAR_ACA 0x16 /* Clear Auto Contingent Active */
- /* 0x17 -> 0x1f are reserved */
-#define MSG_STAG 0x20 /* Simple Queue Tag */
-#define MSG_HTAG 0x21 /* Head of Queue Tag */
-#define MSG_OTAG 0x22 /* Ordered Queue Tag */
-#define MSG_IGNOREWIDE 0x23 /* Ignore Wide Residue */
- /* 0x24 -> 0x7f are reserved */
- /* 0x80 -> 0xff are identify msgs */
#define TUL_SSIGI 0x90 /* R SCSI signal in */
#define REQ 0x80 /* REQ signal */
#define ACK 0x40 /* ACK signal */