/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sun_sas.h>
/*
* Combine uscsi command ans send it out via ioctl
*/
static HBA_STATUS
{
return (status);
}
/*
* Send a SCSI inquiry to a remote WWN
*/
{
int index = 0;
int domainPortFound = 0;
int hbaPortFound = 0;
int chkDomainPort = 0;
double duration;
/* Validate the arguments */
if (responseBuffer == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
if (senseBuffer == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
if (responseSize == NULL) {
return (HBA_STATUS_ERROR_ARG);
}
return (HBA_STATUS_ERROR_ARG);
}
if (scsiStatus == 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) {
/*
* Since all the ports under the same HBA have
* the same LocalSASAddress, we should break
* the loop once we find it dosn't match.
*/
break;
} else {
hbaPortFound = 1;
}
}
if (chkDomainPort) {
domainPortFound = 1;
}
if (!(domainPortFound)) {
continue;
}
}
hba_disco_port != NULL;
/*
* If discoveredPort is not given targetPort, just skip
*/
/* Does not match */
continue;
}
/*
* target port
*/
"%016llx on handle %08lx is not a Target",
return (HBA_STATUS_ERROR_NOT_A_TARGET);
}
/*
* Iterating and matching is needed.
*/
mapping_ptr != NULL;
if (memcmp(
&smhbaLUN, sizeof (HBA_SCSILUN))
!= 0) {
continue;
}
of %.4f seconds", duration);
return (status);
}
sizeof (HBA_SCSILUN));
" %08lx for target %016llx on handle %08lx",
return (HBA_STATUS_ERROR_INVALID_LUN);
}
if (chkDomainPort) {
"Port WWN %016llx on handle %08lx",
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 {
"Port WWN %016llx on handle %08lx",
}
return (HBA_STATUS_ERROR_ILLEGAL_WWN);
}