diff --git a/usr/ibmvio/ibmvio.c b/usr/ibmvio/ibmvio.c index ff91f14..c21b8e1 100644 --- a/usr/ibmvio/ibmvio.c +++ b/usr/ibmvio/ibmvio.c @@ -35,9 +35,9 @@ #include #include #include #include -#include #include +#include "scsi.h" #include "list.h" #include "util.h" #include "tgtd.h" diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c index 0a2578a..4d5afb4 100644 --- a/usr/iscsi/iscsid.c +++ b/usr/iscsi/iscsid.c @@ -17,9 +17,9 @@ #include #include #include #include -#include #include +#include "scsi.h" #include "iscsid.h" #include "tgtd.h" #include "util.h" diff --git a/usr/scsi.h b/usr/scsi.h index f70dfd7..d8a607a 100644 --- a/usr/scsi.h +++ b/usr/scsi.h @@ -100,6 +100,9 @@ #define SAM_STAT_TASK_SET_FULL 0x28 #define SAM_STAT_ACA_ACTIVE 0x30 #define SAM_STAT_TASK_ABORTED 0x40 +/* This looks wrong */ +#define TASK_ABORTED 0x20 + #define NO_SENSE 0x00 #define RECOVERED_ERROR 0x01 #define NOT_READY 0x02 @@ -133,16 +136,36 @@ #define TYPE_NO_LUN 0x7f #define TYPE_SPT 0xff -#define MSG_SIMPLE_TAG 0x20 -#define MSG_HEAD_TAG 0x21 -#define MSG_ORDERED_TAG 0x22 - -#define ABORT_TASK 0x0d +#define COMMAND_COMPLETE 0x00 +#define EXTENDED_MESSAGE 0x01 +#define EXTENDED_MODIFY_DATA_POINTER 0x00 +#define EXTENDED_SDTR 0x01 +#define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ +#define EXTENDED_WDTR 0x03 +#define EXTENDED_PPR 0x04 +#define EXTENDED_MODIFY_BIDI_DATA_PTR 0x05 +#define SAVE_POINTERS 0x02 +#define RESTORE_POINTERS 0x03 +#define DISCONNECT 0x04 +#define INITIATOR_ERROR 0x05 #define ABORT_TASK_SET 0x06 -#define CLEAR_ACA 0x16 +#define MESSAGE_REJECT 0x07 +#define NOP 0x08 +#define MSG_PARITY_ERROR 0x09 +#define LINKED_CMD_COMPLETE 0x0a +#define LINKED_FLG_CMD_COMPLETE 0x0b +#define TARGET_RESET 0x0c +#define ABORT_TASK 0x0d #define CLEAR_TASK_SET 0x0e +#define INITIATE_RECOVERY 0x0f /* SCSI-II only */ +#define RELEASE_RECOVERY 0x10 /* SCSI-II only */ +#define CLEAR_ACA 0x16 #define LOGICAL_UNIT_RESET 0x17 -#define TASK_ABORTED 0x20 -#define SAM_STAT_TASK_ABORTED 0x40 +#define SIMPLE_QUEUE_TAG 0x20 +#define HEAD_OF_QUEUE_TAG 0x21 +#define ORDERED_QUEUE_TAG 0x22 +#define IGNORE_WIDE_RESIDUE 0x23 +#define ACA 0x24 +#define QAS_REQUEST 0x55 #endif diff --git a/usr/target.c b/usr/target.c index f48839e..7539daa 100644 --- a/usr/target.c +++ b/usr/target.c @@ -357,26 +357,26 @@ static int cmd_enabled(struct tgt_cmd_qu { int enabled = 0; - if (cmd->attribute != MSG_SIMPLE_TAG) + if (cmd->attribute != SIMPLE_QUEUE_TAG) dprintf("non simple attribute %" PRIx64 " %x %" PRIu64 " %d\n", cmd->tag, cmd->attribute, cmd->dev ? cmd->dev->lun : UINT64_MAX, q->active_cmd); switch (cmd->attribute) { - case MSG_SIMPLE_TAG: + case SIMPLE_QUEUE_TAG: if (!queue_blocked(q)) enabled = 1; break; - case MSG_ORDERED_TAG: + case ORDERED_QUEUE_TAG: if (!queue_blocked(q) && !queue_active(q)) enabled = 1; break; - case MSG_HEAD_TAG: + case HEAD_OF_QUEUE_TAG: enabled = 1; break; default: eprintf("unknown command attribute %x\n", cmd->attribute); - cmd->attribute = MSG_ORDERED_TAG; + cmd->attribute = ORDERED_QUEUE_TAG; if (!queue_blocked(q) && !queue_active(q)) enabled = 1; } @@ -388,8 +388,8 @@ static void cmd_post_perform(struct tgt_ { q->active_cmd++; switch (cmd->attribute) { - case MSG_ORDERED_TAG: - case MSG_HEAD_TAG: + case ORDERED_QUEUE_TAG: + case HEAD_OF_QUEUE_TAG: set_queue_blocked(q); break; } @@ -522,8 +522,8 @@ static void __cmd_done(struct target *ta q->active_cmd--; switch (cmd->attribute) { - case MSG_ORDERED_TAG: - case MSG_HEAD_TAG: + case ORDERED_QUEUE_TAG: + case HEAD_OF_QUEUE_TAG: clear_queue_blocked(q); break; }