2 * Workbit NinjaSCSI-32Bi/UDE PCI/CardBus SCSI Host Bus Adapter driver
5 * This software may be used and distributed according to the terms of
6 * the GNU General Public License.
10 * Show the command data of a command
12 static const char unknown
[] = "UNKNOWN";
14 static const char * group_0_commands
[] = {
15 /* 00-03 */ "Test Unit Ready", "Rezero Unit", unknown
, "Request Sense",
16 /* 04-07 */ "Format Unit", "Read Block Limits", unknown
, "Reassign Blocks",
17 /* 08-0d */ "Read (6)", unknown
, "Write (6)", "Seek (6)", unknown
, unknown
,
18 /* 0e-12 */ unknown
, "Read Reverse", "Write Filemarks", "Space", "Inquiry",
19 /* 13-16 */ unknown
, "Recover Buffered Data", "Mode Select", "Reserve",
20 /* 17-1b */ "Release", "Copy", "Erase", "Mode Sense", "Start/Stop Unit",
21 /* 1c-1d */ "Receive Diagnostic", "Send Diagnostic",
22 /* 1e-1f */ "Prevent/Allow Medium Removal", unknown
,
26 static const char *group_1_commands
[] = {
27 /* 20-22 */ unknown
, unknown
, unknown
,
28 /* 23-28 */ unknown
, unknown
, "Read Capacity", unknown
, unknown
, "Read (10)",
29 /* 29-2d */ unknown
, "Write (10)", "Seek (10)", unknown
, unknown
,
30 /* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal",
31 /* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position",
32 /* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data",
33 /* 38-3c */ "Medium Scan", "Compare","Copy Verify", "Write Buffer", "Read Buffer",
34 /* 3d-3f */ "Update Block", "Read Long", "Write Long",
38 static const char *group_2_commands
[] = {
39 /* 40-41 */ "Change Definition", "Write Same",
40 /* 42-48 */ "Read Sub-Ch(cd)", "Read TOC", "Read Header(cd)", "Play Audio(cd)", unknown
, "Play Audio MSF(cd)", "Play Audio Track/Index(cd)",
41 /* 49-4f */ "Play Track Relative(10)(cd)", unknown
, "Pause/Resume(cd)", "Log Select", "Log Sense", unknown
, unknown
,
42 /* 50-55 */ unknown
, unknown
, unknown
, unknown
, unknown
, "Mode Select (10)",
43 /* 56-5b */ unknown
, unknown
, unknown
, unknown
, "Mode Sense (10)", unknown
,
44 /* 5c-5f */ unknown
, unknown
, unknown
,
47 #define group(opcode) (((opcode) >> 5) & 7)
49 #define RESERVED_GROUP 0
50 #define VENDOR_GROUP 1
51 #define NOTEXT_GROUP 2
53 static const char **commands
[] = {
54 group_0_commands
, group_1_commands
, group_2_commands
,
55 (const char **) RESERVED_GROUP
, (const char **) RESERVED_GROUP
,
56 (const char **) NOTEXT_GROUP
, (const char **) VENDOR_GROUP
,
57 (const char **) VENDOR_GROUP
60 static const char reserved
[] = "RESERVED";
61 static const char vendor
[] = "VENDOR SPECIFIC";
63 static void print_opcodek(unsigned char opcode
)
65 const char **table
= commands
[ group(opcode
) ];
67 switch ((unsigned long) table
) {
69 printk("%s[%02x] ", reserved
, opcode
);
72 printk("%s(notext)[%02x] ", unknown
, opcode
);
75 printk("%s[%02x] ", vendor
, opcode
);
78 if (table
[opcode
& 0x1f] != unknown
)
79 printk("%s[%02x] ", table
[opcode
& 0x1f], opcode
);
81 printk("%s[%02x] ", unknown
, opcode
);
86 static void print_commandk (unsigned char *command
)
89 // printk(KERN_DEBUG);
90 print_opcodek(command
[0]);
91 /*printk(KERN_DEBUG "%s ", __func__);*/
92 if ((command
[0] >> 5) == 6 ||
93 (command
[0] >> 5) == 7 ) {
94 s
= 12; /* vender specific */
96 s
= COMMAND_SIZE(command
[0]);
99 for ( i
= 1; i
< s
; ++i
) {
100 printk("%02x ", command
[i
]);
105 printk("LBA=%d len=%d",
106 (((unsigned int)command
[1] & 0x0f) << 16) |
107 ( (unsigned int)command
[2] << 8) |
108 ( (unsigned int)command
[3] ),
109 (unsigned int)command
[4]
113 printk("LBA=%d len=%d",
114 ((unsigned int)command
[2] << 24) |
115 ((unsigned int)command
[3] << 16) |
116 ((unsigned int)command
[4] << 8) |
117 ((unsigned int)command
[5] ),
118 ((unsigned int)command
[7] << 8) |
119 ((unsigned int)command
[8] )
123 printk("LBA=%d len=%d",
124 ((unsigned int)command
[2] << 24) |
125 ((unsigned int)command
[3] << 16) |
126 ((unsigned int)command
[4] << 8) |
127 ((unsigned int)command
[5] ),
128 ((unsigned int)command
[6] << 24) |
129 ((unsigned int)command
[7] << 16) |
130 ((unsigned int)command
[8] << 8) |
131 ((unsigned int)command
[9] )
140 static void show_command(Scsi_Cmnd
*SCpnt
)
142 print_commandk(SCpnt
->cmnd
);
145 static void show_busphase(unsigned char stat
)
148 case BUSPHASE_COMMAND
:
149 printk( "BUSPHASE_COMMAND\n");
151 case BUSPHASE_MESSAGE_IN
:
152 printk( "BUSPHASE_MESSAGE_IN\n");
154 case BUSPHASE_MESSAGE_OUT
:
155 printk( "BUSPHASE_MESSAGE_OUT\n");
157 case BUSPHASE_DATA_IN
:
158 printk( "BUSPHASE_DATA_IN\n");
160 case BUSPHASE_DATA_OUT
:
161 printk( "BUSPHASE_DATA_OUT\n");
163 case BUSPHASE_STATUS
:
164 printk( "BUSPHASE_STATUS\n");
166 case BUSPHASE_SELECT
:
167 printk( "BUSPHASE_SELECT\n");
170 printk( "BUSPHASE_other: 0x%x\n", stat
);
175 static void show_autophase(unsigned short i
)
177 printk("auto: 0x%x,", i
);
179 if(i
& COMMAND_PHASE
) {
182 if(i
& DATA_IN_PHASE
) {
185 if(i
& DATA_OUT_PHASE
) {
188 if(i
& MSGOUT_PHASE
) {
191 if(i
& STATUS_PHASE
) {
194 if(i
& ILLEGAL_PHASE
) {
197 if(i
& BUS_FREE_OCCUER
) {
200 if(i
& MSG_IN_OCCUER
) {
203 if(i
& MSG_OUT_OCCUER
) {
206 if(i
& SELECTION_TIMEOUT
) {
209 if(i
& MSGIN_00_VALID
) {
212 if(i
& MSGIN_02_VALID
) {
215 if(i
& MSGIN_03_VALID
) {
218 if(i
& MSGIN_04_VALID
) {
221 if(i
& AUTOSCSI_BUSY
) {
228 static void nsp32_print_register(int base
)
230 if (!(NSP32_DEBUG_MASK
& NSP32_SPECIAL_PRINT_REGISTER
))
233 printk("Phase=0x%x, ", nsp32_read1(base
, SCSI_BUS_MONITOR
));
234 printk("OldPhase=0x%x, ", nsp32_index_read1(base
, OLD_SCSI_PHASE
));
235 printk("syncreg=0x%x, ", nsp32_read1(base
, SYNC_REG
));
236 printk("ackwidth=0x%x, ", nsp32_read1(base
, ACK_WIDTH
));
237 printk("sgtpaddr=0x%lx, ", nsp32_read4(base
, SGT_ADR
));
238 printk("scsioutlatch=0x%x, ", nsp32_read1(base
, SCSI_OUT_LATCH_TARGET_ID
));
239 printk("msgout=0x%lx, ", nsp32_read4(base
, SCSI_MSG_OUT
));
240 printk("miscrd=0x%x, ", nsp32_index_read2(base
, MISC_WR
));
241 printk("seltimeout=0x%x, ", nsp32_read2(base
, SEL_TIME_OUT
));
242 printk("sreqrate=0x%x, ", nsp32_read1(base
, SREQ_SMPL_RATE
));
243 printk("transStatus=0x%x, ", nsp32_read2(base
, TRANSFER_STATUS
));
244 printk("reselectid=0x%x, ", nsp32_read2(base
, COMMAND_CONTROL
));
245 printk("arbit=0x%x, ", nsp32_read1(base
, ARBIT_STATUS
));
246 printk("BmStart=0x%lx, ", nsp32_read4(base
, BM_START_ADR
));
247 printk("BmCount=0x%lx, ", nsp32_read4(base
, BM_CNT
));
248 printk("SackCnt=0x%lx, ", nsp32_read4(base
, SACK_CNT
));
249 printk("SReqCnt=0x%lx, ", nsp32_read4(base
, SREQ_CNT
));
250 printk("SavedSackCnt=0x%lx, ", nsp32_read4(base
, SAVED_SACK_CNT
));
251 printk("ScsiBusControl=0x%x, ", nsp32_read1(base
, SCSI_BUS_CONTROL
));
252 printk("FifoRestCnt=0x%x, ", nsp32_read2(base
, FIFO_REST_CNT
));
253 printk("CdbIn=0x%x, ", nsp32_read1(base
, SCSI_CSB_IN
));
257 printk("execph=0x%x, ", nsp32_read2(base
, SCSI_EXECUTE_PHASE
));
258 printk("IrqStatus=0x%x, ", nsp32_read2(base
, IRQ_STATUS
));