FreeBSD kernel CAM code
scsi_targ_bh.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/bio.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
#include <sys/malloc.h>
#include <sys/uio.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_periph.h>
#include <cam/cam_queue.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_debug.h>
#include <cam/cam_sim.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
Include dependency graph for scsi_targ_bh.c:

Go to the source code of this file.

Data Structures

struct  targbh_softc
 
struct  targbh_cmd_desc
 

Macros

#define MAX_ACCEPT   8
 
#define MAX_IMMEDIATE   16
 
#define MAX_BUF_SIZE   256 /* Max inquiry/sense/mode page transfer */
 
#define ccb_type   ppriv_field0
 
#define ccb_descr   ppriv_ptr1
 
#define ccb_atio   ppriv_ptr1
 

Enumerations

enum  targbh_state { TARGBH_STATE_NORMAL , TARGBH_STATE_EXCEPTION , TARGBH_STATE_TEARDOWN }
 
enum  targbh_flags { TARGBH_FLAG_NONE = 0x00 , TARGBH_FLAG_LUN_ENABLED = 0x01 }
 
enum  targbh_ccb_types { TARGBH_CCB_WORKQ }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static MALLOC_DEFINE (M_SCSIBH, "SCSI bh", "SCSI blackhole buffers")
 
 TAILQ_HEAD (ccb_queue, ccb_hdr)
 
static void targbhasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
 
static cam_status targbhenlun (struct cam_periph *periph)
 
static cam_status targbhdislun (struct cam_periph *periph)
 
static void targbhdone (struct cam_periph *periph, union ccb *done_ccb)
 
static struct targbh_cmd_desctargbhallocdescr (void)
 
static void targbhfreedescr (struct targbh_cmd_desc *buf)
 
 PERIPHDRIVER_DECLARE (targbh, targbhdriver)
 
static cam_status targbhctor (struct cam_periph *periph, void *arg)
 
static void targbhdtor (struct cam_periph *periph)
 
static void targbhstart (struct cam_periph *periph, union ccb *start_ccb)
 

Variables

static struct scsi_inquiry_data no_lun_inq_data
 
static struct scsi_sense_data_fixed no_lun_sense_data
 
static const int request_sense_size = offsetof(struct scsi_sense_data_fixed, fru)
 
static periph_init_t targbhinit
 
static periph_ctor_t targbhctor
 
static periph_dtor_t targbhdtor
 
static periph_start_t targbhstart
 
static struct periph_driver targbhdriver
 

Macro Definition Documentation

◆ ccb_atio

#define ccb_atio   ppriv_ptr1

Definition at line 82 of file scsi_targ_bh.c.

◆ ccb_descr

#define ccb_descr   ppriv_ptr1

Definition at line 79 of file scsi_targ_bh.c.

◆ ccb_type

#define ccb_type   ppriv_field0

Definition at line 78 of file scsi_targ_bh.c.

◆ MAX_ACCEPT

#define MAX_ACCEPT   8

Definition at line 73 of file scsi_targ_bh.c.

◆ MAX_BUF_SIZE

#define MAX_BUF_SIZE   256 /* Max inquiry/sense/mode page transfer */

Definition at line 75 of file scsi_targ_bh.c.

◆ MAX_IMMEDIATE

#define MAX_IMMEDIATE   16

Definition at line 74 of file scsi_targ_bh.c.

Enumeration Type Documentation

◆ targbh_ccb_types

Enumerator
TARGBH_CCB_WORKQ 

Definition at line 69 of file scsi_targ_bh.c.

◆ targbh_flags

Enumerator
TARGBH_FLAG_NONE 
TARGBH_FLAG_LUN_ENABLED 

Definition at line 64 of file scsi_targ_bh.c.

◆ targbh_state

Enumerator
TARGBH_STATE_NORMAL 
TARGBH_STATE_EXCEPTION 
TARGBH_STATE_TEARDOWN 

Definition at line 58 of file scsi_targ_bh.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_SCSIBH  ,
"SCSI bh"  ,
"SCSI blackhole buffers"   
)
static

◆ PERIPHDRIVER_DECLARE()

PERIPHDRIVER_DECLARE ( targbh  ,
targbhdriver   
)

◆ TAILQ_HEAD()

TAILQ_HEAD ( ccb_queue  ,
ccb_hdr   
)

◆ targbhallocdescr()

static struct targbh_cmd_desc * targbhallocdescr ( void  )
static

Definition at line 741 of file scsi_targ_bh.c.

References targbh_cmd_desc::backing_store, MAX_BUF_SIZE, and targbh_cmd_desc::max_size.

Referenced by targbhenlun().

Here is the caller graph for this function:

◆ targbhasync()

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

◆ targbhctor()

◆ targbhdislun()

◆ targbhdone()

◆ targbhdtor()

static void targbhdtor ( struct cam_periph periph)
static

Definition at line 421 of file scsi_targ_bh.c.

References cam_periph_sleep, targbh_softc::init_level, cam_periph::softc, targbh_softc::state, TARGBH_STATE_TEARDOWN, and targbhdislun().

Here is the call graph for this function:

◆ targbhenlun()

◆ targbhfreedescr()

static void targbhfreedescr ( struct targbh_cmd_desc buf)
static

Definition at line 764 of file scsi_targ_bh.c.

References targbh_cmd_desc::backing_store.

Referenced by targbhdone().

Here is the caller graph for this function:

◆ targbhstart()

Variable Documentation

◆ no_lun_inq_data

struct scsi_inquiry_data no_lun_inq_data
static
Initial value:
=
{
2, 2
}
#define T_NODEVICE
Definition: scsi_all.h:2189
#define SID_QUAL_BAD_LU
Definition: scsi_all.h:2211

Definition at line 110 of file scsi_targ_bh.c.

Referenced by targbhdone().

◆ no_lun_sense_data

struct scsi_sense_data_fixed no_lun_sense_data
static
Initial value:
=
{
0,
{ 0, 0, 0, 0 },
offsetof(struct scsi_sense_data_fixed, fru)
- offsetof(struct scsi_sense_data_fixed, extra_len),
{ 0, 0, 0, 0 },
0x25, 0
}
#define SSD_KEY_NOT_READY
Definition: scsi_all.h:3278
#define SSD_ERRCODE_VALID
Definition: scsi_all.h:3272
#define SSD_CURRENT_ERROR
Definition: scsi_all.h:3270

Definition at line 116 of file scsi_targ_bh.c.

Referenced by targbhdone().

◆ request_sense_size

const int request_sense_size = offsetof(struct scsi_sense_data_fixed, fru)
static

Definition at line 129 of file scsi_targ_bh.c.

Referenced by targbhdone().

◆ targbhctor

periph_ctor_t targbhctor
static

Definition at line 136 of file scsi_targ_bh.c.

Referenced by targbhasync().

◆ targbhdriver

struct periph_driver targbhdriver
static
Initial value:
=
{
targbhinit, "targbh",
TAILQ_HEAD_INITIALIZER(targbhdriver.units), 0
}
static periph_init_t targbhinit
Definition: scsi_targ_bh.c:131
static struct periph_driver targbhdriver
Definition: scsi_targ_bh.c:148

Definition at line 148 of file scsi_targ_bh.c.

◆ targbhdtor

periph_dtor_t targbhdtor
static

Definition at line 137 of file scsi_targ_bh.c.

Referenced by targbhasync().

◆ targbhinit

static void targbhinit ( void  )
static

Definition at line 131 of file scsi_targ_bh.c.

◆ targbhstart

periph_start_t targbhstart
static

Definition at line 138 of file scsi_targ_bh.c.

Referenced by targbhasync().