FreeBSD kernel CAM code
cam.h File Reference
#include "opt_cam.h"
#include <sys/cdefs.h>
Include dependency graph for cam.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cam_pinfo
 
struct  cam_status_entry
 

Macros

#define CAM_XPT_PATH_ID   ((path_id_t)~0)
 
#define CAM_BUS_WILDCARD   ((path_id_t)~0)
 
#define CAM_TARGET_WILDCARD   ((target_id_t)~0)
 
#define CAM_LUN_WILDCARD   (~(u_int)0)
 
#define CAM_EXTLUN_BYTE_SWIZZLE(lun)
 
#define CAM_MAX_CDBLEN   16
 
#define CAM_PRIORITY_HOST   ((CAM_RL_HOST << 8) + 0x80)
 
#define CAM_PRIORITY_BUS   ((CAM_RL_BUS << 8) + 0x80)
 
#define CAM_PRIORITY_XPT   ((CAM_RL_XPT << 8) + 0x80)
 
#define CAM_PRIORITY_DEV   ((CAM_RL_DEV << 8) + 0x80)
 
#define CAM_PRIORITY_OOB   (CAM_RL_DEV << 8)
 
#define CAM_PRIORITY_NORMAL   ((CAM_RL_NORMAL << 8) + 0x80)
 
#define CAM_PRIORITY_NONE   (u_int32_t)-1
 
#define CAM_UNQUEUED_INDEX   -1
 
#define CAM_ACTIVE_INDEX   -2
 
#define CAM_DONEQ_INDEX   -3
 
#define CAM_ASYNC_INDEX   -4
 
#define CAM_EXTRAQ_INDEX   INT_MAX
 
#define GENERATIONCMP(x, op, y)   ((int32_t)((x) - (y)) op 0)
 

Typedefs

typedef u_int path_id_t
 
typedef u_int target_id_t
 
typedef u_int64_t lun_id_t
 

Enumerations

enum  cam_rl {
  CAM_RL_HOST , CAM_RL_BUS , CAM_RL_XPT , CAM_RL_DEV ,
  CAM_RL_NORMAL , CAM_RL_VALUES
}
 
enum  cam_flags { CAM_FLAG_NONE = 0x00 , CAM_EXPECT_INQ_CHANGE = 0x01 , CAM_RETRY_SELTO = 0x02 }
 
enum  {
  SF_RETRY_UA = 0x01 , SF_NO_PRINT = 0x02 , SF_QUIET_IR = 0x04 , SF_PRINT_ALWAYS = 0x08 ,
  SF_NO_RECOVERY = 0x10 , SF_NO_RETRY = 0x20 , SF_RETRY_BUSY = 0x40
}
 
enum  cam_status {
  CAM_REQ_INPROG = 0x00 , CAM_REQ_CMP = 0x01 , CAM_REQ_ABORTED = 0x02 , CAM_UA_ABORT = 0x03 ,
  CAM_REQ_CMP_ERR = 0x04 , CAM_BUSY = 0x05 , CAM_REQ_INVALID = 0x06 , CAM_PATH_INVALID = 0x07 ,
  CAM_DEV_NOT_THERE = 0x08 , CAM_UA_TERMIO = 0x09 , CAM_SEL_TIMEOUT = 0x0a , CAM_CMD_TIMEOUT = 0x0b ,
  CAM_SCSI_STATUS_ERROR = 0x0c , CAM_MSG_REJECT_REC = 0x0d , CAM_SCSI_BUS_RESET = 0x0e , CAM_UNCOR_PARITY = 0x0f ,
  CAM_AUTOSENSE_FAIL = 0x10 , CAM_NO_HBA = 0x11 , CAM_DATA_RUN_ERR = 0x12 , CAM_UNEXP_BUSFREE = 0x13 ,
  CAM_SEQUENCE_FAIL = 0x14 , CAM_CCB_LEN_ERR = 0x15 , CAM_PROVIDE_FAIL = 0x16 , CAM_BDR_SENT = 0x17 ,
  CAM_REQ_TERMIO = 0x18 , CAM_UNREC_HBA_ERROR = 0x19 , CAM_REQ_TOO_BIG = 0x1a , CAM_REQUEUE_REQ = 0x1b ,
  CAM_ATA_STATUS_ERROR = 0x1c , CAM_SCSI_IT_NEXUS_LOST = 0x1d , CAM_SMP_STATUS_ERROR = 0x1e , CAM_REQ_SOFTTIMEOUT = 0x1f ,
  CAM_IDE = 0x33 , CAM_RESRC_UNAVAIL = 0x34 , CAM_UNACKED_EVENT = 0x35 , CAM_MESSAGE_RECV = 0x36 ,
  CAM_INVALID_CDB = 0x37 , CAM_LUN_INVALID = 0x38 , CAM_TID_INVALID = 0x39 , CAM_FUNC_NOTAVAIL = 0x3a ,
  CAM_NO_NEXUS = 0x3b , CAM_IID_INVALID = 0x3c , CAM_CDB_RECVD = 0x3d , CAM_LUN_ALRDY_ENA = 0x3e ,
  CAM_SCSI_BUSY = 0x3f , CAM_DEV_QFRZN = 0x40 , CAM_AUTOSNS_VALID = 0x80 , CAM_RELEASE_SIMQ = 0x100 ,
  CAM_SIM_QUEUED = 0x200 , CAM_QOS_VALID = 0x400 , CAM_STATUS_MASK = 0x3F , CAM_SENT_SENSE = 0x40000000
}
 
enum  cam_error_string_flags {
  CAM_ESF_NONE = 0x00 , CAM_ESF_COMMAND = 0x01 , CAM_ESF_CAM_STATUS = 0x02 , CAM_ESF_PROTO_STATUS = 0x04 ,
  CAM_ESF_ALL = 0xff
}
 
enum  cam_error_proto_flags {
  CAM_EPF_NONE = 0x00 , CAM_EPF_MINIMAL = 0x01 , CAM_EPF_NORMAL = 0x02 , CAM_EPF_ALL = 0x03 ,
  CAM_EPF_LEVEL_MASK = 0x0f
}
 
enum  cam_error_scsi_flags { CAM_ESF_PRINT_NONE = 0x00 , CAM_ESF_PRINT_STATUS = 0x10 , CAM_ESF_PRINT_SENSE = 0x20 }
 
enum  cam_error_smp_flags { CAM_ESMF_PRINT_NONE = 0x00 , CAM_ESMF_PRINT_STATUS = 0x10 , CAM_ESMF_PRINT_FULL_CMD = 0x20 }
 
enum  cam_error_ata_flags { CAM_EAF_PRINT_NONE = 0x00 , CAM_EAF_PRINT_STATUS = 0x10 , CAM_EAF_PRINT_RESULT = 0x20 }
 
enum  cam_strvis_flags {
  CAM_STRVIS_FLAG_NONE = 0x00 , CAM_STRVIS_FLAG_NONASCII_MASK = 0x03 , CAM_STRVIS_FLAG_NONASCII_TRIM = 0x00 , CAM_STRVIS_FLAG_NONASCII_RAW = 0x01 ,
  CAM_STRVIS_FLAG_NONASCII_SPC = 0x02 , CAM_STRVIS_FLAG_NONASCII_ESC = 0x03
}
 

Functions

__BEGIN_DECLS typedef int() cam_quirkmatch_t (caddr_t, caddr_t)
 
caddr_t cam_quirkmatch (caddr_t target, caddr_t quirk_table, int num_entries, int entry_size, cam_quirkmatch_t *comp_func)
 
void cam_strvis (u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen)
 
void cam_strvis_flag (u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen, uint32_t flags)
 
void cam_strvis_sbuf (struct sbuf *sb, const u_int8_t *src, int srclen, uint32_t flags)
 
int cam_strmatch (const u_int8_t *str, const u_int8_t *pattern, int str_len)
 
const struct cam_status_entrycam_fetch_status_entry (cam_status status)
 
char * cam_error_string (union ccb *ccb, char *str, int str_len, cam_error_string_flags flags, cam_error_proto_flags proto_flags)
 
void cam_error_print (union ccb *ccb, cam_error_string_flags flags, cam_error_proto_flags proto_flags)
 
static __END_DECLS __inline void cam_init_pinfo (cam_pinfo *pinfo)
 

Variables

const struct cam_status_entry cam_status_table []
 
const int num_cam_status_entries
 
int cam_sort_io_queues
 

Macro Definition Documentation

◆ CAM_ACTIVE_INDEX

#define CAM_ACTIVE_INDEX   -2

Definition at line 97 of file cam.h.

◆ CAM_ASYNC_INDEX

#define CAM_ASYNC_INDEX   -4

Definition at line 99 of file cam.h.

◆ CAM_BUS_WILDCARD

#define CAM_BUS_WILDCARD   ((path_id_t)~0)

Definition at line 47 of file cam.h.

◆ CAM_DONEQ_INDEX

#define CAM_DONEQ_INDEX   -3

Definition at line 98 of file cam.h.

◆ CAM_EXTLUN_BYTE_SWIZZLE

#define CAM_EXTLUN_BYTE_SWIZZLE (   lun)
Value:
( \
((((u_int64_t)lun) & 0xffff000000000000L) >> 48) | \
((((u_int64_t)lun) & 0x0000ffff00000000L) >> 16) | \
((((u_int64_t)lun) & 0x00000000ffff0000L) << 16) | \
((((u_int64_t)lun) & 0x000000000000ffffL) << 48))

Definition at line 51 of file cam.h.

◆ CAM_EXTRAQ_INDEX

#define CAM_EXTRAQ_INDEX   INT_MAX

Definition at line 100 of file cam.h.

◆ CAM_LUN_WILDCARD

#define CAM_LUN_WILDCARD   (~(u_int)0)

Definition at line 49 of file cam.h.

◆ CAM_MAX_CDBLEN

#define CAM_MAX_CDBLEN   16

Definition at line 60 of file cam.h.

◆ CAM_PRIORITY_BUS

#define CAM_PRIORITY_BUS   ((CAM_RL_BUS << 8) + 0x80)

Definition at line 88 of file cam.h.

◆ CAM_PRIORITY_DEV

#define CAM_PRIORITY_DEV   ((CAM_RL_DEV << 8) + 0x80)

Definition at line 90 of file cam.h.

◆ CAM_PRIORITY_HOST

#define CAM_PRIORITY_HOST   ((CAM_RL_HOST << 8) + 0x80)

Definition at line 87 of file cam.h.

◆ CAM_PRIORITY_NONE

#define CAM_PRIORITY_NONE   (u_int32_t)-1

Definition at line 93 of file cam.h.

◆ CAM_PRIORITY_NORMAL

#define CAM_PRIORITY_NORMAL   ((CAM_RL_NORMAL << 8) + 0x80)

Definition at line 92 of file cam.h.

◆ CAM_PRIORITY_OOB

#define CAM_PRIORITY_OOB   (CAM_RL_DEV << 8)

Definition at line 91 of file cam.h.

◆ CAM_PRIORITY_XPT

#define CAM_PRIORITY_XPT   ((CAM_RL_XPT << 8) + 0x80)

Definition at line 89 of file cam.h.

◆ CAM_TARGET_WILDCARD

#define CAM_TARGET_WILDCARD   ((target_id_t)~0)

Definition at line 48 of file cam.h.

◆ CAM_UNQUEUED_INDEX

#define CAM_UNQUEUED_INDEX   -1

Definition at line 96 of file cam.h.

◆ CAM_XPT_PATH_ID

#define CAM_XPT_PATH_ID   ((path_id_t)~0)

Definition at line 46 of file cam.h.

◆ GENERATIONCMP

#define GENERATIONCMP (   x,
  op,
 
)    ((int32_t)((x) - (y)) op 0)

Definition at line 112 of file cam.h.

Typedef Documentation

◆ lun_id_t

typedef u_int64_t lun_id_t

Definition at line 44 of file cam.h.

◆ path_id_t

typedef u_int path_id_t

Definition at line 42 of file cam.h.

◆ target_id_t

typedef u_int target_id_t

Definition at line 43 of file cam.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SF_RETRY_UA 
SF_NO_PRINT 
SF_QUIET_IR 
SF_PRINT_ALWAYS 
SF_NO_RECOVERY 
SF_NO_RETRY 
SF_RETRY_BUSY 

Definition at line 121 of file cam.h.

◆ cam_error_ata_flags

Enumerator
CAM_EAF_PRINT_NONE 
CAM_EAF_PRINT_STATUS 
CAM_EAF_PRINT_RESULT 

Definition at line 341 of file cam.h.

◆ cam_error_proto_flags

Enumerator
CAM_EPF_NONE 
CAM_EPF_MINIMAL 
CAM_EPF_NORMAL 
CAM_EPF_ALL 
CAM_EPF_LEVEL_MASK 

Definition at line 320 of file cam.h.

◆ cam_error_scsi_flags

Enumerator
CAM_ESF_PRINT_NONE 
CAM_ESF_PRINT_STATUS 
CAM_ESF_PRINT_SENSE 

Definition at line 329 of file cam.h.

◆ cam_error_smp_flags

Enumerator
CAM_ESMF_PRINT_NONE 
CAM_ESMF_PRINT_STATUS 
CAM_ESMF_PRINT_FULL_CMD 

Definition at line 335 of file cam.h.

◆ cam_error_string_flags

Enumerator
CAM_ESF_NONE 
CAM_ESF_COMMAND 
CAM_ESF_CAM_STATUS 
CAM_ESF_PROTO_STATUS 
CAM_ESF_ALL 

Definition at line 312 of file cam.h.

◆ cam_flags

enum cam_flags
Enumerator
CAM_FLAG_NONE 
CAM_EXPECT_INQ_CHANGE 
CAM_RETRY_SELTO 

Definition at line 115 of file cam.h.

◆ cam_rl

enum cam_rl
Enumerator
CAM_RL_HOST 
CAM_RL_BUS 
CAM_RL_XPT 
CAM_RL_DEV 
CAM_RL_NORMAL 
CAM_RL_VALUES 

Definition at line 73 of file cam.h.

◆ cam_status

enum cam_status
Enumerator
CAM_REQ_INPROG 
CAM_REQ_CMP 
CAM_REQ_ABORTED 
CAM_UA_ABORT 
CAM_REQ_CMP_ERR 
CAM_BUSY 
CAM_REQ_INVALID 
CAM_PATH_INVALID 
CAM_DEV_NOT_THERE 
CAM_UA_TERMIO 
CAM_SEL_TIMEOUT 
CAM_CMD_TIMEOUT 
CAM_SCSI_STATUS_ERROR 
CAM_MSG_REJECT_REC 
CAM_SCSI_BUS_RESET 
CAM_UNCOR_PARITY 
CAM_AUTOSENSE_FAIL 
CAM_NO_HBA 
CAM_DATA_RUN_ERR 
CAM_UNEXP_BUSFREE 
CAM_SEQUENCE_FAIL 
CAM_CCB_LEN_ERR 
CAM_PROVIDE_FAIL 
CAM_BDR_SENT 
CAM_REQ_TERMIO 
CAM_UNREC_HBA_ERROR 
CAM_REQ_TOO_BIG 
CAM_REQUEUE_REQ 
CAM_ATA_STATUS_ERROR 
CAM_SCSI_IT_NEXUS_LOST 
CAM_SMP_STATUS_ERROR 
CAM_REQ_SOFTTIMEOUT 
CAM_IDE 
CAM_RESRC_UNAVAIL 
CAM_UNACKED_EVENT 
CAM_MESSAGE_RECV 
CAM_INVALID_CDB 
CAM_LUN_INVALID 
CAM_TID_INVALID 
CAM_FUNC_NOTAVAIL 
CAM_NO_NEXUS 
CAM_IID_INVALID 
CAM_CDB_RECVD 
CAM_LUN_ALRDY_ENA 
CAM_SCSI_BUSY 
CAM_DEV_QFRZN 
CAM_AUTOSNS_VALID 
CAM_RELEASE_SIMQ 
CAM_SIM_QUEUED 
CAM_QOS_VALID 
CAM_STATUS_MASK 
CAM_SENT_SENSE 

Definition at line 132 of file cam.h.

◆ cam_strvis_flags

Enumerator
CAM_STRVIS_FLAG_NONE 
CAM_STRVIS_FLAG_NONASCII_MASK 
CAM_STRVIS_FLAG_NONASCII_TRIM 
CAM_STRVIS_FLAG_NONASCII_RAW 
CAM_STRVIS_FLAG_NONASCII_SPC 
CAM_STRVIS_FLAG_NONASCII_ESC 

Definition at line 347 of file cam.h.

Function Documentation

◆ cam_error_print()

void cam_error_print ( union ccb ccb,
cam_error_string_flags  flags,
cam_error_proto_flags  proto_flags 
)

Definition at line 510 of file cam.c.

References cam_error_string().

Referenced by cam_periph_error(), and dasetgeom().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cam_error_string()

◆ cam_fetch_status_entry()

const struct cam_status_entry * cam_fetch_status_entry ( cam_status  status)

Definition at line 292 of file cam.c.

References CAM_STATUS_MASK, cam_status_table, and camstatusentrycomp().

Referenced by cam_error_string(), ctlfe_lun_enable(), ctlfe_online(), passasync(), and sgasync().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cam_init_pinfo()

static __END_DECLS __inline void cam_init_pinfo ( cam_pinfo pinfo)
static

Definition at line 408 of file cam.h.

References CAM_PRIORITY_NONE, CAM_UNQUEUED_INDEX, cam_pinfo::index, and cam_pinfo::priority.

Referenced by xpt_alloc_device().

Here is the caller graph for this function:

◆ cam_quirkmatch()

caddr_t cam_quirkmatch ( caddr_t  target,
caddr_t  quirk_table,
int  num_entries,
int  entry_size,
cam_quirkmatch_t comp_func 
)

Definition at line 281 of file cam.c.

Referenced by adaregister(), ata_find_quirk(), cdregister(), daregister(), fetchtableentries(), saregister(), scsi_find_quirk(), scsi_op_desc(), and xptdevicematch().

Here is the caller graph for this function:

◆ cam_quirkmatch_t()

__BEGIN_DECLS typedef int() cam_quirkmatch_t ( caddr_t  ,
caddr_t   
)

◆ cam_strmatch()

int cam_strmatch ( const u_int8_t *  str,
const u_int8_t *  pattern,
int  str_len 
)

Definition at line 204 of file cam.c.

References cam_strmatch().

Referenced by ata_identify_match(), ata_static_identify_match(), cam_strmatch(), scsi_inquiry_match(), and scsi_static_inquiry_match().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cam_strvis()

void cam_strvis ( u_int8_t *  dst,
const u_int8_t *  src,
int  srclen,
int  dstlen 
)

Definition at line 124 of file cam.c.

References cam_strvis_flag(), and CAM_STRVIS_FLAG_NONASCII_ESC.

Referenced by ata_print_ident_short(), cdregister(), daregister(), saextget(), semb_print_ident(), semb_print_ident_short(), ses_handle_string(), and smp_report_manuf_info_sbuf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cam_strvis_flag()

void cam_strvis_flag ( u_int8_t *  dst,
const u_int8_t *  src,
int  srclen,
int  dstlen,
uint32_t  flags 
)

Definition at line 131 of file cam.c.

References cam_strvis_sbuf().

Referenced by cam_strvis(), ndaregister(), and nvme_probe_done().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cam_strvis_sbuf()

void cam_strvis_sbuf ( struct sbuf *  sb,
const u_int8_t *  src,
int  srclen,
uint32_t  flags 
)

Variable Documentation

◆ cam_sort_io_queues

int cam_sort_io_queues
extern

Definition at line 118 of file cam.c.

◆ cam_status_table

const struct cam_status_entry cam_status_table[]
extern

Definition at line 63 of file cam.c.

Referenced by cam_fetch_status_entry().

◆ num_cam_status_entries

const int num_cam_status_entries
extern