/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <scsi/libsmp_plugin.h>
#include "sas2.h"
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN);
}
/*ARGSUSED*/
static off_t
{
if (len > SMP_REQ_MINLEN)
return (-1);
}
static void
{
if (cap & SMP_TARGET_C_LONG_RESP) {
} else {
fp->srf_allocated_response_len = 0;
fp->srf_request_len = 0;
}
/*
* If this command requires that the expected expander change count
* be set (as many do), we will attempt to set it based on the
* most recently executed command. However, if the user has set it
* already, we will not overwrite that setting. It is the consumer's
* responsibility to keep track of expander changes each time it
* receives a new change count in a response.
*/
/* LINTED - alignment */
if (SCSI_READ16(rqcc) == 0) {
}
}
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
return (0);
}
/*ARGSUSED*/
static off_t
{
if (len > SMP_RESP_MINLEN)
return (-1);
}
static void
{
return;
return;
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_self_config_status_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_zone_perm_table_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_zone_perm_table_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_broadcast_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_discover_req_t));
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_phy_error_log_req_t));
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_phy_sata_req_t));
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_route_info_req_t));
}
/*ARGSUSED*/
static size_t
{
if (len >= SMP_RESP_MINLEN)
len -= SMP_RESP_MINLEN;
else
return (0);
len &= ~3;
if (fp->srf_response_len == 0)
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_phy_event_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_discover_list_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_report_phy_event_list_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN +
sizeof (smp_report_exp_route_table_list_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_config_general_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_enable_disable_zoning_req_t));
}
/*ARGSUSED*/
static size_t
{
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_zone_lock_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_zone_activate_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_zone_unlock_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN +
sizeof (smp_config_zone_manager_password_req_t));
}
/*ARGSUSED*/
static size_t
{
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_config_zone_phy_info_req_t) +
}
static size_t
{
if (cap & SMP_TARGET_C_ZG_256)
descrsz = sizeof (smp_zone_perm_descr256_t);
else
descrsz = sizeof (smp_zone_perm_descr128_t);
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_config_route_info_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_phy_control_req_t));
}
/*ARGSUSED*/
static size_t
{
if (user != 0) {
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_phy_test_function_req_t));
}
/*ARGSUSED*/
static size_t
{
(void) smp_set_errno(ESMP_RANGE);
return (0);
}
return (SMP_REQ_MINLEN + sizeof (smp_config_phy_event_req_t) +
}
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
},
{
.sfd_function = -1
}
};
/*
* Returns the number of bytes in the request frame, including the header
* and footer, for the given function and capabilities. Presently the only
* relevant capability is long-request, which in some cases increases the
* size of the request from the SAS-1 spec to that found in SAS-2.
*
* Variably-sized request frames have no default size; we return 0 in that
* case, which will often be interpreted by the caller as an error although
* in general it is not.
*/
{
switch (fn) {
case SMP_FUNC_REPORT_GENERAL:
return (SMP_REQ_MINLEN);
return (SMP_REQ_MINLEN +
sizeof (smp_report_zone_mgr_password_req_t));
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_self_config_status_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_zone_perm_table_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_broadcast_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_DISCOVER:
return (SMP_REQ_MINLEN + sizeof (smp_discover_req_t));
return (SMP_REQ_MINLEN +
sizeof (smp_report_phy_error_log_req_t));
case SMP_FUNC_REPORT_PHY_SATA:
return (SMP_REQ_MINLEN + sizeof (smp_report_phy_sata_req_t));
return (SMP_REQ_MINLEN + sizeof (smp_report_route_info_req_t));
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_phy_event_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_DISCOVER_LIST:
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_discover_list_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_phy_event_list_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_report_exp_route_table_list_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_CONFIG_GENERAL:
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_config_general_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_enable_disable_zoning_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_ZONE_LOCK:
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_zone_lock_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_ZONE_ACTIVATE:
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_zone_activate_req_t));
return (SMP_REQ_MINLEN);
case SMP_FUNC_ZONE_UNLOCK:
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_zone_unlock_req_t));
return (SMP_REQ_MINLEN);
if (cap & SMP_TARGET_C_LONG_RESP)
return (SMP_REQ_MINLEN +
sizeof (smp_config_zone_manager_password_req_t));
return (SMP_REQ_MINLEN);
return (SMP_REQ_MINLEN + sizeof (smp_config_route_info_req_t));
case SMP_FUNC_PHY_CONTROL:
return (SMP_REQ_MINLEN + sizeof (smp_phy_control_req_t));
return (SMP_REQ_MINLEN + sizeof (smp_phy_test_function_req_t));
case SMP_FUNC_ZONED_BROADCAST:
default:
return (0);
}
}
/*
* This is slightly different - return the length in bytes, including the
* header and footer, to be assumed for the response frame type if the
* length field is zero. Since the length field will not be zero unless the
* long response bit is clear or the target is buggy, we always assume that
* the caller wants the size of the v1 frame.
*/
/*ARGSUSED*/
{
switch (fn) {
case SMP_FUNC_DISCOVER_LIST:
case SMP_FUNC_CONFIG_GENERAL:
case SMP_FUNC_ZONED_BROADCAST:
case SMP_FUNC_ZONE_LOCK:
case SMP_FUNC_ZONE_ACTIVATE:
case SMP_FUNC_ZONE_UNLOCK:
case SMP_FUNC_PHY_CONTROL:
return (SMP_RESP_MINLEN);
return (SMP_RESP_MINLEN +
sizeof (smp_report_zone_mgr_password_resp_t));
case SMP_FUNC_REPORT_GENERAL:
return (SMP_RESP_MINLEN + 24);
return (SMP_RESP_MINLEN +
sizeof (smp_report_manufacturer_info_resp_t));
case SMP_FUNC_DISCOVER:
return (SMP_RESP_MINLEN + 48);
return (SMP_RESP_MINLEN +
sizeof (smp_report_phy_error_log_resp_t));
case SMP_FUNC_REPORT_PHY_SATA:
return (SMP_RESP_MINLEN + 52);
return (SMP_RESP_MINLEN +
sizeof (smp_report_route_info_resp_t));
default:
return (0);
}
}