xref: /freebsd/cddl/lib/libdtrace/cam.d (revision efb77950fdd6fb03dc172a44b3875948609b7804)
1*efb77950SWarner Losh /*-
2*efb77950SWarner Losh  * Copyrtight (c) 2026 Netflix, Inc
3*efb77950SWarner Losh  *
4*efb77950SWarner Losh  * SPDX-License-Expression: BSD-2-Clause
5*efb77950SWarner Losh  */
6*efb77950SWarner Losh 
7*efb77950SWarner Losh inline string xpt_action_string[int key] =
8*efb77950SWarner Losh 	key ==  0 ? "XPT_NOOP" :
9*efb77950SWarner Losh 	key ==  1 ? "XPT_SCSI_IO" :
10*efb77950SWarner Losh 	key ==  2 ? "XPT_GDEV_TYPE" :
11*efb77950SWarner Losh 	key ==  3 ? "XPT_GDEVLIST" :
12*efb77950SWarner Losh 	key ==  4 ? "XPT_PATH_INQ" :
13*efb77950SWarner Losh 	key ==  5 ? "XPT_REL_SIMQ" :
14*efb77950SWarner Losh 	key ==  6 ? "XPT_SASYNC_CB" :
15*efb77950SWarner Losh 	key ==  7 ? "XPT_SDEV_TYPE" :
16*efb77950SWarner Losh 	key ==  8 ? "XPT_SCAN_BUS" :
17*efb77950SWarner Losh 	key ==  9 ? "XPT_DEV_MATCH" :
18*efb77950SWarner Losh 	key == 10 ? "XPT_DEBUG" :
19*efb77950SWarner Losh 	key == 11 ? "XPT_PATH_STATS" :
20*efb77950SWarner Losh 	key == 12 ? "XPT_GDEV_STATS" :
21*efb77950SWarner Losh 	key == 13 ? "XPT_0X0d" :
22*efb77950SWarner Losh 	key == 14 ? "XPT_DEV_ADVINFO" :
23*efb77950SWarner Losh 	key == 15 ? "XPT_ASYNC" :
24*efb77950SWarner Losh 	key == 16 ? "XPT_ABORT" :
25*efb77950SWarner Losh 	key == 17 ? "XPT_RESET_BUS" :
26*efb77950SWarner Losh 	key == 18 ? "XPT_RESET_DEV" :
27*efb77950SWarner Losh 	key == 19 ? "XPT_TERM_IO" :
28*efb77950SWarner Losh 	key == 20 ? "XPT_SCAN_LUN" :
29*efb77950SWarner Losh 	key == 21 ? "XPT_GET_TRAN_SETTINGS" :
30*efb77950SWarner Losh 	key == 22 ? "XPT_SET_TRAN_SETTINGS" :
31*efb77950SWarner Losh 	key == 23 ? "XPT_CALC_GEOMETRY" :
32*efb77950SWarner Losh 	key == 24 ? "XPT_ATA_IO" :
33*efb77950SWarner Losh 	key == 25 ? "XPT_SET_SIM_KNOB" :
34*efb77950SWarner Losh 	key == 26 ? "XPT_GET_SIM_KNOB" :
35*efb77950SWarner Losh 	key == 27 ? "XPT_SMP_IO" :
36*efb77950SWarner Losh 	key == 28 ? "XPT_NVME_IO" :
37*efb77950SWarner Losh 	key == 29 ? "XPT_MMC_IO" :
38*efb77950SWarner Losh 	key == 30 ? "XPT_SCAN_TGT" :
39*efb77950SWarner Losh 	key == 31 ? "XPT_NVME_ADMIN" :
40*efb77950SWarner Losh 	"Too big" ;
41*efb77950SWarner Losh 
42*efb77950SWarner Losh inline string xpt_async_string[int key] =
43*efb77950SWarner Losh 	key == 0x1    ? "AC_BUS_RESET" :
44*efb77950SWarner Losh 	key == 0x2    ? "AC_UNSOL_RESEL" :
45*efb77950SWarner Losh 	key == 0x4    ? "AC_0x4" :
46*efb77950SWarner Losh 	key == 0x8    ? "AC_SENT_AEN" :
47*efb77950SWarner Losh 	key == 0x10   ? "AC_SENT_BDR" :
48*efb77950SWarner Losh 	key == 0x20   ? "AC_PATH_REGISTERED" :
49*efb77950SWarner Losh 	key == 0x40   ? "AC_PATH_DEREGISTERED" :
50*efb77950SWarner Losh 	key == 0x80   ? "AC_FOUND_DEVICE" :
51*efb77950SWarner Losh 	key == 0x100  ? "AC_LOST_DEVICE" :
52*efb77950SWarner Losh 	key == 0x200  ? "AC_TRANSFER_NEG" :
53*efb77950SWarner Losh 	key == 0x400  ? "AC_INQ_CHANGED" :
54*efb77950SWarner Losh 	key == 0x800  ? "AC_GETDEV_CHANGED" :
55*efb77950SWarner Losh 	key == 0x1000 ? "AC_CONTRACT" :
56*efb77950SWarner Losh 	key == 0x2000 ? "AC_ADVINFO_CHANGED" :
57*efb77950SWarner Losh 	key == 0x4000 ? "AC_UNIT_ATTENTION" :
58*efb77950SWarner Losh 	"AC UNKNOWN";
59*efb77950SWarner Losh 
60*efb77950SWarner Losh 
61*efb77950SWarner Losh inline int CAM_CDB_POINTER = 1;
62*efb77950SWarner Losh 
63*efb77950SWarner Losh inline int XPT_OP_MASK		= 0xff;
64*efb77950SWarner Losh inline int XPT_NOOP		= 0x00;
65*efb77950SWarner Losh inline int XPT_SCSI_IO		= 0x01;
66*efb77950SWarner Losh inline int XPT_GDEV_TYPE	= 0x02;
67*efb77950SWarner Losh inline int XPT_GDEVLIST		= 0x03;
68*efb77950SWarner Losh inline int XPT_PATH_INQ		= 0x04;
69*efb77950SWarner Losh inline int XPT_REL_SIMQ		= 0x05;
70*efb77950SWarner Losh inline int XPT_SASYNC_CB	= 0x06;
71*efb77950SWarner Losh inline int XPT_SDEV_TYPE	= 0x07;
72*efb77950SWarner Losh inline int XPT_SCAN_BUS		= 0x08;
73*efb77950SWarner Losh inline int XPT_DEV_MATCH	= 0x09;
74*efb77950SWarner Losh inline int XPT_DEBUG		= 0x0a;
75*efb77950SWarner Losh inline int XPT_PATH_STATS	= 0x0b;
76*efb77950SWarner Losh inline int XPT_GDEV_STATS	= 0x0c;
77*efb77950SWarner Losh inline int XPT_DEV_ADVINFO	= 0x0e;
78*efb77950SWarner Losh inline int XPT_ASYNC		= 0x0f;
79*efb77950SWarner Losh inline int XPT_ABORT		= 0x10;
80*efb77950SWarner Losh inline int XPT_RESET_BUS	= 0x11;
81*efb77950SWarner Losh inline int XPT_RESET_DEV	= 0x12;
82*efb77950SWarner Losh inline int XPT_TERM_IO		= 0x13;
83*efb77950SWarner Losh inline int XPT_SCAN_LUN		= 0x14;
84*efb77950SWarner Losh inline int XPT_GET_TRAN_SETTINGS = 0x15;
85*efb77950SWarner Losh inline int XPT_SET_TRAN_SETTINGS = 0x16;
86*efb77950SWarner Losh inline int XPT_CALC_GEOMETRY	= 0x17;
87*efb77950SWarner Losh inline int XPT_ATA_IO		= 0x18;
88*efb77950SWarner Losh inline int XPT_SET_SIM_KNOB	= 0x19;
89*efb77950SWarner Losh inline int XPT_GET_SIM_KNOB	= 0x1a;
90*efb77950SWarner Losh inline int XPT_SMP_IO		= 0x1b;
91*efb77950SWarner Losh inline int XPT_NVME_IO		= 0x1c;
92*efb77950SWarner Losh inline int XPT_MMC_IO		= 0x1c;
93*efb77950SWarner Losh inline int XPT_SCAN_TGT		= 0x1e;
94*efb77950SWarner Losh inline int XPT_NVME_ADMIN	= 0x1f;
95*efb77950SWarner Losh inline int XPT_ENG_INQ		= 0x20;
96*efb77950SWarner Losh inline int XPT_ENG_EXEC		= 0x21;
97*efb77950SWarner Losh inline int XPT_EN_LUN		= 0x30;
98*efb77950SWarner Losh inline int XPT_TARGET_IO	= 0x31;
99*efb77950SWarner Losh inline int XPT_ACCEPT_TARGET_IO	= 0x32;
100*efb77950SWarner Losh inline int XPT_CONT_TARGET_IO	= 0x33;
101*efb77950SWarner Losh inline int XPT_IMMED_NOTIFY	= 0x34;
102*efb77950SWarner Losh inline int XPT_NOTIFY_ACK	= 0x35;
103*efb77950SWarner Losh inline int XPT_IMMEDIATE_NOTIFY	= 0x36;
104*efb77950SWarner Losh inline int XPT_NOTIFY_ACKNOWLEDGE = 0x37;
105*efb77950SWarner Losh inline int XPT_REPROBE_LUN	= 0x38;
106*efb77950SWarner Losh inline int XPT_MMC_SET_TRAN_SETTINGS = 0x40;
107*efb77950SWarner Losh inline int XPT_MMC_GET_TRAN_SETTINGS = 0x41;
108*efb77950SWarner Losh 
109*efb77950SWarner Losh inline int XPT_FC_QUEUED	= 0x100;
110*efb77950SWarner Losh inline int XPT_FC_USER_CCB	= 0x200;
111*efb77950SWarner Losh inline int XPT_FC_XPT_ONLY	= 0x400;
112*efb77950SWarner Losh inline int XPT_FC_DEV_QUEUED	= 0x800;
113*efb77950SWarner Losh 
114*efb77950SWarner Losh inline int PROTO_UNKNOWN = 0;
115*efb77950SWarner Losh inline int PROTO_UNSPECIFIED = 1;
116*efb77950SWarner Losh inline int PROTO_SCSI = 2;
117*efb77950SWarner Losh inline int PROTO_ATA = 3;
118*efb77950SWarner Losh inline int PROTO_ATAPI = 4;
119*efb77950SWarner Losh inline int PROTO_SATAPM = 5;
120*efb77950SWarner Losh inline int PROTO_SEMB = 6;
121*efb77950SWarner Losh inline int PROTO_NVME = 7;
122*efb77950SWarner Losh inline int PROTO_MMCSD = 8;
123*efb77950SWarner Losh 
124*efb77950SWarner Losh inline int XPORT_UNKNOWN = 0;
125*efb77950SWarner Losh inline int XPORT_UNSPECIFIED = 1;
126*efb77950SWarner Losh inline int XPORT_SPI = 2;
127*efb77950SWarner Losh inline int XPORT_FC = 3;
128*efb77950SWarner Losh inline int XPORT_SSA = 4;
129*efb77950SWarner Losh inline int XPORT_USB = 5;
130*efb77950SWarner Losh inline int XPORT_PPB = 6;
131*efb77950SWarner Losh inline int XPORT_ATA = 7;
132*efb77950SWarner Losh inline int XPORT_SAS = 8;
133*efb77950SWarner Losh inline int XPORT_SATA = 9;
134*efb77950SWarner Losh inline int XPORT_ISCSI = 10;
135*efb77950SWarner Losh inline int XPORT_SRP = 11;
136*efb77950SWarner Losh inline int XPORT_NVME = 12;
137*efb77950SWarner Losh inline int XPORT_MMCSD = 13;
138*efb77950SWarner Losh inline int XPORT_NVMF = 14;
139*efb77950SWarner Losh inline int XPORT_UFSHCI = 15;
140*efb77950SWarner Losh 
141*efb77950SWarner Losh inline int CAM_REQ_INPROG	= 0x00;
142*efb77950SWarner Losh inline int CAM_REQ_CMP		= 0x01;
143*efb77950SWarner Losh inline int CAM_REQ_ABORTED	= 0x02;
144*efb77950SWarner Losh inline int CAM_UA_ABORT		= 0x03;
145*efb77950SWarner Losh inline int CAM_REQ_CMP_ERR	= 0x04;
146*efb77950SWarner Losh inline int CAM_BUSY		= 0x05;
147*efb77950SWarner Losh inline int CAM_REQ_INVALID	= 0x06;
148*efb77950SWarner Losh inline int CAM_PATH_INVALID	= 0x07;
149*efb77950SWarner Losh inline int CAM_DEV_NOT_THERE	= 0x08;
150*efb77950SWarner Losh inline int CAM_UA_TERMIO	= 0x09;
151*efb77950SWarner Losh inline int CAM_SEL_TIMEOUT	= 0x0a;
152*efb77950SWarner Losh inline int CAM_CMD_TIMEOUT	= 0x0b;
153*efb77950SWarner Losh inline int CAM_SCSI_STATUS_ERROR = 0x0c;
154*efb77950SWarner Losh inline int CAM_MSG_REJECT_REC	= 0x0d;
155*efb77950SWarner Losh inline int CAM_SCSI_BUS_RESET	= 0x0e;
156*efb77950SWarner Losh inline int CAM_UNCOR_PARITY	= 0x0f;
157*efb77950SWarner Losh inline int CAM_AUTOSENSE_FAIL	= 0x10;
158*efb77950SWarner Losh inline int CAM_NO_HBA		= 0x11;
159*efb77950SWarner Losh inline int CAM_DATA_RUN_ERR	= 0x12;
160*efb77950SWarner Losh inline int CAM_UNEXP_BUSFREE	= 0x13;
161*efb77950SWarner Losh inline int CAM_SEQUENCE_FAIL	= 0x14;
162*efb77950SWarner Losh inline int CAM_CCB_LEN_ERR	= 0x15;
163*efb77950SWarner Losh inline int CAM_PROVIDE_FAIL	= 0x16;
164*efb77950SWarner Losh inline int CAM_BDR_SENT		= 0x17;
165*efb77950SWarner Losh inline int CAM_REQ_TERMIO	= 0x18;
166*efb77950SWarner Losh inline int CAM_UNREC_HBA_ERROR	= 0x19;
167*efb77950SWarner Losh inline int CAM_REQ_TOO_BIG	= 0x1a;
168*efb77950SWarner Losh inline int CAM_REQUEUE_REQ	= 0x1b;
169*efb77950SWarner Losh inline int CAM_ATA_STATUS_ERROR	= 0x1c;
170*efb77950SWarner Losh inline int CAM_SCSI_IT_NEXUS_LOST = 0x1d;
171*efb77950SWarner Losh inline int CAM_SMP_STATUS_ERROR	= 0x1e;
172*efb77950SWarner Losh inline int CAM_REQ_SOFTTIMEOUT	= 0x1f;
173*efb77950SWarner Losh inline int CAM_NVME_STATUS_ERROR = 0x20;
174*efb77950SWarner Losh inline int CAM_IDE		= 0x33;
175*efb77950SWarner Losh inline int CAM_RESRC_UNAVAIL	= 0x34;
176*efb77950SWarner Losh inline int CAM_UNACKED_EVENT	= 0x35;
177*efb77950SWarner Losh inline int CAM_MESSAGE_RECV	= 0x36;
178*efb77950SWarner Losh inline int CAM_INVALID_CDB	= 0x37;
179*efb77950SWarner Losh inline int CAM_LUN_INVALID	= 0x38;
180*efb77950SWarner Losh inline int CAM_TID_INVALID	= 0x39;
181*efb77950SWarner Losh inline int CAM_FUNC_NOTAVAIL	= 0x3a;
182*efb77950SWarner Losh inline int CAM_NO_NEXUS		= 0x3b;
183*efb77950SWarner Losh inline int CAM_IID_INVALID	= 0x3c;
184*efb77950SWarner Losh inline int CAM_CDB_RECVD	= 0x3d;
185*efb77950SWarner Losh inline int CAM_LUN_ALRDY_ENA	= 0x3e;
186*efb77950SWarner Losh inline int CAM_SCSI_BUSY	= 0x3f;
187*efb77950SWarner Losh 
188*efb77950SWarner Losh inline int CAM_DEV_QFRZN	= 0x40;
189*efb77950SWarner Losh inline int CAM_AUTOSNS_VALID	= 0x80;
190*efb77950SWarner Losh inline int CAM_RELEASE_SIMQ	= 0x100;
191*efb77950SWarner Losh inline int CAM_SIM_QUEUED	= 0x200;
192*efb77950SWarner Losh inline int CAM_QOS_VALID	= 0x400;
193*efb77950SWarner Losh inline int CAM_STATUS_MASK	= 0x3F;
194*efb77950SWarner Losh inline int CAM_SENT_SENSE	= 0x40000000;
195