-
Notifications
You must be signed in to change notification settings - Fork 3
/
debug.c
238 lines (178 loc) · 4.97 KB
/
debug.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#include <exec/io.h>
#include <exec/errors.h>
#include <devices/trackdisk.h>
#include <devices/scsidisk.h>
#include "device.h"
#include "debug.h"
#include "newstyle.h"
#if DEBUG & DBG_CMD
void traceCommand(struct IOStdReq *req) {
char *commandName;
char *err;
switch (req->io_Command) {
case CMD_CLEAR:
commandName = "CMD_CLEAR";
break;
case CMD_UPDATE:
commandName = "CMD_UPDATE";
break;
case CMD_READ:
commandName = "CMD_READ";
break;
case CMD_WRITE:
commandName = "CMD_WRITE";
break;
case TD_REMCHANGEINT:
commandName = "TD_REMCHANGEINT";
break;
case TD_PROTSTATUS:
commandName = "TD_PROTSTATUS";
break;
case TD_CHANGENUM:
commandName = "TD_CHANGENUM";
break;
case TD_CHANGESTATE:
commandName = "TD_CHANGESTATE";
break;
case TD_EJECT:
commandName = "TD_EJECT";
break;
case TD_GETDRIVETYPE:
commandName = "TD_GETDRIVETYPE";
break;
case TD_GETGEOMETRY:
commandName = "TD_GETGEOMETRY";
break;
case TD_MOTOR:
commandName = "TD_MOTOR";
break;
case TD_READ64:
commandName = "TD_READ64";
break;
case TD_WRITE64:
commandName = "TD_WRITE64";
break;
case TD_FORMAT64:
commandName = "TD_FORMAT64";
break;
case NSCMD_DEVICEQUERY:
commandName = "NSCMD_DEVICEQUERY";
break;
case NSCMD_TD_READ64:
commandName = "NSCMD_TD_READ64";
break;
case NSCMD_TD_WRITE64:
commandName = "NSCMD_TD_WRITE64";
break;
case NSCMD_TD_FORMAT64:
commandName = "NSCMD_TD_FORMAT64";
break;
case HD_SCSICMD:
commandName = "HD_SCSICMD";
break;
default:
commandName = "UNKNOWN";
break;
}
switch (req->io_Error) {
case 0:
err = "OK";
break;
case IOERR_OPENFAIL:
err = "IOERR_OPENFAIL";
break;
case IOERR_ABORTED:
err = "IOERR_ABORTED";
break;
case IOERR_NOCMD:
err = "IOERR_NOCMD";
break;
case IOERR_BADLENGTH:
err = "IOERR_BADLENGTH";
break;
case IOERR_BADADDRESS:
err = "IOERR_BADADDRESS";
break;
case IOERR_UNITBUSY:
err = "IOERR_UNITBUSY";
break;
case IOERR_SELFTEST:
err = "IOERR_SELFTEST";
break;
case HFERR_SelfUnit:
err = "HFERR_SelfUnit";
break;
case HFERR_DMA:
err = "HFERR_DMA";
break;
case HFERR_Phase:
err = "HFERR_Phase";
break;
case HFERR_Parity:
err = "HFERR_Parity";
break;
case HFERR_SelTimeout:
err = "HFERR_SelTimeout";
break;
case HFERR_BadStatus:
err = "HFERR_BadStatus";
break;
case HFERR_NoBoard:
err = "HFERR_NoBoard";
break;
case TDERR_NotSpecified:
err = "TDERR_NotSpecified";
break;
case TDERR_NoSecHdr:
err = "TDERR_NoSecHdr";
break;
case TDERR_BadSecPreamble:
err = "TDERR_BadSecPreamble";
break;
case TDERR_BadSecID:
err = "TDERR_BadSecID";
break;
case TDERR_BadHdrSum:
err = "TDERR_BadHdrSum";
break;
case TDERR_BadSecSum:
err = "TDERR_BadSecSum";
break;
case TDERR_TooFewSecs:
err = "TDERR_TooFewSecs";
break;
case TDERR_BadSecHdr:
err = "TDERR_BadSecHdr";
break;
case TDERR_WriteProt:
err = "TDERR_WriteProt";
break;
case TDERR_DiskChanged:
err = "TDERR_DiskChanged";
break;
case TDERR_SeekError:
err = "TDERR_SeekError";
break;
case TDERR_NoMem:
err = "TDERR_NoMem";
break;
case TDERR_BadUnitNum:
err = "TDERR_BadUnitNum";
break;
case TDERR_BadDriveType:
err = "TDERR_BadDriveType";
break;
case TDERR_DriveInUse:
err = "TDERR_DriveInUse";
break;
case TDERR_PostReset:
err = "TDERR_PostReset";
break;
default:
err = "UNKNOWN";
}
struct IDEUnit *unit = (struct IDEUnit *)req->io_Unit;
LONG unitNum = unit->unitNum;
KPrintF("Unit: %ld - %s : Error: %s Actual: %ld\n", unitNum, commandName, err, req->io_Actual);
}
#endif