FreeBSD kernel CAM code
smp_all.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/libkern.h>
#include <sys/kernel.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_xpt.h>
#include <cam/scsi/smp_all.h>
#include <sys/sbuf.h>
Include dependency graph for smp_all.c:

Go to the source code of this file.

Data Structures

struct  smp_error_table_entry
 
struct  smp_cmd_table_entry
 

Functions

 __FBSDID ("$FreeBSD$")
 
static char * smp_yesno (int val)
 
const char * smp_error_desc (int function_result)
 
const char * smp_command_desc (uint8_t cmd_num)
 
void smp_command_decode (uint8_t *smp_request, int request_len, struct sbuf *sb, char *line_prefix, int first_line_len, int line_len)
 
void smp_command_sbuf (struct ccb_smpio *smpio, struct sbuf *sb, char *line_prefix, int first_line_len, int line_len)
 
void smp_error_sbuf (struct ccb_smpio *smpio, struct sbuf *sb)
 
void smp_report_general_sbuf (struct smp_report_general_response *response, int response_len, struct sbuf *sb)
 
void smp_report_manuf_info_sbuf (struct smp_report_manuf_info_response *response, int response_len, struct sbuf *sb)
 
void smp_report_general (struct ccb_smpio *smpio, uint32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), struct smp_report_general_request *request, int request_len, uint8_t *response, int response_len, int long_response, uint32_t timeout)
 
void smp_discover (struct ccb_smpio *smpio, uint32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), struct smp_discover_request *request, int request_len, uint8_t *response, int response_len, int long_response, int ignore_zone_group, int phy, uint32_t timeout)
 
void smp_report_manuf_info (struct ccb_smpio *smpio, uint32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), struct smp_report_manuf_info_request *request, int request_len, uint8_t *response, int response_len, int long_response, uint32_t timeout)
 
void smp_phy_control (struct ccb_smpio *smpio, uint32_t retries, void(*cbfcnp)(struct cam_periph *, union ccb *), struct smp_phy_control_request *request, int request_len, uint8_t *response, int response_len, int long_response, uint32_t expected_exp_change_count, int phy, int phy_op, int update_pp_timeout_val, uint64_t attached_device_name, int prog_min_prl, int prog_max_prl, int slumber_partial, int pp_timeout_value, uint32_t timeout)
 

Variables

static struct smp_error_table_entry smp_error_table []
 
struct smp_cmd_table_entry smp_cmd_table []
 

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ smp_command_decode()

void smp_command_decode ( uint8_t *  smp_request,
int  request_len,
struct sbuf *  sb,
char *  line_prefix,
int  first_line_len,
int  line_len 
)

Definition at line 200 of file smp_all.c.

Referenced by smp_command_sbuf().

Here is the caller graph for this function:

◆ smp_command_desc()

const char * smp_command_desc ( uint8_t  cmd_num)

Definition at line 164 of file smp_all.c.

References smp_cmd_table_entry::cmd_num, and smp_cmd_table.

Referenced by smp_command_sbuf().

Here is the caller graph for this function:

◆ smp_command_sbuf()

void smp_command_sbuf ( struct ccb_smpio smpio,
struct sbuf *  sb,
char *  line_prefix,
int  first_line_len,
int  line_len 
)

Definition at line 231 of file smp_all.c.

References smp_command_decode(), smp_command_desc(), ccb_smpio::smp_request, and ccb_smpio::smp_request_len.

Referenced by cam_error_string(), and smp_error_sbuf().

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

◆ smp_discover()

void smp_discover ( struct ccb_smpio smpio,
uint32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
struct smp_discover_request request,
int  request_len,
uint8_t *  response,
int  response_len,
int  long_response,
int  ignore_zone_group,
int  phy,
uint32_t  timeout 
)

◆ smp_error_desc()

const char * smp_error_desc ( int  function_result)

Definition at line 119 of file smp_all.c.

References smp_error_table_entry::desc, smp_error_table_entry::function_result, and smp_error_table.

Referenced by cam_error_string(), and smp_error_sbuf().

Here is the caller graph for this function:

◆ smp_error_sbuf()

void smp_error_sbuf ( struct ccb_smpio smpio,
struct sbuf *  sb 
)

Definition at line 252 of file smp_all.c.

References ccb_smpio::ccb_h, ccb_hdr::path, smp_command_sbuf(), smp_error_desc(), ccb_smpio::smp_response, and xpt_path_string().

Here is the call graph for this function:

◆ smp_phy_control()

void smp_phy_control ( struct ccb_smpio smpio,
uint32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
struct smp_phy_control_request request,
int  request_len,
uint8_t *  response,
int  response_len,
int  long_response,
uint32_t  expected_exp_change_count,
int  phy,
int  phy_op,
int  update_pp_timeout_val,
uint64_t  attached_device_name,
int  prog_min_prl,
int  prog_max_prl,
int  slumber_partial,
int  pp_timeout_value,
uint32_t  timeout 
)

◆ smp_report_general()

void smp_report_general ( struct ccb_smpio smpio,
uint32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
struct smp_report_general_request request,
int  request_len,
uint8_t *  response,
int  response_len,
int  long_response,
uint32_t  timeout 
)

◆ smp_report_general_sbuf()

void smp_report_general_sbuf ( struct smp_report_general_response response,
int  response_len,
struct sbuf *  sb 
)

Definition at line 281 of file smp_all.c.

References smp_report_general_response::active_zm_address, smp_report_general_response::config_bits0, smp_report_general_response::config_bits1, smp_report_general_response::config_bits2, smp_report_general_response::crc, smp_report_general_response::encl_logical_id, smp_report_general_response::expander_change_count, smp_report_general_response::expander_route_indexes, smp_report_general_response::first_encl_conn_el_index, smp_report_general_response::initial_time_to_reduced_func, smp_report_general_response::last_phy_evl_desc_index, smp_report_general_response::last_sc_stat_desc_index, smp_report_general_response::long_response, smp_report_general_response::max_num_routed_addrs, smp_report_general_response::max_reduced_func_time, smp_report_general_response::max_sc_stat_descs, smp_report_general_response::max_stored_pel_descs, smp_report_general_response::num_encl_conn_el_indexes, smp_report_general_response::num_phys, smp_report_general_response::reduced_functionality, smp_report_general_response::response_len, scsi_2btoul(), scsi_8btou64(), SMP_RG_CONFIGURES_OTHERS, SMP_RG_CONFIGURING, SMP_RG_LONG_RESPONSE, SMP_RG_NUM_ZONE_GROUPS_MASK, SMP_RG_NUM_ZONE_GROUPS_SHIFT, SMP_RG_OPEN_REJECT_RETRY_SUP, SMP_RG_PP_ASSERTED, SMP_RG_PP_SUPPORTED, SMP_RG_REDUCED_FUNCTIONALITY, SMP_RG_SAVING, SMP_RG_SAVING_PHY_INFO_SUP, SMP_RG_SAVING_ZENABLED_SUP, SMP_RG_SAVING_ZM_PWD_SUP, SMP_RG_SAVING_ZPERM_TAB_SUP, SMP_RG_SELF_CONFIGURING, SMP_RG_STP_CONTINUE_AWT, SMP_RG_TABLE_TO_TABLE_SUP, SMP_RG_ZONE_CONFIGURING, SMP_RG_ZONE_LOCKED, SMP_RG_ZONING_ENABLED, SMP_RG_ZONING_SUPPORTED, SMP_WORD_LEN, smp_yesno(), smp_report_general_response::stp_bus_inact_time_limit, smp_report_general_response::stp_max_conn_time_limit, smp_report_general_response::stp_reject_to_open_limit, smp_report_general_response::stp_smp_it_nexus_loss_time, smp_report_general_response::time_to_reduced_func, and smp_report_general_response::zone_lock_inact_time_limit.

Here is the call graph for this function:

◆ smp_report_manuf_info()

void smp_report_manuf_info ( struct ccb_smpio smpio,
uint32_t  retries,
void(*)(struct cam_periph *, union ccb *)  cbfcnp,
struct smp_report_manuf_info_request request,
int  request_len,
uint8_t *  response,
int  response_len,
int  long_response,
uint32_t  timeout 
)

◆ smp_report_manuf_info_sbuf()

◆ smp_yesno()

static char * smp_yesno ( int  val)
static

Definition at line 69 of file smp_all.c.

Referenced by smp_report_general_sbuf(), and smp_report_manuf_info_sbuf().

Here is the caller graph for this function:

Variable Documentation

◆ smp_cmd_table

struct smp_cmd_table_entry smp_cmd_table[]
Initial value:
= {
{SMP_FUNC_REPORT_GENERAL, "REPORT GENERAL"},
{SMP_FUNC_REPORT_MANUF_INFO, "REPORT MANUFACTURER INFORMATION"},
{SMP_FUNC_REPORT_SC_STATUS, "REPORT SELF-CONFIGURATION STATUS"},
{SMP_FUNC_REPORT_ZONE_PERM_TBL, "REPORT ZONE PERMISSION TABLE"},
{SMP_FUNC_REPORT_BROADCAST, "REPORT BROADCAST"},
{SMP_FUNC_DISCOVER, "DISCOVER"},
{SMP_FUNC_REPORT_PHY_ERR_LOG, "REPORT PHY ERROR LOG"},
{SMP_FUNC_REPORT_PHY_SATA, "REPORT PHY SATA"},
{SMP_FUNC_REPORT_ROUTE_INFO, "REPORT ROUTE INFORMATION"},
{SMP_FUNC_REPORT_PHY_EVENT, "REPORT PHY EVENT"},
{SMP_FUNC_DISCOVER_LIST, "DISCOVER LIST"},
{SMP_FUNC_REPORT_PHY_EVENT_LIST, "REPORT PHY EVENT LIST"},
{SMP_FUNC_REPORT_EXP_RTL, "REPORT EXPANDER ROUTE TABLE LIST"},
{SMP_FUNC_CONFIG_GENERAL, "CONFIGURE GENERAL"},
{SMP_FUNC_ENABLE_DISABLE_ZONING, "ENABLE DISABLE ZONING"},
{SMP_FUNC_ZONED_BROADCAST, "ZONED BROADCAST"},
{SMP_FUNC_ZONE_LOCK, "ZONE LOCK"},
{SMP_FUNC_ZONE_ACTIVATE, "ZONE ACTIVATE"},
{SMP_FUNC_ZONE_UNLOCK, "ZONE UNLOCK"},
{SMP_FUNC_CONFIG_ZM_PWD, "CONFIGURE ZONE MANAGER PASSWORD"},
{SMP_FUNC_CONFIG_ZONE_PHY_INFO, "CONFIGURE ZONE PHY INFORMATION"},
{SMP_FUNC_CONFIG_ZONE_PERM_TBL, "CONFIGURE ZONE PERMISSION TABLE"},
{SMP_FUNC_CONFIG_ROUTE_INFO, "CONFIGURE ROUTE INFORMATION"},
{SMP_FUNC_PHY_CONTROL, "PHY CONTROL"},
{SMP_FUNC_PHY_TEST_FUNC, "PHY TEST FUNCTION"},
{SMP_FUNC_CONFIG_PHY_EVENT, "CONFIGURE PHY EVENT"}
}
#define SMP_FUNC_REPORT_PHY_SATA
Definition: smp_all.h:63
#define SMP_FUNC_REPORT_BROADCAST
Definition: smp_all.h:58
#define SMP_FUNC_ZONED_BROADCAST
Definition: smp_all.h:79
#define SMP_FUNC_REPORT_PHY_EVENT
Definition: smp_all.h:65
#define SMP_FUNC_PHY_CONTROL
Definition: smp_all.h:89
#define SMP_FUNC_ZONE_UNLOCK
Definition: smp_all.h:82
#define SMP_FUNC_REPORT_MANUF_INFO
Definition: smp_all.h:54
#define SMP_FUNC_REPORT_GENERAL
Definition: smp_all.h:53
#define SMP_FUNC_CONFIG_PHY_EVENT
Definition: smp_all.h:91
#define SMP_FUNC_CONFIG_GENERAL
Definition: smp_all.h:77
#define SMP_FUNC_REPORT_SC_STATUS
Definition: smp_all.h:55
#define SMP_FUNC_DISCOVER
Definition: smp_all.h:61
#define SMP_FUNC_REPORT_EXP_RTL
Definition: smp_all.h:70
#define SMP_FUNC_CONFIG_ZONE_PERM_TBL
Definition: smp_all.h:85
#define SMP_FUNC_CONFIG_ZONE_PHY_INFO
Definition: smp_all.h:84
#define SMP_FUNC_ZONE_ACTIVATE
Definition: smp_all.h:81
#define SMP_FUNC_DISCOVER_LIST
Definition: smp_all.h:68
#define SMP_FUNC_CONFIG_ROUTE_INFO
Definition: smp_all.h:88
#define SMP_FUNC_REPORT_PHY_ERR_LOG
Definition: smp_all.h:62
#define SMP_FUNC_CONFIG_ZM_PWD
Definition: smp_all.h:83
#define SMP_FUNC_ZONE_LOCK
Definition: smp_all.h:80
#define SMP_FUNC_REPORT_ROUTE_INFO
Definition: smp_all.h:64
#define SMP_FUNC_PHY_TEST_FUNC
Definition: smp_all.h:90
#define SMP_FUNC_REPORT_PHY_EVENT_LIST
Definition: smp_all.h:69
#define SMP_FUNC_ENABLE_DISABLE_ZONING
Definition: smp_all.h:78
#define SMP_FUNC_REPORT_ZONE_PERM_TBL
Definition: smp_all.h:56

Referenced by smp_command_desc().

◆ smp_error_table

struct smp_error_table_entry smp_error_table[]
static
Initial value:
= {
{SMP_FR_ACCEPTED, "SMP Function Accepted"},
{SMP_FR_UNKNOWN_FUNC, "Unknown SMP Function"},
{SMP_FR_FUNCTION_FAILED, "SMP Function Failed"},
{SMP_FR_INVALID_REQ_FRAME_LEN, "Invalid Request Frame Length"},
{SMP_FR_INVALID_EXP_CHG_CNT, "Invalid Expander Change Count"},
{SMP_FR_BUSY, "Busy"},
{SMP_FR_INCOMPLETE_DESC_LIST, "Incomplete Descriptor List"},
{SMP_FR_PHY_DOES_NOT_EXIST, "Phy Does Not Exist"},
{SMP_FR_INDEX_DOES_NOT_EXIST, "Index Does Not Exist"},
{SMP_FR_PHY_DOES_NOT_SUP_SATA, "Phy Does Not Support SATA"},
{SMP_FR_UNKNOWN_PHY_OP, "Unknown Phy Operation"},
{SMP_FR_UNKNOWN_PHY_TEST_FUNC, "Unknown Phy Test Function"},
{SMP_FR_PHY_TEST_FUNC_INPROG, "Phy Test Function In Progress"},
{SMP_FR_PHY_VACANT, "Phy Vacant"},
{SMP_FR_UNKNOWN_PHY_EVENT_SRC, "Unknown Phy Event Source"},
{SMP_FR_UNKNOWN_DESC_TYPE, "Unknown Descriptor Type"},
{SMP_FR_UNKNOWN_PHY_FILTER, "Unknown Phy Filter"},
{SMP_FR_AFFILIATION_VIOLATION, "Affiliation Violation"},
{SMP_FR_SMP_ZONE_VIOLATION, "SMP Zone Violation"},
{SMP_FR_NO_MGMT_ACCESS_RIGHTS, "No Management Access Rights"},
{SMP_FR_UNKNOWN_ED_ZONING_VAL, "Unknown Enable Disable Zoning Value"},
{SMP_FR_ZONE_LOCK_VIOLATION, "Zone Lock Violation"},
{SMP_FR_NOT_ACTIVATED, "Not Activated"},
{SMP_FR_ZG_OUT_OF_RANGE, "Zone Group Out of Range"},
{SMP_FR_NO_PHYS_PRESENCE, "No Physical Presence"},
{SMP_FR_SAVING_NOT_SUP, "Saving Not Supported"},
{SMP_FR_SRC_ZONE_DNE, "Source Zone Group Does Not Exist"},
{SMP_FR_DISABLED_PWD_NOT_SUP, "Disabled Password Not Supported"}
}
#define SMP_FR_INVALID_EXP_CHG_CNT
Definition: smp_all.h:103
#define SMP_FR_UNKNOWN_FUNC
Definition: smp_all.h:100
#define SMP_FR_SAVING_NOT_SUP
Definition: smp_all.h:124
#define SMP_FR_ZONE_LOCK_VIOLATION
Definition: smp_all.h:120
#define SMP_FR_UNKNOWN_DESC_TYPE
Definition: smp_all.h:114
#define SMP_FR_INCOMPLETE_DESC_LIST
Definition: smp_all.h:105
#define SMP_FR_INDEX_DOES_NOT_EXIST
Definition: smp_all.h:107
#define SMP_FR_DISABLED_PWD_NOT_SUP
Definition: smp_all.h:126
#define SMP_FR_AFFILIATION_VIOLATION
Definition: smp_all.h:116
#define SMP_FR_NOT_ACTIVATED
Definition: smp_all.h:121
#define SMP_FR_UNKNOWN_PHY_TEST_FUNC
Definition: smp_all.h:110
#define SMP_FR_SMP_ZONE_VIOLATION
Definition: smp_all.h:117
#define SMP_FR_PHY_DOES_NOT_SUP_SATA
Definition: smp_all.h:108
#define SMP_FR_SRC_ZONE_DNE
Definition: smp_all.h:125
#define SMP_FR_PHY_VACANT
Definition: smp_all.h:112
#define SMP_FR_PHY_DOES_NOT_EXIST
Definition: smp_all.h:106
#define SMP_FR_UNKNOWN_PHY_EVENT_SRC
Definition: smp_all.h:113
#define SMP_FR_UNKNOWN_PHY_FILTER
Definition: smp_all.h:115
#define SMP_FR_ZG_OUT_OF_RANGE
Definition: smp_all.h:122
#define SMP_FR_NO_PHYS_PRESENCE
Definition: smp_all.h:123
#define SMP_FR_UNKNOWN_ED_ZONING_VAL
Definition: smp_all.h:119
#define SMP_FR_PHY_TEST_FUNC_INPROG
Definition: smp_all.h:111
#define SMP_FR_BUSY
Definition: smp_all.h:104
#define SMP_FR_UNKNOWN_PHY_OP
Definition: smp_all.h:109
#define SMP_FR_FUNCTION_FAILED
Definition: smp_all.h:101
#define SMP_FR_NO_MGMT_ACCESS_RIGHTS
Definition: smp_all.h:118
#define SMP_FR_INVALID_REQ_FRAME_LEN
Definition: smp_all.h:102
#define SMP_FR_ACCEPTED
Definition: smp_all.h:99

Definition at line 87 of file smp_all.c.

Referenced by smp_error_desc().