-
Notifications
You must be signed in to change notification settings - Fork 26
/
scsi_trace.c
144 lines (138 loc) · 4.29 KB
/
scsi_trace.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
/*
* Copyright (c) 2019 SUSE LLC
*
* Licensed under LGPL-2.1 (see LICENSE)
*/
#include "common.h"
#include "scsi_trace.h"
#define CASE_STR(x) case x: return #x;
_Use_decl_annotations_
PCHAR
WnbdToStringSrbFunction(ULONG SrbFunction)
{
switch(SrbFunction) {
CASE_STR(SRB_FUNCTION_EXECUTE_SCSI)
CASE_STR(SRB_FUNCTION_CLAIM_DEVICE)
CASE_STR(SRB_FUNCTION_IO_CONTROL)
CASE_STR(SRB_FUNCTION_RECEIVE_EVENT)
CASE_STR(SRB_FUNCTION_RELEASE_QUEUE)
CASE_STR(SRB_FUNCTION_ATTACH_DEVICE)
CASE_STR(SRB_FUNCTION_RELEASE_DEVICE)
CASE_STR(SRB_FUNCTION_SHUTDOWN)
CASE_STR(SRB_FUNCTION_FLUSH)
CASE_STR(SRB_FUNCTION_PROTOCOL_COMMAND)
CASE_STR(SRB_FUNCTION_ABORT_COMMAND)
CASE_STR(SRB_FUNCTION_RELEASE_RECOVERY)
CASE_STR(SRB_FUNCTION_RESET_BUS)
CASE_STR(SRB_FUNCTION_RESET_DEVICE)
CASE_STR(SRB_FUNCTION_TERMINATE_IO)
CASE_STR(SRB_FUNCTION_FLUSH_QUEUE)
CASE_STR(SRB_FUNCTION_REMOVE_DEVICE)
CASE_STR(SRB_FUNCTION_WMI)
CASE_STR(SRB_FUNCTION_LOCK_QUEUE)
CASE_STR(SRB_FUNCTION_UNLOCK_QUEUE)
CASE_STR(SRB_FUNCTION_QUIESCE_DEVICE)
CASE_STR(SRB_FUNCTION_RESET_LOGICAL_UNIT)
CASE_STR(SRB_FUNCTION_SET_LINK_TIMEOUT)
CASE_STR(SRB_FUNCTION_LINK_TIMEOUT_OCCURRED)
CASE_STR(SRB_FUNCTION_LINK_TIMEOUT_COMPLETE)
CASE_STR(SRB_FUNCTION_POWER)
CASE_STR(SRB_FUNCTION_PNP)
CASE_STR(SRB_FUNCTION_DUMP_POINTERS)
CASE_STR(SRB_FUNCTION_FREE_DUMP_POINTERS)
default:
return "UNKNOWN_SRB_FUNCTION";
}
}
_Use_decl_annotations_
PCHAR
WnbdToStringSrbStatus(UCHAR SrbStatus)
{
switch(SrbStatus) {
CASE_STR(SRB_STATUS_PENDING)
CASE_STR(SRB_STATUS_SUCCESS)
CASE_STR(SRB_STATUS_ABORTED)
CASE_STR(SRB_STATUS_ABORT_FAILED)
CASE_STR(SRB_STATUS_ERROR)
CASE_STR(SRB_STATUS_BUSY)
CASE_STR(SRB_STATUS_INVALID_REQUEST)
CASE_STR(SRB_STATUS_INVALID_PATH_ID)
CASE_STR(SRB_STATUS_NO_DEVICE)
CASE_STR(SRB_STATUS_TIMEOUT)
CASE_STR(SRB_STATUS_SELECTION_TIMEOUT)
CASE_STR(SRB_STATUS_COMMAND_TIMEOUT)
CASE_STR(SRB_STATUS_MESSAGE_REJECTED)
CASE_STR(SRB_STATUS_BUS_RESET)
CASE_STR(SRB_STATUS_PARITY_ERROR)
CASE_STR(SRB_STATUS_REQUEST_SENSE_FAILED)
CASE_STR(SRB_STATUS_NO_HBA)
CASE_STR(SRB_STATUS_DATA_OVERRUN)
CASE_STR(SRB_STATUS_UNEXPECTED_BUS_FREE)
CASE_STR(SRB_STATUS_PHASE_SEQUENCE_FAILURE)
CASE_STR(SRB_STATUS_BAD_SRB_BLOCK_LENGTH)
CASE_STR(SRB_STATUS_REQUEST_FLUSHED)
CASE_STR(SRB_STATUS_INVALID_LUN)
CASE_STR(SRB_STATUS_INVALID_TARGET_ID)
CASE_STR(SRB_STATUS_BAD_FUNCTION)
CASE_STR(SRB_STATUS_ERROR_RECOVERY)
CASE_STR(SRB_STATUS_NOT_POWERED)
CASE_STR(SRB_STATUS_LINK_DOWN)
// Recent SDK additions
#ifdef SRB_STATUS_INSUFFICIENT_RESOURCES
CASE_STR(SRB_STATUS_INSUFFICIENT_RESOURCES)
#endif
#ifdef SRB_STATUS_THROTTLED_REQUEST
CASE_STR(SRB_STATUS_THROTTLED_REQUEST)
#endif
default:
return "UNKNOWN_SRB_STATUS";
}
}
_Use_decl_annotations_
PCHAR
WnbdToStringPnpMinorFunction(UCHAR PnpMinorFunction)
{
switch (PnpMinorFunction) {
CASE_STR(IRP_MN_START_DEVICE)
CASE_STR(IRP_MN_QUERY_REMOVE_DEVICE)
CASE_STR(IRP_MN_REMOVE_DEVICE)
CASE_STR(IRP_MN_CANCEL_REMOVE_DEVICE)
CASE_STR(IRP_MN_STOP_DEVICE)
CASE_STR(IRP_MN_QUERY_STOP_DEVICE)
CASE_STR(IRP_MN_CANCEL_STOP_DEVICE)
CASE_STR(IRP_MN_QUERY_DEVICE_RELATIONS)
CASE_STR(IRP_MN_QUERY_INTERFACE)
CASE_STR(IRP_MN_QUERY_CAPABILITIES)
CASE_STR(IRP_MN_QUERY_RESOURCES)
CASE_STR(IRP_MN_QUERY_RESOURCE_REQUIREMENTS)
CASE_STR(IRP_MN_QUERY_DEVICE_TEXT)
CASE_STR(IRP_MN_FILTER_RESOURCE_REQUIREMENTS)
CASE_STR(IRP_MN_READ_CONFIG)
CASE_STR(IRP_MN_WRITE_CONFIG)
CASE_STR(IRP_MN_EJECT)
CASE_STR(IRP_MN_SET_LOCK)
CASE_STR(IRP_MN_QUERY_ID)
CASE_STR(IRP_MN_QUERY_PNP_DEVICE_STATE)
CASE_STR(IRP_MN_QUERY_BUS_INFORMATION)
CASE_STR(IRP_MN_DEVICE_USAGE_NOTIFICATION)
CASE_STR(IRP_MN_SURPRISE_REMOVAL)
CASE_STR(IRP_MN_DEVICE_ENUMERATED)
default:
return "IRP_MN_UNKNOWN";
}
}
_Use_decl_annotations_
PCHAR
WnbdToStringScsiAdapterCtrlType(UCHAR ControlType)
{
switch (ControlType){
CASE_STR(ScsiQuerySupportedControlTypes)
CASE_STR(ScsiStopAdapter)
CASE_STR(ScsiRestartAdapter)
CASE_STR(ScsiSetBootConfig)
CASE_STR(ScsiSetRunningConfig)
CASE_STR(ScsiAdapterControlMax)
default:
return "Unknown";
}
}