/*
* 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>
#include <fcntl.h>
#include <unistd.h>
#include <libdevinfo.h>
#include <inttypes.h>
/*
* structure for di_devlink_walk
*/
typedef struct walk_devlink {
char *path;
char **linkpp;
/*
* Free the phy allocation.
*/
static void
{
}
}
/*
* callback funtion for di_devlink_walk
* Find matching /dev link for the given path argument.
* devlink element and callback function argument.
* The input path is expected to not have "/devices".
*/
extern HBA_STATUS
{
/*
* When path is specified, it doesn't have minor
* name. Therefore, the ../.. prefixes needs to be stripped.
*/
"Unable to get device path from portNode.");
}
(uchar_t **)&propByteData);
if (count < 0) {
if (portDevpath) {
"Property phy-info not found on port %s%s",
} else {
}
return (HBA_STATUS_ERROR);
} else {
if (rval != 0) {
if (portDevpath) {
"nvlist_unpack failed on port %s%s",
} else {
"nvlist_unpack failed.");
}
return (HBA_STATUS_ERROR);
} else {
&phyInfoVal, &nvcount);
if (rval != 0) {
if (portDevpath) {
"nvlist array phy-info-nvl not\
found on port %s%s", DEVICES_DIR,
} else {
"nvlist array phy-info-nvl not\
found");
}
return (HBA_STATUS_ERROR);
} else {
/* indentation moved */
for (i = 0; i < nvcount; i++) {
if (nvlist_lookup_uint8(phyInfoVal[i],
"PhyIdentifier", &phyId) != 0) {
/* Indicate a failure : no better way to set */
phyId = 0xff;
}
if (nvlist_lookup_int8(phyInfoVal[i],
"NegotiatedLinkRate", &negoRate) != 0) {
}
if (nvlist_lookup_int8(phyInfoVal[i],
"ProgrammedMinLinkRate", &prgmMinRate) != 0) {
}
if (nvlist_lookup_int8(phyInfoVal[i],
"ProgrammedMaxLinkRate", &prgmMaxRate) != 0) {
}
if (nvlist_lookup_int8(phyInfoVal[i],
"HardwareMinLinkRate", &hwMinRate) != 0) {
}
if (nvlist_lookup_int8(phyInfoVal[i],
"HardwareMaxLinkRate", &hwMaxRate) != 0) {
}
if (portDevpath)
return (HBA_STATUS_ERROR);
}
/*
* we will fill domain port later.
*/
} else {
}
}
/* end of indentation move */
}
}
}
if (portDevpath) {
}
return (HBA_STATUS_OK);
}