FreeBSD kernel CAM code
ata_pmp.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bio.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
#include <sys/eventhandler.h>
#include <sys/malloc.h>
#include <sys/cons.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_xpt_internal.h>
#include <cam/cam_sim.h>
#include <cam/ata/ata_all.h>
Include dependency graph for ata_pmp.c:

Go to the source code of this file.

Data Structures

struct  pmp_softc
 

Macros

#define ccb_state   ppriv_field0
 
#define ccb_bp   ppriv_ptr1
 
#define PMP_EV_RESET   1
 
#define PMP_EV_RESCAN   2
 
#define PMP_DEFAULT_TIMEOUT   30 /* Timeout in seconds */
 
#define PMP_DEFAULT_RETRY   1
 
#define PMP_DEFAULT_HIDE_SPECIAL   1
 

Enumerations

enum  pmp_state {
  PMP_STATE_NORMAL , PMP_STATE_PORTS , PMP_STATE_PM_QUIRKS_1 , PMP_STATE_PM_QUIRKS_2 ,
  PMP_STATE_PM_QUIRKS_3 , PMP_STATE_PRECONFIG , PMP_STATE_RESET , PMP_STATE_CONNECT ,
  PMP_STATE_CHECK , PMP_STATE_CLEAR , PMP_STATE_CONFIG , PMP_STATE_SCAN
}
 
enum  pmp_flags { PMP_FLAG_SCTX_INIT = 0x200 }
 
enum  pmp_ccb_state { PMP_CCB_PROBE = 0x01 }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void pmpasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
 
static void pmpsysctlinit (void *context, int pending)
 
static void pmpdone (struct cam_periph *periph, union ccb *done_ccb)
 
static SYSCTL_NODE (_kern_cam, OID_AUTO, pmp, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver")
 
 SYSCTL_INT (_kern_cam_pmp, OID_AUTO, retry_count, CTLFLAG_RWTUN, &pmp_retry_count, 0, "Normal I/O retry count")
 
 SYSCTL_INT (_kern_cam_pmp, OID_AUTO, default_timeout, CTLFLAG_RWTUN, &pmp_default_timeout, 0, "Normal I/O timeout (in seconds)")
 
 SYSCTL_INT (_kern_cam_pmp, OID_AUTO, hide_special, CTLFLAG_RWTUN, &pmp_hide_special, 0, "Hide extra ports")
 
 PERIPHDRIVER_DECLARE (pmp, pmpdriver)
 
static void pmpfreeze (struct cam_periph *periph, int mask)
 
static void pmprelease (struct cam_periph *periph, int mask)
 
static void pmponinvalidate (struct cam_periph *periph)
 
static void pmpcleanup (struct cam_periph *periph)
 
static cam_status pmpregister (struct cam_periph *periph, void *arg)
 
static void pmpstart (struct cam_periph *periph, union ccb *start_ccb)
 

Variables

static periph_init_t pmpinit
 
static periph_ctor_t pmpregister
 
static periph_dtor_t pmpcleanup
 
static periph_start_t pmpstart
 
static periph_oninv_t pmponinvalidate
 
static int pmp_retry_count = PMP_DEFAULT_RETRY
 
static int pmp_default_timeout = PMP_DEFAULT_TIMEOUT
 
static int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL
 
static struct periph_driver pmpdriver
 

Macro Definition Documentation

◆ ccb_bp

#define ccb_bp   ppriv_ptr1

Definition at line 91 of file ata_pmp.c.

◆ ccb_state

#define ccb_state   ppriv_field0

Definition at line 90 of file ata_pmp.c.

◆ PMP_DEFAULT_HIDE_SPECIAL

#define PMP_DEFAULT_HIDE_SPECIAL   1

Definition at line 135 of file ata_pmp.c.

◆ PMP_DEFAULT_RETRY

#define PMP_DEFAULT_RETRY   1

Definition at line 131 of file ata_pmp.c.

◆ PMP_DEFAULT_TIMEOUT

#define PMP_DEFAULT_TIMEOUT   30 /* Timeout in seconds */

Definition at line 127 of file ata_pmp.c.

◆ PMP_EV_RESCAN

#define PMP_EV_RESCAN   2

◆ PMP_EV_RESET

#define PMP_EV_RESET   1

Enumeration Type Documentation

◆ pmp_ccb_state

Enumerator
PMP_CCB_PROBE 

Definition at line 85 of file ata_pmp.c.

◆ pmp_flags

enum pmp_flags
Enumerator
PMP_FLAG_SCTX_INIT 

Definition at line 81 of file ata_pmp.c.

◆ pmp_state

enum pmp_state
Enumerator
PMP_STATE_NORMAL 
PMP_STATE_PORTS 
PMP_STATE_PM_QUIRKS_1 
PMP_STATE_PM_QUIRKS_2 
PMP_STATE_PM_QUIRKS_3 
PMP_STATE_PRECONFIG 
PMP_STATE_RESET 
PMP_STATE_CONNECT 
PMP_STATE_CHECK 
PMP_STATE_CLEAR 
PMP_STATE_CONFIG 
PMP_STATE_SCAN 

Definition at line 66 of file ata_pmp.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ PERIPHDRIVER_DECLARE()

PERIPHDRIVER_DECLARE ( pmp  ,
pmpdriver   
)

◆ pmpasync()

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

◆ pmpcleanup()

static void pmpcleanup ( struct cam_periph periph)
static

Definition at line 244 of file ata_pmp.c.

References cam_periph_lock, cam_periph_unlock, cam_periph::path, PMP_FLAG_SCTX_INIT, cam_periph::softc, and xpt_print().

Here is the call graph for this function:

◆ pmpdone()

◆ pmpfreeze()

static void pmpfreeze ( struct cam_periph periph,
int  mask 
)
static

Definition at line 178 of file ata_pmp.c.

References cam_freeze_devq(), CAM_REQ_CMP, cam_periph::path, cam_periph::softc, xpt_acquire_device(), xpt_create_path(), xpt_free_path(), and xpt_path_path_id().

Referenced by pmpasync().

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

◆ pmponinvalidate()

static void pmponinvalidate ( struct cam_periph periph)
static

◆ pmpregister()

◆ pmprelease()

static void pmprelease ( struct cam_periph periph,
int  mask 
)
static

Definition at line 200 of file ata_pmp.c.

References cam_release_devq(), CAM_REQ_CMP, cam_periph::path, cam_periph::softc, xpt_create_path(), xpt_free_path(), xpt_path_path_id(), and xpt_release_device().

Referenced by pmpasync(), pmpdone(), and pmponinvalidate().

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

◆ pmpstart()

◆ pmpsysctlinit()

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

Definition at line 339 of file ata_pmp.c.

References cam_periph_acquire(), cam_periph_release(), PMP_FLAG_SCTX_INIT, cam_periph::softc, and cam_periph::unit_number.

Referenced by pmpregister().

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

◆ SYSCTL_INT() [1/3]

SYSCTL_INT ( _kern_cam_pmp  ,
OID_AUTO  ,
default_timeout  ,
CTLFLAG_RWTUN  ,
pmp_default_timeout,
,
"Normal I/O timeout (in seconds)"   
)

◆ SYSCTL_INT() [2/3]

SYSCTL_INT ( _kern_cam_pmp  ,
OID_AUTO  ,
hide_special  ,
CTLFLAG_RWTUN  ,
pmp_hide_special,
,
"Hide extra ports"   
)

◆ SYSCTL_INT() [3/3]

SYSCTL_INT ( _kern_cam_pmp  ,
OID_AUTO  ,
retry_count  ,
CTLFLAG_RWTUN  ,
pmp_retry_count,
,
"Normal I/O retry count"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _kern_cam  ,
OID_AUTO  ,
pmp  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"CAM Direct Access Disk driver"   
)
static

Variable Documentation

◆ pmp_default_timeout

int pmp_default_timeout = PMP_DEFAULT_TIMEOUT
static

Definition at line 139 of file ata_pmp.c.

Referenced by pmpstart().

◆ pmp_hide_special

int pmp_hide_special = PMP_DEFAULT_HIDE_SPECIAL
static

Definition at line 140 of file ata_pmp.c.

Referenced by pmpdone().

◆ pmp_retry_count

int pmp_retry_count = PMP_DEFAULT_RETRY
static

Definition at line 138 of file ata_pmp.c.

Referenced by pmpstart().

◆ pmpcleanup

periph_dtor_t pmpcleanup
static

Definition at line 120 of file ata_pmp.c.

Referenced by pmpasync().

◆ pmpdriver

struct periph_driver pmpdriver
static
Initial value:
=
{
pmpinit, "pmp",
TAILQ_HEAD_INITIALIZER(pmpdriver.units), 0,
}
static periph_init_t pmpinit
Definition: ata_pmp.c:115
static struct periph_driver pmpdriver
Definition: ata_pmp.c:151
#define CAM_PERIPH_DRV_EARLY
Definition: cam_periph.h:99

Definition at line 151 of file ata_pmp.c.

◆ pmpinit

static void pmpinit ( void  )
static

Definition at line 115 of file ata_pmp.c.

◆ pmponinvalidate

periph_oninv_t pmponinvalidate
static

Definition at line 122 of file ata_pmp.c.

Referenced by pmpasync().

◆ pmpregister

periph_ctor_t pmpregister
static

Definition at line 119 of file ata_pmp.c.

Referenced by pmpasync().

◆ pmpstart

periph_start_t pmpstart
static

Definition at line 121 of file ata_pmp.c.

Referenced by pmpasync().