FreeBSD kernel CAM code
cam.c
Go to the documentation of this file.
1/*-
2 * Generic utility routines for the Common Access Method layer.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
5 *
6 * Copyright (c) 1997 Justin T. Gibbs.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions, and the following disclaimer,
14 * without modification, immediately at the beginning of the file.
15 * 2. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
22 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD$");
33
34#include <sys/param.h>
35#ifdef _KERNEL
36#include <sys/systm.h>
37#include <sys/kernel.h>
38#include <sys/sysctl.h>
39#else /* _KERNEL */
40#include <stdlib.h>
41#include <stdio.h>
42#include <string.h>
43#include <camlib.h>
44#endif /* _KERNEL */
45
46#include <cam/cam.h>
47#include <cam/cam_ccb.h>
48#include <cam/scsi/scsi_all.h>
49#include <cam/scsi/smp_all.h>
50#include <sys/sbuf.h>
51
52#ifdef _KERNEL
53#include <sys/libkern.h>
54#include <cam/cam_queue.h>
55#include <cam/cam_xpt.h>
56
57FEATURE(scbus, "SCSI devices support");
58
59#endif
60
61static int camstatusentrycomp(const void *key, const void *member);
62
64 { CAM_REQ_INPROG, "CCB request is in progress" },
65 { CAM_REQ_CMP, "CCB request completed without error" },
66 { CAM_REQ_ABORTED, "CCB request aborted by the host" },
67 { CAM_UA_ABORT, "Unable to abort CCB request" },
68 { CAM_REQ_CMP_ERR, "CCB request completed with an error" },
69 { CAM_BUSY, "CAM subsystem is busy" },
70 { CAM_REQ_INVALID, "CCB request was invalid" },
71 { CAM_PATH_INVALID, "Supplied Path ID is invalid" },
72 { CAM_DEV_NOT_THERE, "Device Not Present" },
73 { CAM_UA_TERMIO, "Unable to terminate I/O CCB request" },
74 { CAM_SEL_TIMEOUT, "Selection Timeout" },
75 { CAM_CMD_TIMEOUT, "Command timeout" },
76 { CAM_SCSI_STATUS_ERROR, "SCSI Status Error" },
77 { CAM_MSG_REJECT_REC, "Message Reject Reveived" },
78 { CAM_SCSI_BUS_RESET, "SCSI Bus Reset Sent/Received" },
79 { CAM_UNCOR_PARITY, "Uncorrectable parity/CRC error" },
80 { CAM_AUTOSENSE_FAIL, "Auto-Sense Retrieval Failed" },
81 { CAM_NO_HBA, "No HBA Detected" },
82 { CAM_DATA_RUN_ERR, "Data Overrun error" },
83 { CAM_UNEXP_BUSFREE, "Unexpected Bus Free" },
84 { CAM_SEQUENCE_FAIL, "Target Bus Phase Sequence Failure" },
85 { CAM_CCB_LEN_ERR, "CCB length supplied is inadequate" },
86 { CAM_PROVIDE_FAIL, "Unable to provide requested capability" },
87 { CAM_BDR_SENT, "SCSI BDR Message Sent" },
88 { CAM_REQ_TERMIO, "CCB request terminated by the host" },
89 { CAM_UNREC_HBA_ERROR, "Unrecoverable Host Bus Adapter Error" },
90 { CAM_REQ_TOO_BIG, "The request was too large for this host" },
91 { CAM_REQUEUE_REQ, "Unconditionally Re-queue Request", },
92 { CAM_ATA_STATUS_ERROR, "ATA Status Error" },
93 { CAM_SCSI_IT_NEXUS_LOST,"Initiator/Target Nexus Lost" },
94 { CAM_SMP_STATUS_ERROR, "SMP Status Error" },
95 { CAM_IDE, "Initiator Detected Error Message Received" },
96 { CAM_RESRC_UNAVAIL, "Resource Unavailable" },
97 { CAM_UNACKED_EVENT, "Unacknowledged Event by Host" },
98 { CAM_MESSAGE_RECV, "Message Received in Host Target Mode" },
99 { CAM_INVALID_CDB, "Invalid CDB received in Host Target Mode" },
100 { CAM_LUN_INVALID, "Invalid Lun" },
101 { CAM_TID_INVALID, "Invalid Target ID" },
102 { CAM_FUNC_NOTAVAIL, "Function Not Available" },
103 { CAM_NO_NEXUS, "Nexus Not Established" },
104 { CAM_IID_INVALID, "Invalid Initiator ID" },
105 { CAM_CDB_RECVD, "CDB Received" },
106 { CAM_LUN_ALRDY_ENA, "LUN Already Enabled for Target Mode" },
107 { CAM_SCSI_BUSY, "SCSI Bus Busy" },
108};
109
110#ifdef _KERNEL
111SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
112 "CAM Subsystem");
113
114#ifndef CAM_DEFAULT_SORT_IO_QUEUES
115#define CAM_DEFAULT_SORT_IO_QUEUES 1
116#endif
117
119SYSCTL_INT(_kern_cam, OID_AUTO, sort_io_queues, CTLFLAG_RWTUN,
120 &cam_sort_io_queues, 0, "Sort IO queues to try and optimise disk access patterns");
121#endif
122
123void
124cam_strvis(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen)
125{
126 cam_strvis_flag(dst, src, srclen, dstlen,
128}
129
130void
131cam_strvis_flag(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen,
132 uint32_t flags)
133{
134 struct sbuf sb;
135
136 sbuf_new(&sb, dst, dstlen, SBUF_FIXEDLEN);
137 cam_strvis_sbuf(&sb, src, srclen, flags);
138 sbuf_finish(&sb);
139}
140
141void
142cam_strvis_sbuf(struct sbuf *sb, const u_int8_t *src, int srclen,
143 uint32_t flags)
144{
145
146 /* Trim leading/trailing spaces, nulls. */
147 while (srclen > 0 && src[0] == ' ')
148 src++, srclen--;
149 while (srclen > 0
150 && (src[srclen-1] == ' ' || src[srclen-1] == '\0'))
151 srclen--;
152
153 while (srclen > 0) {
154 if (*src < 0x20 || *src >= 0x80) {
155 /* SCSI-II Specifies that these should never occur. */
156 /* non-printable character */
157 switch (flags & CAM_STRVIS_FLAG_NONASCII_MASK) {
159 sbuf_printf(sb, "\\%c%c%c",
160 ((*src & 0300) >> 6) + '0',
161 ((*src & 0070) >> 3) + '0',
162 ((*src & 0007) >> 0) + '0');
163 break;
165 /*
166 * If we run into a NUL, just transform it
167 * into a space.
168 */
169 if (*src != 0x00)
170 sbuf_putc(sb, *src);
171 else
172 sbuf_putc(sb, ' ');
173 break;
175 sbuf_putc(sb, ' ');
176 break;
178 default:
179 break;
180 }
181 } else {
182 /* normal character */
183 sbuf_putc(sb, *src);
184 }
185 src++;
186 srclen--;
187 }
188}
189
190/*
191 * Compare string with pattern, returning 0 on match.
192 * Short pattern matches trailing blanks in name,
193 * Shell globbing rules apply: * matches 0 or more characters,
194 * ? matchces one character, [...] denotes a set to match one char,
195 * [^...] denotes a complimented set to match one character.
196 * Spaces in str used to match anything in the pattern string
197 * but was removed because it's a bug. No current patterns require
198 * it, as far as I know, but it's impossible to know what drives
199 * returned.
200 *
201 * Each '*' generates recursion, so keep the number of * in check.
202 */
203int
204cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len)
205{
206
207 while (*pattern != '\0' && str_len > 0) {
208 if (*pattern == '*') {
209 pattern++;
210 if (*pattern == '\0')
211 return (0);
212 do {
213 if (cam_strmatch(str, pattern, str_len) == 0)
214 return (0);
215 str++;
216 str_len--;
217 } while (str_len > 0);
218 return (1);
219 } else if (*pattern == '[') {
220 int negate_range, ok;
221 uint8_t pc = UCHAR_MAX;
222 uint8_t sc;
223
224 ok = 0;
225 sc = *str++;
226 str_len--;
227 pattern++;
228 if ((negate_range = (*pattern == '^')) != 0)
229 pattern++;
230 while ((*pattern != ']') && *pattern != '\0') {
231 if (*pattern == '-') {
232 if (pattern[1] == '\0') /* Bad pattern */
233 return (1);
234 if (sc >= pc && sc <= pattern[1])
235 ok = 1;
236 pattern++;
237 } else if (*pattern == sc)
238 ok = 1;
239 pc = *pattern;
240 pattern++;
241 }
242 if (ok == negate_range)
243 return (1);
244 pattern++;
245 } else if (*pattern == '?') {
246 /*
247 * NB: || *str == ' ' of the old code is a bug and was
248 * removed. If you add it back, keep this the last if
249 * before the naked else */
250 pattern++;
251 str++;
252 str_len--;
253 } else {
254 if (*str != *pattern)
255 return (1);
256 pattern++;
257 str++;
258 str_len--;
259 }
260 }
261
262 /* '*' is allowed to match nothing, so gobble it */
263 while (*pattern == '*')
264 pattern++;
265
266 if ( *pattern != '\0') {
267 /* Pattern not fully consumed. Not a match */
268 return (1);
269 }
270
271 /* Eat trailing spaces, which get added by SAT */
272 while (str_len > 0 && *str == ' ') {
273 str++;
274 str_len--;
275 }
276
277 return (str_len);
278}
279
280caddr_t
281cam_quirkmatch(caddr_t target, caddr_t quirk_table, int num_entries,
282 int entry_size, cam_quirkmatch_t *comp_func)
283{
284 for (; num_entries > 0; num_entries--, quirk_table += entry_size) {
285 if ((*comp_func)(target, quirk_table) == 0)
286 return (quirk_table);
287 }
288 return (NULL);
289}
290
291const struct cam_status_entry*
293{
294 status &= CAM_STATUS_MASK;
295 return (bsearch(&status, &cam_status_table,
296 nitems(cam_status_table),
297 sizeof(*cam_status_table),
299}
300
301static int
302camstatusentrycomp(const void *key, const void *member)
303{
304 cam_status status;
305 const struct cam_status_entry *table_entry;
306
307 status = *(const cam_status *)key;
308 table_entry = (const struct cam_status_entry *)member;
309
310 return (status - table_entry->status_code);
311}
312
313#ifdef _KERNEL
314char *
315cam_error_string(union ccb *ccb, char *str, int str_len,
317 cam_error_proto_flags proto_flags)
318#else /* !_KERNEL */
319char *
320cam_error_string(struct cam_device *device, union ccb *ccb, char *str,
321 int str_len, cam_error_string_flags flags,
322 cam_error_proto_flags proto_flags)
323#endif /* _KERNEL/!_KERNEL */
324{
325 char path_str[64];
326 struct sbuf sb;
327
328 if ((ccb == NULL)
329 || (str == NULL)
330 || (str_len <= 0))
331 return(NULL);
332
333 if (flags == CAM_ESF_NONE)
334 return(NULL);
335
336 switch (ccb->ccb_h.func_code) {
337 case XPT_ATA_IO:
338 switch (proto_flags & CAM_EPF_LEVEL_MASK) {
339 case CAM_EPF_NONE:
340 break;
341 case CAM_EPF_ALL:
342 case CAM_EPF_NORMAL:
343 proto_flags |= CAM_EAF_PRINT_RESULT;
344 /* FALLTHROUGH */
345 case CAM_EPF_MINIMAL:
346 proto_flags |= CAM_EAF_PRINT_STATUS;
347 /* FALLTHROUGH */
348 default:
349 break;
350 }
351 break;
352 case XPT_SCSI_IO:
353 switch (proto_flags & CAM_EPF_LEVEL_MASK) {
354 case CAM_EPF_NONE:
355 break;
356 case CAM_EPF_ALL:
357 case CAM_EPF_NORMAL:
358 proto_flags |= CAM_ESF_PRINT_SENSE;
359 /* FALLTHROUGH */
360 case CAM_EPF_MINIMAL:
361 proto_flags |= CAM_ESF_PRINT_STATUS;
362 /* FALLTHROUGH */
363 default:
364 break;
365 }
366 break;
367 case XPT_SMP_IO:
368 switch (proto_flags & CAM_EPF_LEVEL_MASK) {
369 case CAM_EPF_NONE:
370 break;
371 case CAM_EPF_ALL:
372 proto_flags |= CAM_ESMF_PRINT_FULL_CMD;
373 /* FALLTHROUGH */
374 case CAM_EPF_NORMAL:
375 case CAM_EPF_MINIMAL:
376 proto_flags |= CAM_ESMF_PRINT_STATUS;
377 /* FALLTHROUGH */
378 default:
379 break;
380 }
381 break;
382 default:
383 break;
384 }
385#ifdef _KERNEL
386 xpt_path_string(ccb->csio.ccb_h.path, path_str, sizeof(path_str));
387#else /* !_KERNEL */
388 cam_path_string(device, path_str, sizeof(path_str));
389#endif /* _KERNEL/!_KERNEL */
390
391 sbuf_new(&sb, str, str_len, 0);
392
393 if (flags & CAM_ESF_COMMAND) {
394 sbuf_cat(&sb, path_str);
395 switch (ccb->ccb_h.func_code) {
396 case XPT_ATA_IO:
397 ata_command_sbuf(&ccb->ataio, &sb);
398 break;
399 case XPT_SCSI_IO:
400#ifdef _KERNEL
402#else /* !_KERNEL */
403 scsi_command_string(device, &ccb->csio, &sb);
404#endif /* _KERNEL/!_KERNEL */
405 break;
406 case XPT_SMP_IO:
407 smp_command_sbuf(&ccb->smpio, &sb, path_str, 79 -
408 strlen(path_str), (proto_flags &
409 CAM_ESMF_PRINT_FULL_CMD) ? 79 : 0);
410 break;
411 case XPT_NVME_IO:
412 case XPT_NVME_ADMIN:
414 break;
415 default:
416 sbuf_printf(&sb, "CAM func %#x",
418 break;
419 }
420 sbuf_printf(&sb, "\n");
421 }
422
423 if (flags & CAM_ESF_CAM_STATUS) {
424 cam_status status;
425 const struct cam_status_entry *entry;
426
427 sbuf_cat(&sb, path_str);
428
429 status = ccb->ccb_h.status & CAM_STATUS_MASK;
430
431 entry = cam_fetch_status_entry(status);
432
433 if (entry == NULL)
434 sbuf_printf(&sb, "CAM status: Unknown (%#x)\n",
435 ccb->ccb_h.status);
436 else
437 sbuf_printf(&sb, "CAM status: %s\n",
438 entry->status_text);
439 }
440
441 if (flags & CAM_ESF_PROTO_STATUS) {
442
443 switch (ccb->ccb_h.func_code) {
444 case XPT_ATA_IO:
445 if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
447 break;
448 if (proto_flags & CAM_EAF_PRINT_STATUS) {
449 sbuf_cat(&sb, path_str);
450 ata_status_sbuf(&ccb->ataio, &sb);
451 sbuf_printf(&sb, "\n");
452 }
453 if (proto_flags & CAM_EAF_PRINT_RESULT) {
454 sbuf_cat(&sb, path_str);
455 sbuf_printf(&sb, "RES: ");
456 ata_res_sbuf(&ccb->ataio.res, &sb);
457 sbuf_printf(&sb, "\n");
458 }
459
460 break;
461 case XPT_SCSI_IO:
462 if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
464 break;
465
466 if (proto_flags & CAM_ESF_PRINT_STATUS) {
467 sbuf_cat(&sb, path_str);
468 sbuf_printf(&sb, "SCSI status: %s\n",
470 }
471
472 if ((proto_flags & CAM_ESF_PRINT_SENSE)
475#ifdef _KERNEL
476 scsi_sense_sbuf(&ccb->csio, &sb,
478#else /* !_KERNEL */
479 scsi_sense_sbuf(device, &ccb->csio, &sb,
481#endif /* _KERNEL/!_KERNEL */
482 }
483 break;
484 case XPT_SMP_IO:
485 if ((ccb->ccb_h.status & CAM_STATUS_MASK) !=
487 break;
488
489 if (proto_flags & CAM_ESF_PRINT_STATUS) {
490 sbuf_cat(&sb, path_str);
491 sbuf_printf(&sb, "SMP status: %s (%#x)\n",
494 }
495 /* There is no SMP equivalent to SCSI sense. */
496 break;
497 default:
498 break;
499 }
500 }
501
502 sbuf_finish(&sb);
503
504 return(sbuf_data(&sb));
505}
506
507#ifdef _KERNEL
508
509void
511 cam_error_proto_flags proto_flags)
512{
513 char str[512];
514
515 printf("%s", cam_error_string(ccb, str, sizeof(str), flags,
516 proto_flags));
517}
518
519#else /* !_KERNEL */
520
521void
522cam_error_print(struct cam_device *device, union ccb *ccb,
524 FILE *ofile)
525{
526 char str[512];
527
528 if ((device == NULL) || (ccb == NULL) || (ofile == NULL))
529 return;
530
531 fprintf(ofile, "%s", cam_error_string(device, ccb, str, sizeof(str),
532 flags, proto_flags));
533}
534
535#endif /* _KERNEL/!_KERNEL */
536
537/*
538 * Common calculate geometry fuction
539 *
540 * Caller should set ccg->volume_size and block_size.
541 * The extended parameter should be zero if extended translation
542 * should not be used.
543 */
544void
545cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended)
546{
547 uint32_t size_mb, secs_per_cylinder;
548
549 if (ccg->block_size == 0) {
551 return;
552 }
553 size_mb = (1024L * 1024L) / ccg->block_size;
554 if (size_mb == 0) {
556 return;
557 }
558 size_mb = ccg->volume_size / size_mb;
559 if (size_mb > 1024 && extended) {
560 ccg->heads = 255;
561 ccg->secs_per_track = 63;
562 } else {
563 ccg->heads = 64;
564 ccg->secs_per_track = 32;
565 }
566 secs_per_cylinder = ccg->heads * ccg->secs_per_track;
567 if (secs_per_cylinder == 0) {
569 return;
570 }
571 ccg->cylinders = ccg->volume_size / secs_per_cylinder;
572 ccg->ccb_h.status = CAM_REQ_CMP;
573}
int ata_res_sbuf(struct ata_res *res, struct sbuf *sb)
Definition: ata_all.c:368
int ata_command_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
Definition: ata_all.c:385
int ata_status_sbuf(struct ccb_ataio *ataio, struct sbuf *sb)
Definition: ata_all.c:399
const struct cam_status_entry cam_status_table[]
Definition: cam.c:63
#define CAM_DEFAULT_SORT_IO_QUEUES
Definition: cam.c:115
char * cam_error_string(union ccb *ccb, char *str, int str_len, cam_error_string_flags flags, cam_error_proto_flags proto_flags)
Definition: cam.c:315
caddr_t cam_quirkmatch(caddr_t target, caddr_t quirk_table, int num_entries, int entry_size, cam_quirkmatch_t *comp_func)
Definition: cam.c:281
int cam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len)
Definition: cam.c:204
__FBSDID("$FreeBSD$")
void cam_strvis_sbuf(struct sbuf *sb, const u_int8_t *src, int srclen, uint32_t flags)
Definition: cam.c:142
const struct cam_status_entry * cam_fetch_status_entry(cam_status status)
Definition: cam.c:292
int cam_sort_io_queues
Definition: cam.c:118
static int camstatusentrycomp(const void *key, const void *member)
Definition: cam.c:302
void cam_strvis(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen)
Definition: cam.c:124
void cam_strvis_flag(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen, uint32_t flags)
Definition: cam.c:131
FEATURE(scbus, "SCSI devices support")
void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended)
Definition: cam.c:545
SYSCTL_INT(_kern_cam, OID_AUTO, sort_io_queues, CTLFLAG_RWTUN, &cam_sort_io_queues, 0, "Sort IO queues to try and optimise disk access patterns")
void cam_error_print(union ccb *ccb, cam_error_string_flags flags, cam_error_proto_flags proto_flags)
Definition: cam.c:510
SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM Subsystem")
cam_error_proto_flags
Definition: cam.h:320
@ CAM_EPF_LEVEL_MASK
Definition: cam.h:325
@ CAM_EPF_NONE
Definition: cam.h:321
@ CAM_EPF_MINIMAL
Definition: cam.h:322
@ CAM_EPF_ALL
Definition: cam.h:324
@ CAM_EPF_NORMAL
Definition: cam.h:323
@ CAM_STRVIS_FLAG_NONASCII_MASK
Definition: cam.h:349
@ CAM_STRVIS_FLAG_NONASCII_ESC
Definition: cam.h:353
@ CAM_STRVIS_FLAG_NONASCII_SPC
Definition: cam.h:352
@ CAM_STRVIS_FLAG_NONASCII_RAW
Definition: cam.h:351
@ CAM_STRVIS_FLAG_NONASCII_TRIM
Definition: cam.h:350
cam_error_string_flags
Definition: cam.h:312
@ CAM_ESF_COMMAND
Definition: cam.h:314
@ CAM_ESF_PROTO_STATUS
Definition: cam.h:316
@ CAM_ESF_CAM_STATUS
Definition: cam.h:315
@ CAM_ESF_NONE
Definition: cam.h:313
cam_status
Definition: cam.h:132
@ CAM_ATA_STATUS_ERROR
Definition: cam.h:225
@ CAM_PATH_INVALID
Definition: cam.h:155
@ CAM_NO_NEXUS
Definition: cam.h:268
@ CAM_SCSI_BUS_RESET
Definition: cam.h:176
@ CAM_REQ_INVALID
Definition: cam.h:152
@ CAM_REQ_INPROG
Definition: cam.h:134
@ CAM_BUSY
Definition: cam.h:149
@ CAM_AUTOSENSE_FAIL
Definition: cam.h:182
@ CAM_IDE
Definition: cam.h:244
@ CAM_PROVIDE_FAIL
Definition: cam.h:200
@ CAM_SCSI_IT_NEXUS_LOST
Definition: cam.h:228
@ CAM_UA_TERMIO
Definition: cam.h:161
@ CAM_REQ_CMP
Definition: cam.h:137
@ CAM_AUTOSNS_VALID
Definition: cam.h:290
@ CAM_REQUEUE_REQ
Definition: cam.h:222
@ CAM_NO_HBA
Definition: cam.h:185
@ CAM_DEV_NOT_THERE
Definition: cam.h:158
@ CAM_CMD_TIMEOUT
Definition: cam.h:167
@ CAM_UA_ABORT
Definition: cam.h:143
@ CAM_RESRC_UNAVAIL
Definition: cam.h:247
@ CAM_UNCOR_PARITY
Definition: cam.h:179
@ CAM_MESSAGE_RECV
Definition: cam.h:253
@ CAM_SEQUENCE_FAIL
Definition: cam.h:194
@ CAM_SCSI_BUSY
Definition: cam.h:280
@ CAM_UNACKED_EVENT
Definition: cam.h:250
@ CAM_REQ_TOO_BIG
Definition: cam.h:212
@ CAM_REQ_CMP_ERR
Definition: cam.h:146
@ CAM_STATUS_MASK
Definition: cam.h:302
@ CAM_MSG_REJECT_REC
Definition: cam.h:173
@ CAM_REQ_ABORTED
Definition: cam.h:140
@ CAM_LUN_INVALID
Definition: cam.h:259
@ CAM_SMP_STATUS_ERROR
Definition: cam.h:231
@ CAM_FUNC_NOTAVAIL
Definition: cam.h:265
@ CAM_CCB_LEN_ERR
Definition: cam.h:197
@ CAM_REQ_TERMIO
Definition: cam.h:206
@ CAM_UNREC_HBA_ERROR
Definition: cam.h:209
@ CAM_INVALID_CDB
Definition: cam.h:256
@ CAM_UNEXP_BUSFREE
Definition: cam.h:191
@ CAM_SCSI_STATUS_ERROR
Definition: cam.h:170
@ CAM_IID_INVALID
Definition: cam.h:271
@ CAM_LUN_ALRDY_ENA
Definition: cam.h:277
@ CAM_CDB_RECVD
Definition: cam.h:274
@ CAM_BDR_SENT
Definition: cam.h:203
@ CAM_TID_INVALID
Definition: cam.h:262
@ CAM_SEL_TIMEOUT
Definition: cam.h:164
@ CAM_DATA_RUN_ERR
Definition: cam.h:188
@ CAM_ESF_PRINT_SENSE
Definition: cam.h:332
@ CAM_ESF_PRINT_STATUS
Definition: cam.h:331
@ CAM_EAF_PRINT_STATUS
Definition: cam.h:343
@ CAM_EAF_PRINT_RESULT
Definition: cam.h:344
__BEGIN_DECLS typedef int() cam_quirkmatch_t(caddr_t, caddr_t)
@ CAM_ESMF_PRINT_FULL_CMD
Definition: cam.h:338
@ CAM_ESMF_PRINT_STATUS
Definition: cam.h:337
@ XPT_NVME_ADMIN
Definition: cam_ccb.h:227
@ XPT_SCSI_IO
Definition: cam_ccb.h:141
@ XPT_NVME_IO
Definition: cam_ccb.h:217
@ XPT_ATA_IO
Definition: cam_ccb.h:199
@ XPT_SMP_IO
Definition: cam_ccb.h:214
int xpt_path_string(struct cam_path *path, char *str, size_t str_len)
Definition: cam_xpt.c:3833
int nvme_command_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb)
Definition: nvme_all.c:189
const char * scsi_status_string(struct ccb_scsiio *csio)
Definition: scsi_all.c:3565
int scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, scsi_sense_string_flags flags)
Definition: scsi_all.c:5016
int scsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb)
Definition: scsi_all.c:3602
#define SCSI_STATUS_CHECK_COND
Definition: scsi_all.h:3692
@ SSS_FLAG_NONE
Definition: scsi_all.h:3755
const char * smp_error_desc(int function_result)
Definition: smp_all.c:119
void smp_command_sbuf(struct ccb_smpio *smpio, struct sbuf *sb, char *line_prefix, int first_line_len, int line_len)
Definition: smp_all.c:231
Definition: cam.h:357
cam_status status_code
Definition: cam.h:358
const char * status_text
Definition: cam.h:359
struct ata_res res
Definition: cam_ccb.h:795
u_int32_t block_size
Definition: cam_ccb.h:1136
u_int64_t volume_size
Definition: cam_ccb.h:1137
u_int32_t cylinders
Definition: cam_ccb.h:1138
u_int8_t heads
Definition: cam_ccb.h:1139
struct ccb_hdr ccb_h
Definition: cam_ccb.h:1135
u_int8_t secs_per_track
Definition: cam_ccb.h:1140
struct cam_path * path
Definition: cam_ccb.h:364
xpt_opcode func_code
Definition: cam_ccb.h:362
u_int32_t status
Definition: cam_ccb.h:363
struct ccb_hdr ccb_h
Definition: cam_ccb.h:750
u_int8_t scsi_status
Definition: cam_ccb.h:760
uint8_t * smp_response
Definition: cam_ccb.h:724
Definition: cam_ccb.h:1345
struct ccb_smpio smpio
Definition: cam_ccb.h:1373
struct ccb_hdr ccb_h
Definition: cam_ccb.h:1346
struct ccb_scsiio csio
Definition: cam_ccb.h:1347
struct ccb_nvmeio nvmeio
Definition: cam_ccb.h:1379
struct ccb_ataio ataio
Definition: cam_ccb.h:1376