03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER START
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The contents of this file are subject to the terms of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Common Development and Distribution License, Version 1.0 only
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (the "License"). You may not use this file except in compliance
03831d35f7499c87d51205817c93e9a8d42c4baestevel * with the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
03831d35f7499c87d51205817c93e9a8d42c4baestevel * See the License for the specific language governing permissions
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and limitations under the License.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * When distributing Covered Code, include this CDDL HEADER in each
03831d35f7499c87d51205817c93e9a8d42c4baestevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * If applicable, add the following below this CDDL HEADER, with the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fields enclosed by brackets "[]" replaced with your own identifying
03831d35f7499c87d51205817c93e9a8d42c4baestevel * information: Portions Copyright [yyyy] [name of copyright owner]
03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER END
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Copyright (c) 1999 by Sun Microsystems, Inc.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#pragma ident "%Z%%M% %I% %E% SMI"
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This module does the reading and interpreting of sun4u system
03831d35f7499c87d51205817c93e9a8d42c4baestevel * kstats. These kstats are created by the following drivers:
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fhc, environ, sysctrl. Each board in the tree should have
03831d35f7499c87d51205817c93e9a8d42c4baestevel * kstats created for it. There are also system wide kstats that
03831d35f7499c87d51205817c93e9a8d42c4baestevel * are created.
03831d35f7499c87d51205817c93e9a8d42c4baestevelread_platform_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat,
03831d35f7499c87d51205817c93e9a8d42c4baestevel struct bd_kstat_data *bdp, struct envctrl_kstat_data *ep)
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* For each board in the system, read the kstats for it. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (bnode = tree->bd_list; bnode != NULL; bnode = bnode->next) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Kstat instances numbers are set by fhc, ac, simmstat,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * and environ drivers based on their board# property.
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Try to find an FHC instance for this board number */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Atempt to read the FHC kstat */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Now read out the data if the kstat read OK */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * We set the kstats_ok flag to good here. If we
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fail one of the data reads, we set it to bad.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For each data value, If the Kstat named struct
03831d35f7499c87d51205817c93e9a8d42c4baestevel * is found, then get the data out.
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Try to find an AC instance for this board number */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Attempt to read the AC kstat. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* If the AC kstat exists, try to read the data from it. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * We set the kstats_ok flag to good here. If we
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fail one of the data reads, we set it to bad.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * For each data value, If the Kstat named struct
03831d35f7499c87d51205817c93e9a8d42c4baestevel * is found, then get the data out.
03831d35f7499c87d51205817c93e9a8d42c4baestevel knp = kstat_data_lookup(ksp, MEMDECODE0_KSTAT_NAMED);
03831d35f7499c87d51205817c93e9a8d42c4baestevel knp = kstat_data_lookup(ksp, MEMDECODE1_KSTAT_NAMED);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Try to find an simmstat instance for this board number */
03831d35f7499c87d51205817c93e9a8d42c4baestevel ksp = kstat_lookup(kc, UNIX, board, SIMMSTAT_KSTAT_NAME);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Try to find an overtemp kstat instance for this board */
03831d35f7499c87d51205817c93e9a8d42c4baestevel ksp = kstat_lookup(kc, UNIX, board, OVERTEMP_KSTAT_NAME);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* XXX - this is for 2.5.1 testing. remove */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Read the kstats for the system control board */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) == -1)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * the clock version register only appears
03831d35f7499c87d51205817c93e9a8d42c4baestevel * on new clock boards
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Read the kstats for the power supply stats */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if ((ksp != NULL) && (kstat_read(kc, ksp, NULL) != -1)) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel (void) memcpy(&sys_kstat->ps_shadow[0], ksp->ks_data,
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* read the overtemp kstat for the system control board */
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Try to find an overtemp kstat instance for this board */
03831d35f7499c87d51205817c93e9a8d42c4baestevel ksp = kstat_lookup(kc, UNIX, CLOCK_BOARD_INDEX, OVERTEMP_KSTAT_NAME);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* XXX - this is for 2.5.1 testing. remove */
03831d35f7499c87d51205817c93e9a8d42c4baestevel if (sizeof (sys_kstat->tempstat) > ksp->ks_data_size)
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Read the reset-info kstat from one of the boards. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel ksp = kstat_lookup(kc, UNIX, 0, RESETINFO_KSTAT_NAME);
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* read kstats for hotplugged boards */
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (i = 0, hp = &sys_kstat->hp_info[0]; i < MAX_BOARDS; i++, hp++) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* read in the kstat for the fault list. */
03831d35f7499c87d51205817c93e9a8d42c4baestevel sizeof (struct ft_list);
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This function does the reading and interpreting of sun4u system
03831d35f7499c87d51205817c93e9a8d42c4baestevel * kstats. These kstats are created by the following drivers:
03831d35f7499c87d51205817c93e9a8d42c4baestevel * fhc, environ, sysctrl. Each board in the tree should have
03831d35f7499c87d51205817c93e9a8d42c4baestevel * kstats created for it. There are also system wide kstats that
03831d35f7499c87d51205817c93e9a8d42c4baestevel * are created.
03831d35f7499c87d51205817c93e9a8d42c4baestevelread_sun4u_kstats(Sys_tree *tree, struct system_kstat_data *sys_kstat)
03831d35f7499c87d51205817c93e9a8d42c4baestevel /* Initialize the kstats structure */
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (i = 0; i < MAX_BOARDS; i++) {
03831d35f7499c87d51205817c93e9a8d42c4baestevel for (i = 0; i < MAX_DEVS; i++) {