FreeBSD kernel CAM code
scsi_cd.c File Reference
#include <sys/cdefs.h>
#include "opt_cd.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bio.h>
#include <sys/conf.h>
#include <sys/disk.h>
#include <sys/malloc.h>
#include <sys/cdio.h>
#include <sys/cdrio.h>
#include <sys/dvdio.h>
#include <sys/devicestat.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/taskqueue.h>
#include <geom/geom_disk.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_periph.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_queue.h>
#include <cam/cam_sim.h>
#include <cam/scsi/scsi_message.h>
#include <cam/scsi/scsi_da.h>
#include <cam/scsi/scsi_cd.h>
Include dependency graph for scsi_cd.c:

Go to the source code of this file.

Data Structures

struct  cd_params
 
struct  cd_tocdata
 
struct  cd_toc_single
 
struct  cd_softc
 
struct  cd_page_sizes
 
struct  cd_quirk_entry
 

Macros

#define LEADOUT   0xaa /* leadout toc entry */
 
#define CD_Q_BIT_STRING
 
#define ccb_state   ppriv_field0
 
#define ccb_bp   ppriv_ptr1
 
#define CD_ANNOUNCETMP_SZ   120
 
#define CD_ANNOUNCE_SZ   400
 
#define CD_DEFAULT_POLL_PERIOD   3
 
#define CD_DEFAULT_RETRY   4
 
#define CD_DEFAULT_TIMEOUT   30000
 

Enumerations

enum  cd_quirks {
  CD_Q_NONE = 0x00 , CD_Q_NO_TOUCH = 0x01 , CD_Q_BCD_TRACKS = 0x02 , CD_Q_10_BYTE_ONLY = 0x10 ,
  CD_Q_RETRY_BUSY = 0x40
}
 
enum  cd_flags {
  CD_FLAG_INVALID = 0x0001 , CD_FLAG_NEW_DISC = 0x0002 , CD_FLAG_DISC_LOCKED = 0x0004 , CD_FLAG_DISC_REMOVABLE = 0x0008 ,
  CD_FLAG_SAW_MEDIA = 0x0010 , CD_FLAG_ACTIVE = 0x0080 , CD_FLAG_SCHED_ON_COMP = 0x0100 , CD_FLAG_RETRY_UA = 0x0200 ,
  CD_FLAG_VALID_MEDIA = 0x0400 , CD_FLAG_VALID_TOC = 0x0800 , CD_FLAG_SCTX_INIT = 0x1000 , CD_FLAG_MEDIA_WAIT = 0x2000 ,
  CD_FLAG_MEDIA_SCAN_ACT = 0x4000
}
 
enum  cd_ccb_state {
  CD_CCB_PROBE = 0x01 , CD_CCB_BUFFER_IO = 0x02 , CD_CCB_TUR = 0x03 , CD_CCB_MEDIA_PREVENT = 0x04 ,
  CD_CCB_MEDIA_ALLOW = 0x05 , CD_CCB_MEDIA_SIZE = 0x06 , CD_CCB_MEDIA_TOC_HDR = 0x07 , CD_CCB_MEDIA_TOC_FULL = 0x08 ,
  CD_CCB_MEDIA_TOC_LEAD = 0x09 , CD_CCB_TYPE_MASK = 0x0F , CD_CCB_RETRY_UA = 0x10
}
 
enum  cd_state {
  CD_STATE_PROBE , CD_STATE_NORMAL , CD_STATE_MEDIA_PREVENT , CD_STATE_MEDIA_ALLOW ,
  CD_STATE_MEDIA_SIZE , CD_STATE_MEDIA_TOC_HDR , CD_STATE_MEDIA_TOC_FULL , CD_STATE_MEDIA_TOC_LEAD
}
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void cdasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
 
static int cdcmdsizesysctl (SYSCTL_HANDLER_ARGS)
 
static int cdrunccb (union ccb *ccb, int(*error_routine)(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags), u_int32_t cam_flags, u_int32_t sense_flags)
 
static void cddone (struct cam_periph *periph, union ccb *start_ccb)
 
static union cd_pagescdgetpage (struct cd_mode_params *mode_params)
 
static int cdgetpagesize (int page_num)
 
static void cdprevent (struct cam_periph *periph, int action)
 
static void cdmediaprobedone (struct cam_periph *periph)
 
static int cdcheckmedia (struct cam_periph *periph, int do_wait)
 
static int cd6byteworkaround (union ccb *ccb)
 
static int cderror (union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
 
static int cdreadtoc (struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags)
 
static int cdgetmode (struct cam_periph *periph, struct cd_mode_params *data, u_int32_t page)
 
static int cdsetmode (struct cam_periph *periph, struct cd_mode_params *data)
 
static int cdplay (struct cam_periph *periph, u_int32_t blk, u_int32_t len)
 
static int cdreadsubchannel (struct cam_periph *periph, u_int32_t mode, u_int32_t format, int track, struct cd_sub_channel_info *data, u_int32_t len)
 
static int cdplaymsf (struct cam_periph *periph, u_int32_t startm, u_int32_t starts, u_int32_t startf, u_int32_t endm, u_int32_t ends, u_int32_t endf)
 
static int cdplaytracks (struct cam_periph *periph, u_int32_t strack, u_int32_t sindex, u_int32_t etrack, u_int32_t eindex)
 
static int cdpause (struct cam_periph *periph, u_int32_t go)
 
static int cdstopunit (struct cam_periph *periph, u_int32_t eject)
 
static int cdstartunit (struct cam_periph *periph, int load)
 
static int cdsetspeed (struct cam_periph *periph, u_int32_t rdspeed, u_int32_t wrspeed)
 
static int cdreportkey (struct cam_periph *periph, struct dvd_authinfo *authinfo)
 
static int cdsendkey (struct cam_periph *periph, struct dvd_authinfo *authinfo)
 
static int cdreaddvdstructure (struct cam_periph *periph, struct dvd_struct *dvdstruct)
 
 PERIPHDRIVER_DECLARE (cd, cddriver)
 
static SYSCTL_NODE (_kern_cam, OID_AUTO, cd, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM CDROM driver")
 
 SYSCTL_INT (_kern_cam_cd, OID_AUTO, poll_period, CTLFLAG_RWTUN, &cd_poll_period, 0, "Media polling period in seconds")
 
 SYSCTL_INT (_kern_cam_cd, OID_AUTO, retry_count, CTLFLAG_RWTUN, &cd_retry_count, 0, "Normal I/O retry count")
 
 SYSCTL_INT (_kern_cam_cd, OID_AUTO, timeout, CTLFLAG_RWTUN, &cd_timeout, 0, "Timeout, in us, for read operations")
 
static MALLOC_DEFINE (M_SCSICD, "scsi_cd", "scsi_cd buffers")
 
static void cddiskgonecb (struct disk *dp)
 
static void cdoninvalidate (struct cam_periph *periph)
 
static void cdcleanup (struct cam_periph *periph)
 
static void cdsysctlinit (void *context, int pending)
 
static cam_status cdregister (struct cam_periph *periph, void *arg)
 
static int cdopen (struct disk *dp)
 
static int cdclose (struct disk *dp)
 
static void cdstrategy (struct bio *bp)
 
static void cdstart (struct cam_periph *periph, union ccb *start_ccb)
 
static struct cd_toc_entry * te_data_get_ptr (void *irtep, u_long cmd)
 
static int cdioctl (struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
 
static void cdmediapoll (void *arg)
 
void scsi_report_key (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int32_t lba, u_int8_t agid, u_int8_t key_format, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_send_key (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int8_t agid, u_int8_t key_format, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_read_dvd_structure (struct ccb_scsiio *csio, u_int32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), u_int8_t tag_action, u_int32_t address, u_int8_t layer_number, u_int8_t format, u_int8_t agid, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout)
 
void scsi_read_toc (struct ccb_scsiio *csio, uint32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, uint8_t byte1_flags, uint8_t format, uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, int sense_len, int timeout)
 

Variables

static struct cd_page_sizes cd_page_size_table []
 
static struct cd_quirk_entry cd_quirk_table []
 
static disk_open_t cdopen
 
static disk_close_t cdclose
 
static disk_ioctl_t cdioctl
 
static disk_strategy_t cdstrategy
 
static periph_init_t cdinit
 
static periph_ctor_t cdregister
 
static periph_dtor_t cdcleanup
 
static periph_start_t cdstart
 
static periph_oninv_t cdoninvalidate
 
static callout_func_t cdmediapoll
 
static struct periph_driver cddriver
 
static int cd_poll_period = CD_DEFAULT_POLL_PERIOD
 
static int cd_retry_count = CD_DEFAULT_RETRY
 
static int cd_timeout = CD_DEFAULT_TIMEOUT
 

Macro Definition Documentation

◆ ccb_bp

#define ccb_bp   ppriv_ptr1

Definition at line 137 of file scsi_cd.c.

◆ ccb_state

#define ccb_state   ppriv_field0

Definition at line 136 of file scsi_cd.c.

◆ CD_ANNOUNCE_SZ

#define CD_ANNOUNCE_SZ   400

◆ CD_ANNOUNCETMP_SZ

#define CD_ANNOUNCETMP_SZ   120

◆ CD_DEFAULT_POLL_PERIOD

#define CD_DEFAULT_POLL_PERIOD   3

Definition at line 319 of file scsi_cd.c.

◆ CD_DEFAULT_RETRY

#define CD_DEFAULT_RETRY   4

Definition at line 322 of file scsi_cd.c.

◆ CD_DEFAULT_TIMEOUT

#define CD_DEFAULT_TIMEOUT   30000

Definition at line 325 of file scsi_cd.c.

◆ CD_Q_BIT_STRING

#define CD_Q_BIT_STRING
Value:
"\020" \
"\001NO_TOUCH" \
"\002BCD_TRACKS" \
"\00510_BYTE_ONLY" \
"\007RETRY_BUSY"

Definition at line 99 of file scsi_cd.c.

◆ LEADOUT

#define LEADOUT   0xaa /* leadout toc entry */

Definition at line 84 of file scsi_cd.c.

Enumeration Type Documentation

◆ cd_ccb_state

Enumerator
CD_CCB_PROBE 
CD_CCB_BUFFER_IO 
CD_CCB_TUR 
CD_CCB_MEDIA_PREVENT 
CD_CCB_MEDIA_ALLOW 
CD_CCB_MEDIA_SIZE 
CD_CCB_MEDIA_TOC_HDR 
CD_CCB_MEDIA_TOC_FULL 
CD_CCB_MEDIA_TOC_LEAD 
CD_CCB_TYPE_MASK 
CD_CCB_RETRY_UA 

Definition at line 122 of file scsi_cd.c.

◆ cd_flags

enum cd_flags
Enumerator
CD_FLAG_INVALID 
CD_FLAG_NEW_DISC 
CD_FLAG_DISC_LOCKED 
CD_FLAG_DISC_REMOVABLE 
CD_FLAG_SAW_MEDIA 
CD_FLAG_ACTIVE 
CD_FLAG_SCHED_ON_COMP 
CD_FLAG_RETRY_UA 
CD_FLAG_VALID_MEDIA 
CD_FLAG_VALID_TOC 
CD_FLAG_SCTX_INIT 
CD_FLAG_MEDIA_WAIT 
CD_FLAG_MEDIA_SCAN_ACT 

Definition at line 106 of file scsi_cd.c.

◆ cd_quirks

enum cd_quirks
Enumerator
CD_Q_NONE 
CD_Q_NO_TOUCH 
CD_Q_BCD_TRACKS 
CD_Q_10_BYTE_ONLY 
CD_Q_RETRY_BUSY 

Definition at line 91 of file scsi_cd.c.

◆ cd_state

enum cd_state
Enumerator
CD_STATE_PROBE 
CD_STATE_NORMAL 
CD_STATE_MEDIA_PREVENT 
CD_STATE_MEDIA_ALLOW 
CD_STATE_MEDIA_SIZE 
CD_STATE_MEDIA_TOC_HDR 
CD_STATE_MEDIA_TOC_FULL 
CD_STATE_MEDIA_TOC_LEAD 

Definition at line 153 of file scsi_cd.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ cd6byteworkaround()

◆ cdasync()

◆ cdcheckmedia()

static int cdcheckmedia ( struct cam_periph periph,
int  do_wait 
)
static

Definition at line 2691 of file scsi_cd.c.

References cam_periph_assert, cam_periph_mtx(), CAM_PRIORITY_NORMAL, CD_FLAG_MEDIA_SCAN_ACT, CD_FLAG_MEDIA_WAIT, CD_FLAG_VALID_MEDIA, CD_STATE_MEDIA_PREVENT, cd_softc::flags, cam_periph::softc, cd_softc::state, and xpt_schedule().

Referenced by cdioctl(), cdopen(), and cdstrategy().

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

◆ cdcleanup()

static void cdcleanup ( struct cam_periph periph)
static

Definition at line 399 of file scsi_cd.c.

References cam_periph_lock, cam_periph_unlock, CD_FLAG_SCTX_INIT, cd_softc::flags, cam_periph::path, cam_periph::softc, and xpt_print().

Here is the call graph for this function:

◆ cdclose()

◆ cdcmdsizesysctl()

static int cdcmdsizesysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 562 of file scsi_cd.c.

Referenced by cdsysctlinit().

Here is the caller graph for this function:

◆ cddiskgonecb()

static void cddiskgonecb ( struct disk *  dp)
static

Definition at line 365 of file scsi_cd.c.

References cam_periph_release().

Referenced by cdregister().

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

◆ cddone()

static void cddone ( struct cam_periph periph,
union ccb start_ccb 
)
static

Definition at line 1150 of file scsi_cd.c.

References scsi_read_capacity_data::addr, cd_softc::bio_queue, cd_params::blksize, CAM_DEBUG, CAM_DEBUG_TRACE, CAM_DEV_QFRZN, cam_periph_assert, cam_periph_invalidate(), cam_periph_release_locked(), cam_periph_unhold(), CAM_PRIORITY_NORMAL, cam_release_devq(), CAM_REQ_CMP, CAM_RETRY_SELTO, CAM_SCSI_STATUS_ERROR, CAM_STATUS_MASK, ccb_getdev::ccb_h, ccb_scsiio::ccb_h, ccb::ccb_h, CD_ANNOUNCE_SZ, CD_ANNOUNCETMP_SZ, CD_CCB_BUFFER_IO, CD_CCB_MEDIA_ALLOW, CD_CCB_MEDIA_PREVENT, CD_CCB_MEDIA_SIZE, CD_CCB_MEDIA_TOC_FULL, CD_CCB_MEDIA_TOC_HDR, CD_CCB_MEDIA_TOC_LEAD, CD_CCB_PROBE, CD_CCB_RETRY_UA, CD_CCB_TUR, CD_CCB_TYPE_MASK, CD_FLAG_DISC_LOCKED, CD_FLAG_SAW_MEDIA, CD_FLAG_VALID_MEDIA, CD_FLAG_VALID_TOC, CD_Q_BCD_TRACKS, CD_Q_BIT_STRING, CD_STATE_MEDIA_ALLOW, CD_STATE_MEDIA_SIZE, CD_STATE_MEDIA_TOC_FULL, CD_STATE_MEDIA_TOC_HDR, CD_STATE_MEDIA_TOC_LEAD, CD_STATE_NORMAL, cderror(), cdmediaprobedone(), ccb::csio, ccb_scsiio::data_ptr, cd_params::disksize, ccb_scsiio::dxfer_len, cd_toc_single::entry, cd_softc::flags, ccb_hdr::func_code, ccb_getdev::inq_data, scsi_read_capacity_data::length, ccb_hdr::path, cam_periph::path, ccb_scsiio::resid, scsi_4btoul(), scsi_extract_sense_ccb(), scsi_sense_desc(), scsi_sense_print(), ccb_scsiio::scsi_status, SCSI_STATUS_BUSY, scsi_status_string(), SF_NO_PRINT, SF_NO_RECOVERY, SF_RETRY_UA, SID_TYPE, cam_periph::softc, SSD_CURRENT_ERROR, SSD_DESC_CURRENT_ERROR, cd_softc::state, ccb_hdr::status, T_CDROM, xpt_action(), xpt_announce_periph_sbuf(), xpt_announce_quirks_sbuf(), XPT_GDEV_TYPE, xpt_print(), xpt_release_ccb(), xpt_schedule(), and xpt_setup_ccb().

Referenced by cdstart().

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

◆ cderror()

◆ cdgetmode()

◆ cdgetpage()

static union cd_pages * cdgetpage ( struct cd_mode_params mode_params)
static

Definition at line 1705 of file scsi_cd.c.

References cd_mode_params::cdb_size, find_mode_page_10(), find_mode_page_6(), and cd_mode_params::mode_buf.

Referenced by cdioctl().

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

◆ cdgetpagesize()

static int cdgetpagesize ( int  page_num)
static

Definition at line 1720 of file scsi_cd.c.

References cd_page_size_table.

Referenced by cd6byteworkaround().

Here is the caller graph for this function:

◆ cdioctl()

◆ cdmediapoll()

static void cdmediapoll ( void *  arg)
static

Definition at line 3126 of file scsi_cd.c.

References cam_periph_acquire(), CAM_PRIORITY_NORMAL, cd_poll_period, CD_STATE_NORMAL, cam_periph::softc, cd_softc::state, and xpt_schedule().

Here is the call graph for this function:

◆ cdmediaprobedone()

static void cdmediaprobedone ( struct cam_periph periph)
static

Definition at line 2670 of file scsi_cd.c.

References cam_periph_assert, CD_FLAG_MEDIA_SCAN_ACT, CD_FLAG_MEDIA_WAIT, cd_softc::flags, and cam_periph::softc.

Referenced by cddone().

Here is the caller graph for this function:

◆ cdoninvalidate()

static void cdoninvalidate ( struct cam_periph periph)
static

Definition at line 374 of file scsi_cd.c.

References cd_softc::bio_queue, cam_periph_assert, CD_FLAG_INVALID, cdasync(), cd_softc::flags, cam_periph::path, cam_periph::softc, and xpt_register_async().

Here is the call graph for this function:

◆ cdopen()

static int cdopen ( struct disk *  dp)
static

◆ cdpause()

static int cdpause ( struct cam_periph periph,
u_int32_t  go 
)
static

◆ cdplay()

static int cdplay ( struct cam_periph periph,
u_int32_t  blk,
u_int32_t  len 
)
static

◆ cdplaymsf()

static int cdplaymsf ( struct cam_periph periph,
u_int32_t  startm,
u_int32_t  starts,
u_int32_t  startf,
u_int32_t  endm,
u_int32_t  ends,
u_int32_t  endf 
)
static

◆ cdplaytracks()

static int cdplaytracks ( struct cam_periph periph,
u_int32_t  strack,
u_int32_t  sindex,
u_int32_t  etrack,
u_int32_t  eindex 
)
static

◆ cdprevent()

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

◆ cdreaddvdstructure()

◆ cdreadsubchannel()

static int cdreadsubchannel ( struct cam_periph periph,
u_int32_t  mode,
u_int32_t  format,
int  track,
struct cd_sub_channel_info *  data,
u_int32_t  len 
)
static

◆ cdreadtoc()

static int cdreadtoc ( struct cam_periph periph,
u_int32_t  mode,
u_int32_t  start,
u_int8_t *  data,
u_int32_t  len,
u_int32_t  sense_flags 
)
static

Definition at line 3150 of file scsi_cd.c.

References cam_periph_getccb(), CAM_PRIORITY_NORMAL, CAM_RETRY_SELTO, ccb, CD_MSF, cd_retry_count, cderror(), cdrunccb(), ccb::csio, MSG_SIMPLE_Q_TAG, scsi_read_toc(), SF_RETRY_UA, SRTOC_FORMAT_TOC, SSD_FULL_SIZE, and xpt_release_ccb().

Referenced by cdioctl().

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

◆ cdregister()

◆ cdreportkey()

◆ cdrunccb()

static int cdrunccb ( union ccb ccb,
int(*)(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)  error_routine,
u_int32_t  cam_flags,
u_int32_t  sense_flags 
)
static

Definition at line 842 of file scsi_cd.c.

References cam_periph_runccb(), ccb::ccb_h, ccb_hdr::path, cam_periph::softc, and xpt_path_periph().

Referenced by cdgetmode(), cdpause(), cdplay(), cdplaymsf(), cdplaytracks(), cdprevent(), cdreaddvdstructure(), cdreadsubchannel(), cdreadtoc(), cdreportkey(), cdsendkey(), cdsetmode(), cdsetspeed(), cdstartunit(), and cdstopunit().

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

◆ cdsendkey()

◆ cdsetmode()

◆ cdsetspeed()

static int cdsetspeed ( struct cam_periph periph,
u_int32_t  rdspeed,
u_int32_t  wrspeed 
)
static

◆ cdstart()

◆ cdstartunit()

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

Definition at line 3610 of file scsi_cd.c.

References cam_periph_getccb(), CAM_PRIORITY_NORMAL, CAM_RETRY_SELTO, ccb, cd_retry_count, cderror(), cdrunccb(), ccb::csio, MSG_SIMPLE_Q_TAG, scsi_start_stop(), SF_RETRY_UA, SSD_FULL_SIZE, and xpt_release_ccb().

Referenced by cdioctl().

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

◆ cdstopunit()

static int cdstopunit ( struct cam_periph periph,
u_int32_t  eject 
)
static

Definition at line 3638 of file scsi_cd.c.

References cam_periph_getccb(), CAM_PRIORITY_NORMAL, CAM_RETRY_SELTO, ccb, cd_retry_count, cderror(), cdrunccb(), ccb::csio, MSG_SIMPLE_Q_TAG, scsi_start_stop(), SF_RETRY_UA, SSD_FULL_SIZE, and xpt_release_ccb().

Referenced by cdioctl().

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

◆ cdstrategy()

static void cdstrategy ( struct bio *  bp)
static

◆ cdsysctlinit()

static void cdsysctlinit ( void *  context,
int  pending 
)
static

Definition at line 515 of file scsi_cd.c.

References cam_periph_acquire(), cam_periph_lock, cam_periph_release(), cam_periph_unlock, CD_FLAG_SCTX_INIT, cdcmdsizesysctl(), cd_softc::flags, cam_periph::softc, and cam_periph::unit_number.

Referenced by cdregister().

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

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_SCSICD  ,
"scsi_cd"  ,
"scsi_cd buffers"   
)
static

◆ PERIPHDRIVER_DECLARE()

PERIPHDRIVER_DECLARE ( cd  ,
cddriver   
)

◆ scsi_read_dvd_structure()

void scsi_read_dvd_structure ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int32_t  address,
u_int8_t  layer_number,
u_int8_t  format,
u_int8_t  agid,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_read_toc()

void scsi_read_toc ( struct ccb_scsiio csio,
uint32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
uint8_t  tag_action,
uint8_t  byte1_flags,
uint8_t  format,
uint8_t  track,
uint8_t *  data_ptr,
uint32_t  dxfer_len,
int  sense_len,
int  timeout 
)

Definition at line 4230 of file scsi_cd.c.

References scsi_read_toc::byte2, CAM_DIR_IN, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_read_toc::data_len, scsi_read_toc::format, scsi_read_toc::from_track, scsi_read_toc::op_code, READ_TOC, and scsi_ulto2b().

Referenced by cdreadtoc(), and cdstart().

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

◆ scsi_report_key()

void scsi_report_key ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int32_t  lba,
u_int8_t  agid,
u_int8_t  key_format,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int8_t  sense_len,
u_int32_t  timeout 
)

◆ scsi_send_key()

void scsi_send_key ( struct ccb_scsiio csio,
u_int32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
u_int8_t  tag_action,
u_int8_t  agid,
u_int8_t  key_format,
u_int8_t *  data_ptr,
u_int32_t  dxfer_len,
u_int8_t  sense_len,
u_int32_t  timeout 
)

Definition at line 4168 of file scsi_cd.c.

References scsi_send_key::agid_keyformat, CAM_DIR_OUT, cam_fill_csio(), cdb_t::cdb_bytes, ccb_scsiio::cdb_io, scsi_send_key::opcode, scsi_send_key::param_len, RK_KF_AGID_SHIFT, RK_KF_KEYFORMAT_MASK, scsi_ulto2b(), and SEND_KEY.

Referenced by cdsendkey().

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

◆ SYSCTL_INT() [1/3]

SYSCTL_INT ( _kern_cam_cd  ,
OID_AUTO  ,
poll_period  ,
CTLFLAG_RWTUN  ,
cd_poll_period,
,
"Media polling period in seconds"   
)

◆ SYSCTL_INT() [2/3]

SYSCTL_INT ( _kern_cam_cd  ,
OID_AUTO  ,
retry_count  ,
CTLFLAG_RWTUN  ,
cd_retry_count,
,
"Normal I/O retry count"   
)

◆ SYSCTL_INT() [3/3]

SYSCTL_INT ( _kern_cam_cd  ,
OID_AUTO  ,
timeout  ,
CTLFLAG_RWTUN  ,
cd_timeout,
,
Timeout,
in  us,
for read operations"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _kern_cam  ,
OID_AUTO  ,
cd  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"CAM CDROM driver"   
)
static

◆ te_data_get_ptr()

static struct cd_toc_entry * te_data_get_ptr ( void *  irtep,
u_long  cmd 
)
static

Definition at line 1733 of file scsi_cd.c.

Referenced by cdioctl().

Here is the caller graph for this function:

Variable Documentation

◆ cd_page_size_table

struct cd_page_sizes cd_page_size_table[]
static
Initial value:
=
{
{ AUDIO_PAGE, sizeof(struct cd_audio_page)}
}
#define AUDIO_PAGE
Definition: scsi_cd.h:767

Definition at line 197 of file scsi_cd.c.

Referenced by cdgetpagesize().

◆ cd_poll_period

int cd_poll_period = CD_DEFAULT_POLL_PERIOD
static

Definition at line 328 of file scsi_cd.c.

Referenced by cdmediapoll(), and cdregister().

◆ cd_quirk_table

struct cd_quirk_entry cd_quirk_table[]
static
Initial value:
=
{
{
{ T_CDROM, SIP_MEDIA_REMOVABLE, "CHINON", "CD-ROM CDS-535","*"},
},
{
{T_CDROM, SIP_MEDIA_REMOVABLE, "NECVMWar", "VMware IDE CDR10", "*"},
}
}
#define T_CDROM
Definition: scsi_all.h:2175
#define SIP_MEDIA_REMOVABLE
Definition: scsi_all.h:3706
@ CD_Q_BCD_TRACKS
Definition: scsi_cd.c:94
@ CD_Q_RETRY_BUSY
Definition: scsi_cd.c:96

Definition at line 218 of file scsi_cd.c.

Referenced by cdregister().

◆ cd_retry_count

◆ cd_timeout

int cd_timeout = CD_DEFAULT_TIMEOUT
static

Definition at line 330 of file scsi_cd.c.

Referenced by cdstart().

◆ cdcleanup

periph_dtor_t cdcleanup
static

Definition at line 252 of file scsi_cd.c.

Referenced by cdasync().

◆ cdclose

disk_close_t cdclose
static

Definition at line 246 of file scsi_cd.c.

Referenced by cdregister().

◆ cddriver

struct periph_driver cddriver
static
Initial value:
=
{
cdinit, "cd",
TAILQ_HEAD_INITIALIZER(cddriver.units), 0
}
static periph_init_t cdinit
Definition: scsi_cd.c:250
static struct periph_driver cddriver
Definition: scsi_cd.c:310

Definition at line 310 of file scsi_cd.c.

◆ cdinit

static void cdinit ( void  )
static

Definition at line 250 of file scsi_cd.c.

◆ cdioctl

disk_ioctl_t cdioctl
static

Definition at line 247 of file scsi_cd.c.

Referenced by cdregister().

◆ cdmediapoll

callout_func_t cdmediapoll
static

Definition at line 308 of file scsi_cd.c.

Referenced by cdregister().

◆ cdoninvalidate

periph_oninv_t cdoninvalidate
static

Definition at line 254 of file scsi_cd.c.

Referenced by cdasync().

◆ cdopen

disk_open_t cdopen
static

Definition at line 245 of file scsi_cd.c.

Referenced by cdregister().

◆ cdregister

periph_ctor_t cdregister
static

Definition at line 251 of file scsi_cd.c.

Referenced by cdasync().

◆ cdstart

periph_start_t cdstart
static

Definition at line 253 of file scsi_cd.c.

Referenced by cdasync().

◆ cdstrategy

disk_strategy_t cdstrategy
static

Definition at line 248 of file scsi_cd.c.

Referenced by cdregister().