FreeBSD kernel CAM code
ata_da.c File Reference
#include <sys/cdefs.h>
#include "opt_ada.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/endian.h>
#include <sys/cons.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/sbuf.h>
#include <geom/geom.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/scsi/scsi_all.h>
#include <cam/scsi/scsi_da.h>
#include <cam/cam_sim.h>
#include <cam/cam_iosched.h>
#include <cam/ata/ata_all.h>
Include dependency graph for ata_da.c:

Go to the source code of this file.

Data Structures

struct  ada_zone_desc
 
struct  disk_params
 
struct  trim_request
 
struct  ada_softc
 
struct  ada_quirk_entry
 

Macros

#define ATA_MAX_28BIT_LBA   268435455UL
 
#define ADA_FLAG_STRING
 
#define ADA_Q_BIT_STRING
 
#define ccb_state   ppriv_field0
 
#define ccb_bp   ppriv_ptr1
 
#define TRIM_MAX_BLOCKS   8
 
#define TRIM_MAX_RANGES   (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES)
 
#define ADA_ANNOUNCETMP_SZ   80
 
#define ADA_ANNOUNCE_SZ   400
 
#define ADA_DEFAULT_TIMEOUT   30 /* Timeout in seconds */
 
#define ADA_DEFAULT_RETRY   4
 
#define ADA_DEFAULT_SEND_ORDERED   1
 
#define ADA_DEFAULT_SPINDOWN_SHUTDOWN   1
 
#define ADA_DEFAULT_SPINDOWN_SUSPEND   1
 
#define ADA_DEFAULT_READ_AHEAD   1
 
#define ADA_DEFAULT_WRITE_CACHE   1
 
#define ADA_RA
 
#define ADA_WC
 
#define ADA_ORDEREDTAG_INTERVAL   4
 

Enumerations

enum  ada_state {
  ADA_STATE_RAHEAD , ADA_STATE_WCACHE , ADA_STATE_LOGDIR , ADA_STATE_IDDIR ,
  ADA_STATE_SUP_CAP , ADA_STATE_ZONE , ADA_STATE_NORMAL
}
 
enum  ada_flags {
  ADA_FLAG_CAN_48BIT = 0x00000002 , ADA_FLAG_CAN_FLUSHCACHE = 0x00000004 , ADA_FLAG_CAN_NCQ = 0x00000008 , ADA_FLAG_CAN_DMA = 0x00000010 ,
  ADA_FLAG_NEED_OTAG = 0x00000020 , ADA_FLAG_WAS_OTAG = 0x00000040 , ADA_FLAG_CAN_TRIM = 0x00000080 , ADA_FLAG_OPEN = 0x00000100 ,
  ADA_FLAG_SCTX_INIT = 0x00000200 , ADA_FLAG_CAN_CFA = 0x00000400 , ADA_FLAG_CAN_POWERMGT = 0x00000800 , ADA_FLAG_CAN_DMA48 = 0x00001000 ,
  ADA_FLAG_CAN_LOG = 0x00002000 , ADA_FLAG_CAN_IDLOG = 0x00004000 , ADA_FLAG_CAN_SUPCAP = 0x00008000 , ADA_FLAG_CAN_ZONE = 0x00010000 ,
  ADA_FLAG_CAN_WCACHE = 0x00020000 , ADA_FLAG_CAN_RAHEAD = 0x00040000 , ADA_FLAG_PROBED = 0x00080000 , ADA_FLAG_ANNOUNCED = 0x00100000 ,
  ADA_FLAG_DIRTY = 0x00200000 , ADA_FLAG_CAN_NCQ_TRIM = 0x00400000 , ADA_FLAG_PIM_ATA_EXT = 0x00800000 , ADA_FLAG_UNMAPPEDIO = 0x01000000 ,
  ADA_FLAG_ROTATING = 0x02000000
}
 
enum  ada_quirks {
  ADA_Q_NONE = 0x00 , ADA_Q_4K = 0x01 , ADA_Q_NCQ_TRIM_BROKEN = 0x02 , ADA_Q_LOG_BROKEN = 0x04 ,
  ADA_Q_SMR_DM = 0x08 , ADA_Q_NO_TRIM = 0x10 , ADA_Q_128KB = 0x20
}
 
enum  ada_ccb_state {
  ADA_CCB_RAHEAD = 0x01 , ADA_CCB_WCACHE = 0x02 , ADA_CCB_BUFFER_IO = 0x03 , ADA_CCB_DUMP = 0x05 ,
  ADA_CCB_TRIM = 0x06 , ADA_CCB_LOGDIR = 0x07 , ADA_CCB_IDDIR = 0x08 , ADA_CCB_SUP_CAP = 0x09 ,
  ADA_CCB_ZONE = 0x0a , ADA_CCB_TYPE_MASK = 0x0F
}
 
enum  ada_zone_mode { ADA_ZONE_NONE = 0x00 , ADA_ZONE_DRIVE_MANAGED = 0x01 , ADA_ZONE_HOST_AWARE = 0x02 , ADA_ZONE_HOST_MANAGED = 0x03 }
 
enum  ada_zone_flags {
  ADA_ZONE_FLAG_RZ_SUP = 0x0001 , ADA_ZONE_FLAG_OPEN_SUP = 0x0002 , ADA_ZONE_FLAG_CLOSE_SUP = 0x0004 , ADA_ZONE_FLAG_FINISH_SUP = 0x0008 ,
  ADA_ZONE_FLAG_RWP_SUP = 0x0010 , ADA_ZONE_FLAG_SUP_MASK , ADA_ZONE_FLAG_URSWRZ = 0x0020 , ADA_ZONE_FLAG_OPT_SEQ_SET = 0x0040 ,
  ADA_ZONE_FLAG_OPT_NONSEQ_SET = 0x0080 , ADA_ZONE_FLAG_MAX_SEQ_SET = 0x0100 , ADA_ZONE_FLAG_SET_MASK
}
 
enum  ada_delete_methods {
  ADA_DELETE_NONE , ADA_DELETE_DISABLE , ADA_DELETE_CFA_ERASE , ADA_DELETE_DSM_TRIM ,
  ADA_DELETE_NCQ_DSM_TRIM , ADA_DELETE_MIN = ADA_DELETE_CFA_ERASE , ADA_DELETE_MAX = ADA_DELETE_NCQ_DSM_TRIM
}
 

Functions

 __FBSDID ("$FreeBSD$")
 
static void adadiskgonecb (struct disk *dp)
 
static void adaasync (void *callback_arg, u_int32_t code, struct cam_path *path, void *arg)
 
static int adabitsysctl (SYSCTL_HANDLER_ARGS)
 
static int adaflagssysctl (SYSCTL_HANDLER_ARGS)
 
static int adazonesupsysctl (SYSCTL_HANDLER_ARGS)
 
static void adasysctlinit (void *context, int pending)
 
static int adagetattr (struct bio *bp)
 
static void adasetflags (struct ada_softc *softc, struct ccb_getdev *cgd)
 
static void adasetgeom (struct ada_softc *softc, struct ccb_getdev *cgd)
 
static void ada_dsmtrim (struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio)
 
static void ada_cfaerase (struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio)
 
static int ada_zone_bio_to_ata (int disk_zone_cmd)
 
static int ada_zone_cmd (struct cam_periph *periph, union ccb *ccb, struct bio *bp, int *queue_ccb)
 
static void adaprobedone (struct cam_periph *periph, union ccb *ccb)
 
static void adazonedone (struct cam_periph *periph, union ccb *ccb)
 
static void adadone (struct cam_periph *periph, union ccb *done_ccb)
 
static int adaerror (union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
 
static void adashutdown (void *arg, int howto)
 
static void adasuspend (void *arg)
 
static void adaresume (void *arg)
 
static SYSCTL_NODE (_kern_cam, OID_AUTO, ada, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM Direct Access Disk driver")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, retry_count, CTLFLAG_RWTUN, &ada_retry_count, 0, "Normal I/O retry count")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, default_timeout, CTLFLAG_RWTUN, &ada_default_timeout, 0, "Normal I/O timeout (in seconds)")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, send_ordered, CTLFLAG_RWTUN, &ada_send_ordered, 0, "Send Ordered Tags")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, spindown_shutdown, CTLFLAG_RWTUN, &ada_spindown_shutdown, 0, "Spin down upon shutdown")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, spindown_suspend, CTLFLAG_RWTUN, &ada_spindown_suspend, 0, "Spin down upon suspend")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, read_ahead, CTLFLAG_RWTUN, &ada_read_ahead, 0, "Enable disk read-ahead")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, write_cache, CTLFLAG_RWTUN, &ada_write_cache, 0, "Enable disk write cache")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, enable_biospeedup, CTLFLAG_RDTUN, &ada_enable_biospeedup, 0, "Enable BIO_SPEEDUP processing")
 
 SYSCTL_INT (_kern_cam_ada, OID_AUTO, enable_uma_ccbs, CTLFLAG_RWTUN, &ada_enable_uma_ccbs, 0, "Use UMA for CCBs")
 
static int adadeletemethodsysctl (SYSCTL_HANDLER_ARGS)
 
 PERIPHDRIVER_DECLARE (ada, adadriver)
 
static MALLOC_DEFINE (M_ATADA, "ata_da", "ata_da buffers")
 
static int adaopen (struct disk *dp)
 
static int adaclose (struct disk *dp)
 
static void adaschedule (struct cam_periph *periph)
 
static void adastrategy (struct bio *bp)
 
static int adadump (void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t length)
 
static void adaoninvalidate (struct cam_periph *periph)
 
static void adacleanup (struct cam_periph *periph)
 
static void adasetdeletemethod (struct ada_softc *softc)
 
static int adazonemodesysctl (SYSCTL_HANDLER_ARGS)
 
static cam_status adaregister (struct cam_periph *periph, void *arg)
 
static int ada_dsmtrim_req_create (struct ada_softc *softc, struct bio *bp, struct trim_request *req)
 
static void ada_ncq_dsmtrim (struct ada_softc *softc, struct bio *bp, struct ccb_ataio *ataio)
 
static void adastart (struct cam_periph *periph, union ccb *start_ccb)
 
static void adasendorderedtag (void *arg)
 
static void adaflush (void)
 
static void adaspindown (uint8_t cmd, int flags)
 

Variables

int iosched_debug
 
static struct ada_zone_desc ada_zone_desc_table []
 
static const char * ada_delete_method_names []
 
static uma_zone_t ada_ccb_zone
 
static struct ada_quirk_entry ada_quirk_table []
 
static disk_strategy_t adastrategy
 
static dumper_t adadump
 
static periph_init_t adainit
 
static periph_oninv_t adaoninvalidate
 
static periph_dtor_t adacleanup
 
static periph_ctor_t adaregister
 
static periph_start_t adastart
 
static callout_func_t adasendorderedtag
 
static int ada_retry_count = ADA_DEFAULT_RETRY
 
static int ada_default_timeout = ADA_DEFAULT_TIMEOUT
 
static int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED
 
static int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN
 
static int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND
 
static int ada_read_ahead = ADA_DEFAULT_READ_AHEAD
 
static int ada_write_cache = ADA_DEFAULT_WRITE_CACHE
 
static int ada_enable_biospeedup = 1
 
static int ada_enable_uma_ccbs = 1
 
static struct periph_driver adadriver
 

Macro Definition Documentation

◆ ADA_ANNOUNCE_SZ

#define ADA_ANNOUNCE_SZ   400

Definition at line 296 of file ata_da.c.

◆ ADA_ANNOUNCETMP_SZ

#define ADA_ANNOUNCETMP_SZ   80

Definition at line 294 of file ata_da.c.

◆ ADA_DEFAULT_READ_AHEAD

#define ADA_DEFAULT_READ_AHEAD   1

Definition at line 887 of file ata_da.c.

◆ ADA_DEFAULT_RETRY

#define ADA_DEFAULT_RETRY   4

Definition at line 871 of file ata_da.c.

◆ ADA_DEFAULT_SEND_ORDERED

#define ADA_DEFAULT_SEND_ORDERED   1

Definition at line 875 of file ata_da.c.

◆ ADA_DEFAULT_SPINDOWN_SHUTDOWN

#define ADA_DEFAULT_SPINDOWN_SHUTDOWN   1

Definition at line 879 of file ata_da.c.

◆ ADA_DEFAULT_SPINDOWN_SUSPEND

#define ADA_DEFAULT_SPINDOWN_SUSPEND   1

Definition at line 883 of file ata_da.c.

◆ ADA_DEFAULT_TIMEOUT

#define ADA_DEFAULT_TIMEOUT   30 /* Timeout in seconds */

Definition at line 867 of file ata_da.c.

◆ ADA_DEFAULT_WRITE_CACHE

#define ADA_DEFAULT_WRITE_CACHE   1

Definition at line 891 of file ata_da.c.

◆ ADA_FLAG_STRING

#define ADA_FLAG_STRING
Value:
"\020" \
"\002CAN_48BIT" \
"\003CAN_FLUSHCACHE" \
"\004CAN_NCQ" \
"\005CAN_DMA" \
"\006NEED_OTAG" \
"\007WAS_OTAG" \
"\010CAN_TRIM" \
"\011OPEN" \
"\012SCTX_INIT" \
"\013CAN_CFA" \
"\014CAN_POWERMGT" \
"\015CAN_DMA48" \
"\016CAN_LOG" \
"\017CAN_IDLOG" \
"\020CAN_SUPCAP" \
"\021CAN_ZONE" \
"\022CAN_WCACHE" \
"\023CAN_RAHEAD" \
"\024PROBED" \
"\025ANNOUNCED" \
"\026DIRTY" \
"\027CAN_NCQ_TRIM" \
"\030PIM_ATA_EXT" \
"\031UNMAPPEDIO" \
"\032ROTATING"

Definition at line 116 of file ata_da.c.

◆ ADA_ORDEREDTAG_INTERVAL

#define ADA_ORDEREDTAG_INTERVAL   4

Definition at line 943 of file ata_da.c.

◆ ADA_Q_BIT_STRING

#define ADA_Q_BIT_STRING
Value:
"\020" \
"\0014K" \
"\002NCQ_TRIM_BROKEN" \
"\003LOG_BROKEN" \
"\004SMR_DM" \
"\005NO_TRIM" \
"\006128KB"

Definition at line 154 of file ata_da.c.

◆ ADA_RA

#define ADA_RA
Value:
(softc->read_ahead >= 0 ? \
softc->read_ahead : ada_read_ahead)
static int ada_read_ahead
Definition: ata_da.c:904

Definition at line 894 of file ata_da.c.

◆ ADA_WC

#define ADA_WC
Value:
(softc->write_cache >= 0 ? \
softc->write_cache : ada_write_cache)
static int ada_write_cache
Definition: ata_da.c:905

Definition at line 896 of file ata_da.c.

◆ ATA_MAX_28BIT_LBA

#define ATA_MAX_28BIT_LBA   268435455UL

Definition at line 75 of file ata_da.c.

◆ ccb_bp

#define ccb_bp   ppriv_ptr1

Definition at line 216 of file ata_da.c.

◆ ccb_state

#define ccb_state   ppriv_field0

Definition at line 215 of file ata_da.c.

◆ TRIM_MAX_BLOCKS

#define TRIM_MAX_BLOCKS   8

Definition at line 243 of file ata_da.c.

◆ TRIM_MAX_RANGES

#define TRIM_MAX_RANGES   (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES)

Definition at line 244 of file ata_da.c.

Enumeration Type Documentation

◆ ada_ccb_state

Enumerator
ADA_CCB_RAHEAD 
ADA_CCB_WCACHE 
ADA_CCB_BUFFER_IO 
ADA_CCB_DUMP 
ADA_CCB_TRIM 
ADA_CCB_LOGDIR 
ADA_CCB_IDDIR 
ADA_CCB_SUP_CAP 
ADA_CCB_ZONE 
ADA_CCB_TYPE_MASK 

Definition at line 163 of file ata_da.c.

◆ ada_delete_methods

Enumerator
ADA_DELETE_NONE 
ADA_DELETE_DISABLE 
ADA_DELETE_CFA_ERASE 
ADA_DELETE_DSM_TRIM 
ADA_DELETE_NCQ_DSM_TRIM 
ADA_DELETE_MIN 
ADA_DELETE_MAX 

Definition at line 218 of file ata_da.c.

◆ ada_flags

enum ada_flags
Enumerator
ADA_FLAG_CAN_48BIT 
ADA_FLAG_CAN_FLUSHCACHE 
ADA_FLAG_CAN_NCQ 
ADA_FLAG_CAN_DMA 
ADA_FLAG_NEED_OTAG 
ADA_FLAG_WAS_OTAG 
ADA_FLAG_CAN_TRIM 
ADA_FLAG_OPEN 
ADA_FLAG_SCTX_INIT 
ADA_FLAG_CAN_CFA 
ADA_FLAG_CAN_POWERMGT 
ADA_FLAG_CAN_DMA48 
ADA_FLAG_CAN_LOG 
ADA_FLAG_CAN_IDLOG 
ADA_FLAG_CAN_SUPCAP 
ADA_FLAG_CAN_ZONE 
ADA_FLAG_CAN_WCACHE 
ADA_FLAG_CAN_RAHEAD 
ADA_FLAG_PROBED 
ADA_FLAG_ANNOUNCED 
ADA_FLAG_DIRTY 
ADA_FLAG_CAN_NCQ_TRIM 
ADA_FLAG_PIM_ATA_EXT 
ADA_FLAG_UNMAPPEDIO 
ADA_FLAG_ROTATING 

Definition at line 89 of file ata_da.c.

◆ ada_quirks

enum ada_quirks
Enumerator
ADA_Q_NONE 
ADA_Q_4K 
ADA_Q_NCQ_TRIM_BROKEN 
ADA_Q_LOG_BROKEN 
ADA_Q_SMR_DM 
ADA_Q_NO_TRIM 
ADA_Q_128KB 

Definition at line 144 of file ata_da.c.

◆ ada_state

enum ada_state
Enumerator
ADA_STATE_RAHEAD 
ADA_STATE_WCACHE 
ADA_STATE_LOGDIR 
ADA_STATE_IDDIR 
ADA_STATE_SUP_CAP 
ADA_STATE_ZONE 
ADA_STATE_NORMAL 

Definition at line 79 of file ata_da.c.

◆ ada_zone_flags

Enumerator
ADA_ZONE_FLAG_RZ_SUP 
ADA_ZONE_FLAG_OPEN_SUP 
ADA_ZONE_FLAG_CLOSE_SUP 
ADA_ZONE_FLAG_FINISH_SUP 
ADA_ZONE_FLAG_RWP_SUP 
ADA_ZONE_FLAG_SUP_MASK 
ADA_ZONE_FLAG_URSWRZ 
ADA_ZONE_FLAG_OPT_SEQ_SET 
ADA_ZONE_FLAG_OPT_NONSEQ_SET 
ADA_ZONE_FLAG_MAX_SEQ_SET 
ADA_ZONE_FLAG_SET_MASK 

Definition at line 183 of file ata_da.c.

◆ ada_zone_mode

Enumerator
ADA_ZONE_NONE 
ADA_ZONE_DRIVE_MANAGED 
ADA_ZONE_HOST_AWARE 
ADA_ZONE_HOST_MANAGED 

Definition at line 176 of file ata_da.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ ada_cfaerase()

static void ada_cfaerase ( struct ada_softc softc,
struct bio *  bp,
struct ccb_ataio ataio 
)
static

Definition at line 2095 of file ata_da.c.

References ada_default_timeout, ada_retry_count, adadone(), ata_28bit_cmd(), CAM_DIR_NONE, cam_fill_ataio(), ada_softc::params, disk_params::secsize, and ada_softc::trim_req.

Referenced by adastart().

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

◆ ada_dsmtrim()

static void ada_dsmtrim ( struct ada_softc softc,
struct bio *  bp,
struct ccb_ataio ataio 
)
static

Definition at line 2052 of file ata_da.c.

References ada_default_timeout, ada_dsmtrim_req_create(), ada_retry_count, adadone(), ata_48bit_cmd(), CAM_DIR_OUT, cam_fill_ataio(), trim_request::data, and ada_softc::trim_req.

Referenced by adastart().

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

◆ ada_dsmtrim_req_create()

static int ada_dsmtrim_req_create ( struct ada_softc softc,
struct bio *  bp,
struct trim_request req 
)
static

Definition at line 1986 of file ata_da.c.

References ada_softc::cam_iosched, cam_iosched_next_trim(), cam_iosched_put_back_trim(), trim_request::data, ada_softc::params, disk_params::secsize, ada_softc::trim_count, ada_softc::trim_lbas, ada_softc::trim_max_ranges, and ada_softc::trim_ranges.

Referenced by ada_dsmtrim(), and ada_ncq_dsmtrim().

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

◆ ada_ncq_dsmtrim()

static void ada_ncq_dsmtrim ( struct ada_softc softc,
struct bio *  bp,
struct ccb_ataio ataio 
)
static

Definition at line 2071 of file ata_da.c.

References ada_default_timeout, ada_dsmtrim_req_create(), ada_retry_count, adadone(), ATA_FLAG_AUX, ccb_ataio::ata_flags, ata_ncq_cmd(), ccb_ataio::aux, CAM_DIR_OUT, cam_fill_ataio(), ccb_ataio::cmd, trim_request::data, ata_cmd::sector_count_exp, and ada_softc::trim_req.

Referenced by adastart().

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

◆ ada_zone_bio_to_ata()

static int ada_zone_bio_to_ata ( int  disk_zone_cmd)
static

Definition at line 2120 of file ata_da.c.

Referenced by ada_zone_cmd().

Here is the caller graph for this function:

◆ ada_zone_cmd()

◆ adaasync()

◆ adabitsysctl()

static int adabitsysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1663 of file ata_da.c.

References ada_softc::flags.

Referenced by adasysctlinit().

Here is the caller graph for this function:

◆ adacleanup()

static void adacleanup ( struct cam_periph periph)
static

◆ adaclose()

◆ adadeletemethodsysctl()

static int adadeletemethodsysctl ( SYSCTL_HANDLER_ARGS  )
static

◆ adadiskgonecb()

static void adadiskgonecb ( struct disk *  dp)
static

Definition at line 1218 of file ata_da.c.

References cam_periph_release().

Referenced by adaregister().

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

◆ adadone()

static void adadone ( struct cam_periph periph,
union ccb done_ccb 
)
static

Definition at line 2850 of file ata_da.c.

References ADA_CCB_BUFFER_IO, ADA_CCB_DUMP, ADA_CCB_IDDIR, ADA_CCB_LOGDIR, ADA_CCB_RAHEAD, ADA_CCB_SUP_CAP, ADA_CCB_TRIM, ADA_CCB_TYPE_MASK, ADA_CCB_WCACHE, ADA_CCB_ZONE, ADA_FLAG_CAN_IDLOG, ADA_FLAG_CAN_LOG, ADA_FLAG_CAN_NCQ_TRIM, ADA_FLAG_CAN_SUPCAP, ADA_FLAG_CAN_ZONE, ADA_FLAG_WAS_OTAG, ADA_STATE_IDDIR, ADA_STATE_LOGDIR, ADA_STATE_SUP_CAP, ADA_STATE_WCACHE, ADA_STATE_ZONE, ADA_ZONE_DRIVE_MANAGED, ADA_ZONE_FLAG_CLOSE_SUP, ADA_ZONE_FLAG_FINISH_SUP, ADA_ZONE_FLAG_MAX_SEQ_SET, ADA_ZONE_FLAG_OPEN_SUP, ADA_ZONE_FLAG_OPT_NONSEQ_SET, ADA_ZONE_FLAG_OPT_SEQ_SET, ADA_ZONE_FLAG_RWP_SUP, ADA_ZONE_FLAG_RZ_SUP, ADA_ZONE_FLAG_SUP_MASK, ADA_ZONE_FLAG_URSWRZ, ADA_ZONE_HOST_AWARE, ADA_ZONE_NONE, adaerror(), adaprobedone(), adaschedule(), adasetdeletemethod(), adazonedone(), ada_softc::ata_iddir, ada_softc::ata_logdir, ccb::ataio, CAM_DEBUG, CAM_DEBUG_TRACE, CAM_DEV_QFRZN, ada_softc::cam_iosched, cam_iosched_bio_complete(), cam_iosched_trim_done(), cam_periph_lock, cam_periph_unlock, cam_release_devq(), CAM_REQ_CMP, CAM_RETRY_SELTO, CAM_STATUS_MASK, ccb_ataio::ccb_h, ccb::ccb_h, ccb_ataio::data_ptr, ccb_ataio::dxfer_len, ada_softc::flags, ada_softc::max_seq_zones, ada_softc::optimal_nonseq_zones, ada_softc::optimal_seq_zones, ada_softc::outstanding_cmds, ccb_hdr::path, ccb_hdr::pinfo, cam_pinfo::priority, ada_softc::refcount, ccb_ataio::resid, SF_NO_PRINT, SF_RETRY_UA, cam_periph::softc, ada_softc::state, ccb_hdr::status, TAILQ_HEAD(), ada_softc::trim_req, ada_softc::valid_iddir_len, ada_softc::valid_logdir_len, xpt_release_ccb(), xpt_schedule(), ada_softc::zone_flags, and ada_softc::zone_mode.

Referenced by ada_cfaerase(), ada_dsmtrim(), ada_ncq_dsmtrim(), ada_zone_cmd(), and adastart().

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

◆ adadump()

◆ adaerror()

static int adaerror ( union ccb ccb,
u_int32_t  cam_flags,
u_int32_t  sense_flags 
)
static

Definition at line 3391 of file ata_da.c.

References CAM_ATA_STATUS_ERROR, CAM_CMD_TIMEOUT, CAM_DATA_RUN_ERR, cam_periph_error(), CAM_REQ_ABORTED, CAM_REQ_CMP_ERR, CAM_REQ_TERMIO, CAM_STATUS_MASK, CAM_UNREC_HBA_ERROR, ccb::ccb_h, ccb_hdr::path, cam_periph::softc, ccb_hdr::status, and xpt_path_periph().

Referenced by adaclose(), adadone(), adadump(), adaflush(), and adaspindown().

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

◆ adaflagssysctl()

static int adaflagssysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1678 of file ata_da.c.

References ADA_FLAG_STRING, and ada_softc::flags.

Referenced by adasysctlinit().

Here is the caller graph for this function:

◆ adaflush()

◆ adagetattr()

static int adagetattr ( struct bio *  bp)
static

Definition at line 1607 of file ata_da.c.

References ada_enable_biospeedup, cam_periph_lock, cam_periph_unlock, cam_periph::path, and xpt_getattr().

Referenced by adaregister().

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

◆ adaoninvalidate()

static void adaoninvalidate ( struct cam_periph periph)
static

Definition at line 1228 of file ata_da.c.

References adaasync(), ada_softc::cam_iosched, cam_iosched_flush(), ada_softc::disk, cam_periph::path, cam_periph::softc, and xpt_register_async().

Here is the call graph for this function:

◆ adaopen()

static int adaopen ( struct disk *  dp)
static

Definition at line 959 of file ata_da.c.

References ADA_FLAG_OPEN, CAM_DEBUG, CAM_DEBUG_PERIPH, CAM_DEBUG_TRACE, cam_periph_acquire(), cam_periph_hold(), cam_periph_lock, cam_periph_release(), cam_periph_unhold(), cam_periph_unlock, ada_softc::flags, cam_periph::path, and cam_periph::softc.

Referenced by adaregister().

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

◆ adaprobedone()

static void adaprobedone ( struct cam_periph periph,
union ccb ccb 
)
static

Definition at line 2689 of file ata_da.c.

References ADA_FLAG_ANNOUNCED, ADA_FLAG_PROBED, ADA_STATE_NORMAL, adaschedule(), cam_periph_release_locked(), cam_periph_unhold(), ada_softc::flags, cam_periph::softc, ada_softc::state, and xpt_release_ccb().

Referenced by adadone(), adaregister(), and adastart().

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

◆ adaregister()

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

Definition at line 1796 of file ata_da.c.

References AC_ADVINFO_CHANGED, AC_BUS_RESET, AC_GETDEV_CHANGED, AC_LOST_DEVICE, AC_SENT_BDR, ADA_ANNOUNCE_SZ, ADA_ANNOUNCETMP_SZ, ada_ccb_zone, ada_default_timeout, ada_enable_uma_ccbs, ADA_FLAG_CAN_LOG, ADA_FLAG_CAN_RAHEAD, ADA_FLAG_CAN_WCACHE, ADA_FLAG_PIM_ATA_EXT, ADA_FLAG_ROTATING, ADA_ORDEREDTAG_INTERVAL, ADA_Q_BIT_STRING, ADA_Q_NONE, ada_quirk_table, ADA_RA, ADA_STATE_LOGDIR, ADA_STATE_RAHEAD, ADA_STATE_WCACHE, ADA_WC, ADA_ZONE_NONE, adaasync(), adaclose(), adadiskgonecb(), adadump, adagetattr(), adaopen(), adaprobedone(), adasendorderedtag, adasetflags(), adasetgeom(), adastrategy, adasysctlinit(), ada_softc::announce_buffer, ada_softc::announce_temp, ata_identify_match(), ada_softc::cam_iosched, cam_iosched_init(), cam_iosched_set_sort_queue(), cam_periph_acquire(), cam_periph_hold(), cam_periph_lock, cam_periph_mtx(), cam_periph_unlock, CAM_PRIORITY_DEV, cam_quirkmatch(), CAM_REQ_CMP, CAM_REQ_CMP_ERR, cam_sim_pollable(), cam_periph::ccb_zone, ada_softc::cpi, ada_softc::disk, ada_softc::flags, ccb_pathinq::hba_misc, ccb_getdev::ident_data, ada_softc::params, cam_periph::path, cam_periph::periph_name, PIM_ATA_EXT, ada_softc::quirks, ada_quirk_entry::quirks, ada_softc::read_ahead, disk_params::secsize, disk_params::sectors, ada_softc::sendordered_c, cam_periph::sim, cam_periph::softc, ada_softc::state, ada_softc::sysctl_task, ccb_pathinq::transport, cam_periph::unit_number, ada_softc::write_cache, XPORT_DEVSTAT_TYPE, xpt_announce_periph_sbuf(), xpt_announce_quirks_sbuf(), xpt_path_inq(), xpt_print(), xpt_register_async(), xpt_schedule(), and ada_softc::zone_mode.

Here is the call graph for this function:

◆ adaresume()

static void adaresume ( void *  arg)
static

◆ adaschedule()

static void adaschedule ( struct cam_periph periph)
static

Definition at line 1042 of file ata_da.c.

References ADA_STATE_NORMAL, ada_softc::cam_iosched, cam_iosched_schedule(), cam_periph::softc, and ada_softc::state.

Referenced by adadone(), adaprobedone(), adastart(), and adastrategy().

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

◆ adasendorderedtag()

static void adasendorderedtag ( void *  arg)
static

◆ adasetdeletemethod()

static void adasetdeletemethod ( struct ada_softc softc)
static

◆ adasetflags()

◆ adasetgeom()

◆ adashutdown()

static void adashutdown ( void *  arg,
int  howto 
)
static

Definition at line 3703 of file ata_da.c.

References ada_spindown_shutdown, adaflush(), and adaspindown().

Here is the call graph for this function:

◆ adaspindown()

◆ adastart()

◆ adastrategy()

static void adastrategy ( struct bio *  bp)
static

◆ adasuspend()

static void adasuspend ( void *  arg)
static

Definition at line 3731 of file ata_da.c.

References ada_spindown_suspend, adaflush(), adaspindown(), and CAM_DEV_QFREEZE.

Here is the call graph for this function:

◆ adasysctlinit()

◆ adazonedone()

◆ adazonemodesysctl()

static int adazonemodesysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1400 of file ata_da.c.

References ADA_ZONE_DRIVE_MANAGED, ADA_ZONE_HOST_AWARE, ADA_ZONE_HOST_MANAGED, ADA_ZONE_NONE, and ada_softc::zone_mode.

Referenced by adasysctlinit().

Here is the caller graph for this function:

◆ adazonesupsysctl()

static int adazonesupsysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 1430 of file ata_da.c.

References ada_zone_desc_table, ada_zone_desc::value, and ada_softc::zone_flags.

Referenced by adasysctlinit().

Here is the caller graph for this function:

◆ MALLOC_DEFINE()

static MALLOC_DEFINE ( M_ATADA  ,
"ata_da"  ,
"ata_da buffers"   
)
static

◆ PERIPHDRIVER_DECLARE()

PERIPHDRIVER_DECLARE ( ada  ,
adadriver   
)

◆ SYSCTL_INT() [1/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
default_timeout  ,
CTLFLAG_RWTUN  ,
ada_default_timeout,
,
"Normal I/O timeout (in seconds)"   
)

◆ SYSCTL_INT() [2/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
enable_biospeedup  ,
CTLFLAG_RDTUN  ,
ada_enable_biospeedup,
,
"Enable BIO_SPEEDUP processing"   
)

◆ SYSCTL_INT() [3/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
enable_uma_ccbs  ,
CTLFLAG_RWTUN  ,
ada_enable_uma_ccbs,
,
"Use UMA for CCBs"   
)

◆ SYSCTL_INT() [4/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
read_ahead  ,
CTLFLAG_RWTUN  ,
ada_read_ahead,
,
"Enable disk read-ahead"   
)

◆ SYSCTL_INT() [5/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
retry_count  ,
CTLFLAG_RWTUN  ,
ada_retry_count,
,
"Normal I/O retry count"   
)

◆ SYSCTL_INT() [6/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
send_ordered  ,
CTLFLAG_RWTUN  ,
ada_send_ordered,
,
"Send Ordered Tags"   
)

◆ SYSCTL_INT() [7/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
spindown_shutdown  ,
CTLFLAG_RWTUN  ,
ada_spindown_shutdown,
,
"Spin down upon shutdown"   
)

◆ SYSCTL_INT() [8/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
spindown_suspend  ,
CTLFLAG_RWTUN  ,
ada_spindown_suspend,
,
"Spin down upon suspend"   
)

◆ SYSCTL_INT() [9/9]

SYSCTL_INT ( _kern_cam_ada  ,
OID_AUTO  ,
write_cache  ,
CTLFLAG_RWTUN  ,
ada_write_cache,
,
"Enable disk write cache"   
)

◆ SYSCTL_NODE()

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

Variable Documentation

◆ ada_ccb_zone

uma_zone_t ada_ccb_zone
static

Definition at line 300 of file ata_da.c.

Referenced by adaregister().

◆ ada_default_timeout

◆ ada_delete_method_names

const char* ada_delete_method_names[]
static
Initial value:
=
{ "NONE", "DISABLE", "CFA_ERASE", "DSM_TRIM", "NCQ_DSM_TRIM" }

Definition at line 228 of file ata_da.c.

Referenced by adadeletemethodsysctl().

◆ ada_enable_biospeedup

int ada_enable_biospeedup = 1
static

Definition at line 906 of file ata_da.c.

Referenced by adagetattr().

◆ ada_enable_uma_ccbs

int ada_enable_uma_ccbs = 1
static

Definition at line 907 of file ata_da.c.

Referenced by adaregister().

◆ ada_quirk_table

struct ada_quirk_entry ada_quirk_table[]
static

Definition at line 307 of file ata_da.c.

Referenced by adaregister().

◆ ada_read_ahead

int ada_read_ahead = ADA_DEFAULT_READ_AHEAD
static

Definition at line 904 of file ata_da.c.

◆ ada_retry_count

int ada_retry_count = ADA_DEFAULT_RETRY
static

Definition at line 899 of file ata_da.c.

Referenced by ada_cfaerase(), ada_dsmtrim(), ada_ncq_dsmtrim(), ada_zone_cmd(), and adastart().

◆ ada_send_ordered

int ada_send_ordered = ADA_DEFAULT_SEND_ORDERED
static

Definition at line 901 of file ata_da.c.

Referenced by adasendorderedtag().

◆ ada_spindown_shutdown

int ada_spindown_shutdown = ADA_DEFAULT_SPINDOWN_SHUTDOWN
static

Definition at line 902 of file ata_da.c.

Referenced by adashutdown().

◆ ada_spindown_suspend

int ada_spindown_suspend = ADA_DEFAULT_SPINDOWN_SUSPEND
static

Definition at line 903 of file ata_da.c.

Referenced by adaresume(), and adasuspend().

◆ ada_write_cache

int ada_write_cache = ADA_DEFAULT_WRITE_CACHE
static

Definition at line 905 of file ata_da.c.

◆ ada_zone_desc_table

struct ada_zone_desc ada_zone_desc_table[]
static
Initial value:
= {
{ADA_ZONE_FLAG_RZ_SUP, "Report Zones" },
{ADA_ZONE_FLAG_RWP_SUP, "Reset Write Pointer" },
}
@ ADA_ZONE_FLAG_FINISH_SUP
Definition: ata_da.c:187
@ ADA_ZONE_FLAG_RZ_SUP
Definition: ata_da.c:184
@ ADA_ZONE_FLAG_CLOSE_SUP
Definition: ata_da.c:186
@ ADA_ZONE_FLAG_RWP_SUP
Definition: ata_da.c:188
@ ADA_ZONE_FLAG_OPEN_SUP
Definition: ata_da.c:185

Referenced by adazonesupsysctl().

◆ adacleanup

periph_dtor_t adacleanup
static

Definition at line 834 of file ata_da.c.

Referenced by adaasync().

◆ adadriver

struct periph_driver adadriver
static
Initial value:
=
{
adainit, "ada",
TAILQ_HEAD_INITIALIZER(adadriver.units), 0
}
static struct periph_driver adadriver
Definition: ata_da.c:946
static periph_init_t adainit
Definition: ata_da.c:831

Definition at line 946 of file ata_da.c.

Referenced by adaflush(), adaresume(), and adaspindown().

◆ adadump

dumper_t adadump
static

Definition at line 830 of file ata_da.c.

Referenced by adaflush(), and adaregister().

◆ adainit

static void adainit ( void  )
static

Definition at line 831 of file ata_da.c.

◆ adaoninvalidate

periph_oninv_t adaoninvalidate
static

Definition at line 833 of file ata_da.c.

Referenced by adaasync().

◆ adaregister

periph_ctor_t adaregister
static

Definition at line 846 of file ata_da.c.

Referenced by adaasync().

◆ adasendorderedtag

callout_func_t adasendorderedtag
static

Definition at line 861 of file ata_da.c.

Referenced by adaregister().

◆ adastart

periph_start_t adastart
static

Definition at line 854 of file ata_da.c.

Referenced by adaasync().

◆ adastrategy

disk_strategy_t adastrategy
static

Definition at line 829 of file ata_da.c.

Referenced by adaregister().

◆ iosched_debug