FreeBSD kernel CAM code
scsi_enc_ses.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/ctype.h>
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
#include <sys/sx.h>
#include <sys/systm.h>
#include <sys/types.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_xpt_periph.h>
#include <cam/cam_periph.h>
#include <cam/scsi/scsi_message.h>
#include <cam/scsi/scsi_enc.h>
#include <cam/scsi/scsi_enc_internal.h>
Include dependency graph for scsi_enc_ses.c:

Go to the source code of this file.

Data Structures

struct  ses_type
 
struct  ses_comstat
 
union  ses_addl_data
 
struct  ses_addl_status
 
struct  ses_element
 
struct  ses_control_request
 
struct  ses_iterator
 Structure encapsulating all data necessary to traverse the elements of a SES configuration. More...
 
struct  ses_cache
 
struct  ses_softc
 
struct  ses_path_iter_args
 
struct  ses_setphyspath_callback_args
 

Macros

#define SCSZ   0x8000
 
#define SES_FLAG_TIMEDCOMP   0x01
 
#define SES_FLAG_ADDLSTATUS   0x02
 
#define SES_FLAG_DESC   0x04
 
#define SES_PRINT_PORTS(p, type)
 

Typedefs

typedef struct ses_type ses_type_t
 
typedef struct ses_comstat ses_comstat_t
 
typedef union ses_addl_data ses_add_data_t
 
typedef struct ses_addl_status ses_add_status_t
 
typedef struct ses_element ses_element_t
 
typedef struct ses_control_request ses_control_request_t
 
typedef struct ses_control_reqlist ses_control_reqlist_t
 
typedef struct ses_cache ses_cache_t
 
typedef struct ses_softc ses_softc_t
 
typedef void ses_devid_callback_t(enc_softc_t *, enc_element_t *, struct scsi_vpd_id_descriptor *, void *)
 
typedef void ses_path_callback_t(enc_softc_t *, enc_element_t *, struct cam_path *, void *)
 
typedef struct ses_path_iter_args ses_path_iter_args_t
 
typedef struct ses_setphyspath_callback_args ses_setphyspath_callback_args_t
 

Enumerations

enum  SesDiagPageCodes {
  SesSupportedPages = 0x0, SesConfigPage = 0x1, SesControlPage = 0x2, SesStatusPage = SesControlPage,
  SesHelpTxt = 0x3, SesStringOut = 0x4, SesStringIn = SesStringOut, SesThresholdOut = 0x5,
  SesThresholdIn = SesThresholdOut, SesArrayControl = 0x6, SesArrayStatus = SesArrayControl, SesElementDescriptor = 0x7,
  SesShortStatus = 0x8, SesEnclosureBusy = 0x9, SesAddlElementStatus = 0xa
}
 
enum  { SES_SETSTATUS_ENC_IDX = -1 }
 
enum  ses_iter_index_values { ITERATOR_INDEX_INVALID = -1, ITERATOR_INDEX_END = INT_MAX }
 
enum  ses_update_action {
  SES_UPDATE_NONE, SES_UPDATE_PAGES, SES_UPDATE_GETCONFIG, SES_UPDATE_GETSTATUS,
  SES_UPDATE_GETELMDESCS, SES_UPDATE_GETELMADDLSTATUS, SES_PROCESS_CONTROL_REQS, SES_PUBLISH_PHYSPATHS,
  SES_PUBLISH_CACHE, SES_NUM_UPDATE_STATES
}
 
enum  ses_elem_index_type_t { SES_ELEM_INDEX_GLOBAL, SES_ELEM_INDEX_INDIVIDUAL }
 
enum  ses_addlstatus_avail_t { TYPE_ADDLSTATUS_NONE, TYPE_ADDLSTATUS_MANDATORY, TYPE_ADDLSTATUS_OPTIONAL }
 

Functions

 __FBSDID ("$FreeBSD: head/sys/cam/scsi/scsi_enc_ses.c 352201 2019-09-11 03:25:30Z mav $")
 
 TAILQ_HEAD (ses_control_reqlist, ses_control_request)
 
static void ses_terminate_control_requests (ses_control_reqlist_t *reqlist, int result)
 
static void ses_iter_reset (struct ses_iterator *iter)
 Reset a SES iterator to just before the first element in the configuration. More...
 
static void ses_iter_init (enc_softc_t *enc, enc_cache_t *cache, struct ses_iterator *iter)
 Initialize the storage of a SES iterator and reset it to the position just before the first element of the configuration. More...
 
static enc_element_tses_iter_next (struct ses_iterator *iter)
 Traverse the provided SES iterator to the next element within the configuraiton. More...
 
static enc_element_tses_iter_seek_to (struct ses_iterator *iter, int element_index, ses_elem_index_type_t index_type)
 Move the provided iterator forwards or backwards to the object having the give index. More...
 
static int ses_set_timed_completion (enc_softc_t *enc, uint8_t tc_en)
 Discover whether this instance supports timed completion of a RECEIVE DIAGNOSTIC RESULTS command requesting the Enclosure Status page, and store the result in the softc, updating if necessary. More...
 
static void ses_poll_status (enc_softc_t *)
 
static void ses_print_addl_data (enc_softc_t *enc, enc_element_t *obj)
 Print the additional element status data for this object. More...
 
static void ses_cache_free_elm_addlstatus (enc_softc_t *enc, enc_cache_t *cache)
 
static void ses_cache_free_elm_descs (enc_softc_t *enc, enc_cache_t *cache)
 
static void ses_cache_free_status (enc_softc_t *enc, enc_cache_t *cache)
 
static void ses_cache_free_elm_map (enc_softc_t *enc, enc_cache_t *cache)
 
static void ses_cache_free (enc_softc_t *enc, enc_cache_t *cache)
 
static void ses_cache_clone (enc_softc_t *enc, enc_cache_t *src, enc_cache_t *dst)
 
int ses_elm_sas_descr_type (union ses_elm_sas_hdr *obj)
 
int ses_elm_addlstatus_proto (struct ses_elm_addlstatus_base_hdr *hdr)
 
int ses_elm_addlstatus_eip (struct ses_elm_addlstatus_base_hdr *hdr)
 
int ses_elm_addlstatus_invalid (struct ses_elm_addlstatus_base_hdr *hdr)
 
int ses_elm_sas_type0_not_all_phys (union ses_elm_sas_hdr *hdr)
 
int ses_elm_sas_dev_phy_sata_dev (struct ses_elm_sas_device_phy *phy)
 
int ses_elm_sas_dev_phy_sata_port (struct ses_elm_sas_device_phy *phy)
 
int ses_elm_sas_dev_phy_dev_type (struct ses_elm_sas_device_phy *phy)
 
static int ses_config_cache_valid (ses_cache_t *ses_cache, const uint8_t *gen_code)
 Verify that the cached configuration data in our softc is valid for processing the page data corresponding to the provided page header. More...
 
static void ses_devids_iter (enc_softc_t *enc, enc_element_t *elm, ses_devid_callback_t *callback, void *callback_arg)
 Iterate over and create vpd device id records from the additional element status data for elm, passing that data to the provided callback. More...
 
static void ses_path_iter_devid_callback (enc_softc_t *enc, enc_element_t *elem, struct scsi_vpd_id_descriptor *devid, void *arg)
 
static void ses_paths_iter (enc_softc_t *enc, enc_element_t *elm, ses_path_callback_t *callback, void *callback_arg)
 Iterate over and find the matching periph objects for the specified element. More...
 
static void ses_elmdevname_callback (enc_softc_t *enc, enc_element_t *elem, struct cam_path *path, void *arg)
 
static void ses_setphyspath_callback (enc_softc_t *enc, enc_element_t *elm, struct cam_path *path, void *arg)
 ses_paths_iter() callback to set the physical path on the CAM EDT entries corresponding to a given SES element. More...
 
static int ses_set_physpath (enc_softc_t *enc, enc_element_t *elm, struct ses_iterator *iter)
 Set a device's physical path string in CAM XPT. More...
 
static void ses_page_cdb (char *cdb, int bufsiz, SesDiagPageCodes pagenum, int dir)
 Helper to set the CDB fields appropriately. More...
 
static int ses_process_pages (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 Process the list of supported pages and update flags. More...
 
static int ses_process_config (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 Process the config page and update associated structures. More...
 
static int ses_process_status (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 Update the status page and associated structures. More...
 
static ses_addlstatus_avail_t ses_typehasaddlstatus (enc_softc_t *enc, uint8_t typidx)
 Check to see whether a given type (as obtained via type headers) is supported by the additional status command. More...
 
static int ses_get_elm_addlstatus_fc (enc_softc_t *, enc_cache_t *, uint8_t *, int)
 
static int ses_get_elm_addlstatus_sas (enc_softc_t *enc, enc_cache_t *enc_cache, uint8_t *buf, int bufsiz, int eip, int tidx, int nobj)
 Update the softc with the additional element status data for this object, for SAS objects. More...
 
static int ses_get_elm_addlstatus_ata (enc_softc_t *enc, enc_cache_t *enc_cache, uint8_t *buf, int bufsiz, int eip, int tidx, int nobj)
 Update the softc with the additional element status data for this object, for ATA objects. More...
 
static int ses_process_elm_addlstatus (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 Parse the additional status element data for each object. More...
 
static int ses_process_control_request (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 
static int ses_publish_physpaths (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 
static int ses_publish_cache (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 
static int ses_process_elm_descs (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t **bufp, int error, int xfer_len)
 Parse the descriptors for each object. More...
 
static int ses_fill_rcv_diag_io (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t *buf)
 
static int ses_encode (enc_softc_t *enc, uint8_t *buf, int amt, ses_control_request_t *req)
 Encode the object status into the response buffer, which is expected to contain the current enclosure status. This function turns off all the 'select' bits for the objects except for the object specified, then sends it back to the enclosure. More...
 
static int ses_fill_control_request (enc_softc_t *enc, struct enc_fsm_state *state, union ccb *ccb, uint8_t *buf)
 
static void ses_print_addl_data_sas_type0 (char *sesname, struct sbuf *sbp, enc_element_t *obj)
 Print the additional element status data for this object, for SAS type 0 objects. See SES2 r20 Section 6.1.13.3.2. More...
 
static void ses_print_addl_data_sas_type1 (char *sesname, struct sbuf *sbp, enc_element_t *obj)
 Print the additional element status data for this object, for SAS type 1 objects. See SES2 r20 Sections 6.1.13.3.3 and 6.1.13.3.4. More...
 
static void ses_print_addl_data_ata (struct sbuf *sbp, enc_element_t *obj)
 Print the additional element status data for this object, for ATA objects. More...
 
static int ses_get_elm_addlstatus_sas_type0 (enc_softc_t *enc, enc_cache_t *enc_cache, uint8_t *buf, int bufsiz, int eip, int nobj)
 Update the softc with the additional element status data for this object, for SAS type 0 objects. More...
 
static int ses_get_elm_addlstatus_sas_type1 (enc_softc_t *enc, enc_cache_t *enc_cache, uint8_t *buf, int bufsiz, int eip, int nobj)
 Update the softc with the additional element status data for this object, for SAS type 1 objects. More...
 
static void ses_softc_invalidate (enc_softc_t *enc)
 
static void ses_softc_cleanup (enc_softc_t *enc)
 
static int ses_init_enc (enc_softc_t *enc)
 
static int ses_get_enc_status (enc_softc_t *enc, int slpflag)
 
static int ses_set_enc_status (enc_softc_t *enc, uint8_t encstat, int slpflag)
 
static int ses_get_elm_status (enc_softc_t *enc, encioc_elm_status_t *elms, int slpflag)
 
static int ses_set_elm_status (enc_softc_t *enc, encioc_elm_status_t *elms, int slpflag)
 
static int ses_get_elm_desc (enc_softc_t *enc, encioc_elm_desc_t *elmd)
 
static int ses_get_elm_devnames (enc_softc_t *enc, encioc_elm_devnames_t *elmdn)
 Respond to ENCIOC_GETELMDEVNAME, providing a device name for the given object id if one is available. More...
 
static int ses_handle_string (enc_softc_t *enc, encioc_string_t *sstr, int ioc)
 Send a string to the primary subenclosure using the String Out SES diagnostic page. More...
 
static void ses_device_found (enc_softc_t *enc)
 Notification received when CAM detects a new device in the SCSI domain in which this SEP resides. More...
 
int ses_softc_init (enc_softc_t *enc)
 Initialize a new SES instance. More...
 

Variables

static enc_softc_cleanup_t ses_softc_cleanup
 
static fsm_fill_handler_t ses_fill_rcv_diag_io
 
static fsm_fill_handler_t ses_fill_control_request
 
static fsm_done_handler_t ses_process_pages
 
static fsm_done_handler_t ses_process_config
 
static fsm_done_handler_t ses_process_status
 
static fsm_done_handler_t ses_process_elm_descs
 
static fsm_done_handler_t ses_process_elm_addlstatus
 
static fsm_done_handler_t ses_process_control_request
 
static fsm_done_handler_t ses_publish_physpaths
 
static fsm_done_handler_t ses_publish_cache
 
static struct enc_fsm_state enc_fsm_states [SES_NUM_UPDATE_STATES]
 
static struct enc_vec ses_enc_vec
 

Detailed Description

Structures and routines specific && private to SES only

Definition in file scsi_enc_ses.c.

Macro Definition Documentation

◆ SCSZ

#define SCSZ   0x8000

Definition at line 256 of file scsi_enc_ses.c.

◆ SES_FLAG_ADDLSTATUS

#define SES_FLAG_ADDLSTATUS   0x02

Definition at line 370 of file scsi_enc_ses.c.

◆ SES_FLAG_DESC

#define SES_FLAG_DESC   0x04

Definition at line 371 of file scsi_enc_ses.c.

◆ SES_FLAG_TIMEDCOMP

#define SES_FLAG_TIMEDCOMP   0x01

Definition at line 369 of file scsi_enc_ses.c.

◆ SES_PRINT_PORTS

#define SES_PRINT_PORTS (   p,
  type 
)
Value:
do { \
if (((p) & SES_SASOBJ_DEV_PHY_PROTOMASK) != 0) { \
sbuf_printf(sbp, " %s (", type); \
sbuf_printf(sbp, " SMP"); \
sbuf_printf(sbp, " STP"); \
sbuf_printf(sbp, " SSP"); \
sbuf_printf(sbp, " )"); \
} \
} while(0)
#define SES_SASOBJ_DEV_PHY_PROTOMASK
Definition: scsi_ses.h:2311
#define SES_SASOBJ_DEV_PHY_SMP
Definition: scsi_ses.h:2307
#define SES_SASOBJ_DEV_PHY_SSP
Definition: scsi_ses.h:2309
#define SES_SASOBJ_DEV_PHY_STP
Definition: scsi_ses.h:2308

Definition at line 2234 of file scsi_enc_ses.c.

Typedef Documentation

◆ ses_add_data_t

◆ ses_add_status_t

◆ ses_cache_t

typedef struct ses_cache ses_cache_t

◆ ses_comstat_t

typedef struct ses_comstat ses_comstat_t

◆ ses_control_reqlist_t

typedef struct ses_control_reqlist ses_control_reqlist_t

Definition at line 124 of file scsi_enc_ses.c.

◆ ses_control_request_t

◆ ses_devid_callback_t

typedef void ses_devid_callback_t(enc_softc_t *, enc_element_t *, struct scsi_vpd_id_descriptor *, void *)

Function signature for consumers of the ses_devids_iter() interface.

Definition at line 803 of file scsi_enc_ses.c.

◆ ses_element_t

typedef struct ses_element ses_element_t

◆ ses_path_callback_t

typedef void ses_path_callback_t(enc_softc_t *, enc_element_t *, struct cam_path *, void *)

Function signature for consumers of the ses_paths_iter() interface.

Definition at line 854 of file scsi_enc_ses.c.

◆ ses_path_iter_args_t

◆ ses_setphyspath_callback_args_t

Argument package passed through ses_paths_iter() to ses_getcampath_callback.

◆ ses_softc_t

typedef struct ses_softc ses_softc_t

◆ ses_type_t

typedef struct ses_type ses_type_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SES_SETSTATUS_ENC_IDX 

Definition at line 125 of file scsi_enc_ses.c.

◆ ses_addlstatus_avail_t

Enumerator
TYPE_ADDLSTATUS_NONE 

The enclosure should not provide additional element status for this element type in page 0x0A.

Note
This status is returned for any types not listed SES3r02. Further types added in a future specification will be incorrectly classified.
TYPE_ADDLSTATUS_MANDATORY 

The element type provides additional element status in page 0x0A.

TYPE_ADDLSTATUS_OPTIONAL 

The element type may provide additional element status in page 0x0A, but i

Definition at line 1633 of file scsi_enc_ses.c.

◆ ses_elem_index_type_t

Element index types tracked by a SES iterator.

Enumerator
SES_ELEM_INDEX_GLOBAL 

Index relative to all elements (overall and individual) in the system.

SES_ELEM_INDEX_INDIVIDUAL 

Index relative to all individual elements in the system.

This index counts only individual elements, skipping overall status elements. This is the index space of the additional element status page (page 0xa).

Definition at line 487 of file scsi_enc_ses.c.

◆ ses_iter_index_values

Enumerator
ITERATOR_INDEX_INVALID 

Value of an initialized but invalid index in a ses_iterator object.

This value is used for the individual_element_index of overal status elements and for all index types when an iterator is first initialized.

ITERATOR_INDEX_END 

Value of an index in a ses_iterator object when the iterator has traversed past the last valid element..

Definition at line 141 of file scsi_enc_ses.c.

◆ ses_update_action

Enumerator
SES_UPDATE_NONE 
SES_UPDATE_PAGES 
SES_UPDATE_GETCONFIG 
SES_UPDATE_GETSTATUS 
SES_UPDATE_GETELMDESCS 
SES_UPDATE_GETELMADDLSTATUS 
SES_PROCESS_CONTROL_REQS 
SES_PUBLISH_PHYSPATHS 
SES_PUBLISH_CACHE 
SES_NUM_UPDATE_STATES 

Definition at line 241 of file scsi_enc_ses.c.

◆ SesDiagPageCodes

Enumerator
SesSupportedPages 
SesConfigPage 
SesControlPage 
SesStatusPage 
SesHelpTxt 
SesStringOut 
SesStringIn 
SesThresholdOut 
SesThresholdIn 
SesArrayControl 
SesArrayStatus 
SesElementDescriptor 
SesShortStatus 
SesEnclosureBusy 
SesAddlElementStatus 

Definition at line 65 of file scsi_enc_ses.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD: head/sys/cam/scsi/scsi_enc_ses.c 352201 2019-09-11 03:25:30Z mav $"  )

◆ ses_cache_clone()

static void ses_cache_clone ( enc_softc_t enc,
enc_cache_t src,
enc_cache_t dst 
)
static

Definition at line 689 of file scsi_enc_ses.c.

References enc_cache::elm_map, enc_element::elm_private, enc_cache::nelms, enc_cache::private, and ses_cache_free().

Referenced by ses_publish_cache().

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

◆ ses_cache_free()

static void ses_cache_free ( enc_softc_t enc,
enc_cache_t cache 
)
static

Definition at line 659 of file scsi_enc_ses.c.

References ses_cache::cfg_page, ENC_DLOG, ENC_FREE, enc_other_cache(), enc_cache::private, ses_cache_free_elm_addlstatus(), ses_cache_free_elm_map(), ses_cache_free_status(), ses_cache::ses_ntypes, ses_cache::ses_types, and ses_cache::subencs.

Referenced by ses_cache_clone(), ses_process_config(), ses_process_status(), and ses_softc_cleanup().

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

◆ ses_cache_free_elm_addlstatus()

static void ses_cache_free_elm_addlstatus ( enc_softc_t enc,
enc_cache_t cache 
)
static

Definition at line 558 of file scsi_enc_ses.c.

References ses_element::addl, ses_cache::elm_addlstatus_page, enc_cache::elm_map, enc_element::elm_private, ENC_DLOG, ENC_FREE, enc_other_cache(), enc_cache::nelms, and enc_cache::private.

Referenced by ses_cache_free(), ses_cache_free_elm_map(), and ses_process_elm_addlstatus().

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

◆ ses_cache_free_elm_descs()

static void ses_cache_free_elm_descs ( enc_softc_t enc,
enc_cache_t cache 
)
static

Definition at line 589 of file scsi_enc_ses.c.

References ses_element::descr, ses_element::descr_len, ses_cache::elm_descs_page, enc_cache::elm_map, enc_element::elm_private, ENC_DLOG, ENC_FREE, enc_other_cache(), enc_cache::nelms, and enc_cache::private.

Referenced by ses_cache_free_elm_map(), and ses_process_elm_descs().

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

◆ ses_cache_free_elm_map()

static void ses_cache_free_elm_map ( enc_softc_t enc,
enc_cache_t cache 
)
static

Definition at line 636 of file scsi_enc_ses.c.

References enc_cache::elm_map, enc_element::elm_private, ENC_DLOG, ENC_FREE_AND_NULL, enc_cache::nelms, ses_cache_free_elm_addlstatus(), and ses_cache_free_elm_descs().

Referenced by ses_cache_free().

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

◆ ses_cache_free_status()

static void ses_cache_free_status ( enc_softc_t enc,
enc_cache_t cache 
)
static

Definition at line 619 of file scsi_enc_ses.c.

References ENC_DLOG, ENC_FREE, enc_other_cache(), enc_cache::private, and ses_cache::status_page.

Referenced by ses_cache_free(), and ses_process_status().

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

◆ ses_config_cache_valid()

static int ses_config_cache_valid ( ses_cache_t ses_cache,
const uint8_t *  gen_code 
)
static

Verify that the cached configuration data in our softc is valid for processing the page data corresponding to the provided page header.

Parameters
ses_cacheThe SES cache to validate.
gen_codeThe 4 byte generation code from a SES diagnostic page header.
Returns
non-zero if true, 0 if false.

Definition at line 787 of file scsi_enc_ses.c.

References ses_cache::cfg_page, ses_page_hdr::gen_code, ses_cfg_page::hdr, and scsi_4btoul().

Referenced by ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), and ses_process_status().

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

◆ ses_device_found()

static void ses_device_found ( enc_softc_t enc)
static

Notification received when CAM detects a new device in the SCSI domain in which this SEP resides.

Parameters
encSES enclosure instance.

Definition at line 2943 of file scsi_enc_ses.c.

References enc_update_request(), ses_poll_status(), and SES_PUBLISH_PHYSPATHS.

Here is the call graph for this function:

◆ ses_devids_iter()

static void ses_devids_iter ( enc_softc_t enc,
enc_element_t elm,
ses_devid_callback_t callback,
void *  callback_arg 
)
static

Iterate over and create vpd device id records from the additional element status data for elm, passing that data to the provided callback.

Parameters
encSES instance containing elm
elmElement for which to extract device ID data.
callbackThe callback function to invoke on each generated device id descriptor for elm.
callback_argArgument passed through to callback on each invocation.

Definition at line 818 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_sas_hdr::base_hdr, enc_element::elm_private, scsi_vpd_id_descriptor::id_type, scsi_vpd_id_descriptor::identifier, scsi_vpd_id_descriptor::length, ses_elm_sas_base_hdr::num_phys, ses_elm_sas_device_phy::phy_addr, scsi_vpd_id_descriptor::proto_codeset, ses_addl_status::proto_data, ses_addl_status::proto_hdr, scsi_vpd_id_descriptor::reserved, ses_addl_status::sas, ses_addl_data::sasdev_phys, SCSI_PROTO_SAS, SVPD_DEVICE_ID_DESC_HDR_LEN, SVPD_ID_ASSOC_PORT, SVPD_ID_CODESET_BINARY, SVPD_ID_PIV, SVPD_ID_PROTO_SHIFT, and SVPD_ID_TYPE_NAA.

Referenced by ses_paths_iter().

Here is the caller graph for this function:

◆ ses_elm_addlstatus_eip()

int ses_elm_addlstatus_eip ( struct ses_elm_addlstatus_base_hdr hdr)

Definition at line 745 of file scsi_enc_ses.c.

Referenced by ses_print_addl_data_sas_type0(), and ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ ses_elm_addlstatus_invalid()

int ses_elm_addlstatus_invalid ( struct ses_elm_addlstatus_base_hdr hdr)

Definition at line 750 of file scsi_enc_ses.c.

Referenced by ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ ses_elm_addlstatus_proto()

int ses_elm_addlstatus_proto ( struct ses_elm_addlstatus_base_hdr hdr)

Definition at line 740 of file scsi_enc_ses.c.

Referenced by ses_print_addl_data(), and ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ ses_elm_sas_descr_type()

int ses_elm_sas_descr_type ( union ses_elm_sas_hdr obj)

Definition at line 735 of file scsi_enc_ses.c.

Referenced by ses_get_elm_addlstatus_sas(), and ses_print_addl_data().

Here is the caller graph for this function:

◆ ses_elm_sas_dev_phy_dev_type()

int ses_elm_sas_dev_phy_dev_type ( struct ses_elm_sas_device_phy phy)

Definition at line 770 of file scsi_enc_ses.c.

Referenced by ses_print_addl_data_sas_type0().

Here is the caller graph for this function:

◆ ses_elm_sas_dev_phy_sata_dev()

int ses_elm_sas_dev_phy_sata_dev ( struct ses_elm_sas_device_phy phy)

Definition at line 760 of file scsi_enc_ses.c.

Referenced by ses_print_addl_data_sas_type0().

Here is the caller graph for this function:

◆ ses_elm_sas_dev_phy_sata_port()

int ses_elm_sas_dev_phy_sata_port ( struct ses_elm_sas_device_phy phy)

Definition at line 765 of file scsi_enc_ses.c.

◆ ses_elm_sas_type0_not_all_phys()

int ses_elm_sas_type0_not_all_phys ( union ses_elm_sas_hdr hdr)

Definition at line 755 of file scsi_enc_ses.c.

Referenced by ses_print_addl_data_sas_type0().

Here is the caller graph for this function:

◆ ses_elmdevname_callback()

static void ses_elmdevname_callback ( enc_softc_t enc,
enc_element_t elem,
struct cam_path path,
void *  arg 
)
static

ses_paths_iter() callback function used by ses_get_elmdevname() to record periph driver instance strings corresponding to a SES element.

Parameters
encSES instance containing elm
elmElement on which periph matching is active.
periphA periph instance that matches elm.
argArgument passed through to callback on each invocation.

Definition at line 997 of file scsi_enc_ses.c.

References cam_periph_list().

Referenced by ses_get_elm_devnames(), and ses_print_addl_data().

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

◆ ses_encode()

static int ses_encode ( enc_softc_t enc,
uint8_t *  buf,
int  amt,
ses_control_request_t req 
)
static

Encode the object status into the response buffer, which is expected to contain the current enclosure status. This function turns off all the 'select' bits for the objects except for the object specified, then sends it back to the enclosure.

Parameters
encSES enclosure the change is being applied to.
bufBuffer containing the current enclosure status response.
amtLength of the response in the buffer.
reqThe control request to be applied to buf.
Returns
0 on success, errno otherwise.

Definition at line 2114 of file scsi_enc_ses.c.

References ses_comstat::comstat, ses_comstat::comstatus, ses_control_page_hdr::control_flags, ses_control_request::elm_idx, ses_control_request::elm_stat, enc_softc::enc_cache, ENC_DLOG, SES_ELEM_INDEX_GLOBAL, ses_iter_init(), ses_iter_seek_to(), and SES_SET_STATUS_MASK.

Here is the call graph for this function:

◆ ses_fill_control_request()

static int ses_fill_control_request ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t *  buf 
)
static

Definition at line 2160 of file scsi_enc_ses.c.

References ses_control_page_hdr::control_flags, enc_softc::enc_daemon_cache, enc_softc::enc_private, ses_status_page::hdr, enc_cache::private, SES_ENCSTAT_INVOP, ses_page_length(), ses_softc::ses_pending_requests, ses_softc::ses_requests, ses_terminate_control_requests(), SESCTL_CSEL, and ses_cache::status_page.

Here is the call graph for this function:

◆ ses_fill_rcv_diag_io()

static int ses_fill_rcv_diag_io ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t *  buf 
)
static

Definition at line 2082 of file scsi_enc_ses.c.

References ccb::ataio, enc_fsm_state::buf_size, ccb::csio, ENC_SEMB_SES, enc_softc::enc_type, MSG_SIMPLE_Q_TAG, enc_fsm_state::page_code, scsi_receive_diagnostic_results(), semb_receive_diagnostic_results(), SSD_FULL_SIZE, and enc_fsm_state::timeout.

Here is the call graph for this function:

◆ ses_get_elm_addlstatus_ata()

static int ses_get_elm_addlstatus_ata ( enc_softc_t enc,
enc_cache_t enc_cache,
uint8_t *  buf,
int  bufsiz,
int  eip,
int  tidx,
int  nobj 
)
static

Update the softc with the additional element status data for this object, for ATA objects.

Parameters
encSES softc to be updated.
bufThe additional element status response buffer.
bufsizSize of the response buffer.
eipThe EIP bit value.
tidxType index for this object.
nobjNumber of objects attached to the SES softc.
Returns
0 on success, errno otherwise.

Definition at line 2659 of file scsi_enc_ses.c.

References enc_cache::elm_map, enc_element::elm_private, ELMTYP_ARRAY_DEV, ELMTYP_DEVICE, ENC_VLOG, ses_elm_type_desc::etype_elm_type, ses_type::hdr, enc_cache::private, and ses_cache::ses_types.

Referenced by ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ ses_get_elm_addlstatus_fc()

static int ses_get_elm_addlstatus_fc ( enc_softc_t enc,
enc_cache_t enc_cache,
uint8_t *  buf,
int  bufsiz 
)
static

Definition at line 2227 of file scsi_enc_ses.c.

References ENC_VLOG.

Referenced by ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ ses_get_elm_addlstatus_sas()

static int ses_get_elm_addlstatus_sas ( enc_softc_t enc,
enc_cache_t enc_cache,
uint8_t *  buf,
int  bufsiz,
int  eip,
int  tidx,
int  nobj 
)
static

Update the softc with the additional element status data for this object, for SAS objects.

Parameters
encSES softc to be updated.
bufThe additional element status response buffer.
bufsizSize of the response buffer.
eipThe EIP bit value.
tidxType index for this object.
nobjNumber of objects attached to the SES softc.
Returns
0 on success, errno otherwise.

Definition at line 2581 of file scsi_enc_ses.c.

References ELMTYP_ARRAY_DEV, ELMTYP_DEVICE, ELMTYP_ESCC, ELMTYP_SAS_EXP, ELMTYP_SCSI_INI, ELMTYP_SCSI_TGT, ENC_VLOG, ses_elm_type_desc::etype_elm_type, ses_type::hdr, enc_cache::private, ses_elm_sas_descr_type(), ses_get_elm_addlstatus_sas_type0(), ses_get_elm_addlstatus_sas_type1(), SES_SASOBJ_TYPE_OTHER, SES_SASOBJ_TYPE_SLOT, and ses_cache::ses_types.

Referenced by ses_process_elm_addlstatus().

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

◆ ses_get_elm_addlstatus_sas_type0()

static int ses_get_elm_addlstatus_sas_type0 ( enc_softc_t enc,
enc_cache_t enc_cache,
uint8_t *  buf,
int  bufsiz,
int  eip,
int  nobj 
)
static

Update the softc with the additional element status data for this object, for SAS type 0 objects.

Parameters
encSES softc to be updated.
bufThe additional element status response buffer.
bufsizSize of the response buffer.
eipThe EIP bit value.
nobjNumber of objects attached to the SES softc.
Returns
0 on success, errno otherwise.

Definition at line 2455 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_sas_hdr::base_hdr, enc_cache::elm_map, enc_element::elm_private, ENC_VLOG, ses_elm_sas_base_hdr::num_phys, ses_addl_status::proto_data, ses_addl_status::proto_hdr, ses_addl_status::sas, and ses_addl_data::sasdev_phys.

Referenced by ses_get_elm_addlstatus_sas().

Here is the caller graph for this function:

◆ ses_get_elm_addlstatus_sas_type1()

static int ses_get_elm_addlstatus_sas_type1 ( enc_softc_t enc,
enc_cache_t enc_cache,
uint8_t *  buf,
int  bufsiz,
int  eip,
int  nobj 
)
static

Update the softc with the additional element status data for this object, for SAS type 1 objects.

Parameters
encSES softc to be updated.
bufThe additional element status response buffer.
bufsizSize of the response buffer.
eipThe EIP bit value.
nobjNumber of objects attached to the SES softc.
Returns
0 on success, errno otherwise.

Definition at line 2514 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_sas_hdr::base_hdr, enc_cache::elm_map, enc_element::elm_private, enc_element::elm_type, ELMTYP_SAS_EXP, ENC_VLOG, ses_elm_sas_base_hdr::num_phys, ses_addl_status::proto_data, ses_addl_status::proto_hdr, ses_addl_status::sas, ses_addl_data::sasexp_phys, and ses_addl_data::sasport_phys.

Referenced by ses_get_elm_addlstatus_sas().

Here is the caller graph for this function:

◆ ses_get_elm_desc()

◆ ses_get_elm_devnames()

static int ses_get_elm_devnames ( enc_softc_t enc,
encioc_elm_devnames_t elmdn 
)
static

Respond to ENCIOC_GETELMDEVNAME, providing a device name for the given object id if one is available.

Parameters
encSES softc to examine.
objdnioctl structure to read/write device name info.
Returns
0 on success, errno otherwise.

Definition at line 2801 of file scsi_enc_ses.c.

References cam_periph_lock, cam_periph_unlock, encioc_elm_devnames::elm_devnames, encioc_elm_devnames::elm_idx, enc_cache::elm_map, encioc_elm_devnames::elm_names_len, encioc_elm_devnames::elm_names_size, enc_softc::enc_cache, enc_softc::periph, ses_elmdevname_callback(), and ses_paths_iter().

Here is the call graph for this function:

◆ ses_get_elm_status()

static int ses_get_elm_status ( enc_softc_t enc,
encioc_elm_status_t elms,
int  slpflag 
)
static

◆ ses_get_enc_status()

static int ses_get_enc_status ( enc_softc_t enc,
int  slpflag 
)
static

Definition at line 2719 of file scsi_enc_ses.c.

◆ ses_handle_string()

static int ses_handle_string ( enc_softc_t enc,
encioc_string_t sstr,
int  ioc 
)
static

Send a string to the primary subenclosure using the String Out SES diagnostic page.

Parameters
encSES enclosure to run the command on.
sstrSES string structure to operate on
iocIoctl being performed
Returns
0 on success, errno otherwise.

Definition at line 2833 of file scsi_enc_ses.c.

References encioc_string::buf, encioc_string::bufsiz, CAM_DIR_IN, CAM_DIR_OUT, cam_strvis(), enc_softc::enc_daemon_cache, ENC_FREE, ENC_MALLOC, enc_softc::enc_private, enc_runcmd(), ENCIOC_GETENCID, ENCIOC_GETENCNAME, ENCIOC_GETSTRING, ENCIOC_SETSTRING, ses_enc_desc::logical_id, enc_cache::private, ses_enc_desc::product_id, ses_enc_desc::product_rev, scsi_8btou64(), ses_cache::ses_nsubencs, ses_page_cdb(), SesStringIn, SesStringOut, ses_cache::subencs, and ses_enc_desc::vendor_id.

Here is the call graph for this function:

◆ ses_init_enc()

static int ses_init_enc ( enc_softc_t enc)
static

Definition at line 2713 of file scsi_enc_ses.c.

◆ ses_iter_init()

static void ses_iter_init ( enc_softc_t enc,
enc_cache_t cache,
struct ses_iterator iter 
)
static

Initialize the storage of a SES iterator and reset it to the position just before the first element of the configuration.

Parameters
encThe SES softc for the SES instance whose configuration will be enumerated by this iterator.
iterThe iterator object to initialize.

Definition at line 412 of file scsi_enc_ses.c.

References ses_iterator::cache, ses_iterator::enc, and ses_iter_reset().

Referenced by ses_encode(), ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), ses_process_status(), and ses_publish_physpaths().

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

◆ ses_iter_next()

static enc_element_t* ses_iter_next ( struct ses_iterator iter)
static

Traverse the provided SES iterator to the next element within the configuraiton.

Parameters
iterThe iterator to move.
Returns
If a valid next element exists, a pointer to it's enc_element_t. Otherwise NULL.

Definition at line 429 of file scsi_enc_ses.c.

References ses_iterator::cache, enc_cache::elm_map, ses_elm_type_desc::etype_maxelt, ses_iterator::global_element_index, ses_type::hdr, ses_iterator::individual_element_index, ITERATOR_INDEX_END, ITERATOR_INDEX_INVALID, enc_cache::nelms, enc_cache::private, ses_iterator::saved_individual_element_index, ses_cache::ses_ntypes, ses_cache::ses_types, ses_iterator::type_element_index, and ses_iterator::type_index.

Referenced by ses_iter_seek_to(), ses_process_config(), ses_process_elm_addlstatus(), ses_process_elm_descs(), ses_process_status(), and ses_publish_physpaths().

Here is the caller graph for this function:

◆ ses_iter_reset()

static void ses_iter_reset ( struct ses_iterator iter)
static

Reset a SES iterator to just before the first element in the configuration.

Parameters
iterThe iterator object to reset.

The indexes within a reset iterator are invalid and will only become valid upon completion of a ses_iter_seek_to() or a ses_iter_next().

Definition at line 388 of file scsi_enc_ses.c.

References ses_iterator::global_element_index, ses_iterator::individual_element_index, ITERATOR_INDEX_INVALID, ses_iterator::saved_individual_element_index, ses_iterator::type_element_index, and ses_iterator::type_index.

Referenced by ses_iter_init(), and ses_iter_seek_to().

Here is the caller graph for this function:

◆ ses_iter_seek_to()

static enc_element_t* ses_iter_seek_to ( struct ses_iterator iter,
int  element_index,
ses_elem_index_type_t  index_type 
)
static

Move the provided iterator forwards or backwards to the object having the give index.

Parameters
iterThe iterator on which to perform the seek.
element_indexThe index of the element to find.
index_typeThe type (global or individual) of element_index.
Returns
If the element is found, a pointer to it's enc_element_t. Otherwise NULL.

Definition at line 516 of file scsi_enc_ses.c.

References ses_iterator::cache, enc_cache::elm_map, ses_iterator::global_element_index, ses_iterator::individual_element_index, SES_ELEM_INDEX_GLOBAL, ses_iter_next(), and ses_iter_reset().

Referenced by ses_encode(), and ses_process_elm_addlstatus().

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

◆ ses_page_cdb()

static void ses_page_cdb ( char *  cdb,
int  bufsiz,
SesDiagPageCodes  pagenum,
int  dir 
)
static

Helper to set the CDB fields appropriately.

Parameters
cdbBuffer containing the cdb.
pagenumSES diagnostic page to query for.
dirDirection of query.

Definition at line 1162 of file scsi_enc_ses.c.

References CAM_DIR_IN, RECEIVE_DIAGNOSTIC, and SEND_DIAGNOSTIC.

Referenced by ses_handle_string().

Here is the caller graph for this function:

◆ ses_path_iter_devid_callback()

static void ses_path_iter_devid_callback ( enc_softc_t enc,
enc_element_t elem,
struct scsi_vpd_id_descriptor devid,
void *  arg 
)
static

ses_devids_iter() callback function used by ses_paths_iter() to map device ids to peripheral driver instances.

Parameters
encSES instance containing elm
elmElement on which device ID matching is active.
periphA device ID corresponding to elm.
argArgument passed through to callback on each invocation.

Definition at line 876 of file scsi_enc_ses.c.

References ses_path_iter_args::callback, ses_path_iter_args::callback_arg, CAM_DEV_MATCH_LAST, CAM_DEV_MATCH_MORE, CAM_LUN_WILDCARD, CAM_REQ_CMP, CAM_STATUS_MASK, CAM_TARGET_WILDCARD, CAM_XPT_PATH_ID, ccb_dev_match::ccb_h, ccb::ccb_h, device_match_pattern::data, DEV_MATCH_DEVICE, DEV_MATCH_DEVID, match_pattern::device_pattern, match_result::device_result, device_match_pattern::devid_pat, device_match_pattern::flags, ccb_hdr::func_code, device_id_match_pattern::id, device_id_match_pattern::id_len, scsi_vpd_id_descriptor::length, ccb_dev_match::match_buf_len, ccb_dev_match::matches, ccb_dev_match::num_patterns, ccb_hdr::path, device_match_result::path_id, ccb_dev_match::pattern_buf_len, ccb_dev_match::patterns, ccb_hdr::status, ccb_dev_match::status, device_match_result::target_id, device_match_result::target_lun, xpt_action(), xpt_create_path(), XPT_DEV_MATCH, and xpt_free_path().

Referenced by ses_paths_iter().

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

◆ ses_paths_iter()

static void ses_paths_iter ( enc_softc_t enc,
enc_element_t elm,
ses_path_callback_t callback,
void *  callback_arg 
)
static

Iterate over and find the matching periph objects for the specified element.

Parameters
encSES instance containing elm
elmElement for which to perform periph object matching.
callbackThe callback function to invoke with each matching periph object.
callback_argArgument passed through to callback on each invocation.

Definition at line 947 of file scsi_enc_ses.c.

References ses_element::addl, ses_addl_status::ata, ses_elm_ata_hdr::bus, ses_path_iter_args::callback, ses_path_iter_args::callback_arg, CAM_PRIORITY_NORMAL, CAM_REQ_CMP, ccb_getdev::ccb_h, ccb::ccb_h, enc_element::elm_private, ccb_hdr::func_code, ses_addl_status::hdr, ses_addl_status::proto_data, ses_addl_status::proto_hdr, ses_addl_status::sas, ses_addl_data::sasdev_phys, scsi_4btoul(), ses_devids_iter(), ses_path_iter_devid_callback(), ccb_hdr::status, ses_elm_ata_hdr::target, xpt_action(), xpt_create_path(), xpt_free_path(), XPT_GDEV_TYPE, and xpt_setup_ccb().

Referenced by ses_get_elm_devnames(), ses_print_addl_data(), and ses_set_physpath().

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

◆ ses_poll_status()

static void ses_poll_status ( enc_softc_t enc)
static
Invariant
Called with cam_periph mutex held.

Definition at line 2924 of file scsi_enc_ses.c.

References enc_softc::enc_private, enc_update_request(), SES_FLAG_ADDLSTATUS, SES_FLAG_DESC, ses_softc::ses_flags, SES_UPDATE_GETELMADDLSTATUS, SES_UPDATE_GETELMDESCS, and SES_UPDATE_GETSTATUS.

Referenced by ses_device_found(), ses_process_config(), and ses_process_control_request().

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

◆ ses_print_addl_data()

static void ses_print_addl_data ( enc_softc_t enc,
enc_element_t obj 
)
static

Print the additional element status data for this object.

Parameters
encSES softc associated with the object.
objThe object to print the data for.

Definition at line 2370 of file scsi_enc_ses.c.

References ses_addl_status::ata, enc_element::elm_private, enc_element::elm_type, elm_type_names, ELMTYP_LAST, ses_addl_status::hdr, enc_softc::periph, cam_periph::periph_name, ses_addl_status::proto_hdr, ses_addl_status::sas, ses_elm_addlstatus_proto(), ses_elm_sas_descr_type(), ses_elmdevname_callback(), ses_paths_iter(), ses_print_addl_data_ata(), ses_print_addl_data_sas_type0(), ses_print_addl_data_sas_type1(), SES_SASOBJ_TYPE_OTHER, SES_SASOBJ_TYPE_SLOT, SPSP_PROTO_ATA, SPSP_PROTO_FC, SPSP_PROTO_SAS, enc_element::subenclosure, enc_element::type_elm_idx, and cam_periph::unit_number.

Referenced by ses_publish_physpaths().

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

◆ ses_print_addl_data_ata()

static void ses_print_addl_data_ata ( struct sbuf *  sbp,
enc_element_t obj 
)
static

Print the additional element status data for this object, for ATA objects.

Parameters
sbpSbuf to print to.
objThe object to print the data for.

Definition at line 2353 of file scsi_enc_ses.c.

References ses_element::addl, ses_addl_status::ata, ses_elm_ata_hdr::bus, enc_element::elm_private, ses_addl_status::proto_hdr, scsi_4btoul(), and ses_elm_ata_hdr::target.

Referenced by ses_print_addl_data().

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

◆ ses_print_addl_data_sas_type0()

static void ses_print_addl_data_sas_type0 ( char *  sesname,
struct sbuf *  sbp,
enc_element_t obj 
)
static

Print the additional element status data for this object, for SAS type 0 objects. See SES2 r20 Section 6.1.13.3.2.

Parameters
sesnameSES device name associated with the object.
sbpSbuf to print to.
objThe object to print the data for.

Definition at line 2256 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_sas_hdr::base_hdr, ses_elm_sas_type0_eip_hdr::dev_slot_num, enc_element::elm_private, ses_addl_status::hdr, ses_elm_sas_device_phy::initiator_ports, ses_elm_sas_base_hdr::num_phys, ses_elm_sas_device_phy::parent_addr, ses_elm_sas_device_phy::phy_addr, ses_elm_sas_device_phy::phy_id, ses_addl_status::proto_data, ses_addl_status::proto_hdr, ses_addl_status::sas, ses_addl_data::sasdev_phys, scsi_8btou64(), ses_elm_addlstatus_eip(), ses_elm_sas_dev_phy_dev_type(), ses_elm_sas_dev_phy_sata_dev(), ses_elm_sas_type0_not_all_phys(), SES_PRINT_PORTS, ses_elm_sas_device_phy::target_ports, and ses_elm_sas_hdr::type0_eip.

Referenced by ses_print_addl_data().

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

◆ ses_print_addl_data_sas_type1()

static void ses_print_addl_data_sas_type1 ( char *  sesname,
struct sbuf *  sbp,
enc_element_t obj 
)
static

Print the additional element status data for this object, for SAS type 1 objects. See SES2 r20 Sections 6.1.13.3.3 and 6.1.13.3.4.

Parameters
sesnameSES device name associated with the object.
sbpSbuf to print to.
objThe object to print the data for.

Definition at line 2305 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_sas_hdr::base_hdr, ses_elm_sas_expander_phy::connector_index, ses_elm_sas_port_phy::connector_index, enc_element::elm_private, enc_element::elm_type, ELMTYP_SAS_EXP, ses_elm_sas_base_hdr::num_phys, ses_elm_sas_expander_phy::other_index, ses_elm_sas_port_phy::other_index, ses_elm_sas_port_phy::phy_addr, ses_elm_sas_port_phy::phy_id, ses_addl_status::proto_data, ses_addl_status::proto_hdr, ses_addl_status::sas, ses_addl_data::sasexp_phys, ses_addl_data::sasport_phys, and scsi_8btou64().

Referenced by ses_print_addl_data().

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

◆ ses_process_config()

static int ses_process_config ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Process the config page and update associated structures.

Parameters
encSES device to query.
bufBuffer containing the config page.
xfer_lenLength of the config page in the buffer.
Returns
0 on success, errno otherwise.

Definition at line 1325 of file scsi_enc_ses.c.

References ses_enc_desc::byte0, CAM_DEBUG, CAM_DEBUG_SUBTRACE, ses_cache::cfg_page, enc_element::elm_idx, enc_cache::elm_map, enc_element::elm_private, enc_element::elm_type, enc_softc::enc_daemon_cache, ENC_DLOG, enc_softc::enc_private, enc_update_request(), ENC_VLOG, ses_elm_type_desc::etype_elm_type, ses_elm_type_desc::etype_maxelt, ses_elm_type_desc::etype_subenc, ses_elm_type_desc::etype_txt_len, ses_page_hdr::gen_code, ses_iterator::global_element_index, ses_type::hdr, ses_cfg_page::hdr, ses_enc_desc::length, ses_enc_desc::logical_id, enc_cache::nelms, ses_enc_desc::num_types, cam_periph::path, enc_softc::periph, enc_cache::private, scsi_4btoul(), scsi_8btou64(), ses_cache_free(), ses_cfg_page_get_num_subenc(), ses_config_cache_valid(), ses_enc_desc_is_complete(), ses_enc_desc_next(), ses_iter_init(), ses_iter_next(), ses_cache::ses_nsubencs, ses_cache::ses_ntypes, ses_page_length(), ses_poll_status(), SES_PUBLISH_CACHE, ses_cache::ses_types, ses_enc_desc::subenc_id, enc_element::subenclosure, ses_cfg_page::subencs, ses_cache::subencs, ses_type::text, ses_iterator::type_element_index, enc_element::type_elm_idx, and ses_iterator::type_index.

Here is the call graph for this function:

◆ ses_process_control_request()

static int ses_process_control_request ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Definition at line 1926 of file scsi_enc_ses.c.

References enc_softc::enc_private, ses_softc::ses_pending_requests, ses_poll_status(), and ses_terminate_control_requests().

Here is the call graph for this function:

◆ ses_process_elm_addlstatus()

static int ses_process_elm_addlstatus ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Parse the additional status element data for each object.

Parameters
encThe SES softc to update.
bufThe buffer containing the additional status element response.
xfer_lenSize of the buffer.
Returns
0 on success, errno otherwise.

Definition at line 1710 of file scsi_enc_ses.c.

References ses_element::addl, ses_elm_addlstatus_base_hdr::byte0, ses_elm_addlstatus_eip_hdr::byte2, ses_elm_addlstatus_eip_hdr::element_index, ses_cache::elm_addlstatus_page, enc_element::elm_private, enc_softc::enc_daemon_cache, ENC_DLOG, enc_update_request(), ENC_VLOG, ses_page_hdr::gen_code, ses_iterator::global_element_index, ses_addl_status::hdr, ses_addl_elem_status_page::hdr, ses_iterator::individual_element_index, ITERATOR_INDEX_INVALID, ses_page_hdr::length, ses_elm_addlstatus_base_hdr::length, enc_cache::private, SES_ADDL_EIP_EIIOE, ses_cache_free_elm_addlstatus(), ses_config_cache_valid(), SES_EIP_HDR_EXTRA_LEN, SES_ELEM_INDEX_GLOBAL, SES_ELEM_INDEX_INDIVIDUAL, ses_elm_addlstatus_eip(), ses_elm_addlstatus_invalid(), ses_elm_addlstatus_proto(), ses_get_elm_addlstatus_ata(), ses_get_elm_addlstatus_fc(), ses_get_elm_addlstatus_sas(), ses_iter_init(), ses_iter_next(), ses_iter_seek_to(), ses_page_length(), SES_PUBLISH_CACHE, SES_PUBLISH_PHYSPATHS, ses_typehasaddlstatus(), SES_UPDATE_GETCONFIG, SPSP_PROTO_ATA, SPSP_PROTO_FC, SPSP_PROTO_SAS, TYPE_ADDLSTATUS_MANDATORY, TYPE_ADDLSTATUS_NONE, TYPE_ADDLSTATUS_OPTIONAL, ses_iterator::type_element_index, and ses_iterator::type_index.

Here is the call graph for this function:

◆ ses_process_elm_descs()

static int ses_process_elm_descs ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Parse the descriptors for each object.

Parameters
encThe SES softc to update.
bufThe buffer containing the descriptor list response.
xfer_lenSize of the buffer.
Returns
0 on success, errno otherwise.

Definition at line 1990 of file scsi_enc_ses.c.

References ses_element::descr, ses_element::descr_len, ses_cache::elm_descs_page, enc_softc::enc_daemon_cache, ENC_DLOG, enc_softc::enc_private, enc_update_request(), ENC_VLOG, ses_page_hdr::gen_code, ses_iterator::global_element_index, ses_elem_descr_page::hdr, ses_elm_desc_hdr::length, enc_cache::private, scsi_2btoul(), ses_cache_free_elm_descs(), ses_config_cache_valid(), SES_FLAG_ADDLSTATUS, ses_softc::ses_flags, ses_iter_init(), ses_iter_next(), ses_page_length(), SES_PUBLISH_CACHE, SES_UPDATE_GETCONFIG, SES_UPDATE_GETELMADDLSTATUS, ses_iterator::type_element_index, and ses_iterator::type_index.

Here is the call graph for this function:

◆ ses_process_pages()

static int ses_process_pages ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Process the list of supported pages and update flags.

Parameters
encSES device to query.
bufBuffer containing the config page.
xfer_lenLength of the config page in the buffer.
Returns
0 on success, errno otherwise.

Definition at line 1272 of file scsi_enc_ses.c.

References CAM_DEBUG, CAM_DEBUG_SUBTRACE, ENC_DLOG, enc_softc::enc_private, ENC_VLOG, scsi_diag_page::length, scsi_diag_page::params, cam_periph::path, enc_softc::periph, scsi_2btoul(), SES_FLAG_ADDLSTATUS, SES_FLAG_DESC, ses_softc::ses_flags, SesAddlElementStatus, and SesElementDescriptor.

Here is the call graph for this function:

◆ ses_process_status()

static int ses_process_status ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Update the status page and associated structures.

Parameters
encSES softc to update for.
bufBuffer containing the status page.
bufszAmount of data in the buffer.
Returns
0 on success, errno otherwise.

Definition at line 1524 of file scsi_enc_ses.c.

References ses_status_element::bytes, ses_status_page::elements, enc_softc::enc_daemon_cache, ENC_DLOG, enc_softc::enc_private, enc_cache::enc_status, enc_update_request(), ENC_VLOG, ses_page_hdr::gen_code, ses_iterator::global_element_index, ses_status_page::hdr, ses_page_hdr::page_code, ses_page_hdr::page_specific_flags, enc_cache::private, scsi_4btoul(), ses_cache_free(), ses_cache_free_status(), ses_config_cache_valid(), SES_FLAG_ADDLSTATUS, SES_FLAG_DESC, ses_softc::ses_flags, ses_iter_init(), ses_iter_next(), ses_page_length(), SES_PUBLISH_CACHE, SES_UPDATE_GETCONFIG, SesShortStatus, ses_cache::status_page, ses_iterator::type_element_index, and ses_iterator::type_index.

Here is the call graph for this function:

◆ ses_publish_cache()

static int ses_publish_cache ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Definition at line 1968 of file scsi_enc_ses.c.

References ses_iterator::enc, enc_softc::enc_cache, enc_softc::enc_cache_lock, enc_softc::enc_daemon_cache, and ses_cache_clone().

Here is the call graph for this function:

◆ ses_publish_physpaths()

static int ses_publish_physpaths ( enc_softc_t enc,
struct enc_fsm_state state,
union ccb ccb,
uint8_t **  bufp,
int  error,
int  xfer_len 
)
static

Definition at line 1943 of file scsi_enc_ses.c.

References ses_iterator::enc, enc_softc::enc_daemon_cache, ses_iter_init(), ses_iter_next(), ses_print_addl_data(), and ses_set_physpath().

Here is the call graph for this function:

◆ ses_set_elm_status()

static int ses_set_elm_status ( enc_softc_t enc,
encioc_elm_status_t elms,
int  slpflag 
)
static

Definition at line 2752 of file scsi_enc_ses.c.

References cam_periph_sleep, encioc_elm_status::cstat, ses_control_request::elm_idx, encioc_elm_status::elm_idx, ses_control_request::elm_stat, enc_softc::enc_private, enc_update_request(), enc_softc::periph, ses_control_request::result, SES_PROCESS_CONTROL_REQS, ses_softc::ses_requests, and SESCTL_CSEL.

Here is the call graph for this function:

◆ ses_set_enc_status()

static int ses_set_enc_status ( enc_softc_t enc,
uint8_t  encstat,
int  slpflag 
)
static

Definition at line 2726 of file scsi_enc_ses.c.

References cam_periph_sleep, ses_comstat::comstatus, ses_control_request::elm_idx, ses_control_request::elm_stat, enc_softc::enc_private, enc_update_request(), enc_softc::periph, ses_control_request::result, SES_PROCESS_CONTROL_REQS, ses_softc::ses_requests, and SES_SETSTATUS_ENC_IDX.

Here is the call graph for this function:

◆ ses_set_physpath()

static int ses_set_physpath ( enc_softc_t enc,
enc_element_t elm,
struct ses_iterator iter 
)
static

Set a device's physical path string in CAM XPT.

Parameters
encSES instance containing elm
elmElement to publish physical path string for
iterIterator whose state corresponds to elm
Returns
0 on success, errno otherwise.

Definition at line 1073 of file scsi_enc_ses.c.

References ses_element::addl, ccb_dev_advinfo::buf, ccb_dev_advinfo::bufsiz, ccb_dev_advinfo::buftype, CAM_DEV_QFRZN, cam_periph_lock, cam_periph_unlock, CAM_PRIORITY_NORMAL, cam_release_devq(), CAM_REQ_CMP, CAM_SCSI_DEVID_MAXLEN, ccb_dev_advinfo::ccb_h, ccb::ccb_h, CDAI_FLAG_NONE, CDAI_TYPE_SCSI_DEVID, ses_element::descr, ses_element::descr_len, enc_element::elm_private, ENC_FREE, ccb_dev_advinfo::flags, ccb_hdr::func_code, ses_addl_status::hdr, scsi_vpd_id_descriptor::identifier, cam_periph::path, ccb_hdr::path, enc_softc::periph, scsi_8btou64(), scsi_devid_is_naa_ieee_reg(), scsi_get_devid(), ses_paths_iter(), ses_setphyspath_callback(), ccb_hdr::status, ses_iterator::type_element_index, ses_iterator::type_index, xpt_action(), XPT_DEV_ADVINFO, and xpt_setup_ccb().

Referenced by ses_publish_physpaths().

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

◆ ses_set_timed_completion()

static int ses_set_timed_completion ( enc_softc_t enc,
uint8_t  tc_en 
)
static

Discover whether this instance supports timed completion of a RECEIVE DIAGNOSTIC RESULTS command requesting the Enclosure Status page, and store the result in the softc, updating if necessary.

Parameters
encSES instance to query and update.
tc_enValue of timed completion to set (see
Returns
).
1 if timed completion enabled, 0 otherwise.

Definition at line 1191 of file scsi_enc_ses.c.

References ses_mgmt_mode_page::byte5, cam_periph_getccb(), cam_periph_runccb(), CAM_PRIORITY_NORMAL, CAM_REQ_CMP, ccb::ccb_h, ccb::csio, ENC_CFLAGS, enc_error(), ENC_FLAGS, ENC_FREE, ENC_LOG, ENC_MALLOCZ, enc_softc::enc_private, ENC_VLOG, ses_mgmt_mode_page::max_comp_time, MSG_SIMPLE_Q_TAG, enc_softc::periph, scsi_mode_select(), scsi_mode_sense(), SES_FLAG_TIMEDCOMP, ses_softc::ses_flags, SES_MGMT_MODE_PAGE_CODE, SES_MGMT_TIMED_COMP_EN, SF_QUIET_IR, SMS_PAGE_CTRL_CURRENT, SSD_FULL_SIZE, ccb_hdr::status, and xpt_release_ccb().

Referenced by ses_softc_init().

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

◆ ses_setphyspath_callback()

static void ses_setphyspath_callback ( enc_softc_t enc,
enc_element_t elm,
struct cam_path path,
void *  arg 
)
static

ses_paths_iter() callback to set the physical path on the CAM EDT entries corresponding to a given SES element.

Parameters
encSES instance containing elm
elmElement on which periph matching is active.
periphA periph instance that matches elm.
argArgument passed through to callback on each invocation.

Definition at line 1025 of file scsi_enc_ses.c.

References ccb_dev_advinfo::buf, ccb_dev_advinfo::bufsiz, ccb_dev_advinfo::buftype, CAM_DEV_QFRZN, CAM_PRIORITY_NORMAL, cam_release_devq(), CAM_REQ_CMP, ccb_dev_advinfo::ccb_h, ccb::ccb_h, CDAI_FLAG_NONE, CDAI_FLAG_STORE, CDAI_TYPE_PHYS_PATH, ccb_dev_advinfo::flags, ccb_hdr::func_code, ccb_hdr::path, ccb_hdr::status, xpt_action(), XPT_DEV_ADVINFO, xpt_path_lock, xpt_path_unlock, and xpt_setup_ccb().

Referenced by ses_set_physpath().

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

◆ ses_softc_cleanup()

static void ses_softc_cleanup ( enc_softc_t enc)
static

Definition at line 2702 of file scsi_enc_ses.c.

References enc_softc::enc_cache, enc_softc::enc_daemon_cache, ENC_FREE_AND_NULL, enc_softc::enc_private, enc_cache::private, and ses_cache_free().

Here is the call graph for this function:

◆ ses_softc_init()

int ses_softc_init ( enc_softc_t enc)

Initialize a new SES instance.

Parameters
encSES softc structure to set up the instance in.
doinitDo the initialization (see main driver).
Returns
0 on success, errno otherwise.

Definition at line 2974 of file scsi_enc_ses.c.

References CAM_DEBUG, CAM_DEBUG_SUBTRACE, enc_softc::enc_cache, enc_softc::enc_daemon_cache, ENC_FREE_AND_NULL, enc_softc::enc_fsm_states, enc_fsm_states, ENC_MALLOCZ, enc_softc::enc_private, enc_update_request(), enc_softc::enc_vec, cam_periph::path, enc_softc::periph, enc_cache::private, ses_enc_vec, ses_softc::ses_pending_requests, ses_softc::ses_requests, ses_set_timed_completion(), and SES_UPDATE_PAGES.

Here is the call graph for this function:

◆ ses_softc_invalidate()

static void ses_softc_invalidate ( enc_softc_t enc)
static

Definition at line 2693 of file scsi_enc_ses.c.

References enc_softc::enc_private, ses_softc::ses_requests, and ses_terminate_control_requests().

Here is the call graph for this function:

◆ ses_terminate_control_requests()

static void ses_terminate_control_requests ( ses_control_reqlist_t reqlist,
int  result 
)
static

Definition at line 130 of file scsi_enc_ses.c.

References ses_control_request::result.

Referenced by ses_fill_control_request(), ses_process_control_request(), and ses_softc_invalidate().

Here is the caller graph for this function:

◆ ses_typehasaddlstatus()

static ses_addlstatus_avail_t ses_typehasaddlstatus ( enc_softc_t enc,
uint8_t  typidx 
)
static

Check to see whether a given type (as obtained via type headers) is supported by the additional status command.

Parameters
encSES softc to check.
typidxType index to check for.
Returns
An enumeration indicating if additional status is mandatory, optional, or not required for this type.

Definition at line 1669 of file scsi_enc_ses.c.

References ELMTYP_ARRAY_DEV, ELMTYP_DEVICE, ELMTYP_ESCC, ELMTYP_SAS_EXP, ELMTYP_SCSI_INI, ELMTYP_SCSI_TGT, enc_softc::enc_daemon_cache, ses_elm_type_desc::etype_elm_type, ses_type::hdr, enc_cache::private, ses_cache::ses_types, TYPE_ADDLSTATUS_MANDATORY, TYPE_ADDLSTATUS_NONE, and TYPE_ADDLSTATUS_OPTIONAL.

Referenced by ses_process_elm_addlstatus().

Here is the caller graph for this function:

◆ TAILQ_HEAD()

TAILQ_HEAD ( ses_control_reqlist  ,
ses_control_request   
)

Variable Documentation

◆ enc_fsm_states

struct enc_fsm_state enc_fsm_states[SES_NUM_UPDATE_STATES]
static

Definition at line 269 of file scsi_enc_ses.c.

Referenced by ses_softc_init().

◆ ses_enc_vec

struct enc_vec ses_enc_vec
static
Initial value:
=
{
.softc_invalidate = ses_softc_invalidate,
.softc_cleanup = ses_softc_cleanup,
.init_enc = ses_init_enc,
.get_enc_status = ses_get_enc_status,
.set_enc_status = ses_set_enc_status,
.get_elm_status = ses_get_elm_status,
.set_elm_status = ses_set_elm_status,
.get_elm_desc = ses_get_elm_desc,
.get_elm_devnames = ses_get_elm_devnames,
.handle_string = ses_handle_string,
.device_found = ses_device_found,
.poll_status = ses_poll_status
}
static int ses_get_elm_desc(enc_softc_t *enc, encioc_elm_desc_t *elmd)
static int ses_init_enc(enc_softc_t *enc)
static void ses_poll_status(enc_softc_t *)
static int ses_set_elm_status(enc_softc_t *enc, encioc_elm_status_t *elms, int slpflag)
static int ses_handle_string(enc_softc_t *enc, encioc_string_t *sstr, int ioc)
Send a string to the primary subenclosure using the String Out SES diagnostic page.
static int ses_get_elm_devnames(enc_softc_t *enc, encioc_elm_devnames_t *elmdn)
Respond to ENCIOC_GETELMDEVNAME, providing a device name for the given object id if one is available.
static void ses_softc_invalidate(enc_softc_t *enc)
static int ses_set_enc_status(enc_softc_t *enc, uint8_t encstat, int slpflag)
static void ses_device_found(enc_softc_t *enc)
Notification received when CAM detects a new device in the SCSI domain in which this SEP resides.
static int ses_get_elm_status(enc_softc_t *enc, encioc_elm_status_t *elms, int slpflag)
static enc_softc_cleanup_t ses_softc_cleanup
Definition: scsi_enc_ses.c:254
static int ses_get_enc_status(enc_softc_t *enc, int slpflag)

Definition at line 2949 of file scsi_enc_ses.c.

Referenced by ses_softc_init().

◆ ses_fill_control_request

fsm_fill_handler_t ses_fill_control_request
static

Definition at line 259 of file scsi_enc_ses.c.

◆ ses_fill_rcv_diag_io

fsm_fill_handler_t ses_fill_rcv_diag_io
static

Definition at line 258 of file scsi_enc_ses.c.

◆ ses_process_config

fsm_done_handler_t ses_process_config
static

Definition at line 261 of file scsi_enc_ses.c.

◆ ses_process_control_request

fsm_done_handler_t ses_process_control_request
static

Definition at line 265 of file scsi_enc_ses.c.

◆ ses_process_elm_addlstatus

fsm_done_handler_t ses_process_elm_addlstatus
static

Definition at line 264 of file scsi_enc_ses.c.

◆ ses_process_elm_descs

fsm_done_handler_t ses_process_elm_descs
static

Definition at line 263 of file scsi_enc_ses.c.

◆ ses_process_pages

fsm_done_handler_t ses_process_pages
static

Definition at line 260 of file scsi_enc_ses.c.

◆ ses_process_status

fsm_done_handler_t ses_process_status
static

Definition at line 262 of file scsi_enc_ses.c.

◆ ses_publish_cache

fsm_done_handler_t ses_publish_cache
static

Definition at line 267 of file scsi_enc_ses.c.

◆ ses_publish_physpaths

fsm_done_handler_t ses_publish_physpaths
static

Definition at line 266 of file scsi_enc_ses.c.

◆ ses_softc_cleanup

enc_softc_cleanup_t ses_softc_cleanup
static

Definition at line 254 of file scsi_enc_ses.c.