Skip to contentSkip to conversation

Some constants I don't understand in sym2

DISCUSSION Matthew Wilcox 2 participants 2 messages Sep 20, 2004 SCSI

lore
Share & tools
lore
#0 lore raw

I'd like to convert sym2 over to using the same constants as the rest of Linux SCSI. I think this process has uncovered a bug, but it may simply be history that I'm missing. Here's one bit:

-#define        S_GOOD          (0x00)
-#define        S_CHECK_COND    (0x02)
[...]
+#define        S_GOOD          SAM_STAT_GOOD
+#define        S_CHECK_COND    SAM_STAT_CHECK_CONDITION
[...]
 #define        S_TERMINATED    (0x20)
-#define        S_QUEUE_FULL    (0x28)
+#define        S_QUEUE_FULL    SAM_STAT_TASK_SET_FULL
 #define        S_ILLEGAL       (0xff)

I don't know what S_TERMINATED should be. There's SAM_STAT_COMMAND_TERMINATED 0x22, marked as obsolete in SAM-3. Was there ever a TERMINATED that was 0x20, or is this simply a mistake? This same definition can also be found in drivers/scsi/sym53c8xx_defs.h (from the same author). aiclib.h thinks SCSI_STATUS_CMD_TERMINATED (0x22) is obsolete in SAM-2 instead of SAM-3.

Other symbolic tags I haven't found Linux names for yet include:

 #define        M_ABORT_TAG     (0x0d)
 #define        M_CLEAR_QUEUE   (0x0e)
-#define        M_INIT_REC      (0x0f)
-#define        M_REL_REC       (0x10)
+#define        M_INIT_REC      INITIATE_RECOVERY
+#define        M_REL_REC       RELEASE_RECOVERY
 #define        M_TERMINATE     (0x11)
 #define        M_IGN_RESIDUE   (0x23)
 #define        M_IDENTIFY      (0x80)

Again, history lesson / pointers to specs appreciated (I have sam3r09, spc3r15 and spi5r06 handy).

Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
#1 lore raw
Quoted 1 line

Was there ever a TERMINATED that was 0x20, or is this simply a

mistake?

SCSI-2 defines "COMMAND TERMINATED" status as 0x22. This status value is special because the target is supposed to have sense data available after returning COMMAND TERMINATED status (just like after returning CHECK CONDITION). The sym2 driver requests sense data after seeing a status of S_TERMINATED or S_CHECK_COND, so this looks like a typo. The correct value is 0x22.

Quoted 12 lines

Other symbolic tags I haven't found Linux names for yet include:

 #define        M_ABORT_TAG     (0x0d)
 #define        M_CLEAR_QUEUE   (0x0e)
(quoted diff) +2 -2
-#define        M_INIT_REC      (0x0f)
-#define        M_REL_REC       (0x10)
+#define        M_INIT_REC      INITIATE_RECOVERY
+#define        M_REL_REC       RELEASE_RECOVERY
 #define        M_TERMINATE     (0x11)
 #define        M_IGN_RESIDUE   (0x23)
 #define        M_IDENTIFY      (0x80)
Quoted 2 lines

Again, history lesson / pointers to specs appreciated (I have sam3r09, spc3r15 and spi5r06 handy).

These are SCSI-2 names for various SPI messages. SCSI-3 gave them different names but kept the same meanings. Do a reverse lookup on the message code in the SPI spec to get the new names:

ABORT TAG -> ABORT TASK
CLEAR QUEUE -> CLEAR TASK SET
TERMINATE TASK -> defined in SPI2 but not in SPI3 and above IGNORE WIDE RESIDUE (same)
IDENTIFY (actually a bitmask - any message with the high bit set is IDENTIFY)

As always, SCSI-related specs can be downloaded from www.t10.org

Anthony J. Battersby
Cybernetics