/*
* 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 <kstat.h>
#include <sun_sas.h>
/*
* Retrieves the statistics for a specified port.phy on an adapter
*/
int instance = 0;
int i;
/* Validate the arguments */
if (pStatistics == NULL) {
"NULL Phy Statistics buffer of phyIndex: %08lx", phy);
return (HBA_STATUS_ERROR_ARG);
}
"NULL SAS Phy Statistics buffer of phyIndex: %08lx", phy);
return (HBA_STATUS_ERROR_ARG);
}
"Invalid HBA handler %08lx of phyIndex: %08lx",
return (HBA_STATUS_ERROR_INVALID_HANDLE);
}
/* Check for stale data */
if (status != HBA_STATUS_OK) {
"Verify Adapter failed for phyIndex: %08lx", phy);
return (status);
}
hba_port_ptr != NULL;
break;
}
}
if (hba_port_ptr == NULL) {
"Invalid port index of phyIndex: %08lx", phy);
return (HBA_STATUS_ERROR_ILLEGAL_INDEX);
}
SASPort->NumberofPhys) {
return (HBA_STATUS_ERROR_ILLEGAL_INDEX);
}
/* We need to find out the phy identifier. */
break;
}
return (HBA_STATUS_ERROR_ILLEGAL_INDEX);
}
/*
* for statistics that are not supported, its bits should all be
* set to -1
*/
sizeof (SMHBA_SASPHYSTATISTICS));
/* First, we need the deivce path to locate the devinfo node. */
sizeof (path));
if (charptr) {
*charptr = '\0';
}
errno = 0;
if (node == DI_NODE_NIL) {
"Unable to take devinfo snapshot on HBA \"%s\" "
"for phyIndex: %08lx due to %s",
return (HBA_STATUS_ERROR);
}
/*
* Then we could fetch the instance number and driver name of this
* device.
*/
if (instance == -1) {
"An instance number has not been assigned to the "
return (HBA_STATUS_ERROR);
}
if (driver_name == NULL) {
"No driver bound to this device \"%s\" "
"when get phyIndex: %08lx",
return (HBA_STATUS_ERROR);
}
/*
* Construct the kstat name here.
*/
/* retrieve all the statistics from kstat. */
kc = kstat_open();
"kstat_open failed due to \"%s\" of phyIndex: %08lx",
return (HBA_STATUS_ERROR);
}
"No matching kstat name found for \"%s\" "
"of phyIndex: %08lx",
kstat_name, phy);
(void) kstat_close(kc);
return (HBA_STATUS_ERROR);
}
/* Found the phy we're looking for. */
"error reading kstat data due to \"%s\" "
"of phyIndex: %08lx",
(void) kstat_close(kc);
return (HBA_STATUS_ERROR);
}
"SecondsSinceLastReset") == 0) {
continue;
}
continue;
}
continue;
}
continue;
}
continue;
}
continue;
}
continue;
}
continue;
}
}
}
(void) kstat_close(kc);
return (HBA_STATUS_OK);
}