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

Go to the source code of this file.

Data Structures

struct  scsi_exchange_medium
 
struct  scsi_initialize_element_status
 
struct  scsi_move_medium
 
struct  scsi_position_to_element
 
struct  scsi_read_element_status
 
struct  scsi_request_volume_element_address
 
struct  read_element_status_header
 
struct  read_element_status_page_header
 
struct  volume_tag
 
struct  read_element_status_device_id
 
struct  read_element_status_descriptor
 
struct  scsi_send_volume_tag
 
struct  scsi_send_volume_tag_parameters
 
struct  page_device_capabilities
 
struct  page_element_address_assignment
 
struct  page_transport_geometry_parameters
 

Macros

#define EXCHANGE_MEDIUM   0xa6
 
#define EXCHANGE_MEDIUM_INV1   0x01
 
#define EXCHANGE_MEDIUM_INV2   0x02
 
#define INITIALIZE_ELEMENT_STATUS   0x07
 
#define MOVE_MEDIUM_INVERT   0x01
 
#define POSITION_TO_ELEMENT_INVERT   0x01
 
#define READ_ELEMENT_STATUS_VOLTAG   0x10 /* report volume tag info */
 
#define READ_ELEMENT_STATUS_DVCID   0x01 /* report device serial number */
 
#define READ_ELEMENT_STATUS_CURDATA   0x02 /* allow motion during command */
 
#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG   0x10
 
#define CH_ELEMENT_ADDR_ASSIGN_PAGE   0x1D
 
#define CH_TRANS_GEOM_PARAMS_PAGE   0x1E
 
#define CH_DEVICE_CAP_PAGE   0x1F
 
#define READ_ELEMENT_STATUS_AVOLTAG   0x40
 
#define READ_ELEMENT_STATUS_PVOLTAG   0x80
 
#define READ_ELEMENT_STATUS_CODE_SET(p)   ((p) & 0x0F)
 
#define READ_ELEMENT_STATUS_PROTOCOL_ID(p)   ((p) >> 4)
 
#define READ_ELEMENT_STATUS_PIV_SET   0x80
 
#define READ_ELEMENT_STATUS_ASSOCIATION(p)   ((p) >> 4)
 
#define READ_ELEMENT_STATUS_DESIGNATOR_TYPE(p)   ((p) & 0x0F)
 
#define READ_ELEMENT_STATUS_FULL   0x01
 
#define READ_ELEMENT_STATUS_IMPEXP   0x02
 
#define READ_ELEMENT_STATUS_EXCEPT   0x04
 
#define READ_ELEMENT_STATUS_ACCESS   0x08
 
#define READ_ELEMENT_STATUS_EXENAB   0x10
 
#define READ_ELEMENT_STATUS_INENAB   0x20
 
#define READ_ELEMENT_STATUS_MT_MASK1   0x05
 
#define READ_ELEMENT_STATUS_ST_MASK1   0x0c
 
#define READ_ELEMENT_STATUS_IE_MASK1   0x3f
 
#define READ_ELEMENT_STATUS_DT_MASK1   0x0c
 
#define READ_ELEMENT_STATUS_DT_LUNMASK   0x07
 
#define READ_ELEMENT_STATUS_DT_LUVALID   0x10
 
#define READ_ELEMENT_STATUS_DT_IDVALID   0x20
 
#define READ_ELEMENT_STATUS_DT_NOTBUS   0x80
 
#define READ_ELEMENT_STATUS_INVERT   0x40
 
#define READ_ELEMENT_STATUS_SVALID   0x80
 
#define READ_ELEMENT_STATUS_ED   0x80
 
#define READ_ELEMENT_STATUS_MEDIA_TYPE_MASK   0x07
 
#define ELEMENT_TYPE_MASK   0x0f /* Note: these aren't bits */
 
#define ELEMENT_TYPE_ALL   0x00
 
#define ELEMENT_TYPE_MT   0x01
 
#define ELEMENT_TYPE_ST   0x02
 
#define ELEMENT_TYPE_IE   0x03
 
#define ELEMENT_TYPE_DT   0x04
 
#define PGCODE_MASK   0x3f /* valid page number bits in pg_code */
 
#define PGCODE_PS   0x80 /* indicates page is savable */
 
#define SEND_VOLUME_TAG   0xb6
 
#define SEND_VOLUME_TAG_ASSERT_PRIMARY   0x08
 
#define SEND_VOLUME_TAG_ASSERT_ALTERNATE   0x09
 
#define SEND_VOLUME_TAG_REPLACE_PRIMARY   0x0a
 
#define SEND_VOLUME_TAG_REPLACE_ALTERNATE   0x0b
 
#define SEND_VOLUME_TAG_UNDEFINED_PRIMARY   0x0c
 
#define SEND_VOLUME_TAG_UNDEFINED_ALTERNATE   0x0d
 
#define STOR_MT   0x01
 
#define STOR_ST   0x02
 
#define STOR_IE   0x04
 
#define STOR_DT   0x08
 
#define MOVE_TO_MT   0x01
 
#define MOVE_TO_ST   0x02
 
#define MOVE_TO_IE   0x04
 
#define MOVE_TO_DT   0x08
 
#define EXCHANGE_WITH_MT   0x01
 
#define EXCHANGE_WITH_ST   0x02
 
#define EXCHANGE_WITH_IE   0x04
 
#define EXCHANGE_WITH_DT   0x08
 
#define CAN_ROTATE   0x01
 

Functions

__BEGIN_DECLS void scsi_move_medium (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int32_t tea, u_int32_t src, u_int32_t dst, int invert, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_exchange_medium (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int32_t tea, u_int32_t src, u_int32_t dst1, u_int32_t dst2, int invert1, int invert2, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_position_to_element (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int32_t tea, u_int32_t dst, int invert, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_read_element_status (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int voltag, u_int32_t sea, int curdata, int dvcid, u_int32_t count, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_initialize_element_status (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_send_volume_tag (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int16_t element_address, u_int8_t send_action_code, struct scsi_send_volume_tag_parameters *parameters, u_int8_t sense_len, u_int32_t timeout)
 

Macro Definition Documentation

◆ CAN_ROTATE

#define CAN_ROTATE   0x01

Definition at line 466 of file scsi_ch.h.

◆ CH_DEVICE_CAP_PAGE

#define CH_DEVICE_CAP_PAGE   0x1F

Definition at line 174 of file scsi_ch.h.

◆ CH_ELEMENT_ADDR_ASSIGN_PAGE

#define CH_ELEMENT_ADDR_ASSIGN_PAGE   0x1D

Definition at line 172 of file scsi_ch.h.

◆ CH_TRANS_GEOM_PARAMS_PAGE

#define CH_TRANS_GEOM_PARAMS_PAGE   0x1E

Definition at line 173 of file scsi_ch.h.

◆ ELEMENT_TYPE_ALL

#define ELEMENT_TYPE_ALL   0x00

Definition at line 286 of file scsi_ch.h.

◆ ELEMENT_TYPE_DT

#define ELEMENT_TYPE_DT   0x04

Definition at line 290 of file scsi_ch.h.

◆ ELEMENT_TYPE_IE

#define ELEMENT_TYPE_IE   0x03

Definition at line 289 of file scsi_ch.h.

◆ ELEMENT_TYPE_MASK

#define ELEMENT_TYPE_MASK   0x0f /* Note: these aren't bits */

Definition at line 285 of file scsi_ch.h.

◆ ELEMENT_TYPE_MT

#define ELEMENT_TYPE_MT   0x01

Definition at line 287 of file scsi_ch.h.

◆ ELEMENT_TYPE_ST

#define ELEMENT_TYPE_ST   0x02

Definition at line 288 of file scsi_ch.h.

◆ EXCHANGE_MEDIUM

#define EXCHANGE_MEDIUM   0xa6

Definition at line 80 of file scsi_ch.h.

◆ EXCHANGE_MEDIUM_INV1

#define EXCHANGE_MEDIUM_INV1   0x01

Definition at line 87 of file scsi_ch.h.

◆ EXCHANGE_MEDIUM_INV2

#define EXCHANGE_MEDIUM_INV2   0x02

Definition at line 88 of file scsi_ch.h.

◆ EXCHANGE_WITH_DT

#define EXCHANGE_WITH_DT   0x08

Definition at line 387 of file scsi_ch.h.

◆ EXCHANGE_WITH_IE

#define EXCHANGE_WITH_IE   0x04

Definition at line 386 of file scsi_ch.h.

◆ EXCHANGE_WITH_MT

#define EXCHANGE_WITH_MT   0x01

Definition at line 384 of file scsi_ch.h.

◆ EXCHANGE_WITH_ST

#define EXCHANGE_WITH_ST   0x02

Definition at line 385 of file scsi_ch.h.

◆ INITIALIZE_ELEMENT_STATUS

#define INITIALIZE_ELEMENT_STATUS   0x07

Definition at line 98 of file scsi_ch.h.

◆ MOVE_MEDIUM_INVERT

#define MOVE_MEDIUM_INVERT   0x01

Definition at line 116 of file scsi_ch.h.

◆ MOVE_TO_DT

#define MOVE_TO_DT   0x08

Definition at line 376 of file scsi_ch.h.

◆ MOVE_TO_IE

#define MOVE_TO_IE   0x04

Definition at line 375 of file scsi_ch.h.

◆ MOVE_TO_MT

#define MOVE_TO_MT   0x01

Definition at line 373 of file scsi_ch.h.

◆ MOVE_TO_ST

#define MOVE_TO_ST   0x02

Definition at line 374 of file scsi_ch.h.

◆ PGCODE_MASK

#define PGCODE_MASK   0x3f /* valid page number bits in pg_code */

Definition at line 295 of file scsi_ch.h.

◆ PGCODE_PS

#define PGCODE_PS   0x80 /* indicates page is savable */

Definition at line 296 of file scsi_ch.h.

◆ POSITION_TO_ELEMENT_INVERT

#define POSITION_TO_ELEMENT_INVERT   0x01

Definition at line 131 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_ACCESS

#define READ_ELEMENT_STATUS_ACCESS   0x08

Definition at line 229 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_ASSOCIATION

#define READ_ELEMENT_STATUS_ASSOCIATION (   p)    ((p) >> 4)

Definition at line 214 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_AVOLTAG

#define READ_ELEMENT_STATUS_AVOLTAG   0x40

Definition at line 190 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_CODE_SET

#define READ_ELEMENT_STATUS_CODE_SET (   p)    ((p) & 0x0F)

Definition at line 209 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_CURDATA

#define READ_ELEMENT_STATUS_CURDATA   0x02 /* allow motion during command */

Definition at line 147 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DESIGNATOR_TYPE

#define READ_ELEMENT_STATUS_DESIGNATOR_TYPE (   p)    ((p) & 0x0F)

Definition at line 215 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DT_IDVALID

#define READ_ELEMENT_STATUS_DT_IDVALID   0x20

Definition at line 248 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DT_LUNMASK

#define READ_ELEMENT_STATUS_DT_LUNMASK   0x07

Definition at line 246 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DT_LUVALID

#define READ_ELEMENT_STATUS_DT_LUVALID   0x10

Definition at line 247 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DT_MASK1

#define READ_ELEMENT_STATUS_DT_MASK1   0x0c

Definition at line 236 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DT_NOTBUS

#define READ_ELEMENT_STATUS_DT_NOTBUS   0x80

Definition at line 249 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_DVCID

#define READ_ELEMENT_STATUS_DVCID   0x01 /* report device serial number */

Definition at line 146 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_ED

#define READ_ELEMENT_STATUS_ED   0x80

Definition at line 262 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_EXCEPT

#define READ_ELEMENT_STATUS_EXCEPT   0x04

Definition at line 228 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_EXENAB

#define READ_ELEMENT_STATUS_EXENAB   0x10

Definition at line 230 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_FULL

#define READ_ELEMENT_STATUS_FULL   0x01

Definition at line 226 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_IE_MASK1

#define READ_ELEMENT_STATUS_IE_MASK1   0x3f

Definition at line 235 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_IMPEXP

#define READ_ELEMENT_STATUS_IMPEXP   0x02

Definition at line 227 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_INENAB

#define READ_ELEMENT_STATUS_INENAB   0x20

Definition at line 231 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_INVERT

#define READ_ELEMENT_STATUS_INVERT   0x40

Definition at line 260 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_MEDIA_TYPE_MASK

#define READ_ELEMENT_STATUS_MEDIA_TYPE_MASK   0x07

Definition at line 263 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_MT_MASK1

#define READ_ELEMENT_STATUS_MT_MASK1   0x05

Definition at line 233 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_PIV_SET

#define READ_ELEMENT_STATUS_PIV_SET   0x80

Definition at line 213 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_PROTOCOL_ID

#define READ_ELEMENT_STATUS_PROTOCOL_ID (   p)    ((p) >> 4)

Definition at line 210 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_PVOLTAG

#define READ_ELEMENT_STATUS_PVOLTAG   0x80

Definition at line 191 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_ST_MASK1

#define READ_ELEMENT_STATUS_ST_MASK1   0x0c

Definition at line 234 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_SVALID

#define READ_ELEMENT_STATUS_SVALID   0x80

Definition at line 261 of file scsi_ch.h.

◆ READ_ELEMENT_STATUS_VOLTAG

#define READ_ELEMENT_STATUS_VOLTAG   0x10 /* report volume tag info */

Definition at line 141 of file scsi_ch.h.

◆ REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG

#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG   0x10

Definition at line 157 of file scsi_ch.h.

◆ SEND_VOLUME_TAG

#define SEND_VOLUME_TAG   0xb6

Definition at line 304 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_ASSERT_ALTERNATE

#define SEND_VOLUME_TAG_ASSERT_ALTERNATE   0x09

Definition at line 311 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_ASSERT_PRIMARY

#define SEND_VOLUME_TAG_ASSERT_PRIMARY   0x08

Definition at line 310 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_REPLACE_ALTERNATE

#define SEND_VOLUME_TAG_REPLACE_ALTERNATE   0x0b

Definition at line 313 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_REPLACE_PRIMARY

#define SEND_VOLUME_TAG_REPLACE_PRIMARY   0x0a

Definition at line 312 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_UNDEFINED_ALTERNATE

#define SEND_VOLUME_TAG_UNDEFINED_ALTERNATE   0x0d

Definition at line 315 of file scsi_ch.h.

◆ SEND_VOLUME_TAG_UNDEFINED_PRIMARY

#define SEND_VOLUME_TAG_UNDEFINED_PRIMARY   0x0c

Definition at line 314 of file scsi_ch.h.

◆ STOR_DT

#define STOR_DT   0x08

Definition at line 361 of file scsi_ch.h.

◆ STOR_IE

#define STOR_IE   0x04

Definition at line 360 of file scsi_ch.h.

◆ STOR_MT

#define STOR_MT   0x01

Definition at line 358 of file scsi_ch.h.

◆ STOR_ST

#define STOR_ST   0x02

Definition at line 359 of file scsi_ch.h.

Function Documentation

◆ scsi_exchange_medium()

void scsi_exchange_medium ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int32_t  tea,
u_int32_t  src,
u_int32_t  dst1,
u_int32_t  dst2,
int  invert1,
int  invert2,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_initialize_element_status()

void scsi_initialize_element_status ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 1870 of file scsi_ch.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, INITIALIZE_ELEMENT_STATUS, and scsi_initialize_element_status::opcode.

Referenced by chielem().

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

◆ scsi_move_medium()

__BEGIN_DECLS void scsi_move_medium ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int32_t  tea,
u_int32_t  src,
u_int32_t  dst,
int  invert,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 1730 of file scsi_ch.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_move_medium::dst, scsi_move_medium::invert, MOVE_MEDIUM, MOVE_MEDIUM_INVERT, scsi_move_medium::opcode, scsi_ulto2b(), scsi_move_medium::src, and scsi_move_medium::tea.

Referenced by chmove().

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

◆ scsi_position_to_element()

void scsi_position_to_element ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int32_t  tea,
u_int32_t  dst,
int  invert,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_read_element_status()

void scsi_read_element_status ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  voltag,
u_int32_t  sea,
int  curdata,
int  dvcid,
u_int32_t  count,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_send_volume_tag()

void scsi_send_volume_tag ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int16_t  element_address,
u_int8_t  send_action_code,
struct scsi_send_volume_tag_parameters parameters,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 1896 of file scsi_ch.c.

References CAM_DIR_OUT, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_send_volume_tag::ea, scsi_send_volume_tag::opcode, scsi_send_volume_tag::pll, scsi_send_volume_tag::sac, scsi_ulto2b(), and SEND_VOLUME_TAG.

Referenced by chsetvoltag().

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