/*
* 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 <sun_sas.h>
/*
* Pass usmp_cmd into ioctl
*/
static HBA_STATUS
int fd;
/*
* open smp device
*/
"open devpath %s failed due to %s",
return (HBA_STATUS_ERROR);
}
/*
* send usmp command
*/
} else {
}
return (ret);
}
return (HBA_STATUS_OK);
}
/*
* Send a USMP command to a remote SMP node
*/
{
int domainPortFound = 0;
int chkDomainPort = 0;
int hbaPortFound = 0;
double duration;
/* Validate the arguments */
if (pRspBuffer == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
if (pReqBuffer == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
if (pRspBufferSize == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
return (HBA_STATUS_ERROR_INVALID_HANDLE);
}
/* Check for stale data */
if (status != HBA_STATUS_OK) {
return (status);
}
/*
* We are not checking to see if our data is stale.
* By verifying this information here, we will take a big performance
* hit. This check will be done later only if the Inquiry ioctl fails
*/
"HBA handle had NULL device path.\
Unable to send SCSI cmd");
return (HBA_STATUS_ERROR);
}
chkDomainPort = 1;
/* Determine which port to use */
hba_port_ptr != NULL;
if (hbaPortFound == 0) {
/*
* HBA ports under the same HBA may have
* different LocalSASAddress. We should loop
* through the HBA port list to find the
* matching HBA port.
*/
continue;
} else {
hbaPortFound = 1;
}
}
if (chkDomainPort != 0) {
domainPortFound = 1;
}
if (!(domainPortFound)) {
continue;
}
}
hba_disco_port != NULL;
/*
* If discoveredPort is not given targetPort, just skip
*/
/* Does not match */
continue;
}
/*
* If matching targetPort does not support SMP protocal
* return error.
* comment it out for testing only
*/
if ((hba_disco_port->port_attributes.\
HBA_SASPORTPROTOCOL_SMP) == 0) {
does not support SMP protocol",
return (HBA_STATUS_ERROR_INVALID_PROTOCOL_TYPE);
}
/*
* SMP target port doesn't have any scsi info.
* So we use OSDeviceName from port attributes.
*/
of %.4f seconds", duration);
return (status);
}
if (chkDomainPort) {
"requested SMP target port %16llx",
return (HBA_STATUS_ERROR_ILLEGAL_WWN);
}
}
if (hbaPortFound == 0) {
"Unable to locate requested Port WWN %016llx on "
} else if (chkDomainPort && !domainPortFound) {
" domainPortWWN %016llx on handle %08lx",
} else {
"requested SMP target port %16llx",
}
return (HBA_STATUS_ERROR_ILLEGAL_WWN);
}