FreeBSD kernel CAM code
scsi_sa.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/bio.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/mtio.h>
#include <sys/conf.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/fcntl.h>
#include <sys/devicestat.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_periph.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_debug.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
#include <cam/scsi/scsi_sa.h>
#include "opt_sa.h"
Include dependency graph for scsi_sa.c:

Go to the source code of this file.

Data Structures

struct  sa_timeout_desc
 
struct  sa_devs
 
struct  sa_prot_state
 
struct  sa_prot_info
 
struct  sa_prot_map
 
struct  sa_softc
 
struct  sa_quirk_entry
 
struct  sa_param_ent
 

Macros

#define SA_IO_TIMEOUT   32
 
#define SA_SPACE_TIMEOUT   1 * 60
 
#define SA_REWIND_TIMEOUT   2 * 60
 
#define SA_ERASE_TIMEOUT   4 * 60
 
#define SA_REP_DENSITY_TIMEOUT   1
 
#define SCSIOP_TIMEOUT   (60 * 1000) /* not an option */
 
#define IO_TIMEOUT   (SA_IO_TIMEOUT * 60 * 1000)
 
#define REWIND_TIMEOUT   (SA_REWIND_TIMEOUT * 60 * 1000)
 
#define ERASE_TIMEOUT   (SA_ERASE_TIMEOUT * 60 * 1000)
 
#define SPACE_TIMEOUT   (SA_SPACE_TIMEOUT * 60 * 1000)
 
#define REP_DENSITY_TIMEOUT   (SA_REP_DENSITY_TIMEOUT * 60 * 1000)
 
#define UNUSED_PARAMETER(x)   x = x
 
#define QFRLS(ccb)
 
#define ccb_pflags   ppriv_field0
 
#define ccb_bp   ppriv_ptr1
 
#define SA_POSITION_UPDATED   0x1
 
#define SA_QUIRK_BIT_STRING
 
#define SAMODE(z)   (dev2unit(z) & 0x3)
 
#define SA_IS_CTRL(z)   (dev2unit(z) & (1 << 4))
 
#define SA_NOT_CTLDEV   0
 
#define SA_CTLDEV   1
 
#define SA_ATYPE_R   0
 
#define SA_ATYPE_NR   1
 
#define SA_ATYPE_ER   2
 
#define SA_NUM_ATYPES   3
 
#define SAMINOR(ctl, access)    ((ctl << 4) | (access & 0x3))
 
#define SASBADDBASE(sb, indent, data, xfmt, name, type, xsize, desc)
 
#define SASBADDINT(sb, indent, data, fmt, name)
 
#define SASBADDINTDESC(sb, indent, data, fmt, name, desc)
 
#define SASBADDUINT(sb, indent, data, fmt, name)
 
#define SASBADDUINTDESC(sb, indent, data, fmt, name, desc)
 
#define SASBADDFIXEDSTR(sb, indent, data, fmt, name)
 
#define SASBADDFIXEDSTRDESC(sb, indent, data, fmt, name, desc)
 
#define SASBADDVARSTR(sb, indent, data, fmt, name, maxlen)    SASBADDBASE(sb, indent, data, fmt, name, str, maxlen, NULL)
 
#define SASBADDVARSTRDESC(sb, indent, data, fmt, name, maxlen, desc)    SASBADDBASE(sb, indent, data, fmt, name, str, maxlen, desc)
 
#define SASBADDNODE(sb, indent, name)
 
#define SASBADDNODENUM(sb, indent, name, num)
 
#define SASBENDNODE(sb, indent, name)
 
#define SA_DENSITY_TYPES   4
 
#define SA_NUM_PROT_ENTS   nitems(sa_prot_table)
 
#define SA_PROT_ENABLED(softc)
 
#define SA_PROT_LEN(softc)   softc->prot_info.cur_prot_state.pi_length
 
#define last_io_sense   errinfo._last_io_sense
 
#define last_io_resid   errinfo._last_io_resid
 
#define last_io_cdb   errinfo._last_io_cdb
 
#define last_ctl_sense   errinfo._last_ctl_sense
 
#define last_ctl_resid   errinfo._last_ctl_resid
 
#define last_ctl_cdb   errinfo._last_ctl_cdb
 
#define SA_DEFAULT_IO_SPLIT   0
 
#define D_TAPE   0
 
#define PENDING_MOUNT_CHECK(softc, periph, dev)
 
#define SAFILLDENSSB(dens_data, sb, indent, field, desc_remain, len_to_go, cur_offset, desc)
 
#define SAFILLDENSSBSTR(dens_data, sb, indent, field, desc_remain, len_to_go, cur_offset, desc)
 

Enumerations

enum  sa_state { SA_STATE_NORMAL , SA_STATE_PROBE , SA_STATE_ABNORMAL }
 
enum  sa_flags {
  SA_FLAG_OPEN = 0x00001 , SA_FLAG_FIXED = 0x00002 , SA_FLAG_TAPE_LOCKED = 0x00004 , SA_FLAG_TAPE_MOUNTED = 0x00008 ,
  SA_FLAG_TAPE_WP = 0x00010 , SA_FLAG_TAPE_WRITTEN = 0x00020 , SA_FLAG_EOM_PENDING = 0x00040 , SA_FLAG_EIO_PENDING = 0x00080 ,
  SA_FLAG_EOF_PENDING = 0x00100 , SA_FLAG_ERR_PENDING , SA_FLAG_INVALID = 0x00200 , SA_FLAG_COMP_ENABLED = 0x00400 ,
  SA_FLAG_COMP_SUPP = 0x00800 , SA_FLAG_COMP_UNSUPP = 0x01000 , SA_FLAG_TAPE_FROZEN = 0x02000 , SA_FLAG_PROTECT_SUPP = 0x04000 ,
  SA_FLAG_COMPRESSION , SA_FLAG_SCTX_INIT = 0x08000 , SA_FLAG_RSOC_TO_TRY = 0x10000
}
 
enum  sa_mode { SA_MODE_REWIND = 0x00 , SA_MODE_NOREWIND = 0x01 , SA_MODE_OFFLINE = 0x02 }
 
enum  sa_timeout_types {
  SA_TIMEOUT_ERASE , SA_TIMEOUT_LOAD , SA_TIMEOUT_LOCATE , SA_TIMEOUT_MODE_SELECT ,
  SA_TIMEOUT_MODE_SENSE , SA_TIMEOUT_PREVENT , SA_TIMEOUT_READ , SA_TIMEOUT_READ_BLOCK_LIMITS ,
  SA_TIMEOUT_READ_POSITION , SA_TIMEOUT_REP_DENSITY , SA_TIMEOUT_RESERVE , SA_TIMEOUT_REWIND ,
  SA_TIMEOUT_SPACE , SA_TIMEOUT_TUR , SA_TIMEOUT_WRITE , SA_TIMEOUT_WRITE_FILEMARKS ,
  SA_TIMEOUT_TYPE_MAX
}
 
enum  sa_params {
  SA_PARAM_NONE = 0x000 , SA_PARAM_BLOCKSIZE = 0x001 , SA_PARAM_DENSITY = 0x002 , SA_PARAM_COMPRESSION = 0x004 ,
  SA_PARAM_BUFF_MODE = 0x008 , SA_PARAM_NUMBLOCKS = 0x010 , SA_PARAM_WP = 0x020 , SA_PARAM_SPEED = 0x040 ,
  SA_PARAM_DENSITY_EXT = 0x080 , SA_PARAM_LBP = 0x100 , SA_PARAM_ALL = 0x1ff
}
 
enum  sa_quirks {
  SA_QUIRK_NONE = 0x000 , SA_QUIRK_NOCOMP = 0x001 , SA_QUIRK_FIXED = 0x002 , SA_QUIRK_VARIABLE = 0x004 ,
  SA_QUIRK_2FM = 0x008 , SA_QUIRK_1FM = 0x010 , SA_QUIRK_NODREAD = 0x020 , SA_QUIRK_NO_MODESEL = 0x040 ,
  SA_QUIRK_NO_CPAGE = 0x080 , SA_QUIRK_NO_LONG_POS = 0x100
}
 
enum  sa_param_type { SA_PARAM_TYPE_ENTRY , SA_PARAM_TYPE_NODE }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_SCSISA, "SCSI sa", "SCSI sequential access buffers")
 
static void saasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
 
static void sadone (struct cam_periph *periph, union ccb *start_ccb)
 
static int saerror (union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
 
static int samarkswanted (struct cam_periph *)
 
static int sacheckeod (struct cam_periph *periph)
 
static int sagetparams (struct cam_periph *periph, sa_params params_to_get, u_int32_t *blocksize, u_int8_t *density, u_int32_t *numblocks, int *buff_mode, u_int8_t *write_protect, u_int8_t *speed, int *comp_supported, int *comp_enabled, u_int32_t *comp_algorithm, sa_comp_t *comp_page, struct scsi_control_data_prot_subpage *prot_page, int dp_size, int prot_changeable)
 
static int sasetprot (struct cam_periph *periph, struct sa_prot_state *new_prot)
 
static int sasetparams (struct cam_periph *periph, sa_params params_to_set, u_int32_t blocksize, u_int8_t density, u_int32_t comp_algorithm, u_int32_t sense_flags)
 
static int sasetsili (struct cam_periph *periph, struct mtparamset *ps, int num_params)
 
static int saseteotwarn (struct cam_periph *periph, struct mtparamset *ps, int num_params)
 
static void safillprot (struct sa_softc *softc, int *indent, struct sbuf *sb)
 
static void sapopulateprots (struct sa_prot_state *cur_state, struct sa_prot_map *new_table, int table_ents)
 
static struct sa_prot_mapsafindprotent (char *name, struct sa_prot_map *table, int table_ents)
 
static int sasetprotents (struct cam_periph *periph, struct mtparamset *ps, int num_params)
 
static struct sa_param_entsafindparament (struct mtparamset *ps)
 
static int saparamsetlist (struct cam_periph *periph, struct mtsetlist *list, int need_copy)
 
static int saextget (struct cdev *dev, struct cam_periph *periph, struct sbuf *sb, struct mtextget *g)
 
static int saparamget (struct sa_softc *softc, struct sbuf *sb)
 
static void saprevent (struct cam_periph *periph, int action)
 
static int sarewind (struct cam_periph *periph)
 
static int saspace (struct cam_periph *periph, int count, scsi_space_code code)
 
static void sadevgonecb (void *arg)
 
static void sasetupdev (struct sa_softc *softc, struct cdev *dev)
 
static void saloadtotunables (struct sa_softc *softc)
 
static void sasysctlinit (void *context, int pending)
 
static int samount (struct cam_periph *, int, struct cdev *)
 
static int saretension (struct cam_periph *periph)
 
static int sareservereleaseunit (struct cam_periph *periph, int reserve)
 
static int saloadunload (struct cam_periph *periph, int load)
 
static int saerase (struct cam_periph *periph, int longerase)
 
static int sawritefilemarks (struct cam_periph *periph, int nmarks, int setmarks, int immed)
 
static int sagetpos (struct cam_periph *periph)
 
static int sardpos (struct cam_periph *periph, int, u_int32_t *)
 
static int sasetpos (struct cam_periph *periph, int, struct mtlocate *)
 
static void safilldenstypesb (struct sbuf *sb, int *indent, uint8_t *buf, int buf_len, int is_density)
 
static void safilldensitysb (struct sa_softc *softc, int *indent, struct sbuf *sb)
 
static void saloadtimeouts (struct sa_softc *softc, union ccb *ccb)
 
static SYSCTL_NODE (_kern_cam, OID_AUTO, sa, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM Sequential Access Tape Driver")
 
 SYSCTL_INT (_kern_cam_sa, OID_AUTO, allow_io_split, CTLFLAG_RDTUN, &sa_allow_io_split, 0, "Default I/O split value")
 
 PERIPHDRIVER_DECLARE (sa, sadriver)
 
static int saopen (struct cdev *dev, int flags, int fmt, struct thread *td)
 
static int saclose (struct cdev *dev, int flag, int fmt, struct thread *td)
 
static void sastrategy (struct bio *bp)
 
static int sagetparams_common (struct cdev *dev, struct cam_periph *periph)
 
static int saioctl (struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
 
static void saoninvalidate (struct cam_periph *periph)
 
static void sacleanup (struct cam_periph *periph)
 
static cam_status saregister (struct cam_periph *periph, void *arg)
 
static void sastart (struct cam_periph *periph, union ccb *start_ccb)
 
void scsi_read_block_limits (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, struct scsi_read_block_limits_data *rlimit_buf, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_sa_read_write (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int readop, int sli, int fixed, u_int32_t length, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_load_unload (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immediate, int eot, int reten, int load, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_rewind (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immediate, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_space (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, scsi_space_code code, u_int32_t count, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_write_filemarks (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immediate, int setmark, u_int32_t num_marks, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_reserve_release_unit (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int third_party, int third_party_id, u_int8_t sense_len, u_int32_t timeout, int reserve)
 
void scsi_erase (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immediate, int long_erase, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_read_position (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int hardsoft, struct scsi_tape_position_data *sbp, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_read_position_10 (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int service_action, u_int8_t *data_ptr, u_int32_t length, u_int32_t sense_len, u_int32_t timeout)
 
void scsi_set_position (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int hardsoft, u_int32_t blkno, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_locate_10 (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immed, int cp, int hard, int64_t partition, u_int32_t block_address, int sense_len, u_int32_t timeout)
 
void scsi_locate_16 (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int immed, int cp, u_int8_t dest_type, int bam, int64_t partition, u_int64_t logical_id, int sense_len, u_int32_t timeout)
 
void scsi_report_density_support (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int media, int medium_type, u_int8_t *data_ptr, u_int32_t length, u_int32_t sense_len, u_int32_t timeout)
 
void scsi_set_capacity (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int byte1, u_int32_t proportion, u_int32_t sense_len, u_int32_t timeout)
 
void scsi_format_medium (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int byte1, int byte2, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int32_t sense_len, u_int32_t timeout)
 
void scsi_allow_overwrite (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, int allow_overwrite, int partition, u_int64_t logical_id, u_int32_t sense_len, u_int32_t timeout)
 

Variables

static struct sa_timeout_desc sa_default_timeouts [SA_TIMEOUT_TYPE_MAX]
 
struct sa_prot_map sa_prot_table []
 
static struct sa_quirk_entry sa_quirk_table []
 
static d_open_t saopen
 
static d_close_t saclose
 
static d_strategy_t sastrategy
 
static d_ioctl_t saioctl
 
static periph_init_t sainit
 
static periph_ctor_t saregister
 
static periph_oninv_t saoninvalidate
 
static periph_dtor_t sacleanup
 
static periph_start_t sastart
 
static int sa_allow_io_split = SA_DEFAULT_IO_SPLIT
 
static struct periph_driver sadriver
 
static struct cdevsw sa_cdevsw
 
struct sa_param_ent sa_param_table []
 

Macro Definition Documentation

◆ ccb_bp

#define ccb_bp   ppriv_ptr1

Definition at line 122 of file scsi_sa.c.

◆ ccb_pflags

#define ccb_pflags   ppriv_field0

Definition at line 121 of file scsi_sa.c.

◆ D_TAPE

#define D_TAPE   0

Definition at line 698 of file scsi_sa.c.

◆ ERASE_TIMEOUT

#define ERASE_TIMEOUT   (SA_ERASE_TIMEOUT * 60 * 1000)

Definition at line 95 of file scsi_sa.c.

◆ IO_TIMEOUT

#define IO_TIMEOUT   (SA_IO_TIMEOUT * 60 * 1000)

Definition at line 93 of file scsi_sa.c.

◆ last_ctl_cdb

#define last_ctl_cdb   errinfo._last_ctl_cdb

Definition at line 462 of file scsi_sa.c.

◆ last_ctl_resid

#define last_ctl_resid   errinfo._last_ctl_resid

Definition at line 461 of file scsi_sa.c.

◆ last_ctl_sense

#define last_ctl_sense   errinfo._last_ctl_sense

Definition at line 460 of file scsi_sa.c.

◆ last_io_cdb

#define last_io_cdb   errinfo._last_io_cdb

Definition at line 459 of file scsi_sa.c.

◆ last_io_resid

#define last_io_resid   errinfo._last_io_resid

Definition at line 458 of file scsi_sa.c.

◆ last_io_sense

#define last_io_sense   errinfo._last_io_sense

Definition at line 457 of file scsi_sa.c.

◆ PENDING_MOUNT_CHECK

#define PENDING_MOUNT_CHECK (   softc,
  periph,
  dev 
)
Value:
if (softc->open_pending_mount) { \
error = samount(periph, 0, dev); \
if (error) { \
break; \
} \
saprevent(periph, PR_PREVENT); \
softc->open_pending_mount = 0; \
}
#define PR_PREVENT
Definition: scsi_all.h:945
static int samount(struct cam_periph *, int, struct cdev *)
Definition: scsi_sa.c:3169

Definition at line 1549 of file scsi_sa.c.

◆ QFRLS

#define QFRLS (   ccb)
Value:
if (((ccb)->ccb_h.status & CAM_DEV_QFRZN) != 0) \
cam_release_devq((ccb)->ccb_h.path, 0, 0, 0, FALSE)
@ CAM_DEV_QFRZN
Definition: cam.h:287
Definition: cam_ccb.h:1345

Definition at line 107 of file scsi_sa.c.

◆ REP_DENSITY_TIMEOUT

#define REP_DENSITY_TIMEOUT   (SA_REP_DENSITY_TIMEOUT * 60 * 1000)

Definition at line 97 of file scsi_sa.c.

◆ REWIND_TIMEOUT

#define REWIND_TIMEOUT   (SA_REWIND_TIMEOUT * 60 * 1000)

Definition at line 94 of file scsi_sa.c.

◆ SA_ATYPE_ER

#define SA_ATYPE_ER   2

Definition at line 263 of file scsi_sa.c.

◆ SA_ATYPE_NR

#define SA_ATYPE_NR   1

Definition at line 262 of file scsi_sa.c.

◆ SA_ATYPE_R

#define SA_ATYPE_R   0

Definition at line 261 of file scsi_sa.c.

◆ SA_CTLDEV

#define SA_CTLDEV   1

Definition at line 259 of file scsi_sa.c.

◆ SA_DEFAULT_IO_SPLIT

#define SA_DEFAULT_IO_SPLIT   0

Definition at line 672 of file scsi_sa.c.

◆ SA_DENSITY_TYPES

#define SA_DENSITY_TYPES   4

Definition at line 328 of file scsi_sa.c.

◆ SA_ERASE_TIMEOUT

#define SA_ERASE_TIMEOUT   4 * 60

Definition at line 85 of file scsi_sa.c.

◆ SA_IO_TIMEOUT

#define SA_IO_TIMEOUT   32

Definition at line 76 of file scsi_sa.c.

◆ SA_IS_CTRL

#define SA_IS_CTRL (   z)    (dev2unit(z) & (1 << 4))

Definition at line 256 of file scsi_sa.c.

◆ SA_NOT_CTLDEV

#define SA_NOT_CTLDEV   0

Definition at line 258 of file scsi_sa.c.

◆ SA_NUM_ATYPES

#define SA_NUM_ATYPES   3

Definition at line 264 of file scsi_sa.c.

◆ SA_NUM_PROT_ENTS

#define SA_NUM_PROT_ENTS   nitems(sa_prot_table)

Definition at line 372 of file scsi_sa.c.

◆ SA_POSITION_UPDATED

#define SA_POSITION_UPDATED   0x1

Definition at line 125 of file scsi_sa.c.

◆ SA_PROT_ENABLED

#define SA_PROT_ENABLED (   softc)
Value:
((softc->flags & SA_FLAG_PROTECT_SUPP) \
&& (softc->prot_info.cur_prot_state.initialized != 0) \
&& (softc->prot_info.cur_prot_state.prot_method != 0))
@ SA_FLAG_PROTECT_SUPP
Definition: scsi_sa.c:144

Definition at line 374 of file scsi_sa.c.

◆ SA_PROT_LEN

#define SA_PROT_LEN (   softc)    softc->prot_info.cur_prot_state.pi_length

Definition at line 378 of file scsi_sa.c.

◆ SA_QUIRK_BIT_STRING

#define SA_QUIRK_BIT_STRING
Value:
"\020" \
"\001NOCOMP" \
"\002FIXED" \
"\003VARIABLE" \
"\0042FM" \
"\0051FM" \
"\006NODREAD" \
"\007NO_MODESEL" \
"\010NO_CPAGE" \
"\011NO_LONG_POS"

Definition at line 243 of file scsi_sa.c.

◆ SA_REP_DENSITY_TIMEOUT

#define SA_REP_DENSITY_TIMEOUT   1

Definition at line 88 of file scsi_sa.c.

◆ SA_REWIND_TIMEOUT

#define SA_REWIND_TIMEOUT   2 * 60

Definition at line 82 of file scsi_sa.c.

◆ SA_SPACE_TIMEOUT

#define SA_SPACE_TIMEOUT   1 * 60

Definition at line 79 of file scsi_sa.c.

◆ SAFILLDENSSB

#define SAFILLDENSSB (   dens_data,
  sb,
  indent,
  field,
  desc_remain,
  len_to_go,
  cur_offset,
  desc 
)

Definition at line 5497 of file scsi_sa.c.

◆ SAFILLDENSSBSTR

#define SAFILLDENSSBSTR (   dens_data,
  sb,
  indent,
  field,
  desc_remain,
  len_to_go,
  cur_offset,
  desc 
)
Value:
{ \
size_t cur_field_len; \
char tmpstr[32]; \
\
cur_field_len = sizeof(dens_data->field); \
if (desc_remain < cur_field_len) { \
len_to_go -= desc_remain; \
cur_offset += desc_remain; \
continue; \
} \
len_to_go -= cur_field_len; \
cur_offset += cur_field_len; \
desc_remain -= cur_field_len; \
cam_strvis(tmpstr, dens_data->field, \
sizeof(dens_data->field), sizeof(tmpstr)); \
SASBADDVARSTRDESC(sb, indent, tmpstr, %s, field, \
strlen(tmpstr) + 1, desc); \
};
void cam_strvis(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen)
Definition: cam.c:124

Definition at line 5541 of file scsi_sa.c.

◆ SAMINOR

#define SAMINOR (   ctl,
  access 
)     ((ctl << 4) | (access & 0x3))

Definition at line 266 of file scsi_sa.c.

◆ SAMODE

#define SAMODE (   z)    (dev2unit(z) & 0x3)

Definition at line 255 of file scsi_sa.c.

◆ SASBADDBASE

#define SASBADDBASE (   sb,
  indent,
  data,
  xfmt,
  name,
  type,
  xsize,
  desc 
)
Value:
sbuf_printf(sb, "%*s<%s type=\"%s\" size=\"%zd\" " \
"fmt=\"%s\" desc=\"%s\">" #xfmt "</%s>\n", indent, "", \
#name, #type, xsize, #xfmt, desc ? desc : "", data, #name);

Definition at line 276 of file scsi_sa.c.

◆ SASBADDFIXEDSTR

#define SASBADDFIXEDSTR (   sb,
  indent,
  data,
  fmt,
  name 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, str, sizeof(data), \
NULL)
#define SASBADDBASE(sb, indent, data, xfmt, name, type, xsize, desc)
Definition: scsi_sa.c:276

Definition at line 297 of file scsi_sa.c.

◆ SASBADDFIXEDSTRDESC

#define SASBADDFIXEDSTRDESC (   sb,
  indent,
  data,
  fmt,
  name,
  desc 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, str, sizeof(data), \
desc)

Definition at line 301 of file scsi_sa.c.

◆ SASBADDINT

#define SASBADDINT (   sb,
  indent,
  data,
  fmt,
  name 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, int, sizeof(data), \
NULL)

Definition at line 281 of file scsi_sa.c.

◆ SASBADDINTDESC

#define SASBADDINTDESC (   sb,
  indent,
  data,
  fmt,
  name,
  desc 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, int, sizeof(data), \
desc)

Definition at line 285 of file scsi_sa.c.

◆ SASBADDNODE

#define SASBADDNODE (   sb,
  indent,
  name 
)
Value:
{ \
sbuf_printf(sb, "%*s<%s type=\"%s\">\n", indent, "", #name, \
"node"); \
indent += 2; \
}

Definition at line 311 of file scsi_sa.c.

◆ SASBADDNODENUM

#define SASBADDNODENUM (   sb,
  indent,
  name,
  num 
)
Value:
{ \
sbuf_printf(sb, "%*s<%s type=\"%s\" num=\"%d\">\n", indent, "", \
#name, "node", num); \
indent += 2; \
}

Definition at line 317 of file scsi_sa.c.

◆ SASBADDUINT

#define SASBADDUINT (   sb,
  indent,
  data,
  fmt,
  name 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, uint, sizeof(data), \
NULL)

Definition at line 289 of file scsi_sa.c.

◆ SASBADDUINTDESC

#define SASBADDUINTDESC (   sb,
  indent,
  data,
  fmt,
  name,
  desc 
)
Value:
SASBADDBASE(sb, indent, data, fmt, name, uint, sizeof(data), \
desc)

Definition at line 293 of file scsi_sa.c.

◆ SASBADDVARSTR

#define SASBADDVARSTR (   sb,
  indent,
  data,
  fmt,
  name,
  maxlen 
)     SASBADDBASE(sb, indent, data, fmt, name, str, maxlen, NULL)

Definition at line 305 of file scsi_sa.c.

◆ SASBADDVARSTRDESC

#define SASBADDVARSTRDESC (   sb,
  indent,
  data,
  fmt,
  name,
  maxlen,
  desc 
)     SASBADDBASE(sb, indent, data, fmt, name, str, maxlen, desc)

Definition at line 308 of file scsi_sa.c.

◆ SASBENDNODE

#define SASBENDNODE (   sb,
  indent,
  name 
)
Value:
{ \
indent -= 2; \
sbuf_printf(sb, "%*s</%s>\n", indent, "", #name); \
}

Definition at line 323 of file scsi_sa.c.

◆ SCSIOP_TIMEOUT

#define SCSIOP_TIMEOUT   (60 * 1000) /* not an option */

Definition at line 91 of file scsi_sa.c.

◆ SPACE_TIMEOUT

#define SPACE_TIMEOUT   (SA_SPACE_TIMEOUT * 60 * 1000)

Definition at line 96 of file scsi_sa.c.

◆ UNUSED_PARAMETER

#define UNUSED_PARAMETER (   x)    x = x

Definition at line 104 of file scsi_sa.c.

Enumeration Type Documentation

◆ sa_flags

enum sa_flags
Enumerator
SA_FLAG_OPEN 
SA_FLAG_FIXED 
SA_FLAG_TAPE_LOCKED 
SA_FLAG_TAPE_MOUNTED 
SA_FLAG_TAPE_WP 
SA_FLAG_TAPE_WRITTEN 
SA_FLAG_EOM_PENDING 
SA_FLAG_EIO_PENDING 
SA_FLAG_EOF_PENDING 
SA_FLAG_ERR_PENDING 
SA_FLAG_INVALID 
SA_FLAG_COMP_ENABLED 
SA_FLAG_COMP_SUPP 
SA_FLAG_COMP_UNSUPP 
SA_FLAG_TAPE_FROZEN 
SA_FLAG_PROTECT_SUPP 
SA_FLAG_COMPRESSION 
SA_FLAG_SCTX_INIT 
SA_FLAG_RSOC_TO_TRY 

Definition at line 127 of file scsi_sa.c.

◆ sa_mode

enum sa_mode
Enumerator
SA_MODE_REWIND 
SA_MODE_NOREWIND 
SA_MODE_OFFLINE 

Definition at line 152 of file scsi_sa.c.

◆ sa_param_type

Enumerator
SA_PARAM_TYPE_ENTRY 
SA_PARAM_TYPE_NODE 

Definition at line 1356 of file scsi_sa.c.

◆ sa_params

enum sa_params
Enumerator
SA_PARAM_NONE 
SA_PARAM_BLOCKSIZE 
SA_PARAM_DENSITY 
SA_PARAM_COMPRESSION 
SA_PARAM_BUFF_MODE 
SA_PARAM_NUMBLOCKS 
SA_PARAM_WP 
SA_PARAM_SPEED 
SA_PARAM_DENSITY_EXT 
SA_PARAM_LBP 
SA_PARAM_ALL 

Definition at line 216 of file scsi_sa.c.

◆ sa_quirks

enum sa_quirks
Enumerator
SA_QUIRK_NONE 
SA_QUIRK_NOCOMP 
SA_QUIRK_FIXED 
SA_QUIRK_VARIABLE 
SA_QUIRK_2FM 
SA_QUIRK_1FM 
SA_QUIRK_NODREAD 
SA_QUIRK_NO_MODESEL 
SA_QUIRK_NO_CPAGE 
SA_QUIRK_NO_LONG_POS 

Definition at line 230 of file scsi_sa.c.

◆ sa_state

enum sa_state
Enumerator
SA_STATE_NORMAL 
SA_STATE_PROBE 
SA_STATE_ABNORMAL 

Definition at line 117 of file scsi_sa.c.

◆ sa_timeout_types

Enumerator
SA_TIMEOUT_ERASE 
SA_TIMEOUT_LOAD 
SA_TIMEOUT_LOCATE 
SA_TIMEOUT_MODE_SELECT 
SA_TIMEOUT_MODE_SENSE 
SA_TIMEOUT_PREVENT 
SA_TIMEOUT_READ 
SA_TIMEOUT_READ_BLOCK_LIMITS 
SA_TIMEOUT_READ_POSITION 
SA_TIMEOUT_REP_DENSITY 
SA_TIMEOUT_RESERVE 
SA_TIMEOUT_REWIND 
SA_TIMEOUT_SPACE 
SA_TIMEOUT_TUR 
SA_TIMEOUT_WRITE 
SA_TIMEOUT_WRITE_FILEMARKS 
SA_TIMEOUT_TYPE_MAX 

Definition at line 158 of file scsi_sa.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_SCSISA  ,
"SCSI sa"  ,
"SCSI sequential access buffers"   
)
static

◆ PERIPHDRIVER_DECLARE()

PERIPHDRIVER_DECLARE ( sa  ,
sadriver   
)

◆ saasync()

static void saasync ( void *  callback_arg,
u_int32_t  code,
struct cam_path path,
void *  arg 
)
static

Definition at line 2292 of file scsi_sa.c.

References AC_FOUND_DEVICE, cam_periph_alloc(), cam_periph_async(), CAM_PERIPH_BIO, CAM_REQ_CMP, CAM_REQ_INPROG, ccb_getdev::inq_data, PROTO_SCSI, ccb_getdev::protocol, saasync(), sacleanup, saoninvalidate, saregister, sastart, SID_QUAL, SID_QUAL_LU_CONNECTED, SID_TYPE, and T_SEQUENTIAL.

Referenced by saasync(), saoninvalidate(), and saregister().

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

◆ sacheckeod()

static int sacheckeod ( struct cam_periph periph)
static

Definition at line 3650 of file scsi_sa.c.

References sa_softc::periph, samarkswanted(), and sawritefilemarks().

Referenced by saclose(), and saioctl().

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

◆ sacleanup()

◆ saclose()

◆ sadevgonecb()

static void sadevgonecb ( void *  arg)
static

Definition at line 2193 of file scsi_sa.c.

References cam_periph_mtx(), cam_periph_release_locked(), sa_softc::num_devs_to_destroy, sa_softc::open_count, sa_softc::periph, and cam_periph::softc.

Referenced by saoninvalidate().

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

◆ sadone()

◆ saerase()

static int saerase ( struct cam_periph periph,
int  longerase 
)
static

Definition at line 5462 of file scsi_sa.c.

References cam_periph_getccb(), cam_periph_runccb(), ccb, ccb::csio, sa_softc::device_stats, sa_softc::dsreg, MSG_SIMPLE_Q_TAG, sa_softc::open_rdonly, sa_softc::periph, SA_TIMEOUT_ERASE, saerror(), scsi_erase(), cam_periph::softc, SSD_FULL_SIZE, sa_softc::timeout_info, and xpt_release_ccb().

Referenced by saioctl().

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

◆ saerror()

◆ saextget()

◆ safilldensitysb()

static void safilldensitysb ( struct sa_softc softc,
int *  indent,
struct sbuf *  sb 
)
static

Definition at line 5736 of file scsi_sa.c.

References sa_softc::density_info, sa_softc::density_info_valid, sa_softc::density_type_bits, sa_softc::media_density, SA_DENSITY_TYPES, safilldenstypesb(), SASBADDINTDESC, SASBADDNODE, SASBADDUINTDESC, SASBENDNODE, SRDS_MEDIA, and SRDS_MEDIUM_TYPE.

Referenced by saextget().

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

◆ safilldenstypesb()

◆ safillprot()

static void safillprot ( struct sa_softc softc,
int *  indent,
struct sbuf *  sb 
)
static

◆ safindparament()

static struct sa_param_ent * safindparament ( struct mtparamset *  ps)
static

Definition at line 1373 of file scsi_sa.c.

References sa_param_ent::name, sa_param_ent::param_type, sa_param_table, and SA_PARAM_TYPE_ENTRY.

Referenced by saparamsetlist().

Here is the caller graph for this function:

◆ safindprotent()

static struct sa_prot_map * safindprotent ( char *  name,
struct sa_prot_map table,
int  table_ents 
)
static

Definition at line 1221 of file scsi_sa.c.

References sa_prot_map::name.

Referenced by sasetprotents().

Here is the caller graph for this function:

◆ sagetparams()

static int sagetparams ( struct cam_periph periph,
sa_params  params_to_get,
u_int32_t *  blocksize,
u_int8_t *  density,
u_int32_t *  numblocks,
int *  buff_mode,
u_int8_t *  write_protect,
u_int8_t *  speed,
int *  comp_supported,
int *  comp_enabled,
u_int32_t *  comp_algorithm,
sa_comp_t comp_page,
struct scsi_control_data_prot_subpage prot_page,
int  dp_size,
int  prot_changeable 
)
static

Definition at line 3875 of file scsi_sa.c.

References scsi_mode_header_6::blk_desc_len, scsi_mode_blk_desc::blklen, CAM_DEBUG_INFO, CAM_DEBUGGED, cam_periph_getccb(), cam_periph_runccb(), CAM_REQ_CMP, CAM_SCSI_STATUS_ERROR, CAM_STATUS_MASK, ccb, ccb::ccb_h, cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_data_compression_page::comp_algorithm, ccb::csio, sa_prot_info::cur_prot_state, scsi_mode_header_10::data_length, scsi_data_compression_page::dce_and_dcc, sa_comp_t::dcomp, sa_comp_t::dconf, scsi_mode_blk_desc::density, sa_softc::density_info, sa_softc::density_info_valid, sa_softc::density_type_bits, scsi_mode_header_6::dev_spec, sa_softc::device_stats, ccb_scsiio::dxfer_len, sa_softc::flags, sa_prot_state::initialized, sa_prot_state::lbp_r, sa_prot_state::lbp_w, MSG_SIMPLE_Q_TAG, scsi_mode_blk_desc::nblocks, cam_periph::path, sa_softc::periph, sa_prot_state::pi_length, scsi_control_data_prot_subpage::pi_length, scsi_control_data_prot_subpage::prot_bits, sa_softc::prot_info, sa_prot_state::prot_method, scsi_control_data_prot_subpage::prot_method, sa_softc::quirks, sa_prot_state::rbdp, ccb_scsiio::resid, SA_COMP_NONE, SA_CTRL_DP_LBP_R, SA_CTRL_DP_LBP_W, SA_CTRL_DP_PI_LENGTH_MASK, SA_CTRL_DP_RBDP, SA_CTRL_DP_SUBPAGE_CODE, SA_DATA_COMPRESSION_PAGE, SA_DCP_DCC, SA_DCP_DCE, SA_DENSITY_TYPES, SA_DEVICE_CONFIGURATION_PAGE, SA_FLAG_PROTECT_SUPP, SA_PARAM_BLOCKSIZE, SA_PARAM_BUFF_MODE, SA_PARAM_COMPRESSION, SA_PARAM_DENSITY, SA_PARAM_DENSITY_EXT, SA_PARAM_LBP, SA_PARAM_NUMBLOCKS, SA_PARAM_SPEED, SA_PARAM_WP, SA_QUIRK_NO_CPAGE, SA_QUIRK_NOCOMP, SA_TIMEOUT_MODE_SENSE, SA_TIMEOUT_REP_DENSITY, saerror(), scsi_2btoul(), scsi_3btoul(), scsi_4btoul(), scsi_mode_sense(), scsi_mode_sense_len(), scsi_report_density_support(), sa_softc::scsi_rev, SCSI_REV_SPC, scsi_sense_print(), scsi_dev_conf_page::sel_comp_alg, SF_NO_PRINT, SMH_SA_BUF_MODE_MASK, SMH_SA_SPEED_MASK, SMH_SA_WP, SMS_CONTROL_MODE_PAGE, SMS_PAGE_CTRL_CHANGEABLE, SMS_PAGE_CTRL_CURRENT, SMS_VENDOR_SPECIFIC_PAGE, cam_periph::softc, SRDS_MEDIA, SRDS_MEDIUM_TYPE, SSD_FULL_SIZE, ccb_hdr::status, scsi_mode_sense_10::subpage, sa_softc::timeout_info, xpt_print_path(), and xpt_release_ccb().

Referenced by sagetparams_common(), samount(), sasetparams(), and sasetprot().

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

◆ sagetparams_common()

static int sagetparams_common ( struct cdev *  dev,
struct cam_periph periph 
)
static

◆ sagetpos()

◆ saioctl()

static int saioctl ( struct cdev *  dev,
u_long  cmd,
caddr_t  arg,
int  flag,
struct thread *  td 
)
static

◆ saloadtimeouts()

◆ saloadtotunables()

static void saloadtotunables ( struct sa_softc softc)
static

Definition at line 2359 of file scsi_sa.c.

References sa_timeout_desc::desc, sa_softc::periph, sa_default_timeouts, SA_TIMEOUT_TYPE_MAX, sa_softc::timeout_info, and cam_periph::unit_number.

Referenced by sadone(), saregister(), and sastart().

Here is the caller graph for this function:

◆ saloadunload()

static int saloadunload ( struct cam_periph periph,
int  load 
)
static

◆ samarkswanted()

static int samarkswanted ( struct cam_periph periph)
static

Definition at line 3633 of file scsi_sa.c.

References sa_softc::filemarks, sa_softc::flags, sa_softc::periph, sa_softc::quirks, SA_FLAG_TAPE_WRITTEN, SA_QUIRK_2FM, and cam_periph::softc.

Referenced by sacheckeod().

Here is the caller graph for this function:

◆ samount()

static int samount ( struct cam_periph periph,
int  oflags,
struct cdev *  dev 
)
static

Definition at line 3169 of file scsi_sa.c.

References sa_softc::blk_gran, sa_softc::blk_mask, sa_softc::blk_shift, sa_softc::blkno, sa_softc::buffer_mode, CAM_DEBUG_INFO, CAM_DEBUGGED, cam_periph_getccb(), cam_periph_runccb(), CAM_RETRY_SELTO, ccb, sa_softc::comp_algorithm, ccb::csio, sa_softc::device_stats, sa_softc::dsreg, sa_softc::filemarks, sa_softc::fileno, sa_softc::flags, sa_softc::last_media_blksize, sa_softc::max_blk, scsi_read_block_limits_data::maximum, sa_softc::media_blksize, sa_softc::media_density, sa_softc::media_numblks, sa_softc::min_blk, scsi_read_block_limits_data::minimum, MSG_SIMPLE_Q_TAG, sa_softc::partition, cam_periph::path, sa_softc::periph, sa_softc::quirks, RBL_GRAN, sa_softc::rep_blkno, sa_softc::rep_fileno, SA_FLAG_COMP_ENABLED, SA_FLAG_COMP_SUPP, SA_FLAG_COMP_UNSUPP, SA_FLAG_COMPRESSION, SA_FLAG_ERR_PENDING, SA_FLAG_FIXED, SA_FLAG_TAPE_MOUNTED, SA_FLAG_TAPE_WP, SA_FLAG_TAPE_WRITTEN, SA_PARAM_ALL, SA_PARAM_BLOCKSIZE, SA_PARAM_BUFF_MODE, SA_PARAM_DENSITY, SA_QUIRK_1FM, SA_QUIRK_2FM, SA_QUIRK_FIXED, SA_QUIRK_NO_MODESEL, SA_QUIRK_NODREAD, SA_QUIRK_VARIABLE, SA_TIMEOUT_LOAD, SA_TIMEOUT_READ, SA_TIMEOUT_READ_BLOCK_LIMITS, SA_TIMEOUT_REWIND, SA_TIMEOUT_TUR, saerror(), sagetparams(), sareservereleaseunit(), sasetparams(), sa_softc::saved_comp_algorithm, scsi_2btoul(), scsi_3btoul(), SCSI_DEFAULT_DENSITY, SCSI_DENSITY_HALFINCH_1600, SCSI_DENSITY_HALFINCH_6250, SCSI_DENSITY_HALFINCH_6250C, SCSI_DENSITY_HALFINCH_800, SCSI_DENSITY_HALFINCH_PE, SCSI_DENSITY_QIC_11_4TRK, SCSI_DENSITY_QIC_11_9TRK, SCSI_DENSITY_QIC_120, SCSI_DENSITY_QIC_1320, SCSI_DENSITY_QIC_150, SCSI_DENSITY_QIC_24, SCSI_DENSITY_QIC_2GB, SCSI_DENSITY_QIC_3080, SCSI_DENSITY_QIC_4GB, SCSI_DENSITY_QIC_525_320, scsi_load_unload(), scsi_read_block_limits(), sa_softc::scsi_rev, SCSI_REV_SPC, scsi_rewind(), scsi_sa_read_write(), scsi_test_unit_ready(), SF_NO_PRINT, SF_RETRY_UA, SMH_SA_BUF_MODE_NOBUF, SMH_SA_BUF_MODE_SIBUF, cam_periph::softc, sa_softc::speed, SSD_FULL_SIZE, sa_softc::timeout_info, UNUSED_PARAMETER, xpt_print(), and xpt_release_ccb().

Referenced by saopen(), and sastrategy().

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

◆ saoninvalidate()

static void saoninvalidate ( struct cam_periph periph)
static

◆ saopen()

◆ saparamget()

static int saparamget ( struct sa_softc softc,
struct sbuf *  sb 
)
static

Definition at line 4891 of file scsi_sa.c.

References sa_softc::eot_warn, safillprot(), SASBADDINTDESC, SASBADDNODE, SASBENDNODE, and sa_softc::sili.

Referenced by saioctl().

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

◆ saparamsetlist()

static int saparamsetlist ( struct cam_periph periph,
struct mtsetlist *  list,
int  need_copy 
)
static

Definition at line 1402 of file scsi_sa.c.

References cam_periph_lock, cam_periph_unlock, sa_param_ent::param_type, cam_periph::path, SA_PARAM_TYPE_NODE, safindparament(), sa_param_ent::set_func, and xpt_print().

Referenced by saioctl().

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

◆ sapopulateprots()

static void sapopulateprots ( struct sa_prot_state cur_state,
struct sa_prot_map new_table,
int  table_ents 
)
static

Definition at line 1203 of file scsi_sa.c.

References SA_NUM_PROT_ENTS, and sa_prot_table.

Referenced by sasetprotents().

Here is the caller graph for this function:

◆ saprevent()

static void saprevent ( struct cam_periph periph,
int  action 
)
static

◆ sardpos()

◆ saregister()

static cam_status saregister ( struct cam_periph periph,
void *  arg 
)
static

Definition at line 2461 of file scsi_sa.c.

References AC_LOST_DEVICE, sa_softc::allow_io_split, sa_softc::bio_queue, sa_softc::blkno, sa_softc::bop, sa_softc::bpew, ccb_dev_advinfo::buf, ccb_dev_advinfo::bufsiz, ccb_dev_advinfo::buftype, CAM_DEV_QFRZN, cam_periph_acquire(), cam_periph_lock, cam_periph_unlock, CAM_PRIORITY_DEV, CAM_PRIORITY_NORMAL, cam_quirkmatch(), cam_release_devq(), CAM_REQ_CMP, CAM_REQ_CMP_ERR, ccb_dev_advinfo::ccb_h, CDAI_FLAG_NONE, CDAI_TYPE_EXT_INQ, sa_softc::cpi_maxio, sa_devs::ctl_dev, sa_softc::density_type_bits, sa_softc::device_stats, sa_softc::devs, sa_softc::eop, sa_devs::er_dev, sa_softc::fileno, ccb_dev_advinfo::flags, sa_softc::flags, scsi_vpd_extended_inquiry_data::flags1, ccb_hdr::func_code, ccb_pathinq::hba_misc, ccb_getdev::inq_data, sa_softc::last_media_blksize, ccb_pathinq::maxio, sa_softc::maxio, sa_devs::nr_dev, sa_softc::partition, ccb_hdr::path, cam_periph::path, sa_softc::periph, cam_periph::periph_name, PIM_UNMAPPED, sa_softc::quirks, sa_devs::r_dev, sa_softc::rep_blkno, sa_softc::rep_fileno, sa_allow_io_split, SA_ATYPE_ER, SA_ATYPE_NR, SA_ATYPE_R, sa_cdevsw, SA_CTLDEV, sa_default_timeouts, SA_FLAG_PROTECT_SUPP, SA_FLAG_RSOC_TO_TRY, SA_NOT_CTLDEV, SA_QUIRK_BIT_STRING, SA_QUIRK_NO_LONG_POS, SA_QUIRK_NONE, sa_quirk_table, SA_STATE_NORMAL, SA_STATE_PROBE, SA_TIMEOUT_TYPE_MAX, saasync(), saloadtotunables(), SAMINOR, sasetupdev(), sasysctlinit(), scsi_inquiry_match(), sa_softc::scsi_rev, SCSI_REV_CCS, SCSI_REV_SPC4, sa_softc::si_flags, SID_ANSI_REV, SID_TYPE, cam_periph::softc, scsi_inquiry_data::spc3_flags, SPC3_SID_PROTECT, SRDS_MEDIA, SRDS_MEDIUM_TYPE, sa_softc::state, ccb_hdr::status, SVPD_EID_SA_SPT_LBP, sa_softc::sysctl_task, sa_softc::timeout_info, ccb_pathinq::transport, cam_periph::unit_number, sa_timeout_desc::value, scsi_inquiry_data::version, XPORT_DEVSTAT_TYPE, xpt_action(), xpt_announce_periph(), xpt_announce_quirks(), XPT_DEV_ADVINFO, xpt_path_inq(), xpt_print(), xpt_register_async(), xpt_schedule(), and xpt_setup_ccb().

Here is the call graph for this function:

◆ sareservereleaseunit()

static int sareservereleaseunit ( struct cam_periph periph,
int  reserve 
)
static

◆ saretension()

static int saretension ( struct cam_periph periph)
static

◆ sarewind()

static int sarewind ( struct cam_periph periph)
static

◆ saseteotwarn()

static int saseteotwarn ( struct cam_periph periph,
struct mtparamset *  ps,
int  num_params 
)
static

Definition at line 1137 of file scsi_sa.c.

References sa_softc::eot_warn, sa_softc::periph, and cam_periph::softc.

◆ sasetparams()

static int sasetparams ( struct cam_periph periph,
sa_params  params_to_set,
u_int32_t  blocksize,
u_int8_t  density,
u_int32_t  comp_algorithm,
u_int32_t  sense_flags 
)
static

◆ sasetpos()

static int sasetpos ( struct cam_periph periph,
int  hard,
struct mtlocate *  locate_info 
)
static

◆ sasetprot()

◆ sasetprotents()

static int sasetprotents ( struct cam_periph periph,
struct mtparamset *  ps,
int  num_params 
)
static

◆ sasetsili()

static int sasetsili ( struct cam_periph periph,
struct mtparamset *  ps,
int  num_params 
)
static

Definition at line 1076 of file scsi_sa.c.

References sa_softc::flags, sa_softc::periph, SA_FLAG_FIXED, SA_PARAM_BLOCKSIZE, sasetparams(), SF_QUIET_IR, sa_softc::sili, and cam_periph::softc.

Here is the call graph for this function:

◆ sasetupdev()

static void sasetupdev ( struct sa_softc softc,
struct cdev *  dev 
)
static

Definition at line 2338 of file scsi_sa.c.

References sa_softc::maxio, sa_softc::num_devs_to_destroy, and sa_softc::si_flags.

Referenced by saregister().

Here is the caller graph for this function:

◆ saspace()

◆ sastart()

◆ sastrategy()

◆ sasysctlinit()

◆ sawritefilemarks()

static int sawritefilemarks ( struct cam_periph periph,
int  nmarks,
int  setmarks,
int  immed 
)
static

◆ scsi_allow_overwrite()

void scsi_allow_overwrite ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  allow_overwrite,
int  partition,
u_int64_t  logical_id,
u_int32_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_erase()

void scsi_erase ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  immediate,
int  long_erase,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6094 of file scsi_sa.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, ERASE, scsi_erase::lun_imm_long, scsi_erase::opcode, SE_IMMED, and SE_LONG.

Referenced by saerase().

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

◆ scsi_format_medium()

void scsi_format_medium ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  byte1,
int  byte2,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int32_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_load_unload()

void scsi_load_unload ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  immediate,
int  eot,
int  reten,
int  load,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 5980 of file scsi_sa.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_load_unload::eot_reten_load, scsi_load_unload::immediate, LOAD_UNLOAD, scsi_load_unload::opcode, SLU_EOT, SLU_IMMED, SLU_LOAD, and SLU_RETEN.

Referenced by saloadunload(), samount(), and saretension().

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

◆ scsi_locate_10()

void scsi_locate_10 ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  immed,
int  cp,
int  hard,
int64_t  partition,
u_int32_t  block_address,
int  sense_len,
u_int32_t  timeout 
)

Definition at line 6196 of file scsi_sa.c.

References scsi_tape_locate::blkaddr, scsi_tape_locate::byte1, CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, LOCATE, scsi_tape_locate::opcode, scsi_tape_locate::partition, SA_SPOS_BT, SA_SPOS_CP, SA_SPOS_IMMED, and scsi_ulto4b().

Referenced by sasetpos().

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

◆ scsi_locate_16()

void scsi_locate_16 ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  immed,
int  cp,
u_int8_t  dest_type,
int  bam,
int64_t  partition,
u_int64_t  logical_id,
int  sense_len,
u_int32_t  timeout 
)

◆ scsi_read_block_limits()

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

Definition at line 5934 of file scsi_sa.c.

References CAM_DIR_IN, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_read_block_limits::opcode, and READ_BLOCK_LIMITS.

Referenced by samount().

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

◆ scsi_read_position()

void scsi_read_position ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  hardsoft,
struct scsi_tape_position_data sbp,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6120 of file scsi_sa.c.

References scsi_tape_read_position::byte1, CAM_DIR_IN, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_tape_read_position::opcode, and READ_POSITION.

Referenced by sardpos().

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

◆ scsi_read_position_10()

void scsi_read_position_10 ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  service_action,
u_int8_t *  data_ptr,
u_int32_t  length,
u_int32_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6140 of file scsi_sa.c.

References scsi_tape_read_position::byte1, CAM_DIR_IN, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_tape_read_position::length, scsi_tape_read_position::opcode, READ_POSITION, SA_RPOS_EXTENDED_FORM, and scsi_ulto2b().

Referenced by sagetpos().

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

◆ scsi_report_density_support()

void scsi_report_density_support ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  media,
int  medium_type,
u_int8_t *  data_ptr,
u_int32_t  length,
u_int32_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6263 of file scsi_sa.c.

References scsi_report_density_support::byte1, CAM_DIR_IN, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_report_density_support::length, scsi_report_density_support::opcode, REPORT_DENSITY_SUPPORT, scsi_ulto2b(), SRDS_MEDIA, and SRDS_MEDIUM_TYPE.

Referenced by sagetparams().

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

◆ scsi_reserve_release_unit()

void scsi_reserve_release_unit ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  third_party,
int  third_party_id,
u_int8_t  sense_len,
u_int32_t  timeout,
int  reserve 
)

Definition at line 6067 of file scsi_sa.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_reserve_release_unit::lun_thirdparty, scsi_reserve_release_unit::opcode, RELEASE_UNIT, RESERVE_UNIT, SRRU_3RD_MASK, SRRU_3RD_PARTY, and SRRU_3RD_SHAMT.

Referenced by sareservereleaseunit().

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

◆ scsi_rewind()

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

Definition at line 6005 of file scsi_sa.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_rewind::immediate, scsi_rewind::opcode, REWIND, and SREW_IMMED.

Referenced by samount(), and sarewind().

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

◆ scsi_sa_read_write()

void scsi_sa_read_write ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  readop,
int  sli,
int  fixed,
u_int32_t  length,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 5952 of file scsi_sa.c.

References CAM_DATA_BIO, CAM_DIR_IN, CAM_DIR_OUT, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_sa_rw::control, scsi_sa_rw::length, scsi_sa_rw::opcode, SA_READ, SA_WRITE, SAR_SLI, SARW_FIXED, SCSI_RW_BIO, SCSI_RW_DIRMASK, SCSI_RW_READ, scsi_ulto3b(), and scsi_sa_rw::sli_fixed.

Referenced by samount(), and sastart().

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

◆ scsi_set_capacity()

void scsi_set_capacity ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  byte1,
u_int32_t  proportion,
u_int32_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_set_position()

void scsi_set_position ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  hardsoft,
u_int32_t  blkno,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_space()

void scsi_space ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
scsi_space_code  code,
u_int32_t  count,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6023 of file scsi_sa.c.

References CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_space::code, scsi_space::control, scsi_space::count, scsi_space::opcode, scsi_ulto3b(), and SPACE.

Referenced by saspace().

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

◆ scsi_write_filemarks()

void scsi_write_filemarks ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
int  immediate,
int  setmark,
u_int32_t  num_marks,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 6041 of file scsi_sa.c.

References scsi_write_filemarks::byte2, CAM_DIR_NONE, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_write_filemarks::num_marks, scsi_write_filemarks::opcode, scsi_ulto3b(), SWFMRK_IMMED, SWFMRK_WSMK, and WRITE_FILEMARKS.

Referenced by sawritefilemarks().

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

◆ SYSCTL_INT()

SYSCTL_INT ( _kern_cam_sa  ,
OID_AUTO  ,
allow_io_split  ,
CTLFLAG_RDTUN  ,
sa_allow_io_split,
,
"Default I/O split value"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _kern_cam  ,
OID_AUTO  ,
sa  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"CAM Sequential Access Tape Driver"   
)
static

Variable Documentation

◆ sa_allow_io_split

int sa_allow_io_split = SA_DEFAULT_IO_SPLIT
static

Definition at line 675 of file scsi_sa.c.

Referenced by saregister().

◆ sa_cdevsw

struct cdevsw sa_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_open = saopen,
.d_close = saclose,
.d_read = physread,
.d_write = physwrite,
.d_ioctl = saioctl,
.d_strategy = sastrategy,
.d_name = "sa",
.d_flags = D_TAPE | D_TRACKCLOSE,
}
static d_strategy_t sastrategy
Definition: scsi_sa.c:592
#define D_TAPE
Definition: scsi_sa.c:698
static d_ioctl_t saioctl
Definition: scsi_sa.c:593
static d_close_t saclose
Definition: scsi_sa.c:591
static d_open_t saopen
Definition: scsi_sa.c:590

Definition at line 701 of file scsi_sa.c.

Referenced by saregister().

◆ sa_default_timeouts

struct sa_timeout_desc sa_default_timeouts[SA_TIMEOUT_TYPE_MAX]
static
Initial value:
= {
{"erase", ERASE_TIMEOUT},
{"load", REWIND_TIMEOUT},
{"locate", SPACE_TIMEOUT},
{"mode_select", SCSIOP_TIMEOUT},
{"mode_sense", SCSIOP_TIMEOUT},
{"prevent", SCSIOP_TIMEOUT},
{"read", IO_TIMEOUT},
{"read_block_limits", SCSIOP_TIMEOUT},
{"read_position", SCSIOP_TIMEOUT},
{"report_density", REP_DENSITY_TIMEOUT},
{"reserve", SCSIOP_TIMEOUT},
{"rewind", REWIND_TIMEOUT},
{"space", SPACE_TIMEOUT},
{"tur", SCSIOP_TIMEOUT},
{"write", IO_TIMEOUT},
{"write_filemarks", IO_TIMEOUT},
}
#define REP_DENSITY_TIMEOUT
Definition: scsi_sa.c:97
#define REWIND_TIMEOUT
Definition: scsi_sa.c:94
#define SCSIOP_TIMEOUT
Definition: scsi_sa.c:91
#define ERASE_TIMEOUT
Definition: scsi_sa.c:95
#define IO_TIMEOUT
Definition: scsi_sa.c:93
#define SPACE_TIMEOUT
Definition: scsi_sa.c:96

Referenced by saloadtotunables(), saregister(), and sasysctlinit().

◆ sa_param_table

struct sa_param_ent sa_param_table[]
Initial value:
= {
{"protection.", SA_PARAM_TYPE_NODE, sasetprotents }
}
static int sasetprotents(struct cam_periph *periph, struct mtparamset *ps, int num_params)
Definition: scsi_sa.c:1244
static int sasetsili(struct cam_periph *periph, struct mtparamset *ps, int num_params)
Definition: scsi_sa.c:1076
static int saseteotwarn(struct cam_periph *periph, struct mtparamset *ps, int num_params)
Definition: scsi_sa.c:1137
@ SA_PARAM_TYPE_ENTRY
Definition: scsi_sa.c:1357
@ SA_PARAM_TYPE_NODE
Definition: scsi_sa.c:1358

Referenced by safindparament().

◆ sa_prot_table

struct sa_prot_map sa_prot_table[]
Initial value:
= {
{ "prot_method", MT_PARAM_SET_UNSIGNED,
__offsetof(struct sa_prot_state, prot_method),
0, 255, NULL },
{ "pi_length", MT_PARAM_SET_UNSIGNED,
__offsetof(struct sa_prot_state, pi_length),
{ "lbp_w", MT_PARAM_SET_UNSIGNED,
__offsetof(struct sa_prot_state, lbp_w),
0, 1, NULL },
{ "lbp_r", MT_PARAM_SET_UNSIGNED,
__offsetof(struct sa_prot_state, lbp_r),
0, 1, NULL },
{ "rbdp", MT_PARAM_SET_UNSIGNED,
__offsetof(struct sa_prot_state, rbdp),
0, 1, NULL }
}
#define SA_CTRL_DP_PI_LENGTH_MASK
Definition: scsi_sa.h:295

Referenced by sapopulateprots().

◆ sa_quirk_table

struct sa_quirk_entry sa_quirk_table[]
static

Definition at line 486 of file scsi_sa.c.

Referenced by saregister().

◆ sacleanup

periph_dtor_t sacleanup
static

Definition at line 597 of file scsi_sa.c.

Referenced by saasync().

◆ saclose

d_close_t saclose
static

Definition at line 591 of file scsi_sa.c.

◆ sadriver

struct periph_driver sadriver
static
Initial value:
=
{
sainit, "sa",
TAILQ_HEAD_INITIALIZER(sadriver.units), 0
}
static periph_init_t sainit
Definition: scsi_sa.c:594
static struct periph_driver sadriver
Definition: scsi_sa.c:688

Definition at line 688 of file scsi_sa.c.

◆ sainit

static void sainit ( void  )
static

Definition at line 594 of file scsi_sa.c.

◆ saioctl

d_ioctl_t saioctl
static

Definition at line 593 of file scsi_sa.c.

◆ saoninvalidate

periph_oninv_t saoninvalidate
static

Definition at line 596 of file scsi_sa.c.

Referenced by saasync().

◆ saopen

d_open_t saopen
static

Definition at line 590 of file scsi_sa.c.

◆ saregister

periph_ctor_t saregister
static

Definition at line 595 of file scsi_sa.c.

Referenced by saasync().

◆ sastart

periph_start_t sastart
static

Definition at line 598 of file scsi_sa.c.

Referenced by saasync().

◆ sastrategy

d_strategy_t sastrategy
static

Definition at line 592 of file scsi_sa.c.