03831d35f7499c87d51205817c93e9a8d42c4baestevel * CDDL HEADER START
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The contents of this file are subject to the terms of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Common Development and Distribution License (the "License").
03831d35f7499c87d51205817c93e9a8d42c4baestevel * You may not use this file except in compliance 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 2000 Sun Microsystems, Inc. All rights reserved.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Use is subject to license terms.
03831d35f7499c87d51205817c93e9a8d42c4baestevel#pragma ident "%Z%%M% %I% %E% SMI"
03831d35f7499c87d51205817c93e9a8d42c4baestevelextern "C" {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * sgenv.h - Serengeti Environmental Driver
03831d35f7499c87d51205817c93e9a8d42c4baestevel * This header file contains the environmental definitions for
03831d35f7499c87d51205817c93e9a8d42c4baestevel * the Serengeti platform.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * It contains all the information necessary to obtain the required
03831d35f7499c87d51205817c93e9a8d42c4baestevel * data from the kstats which export the environmental data. The
03831d35f7499c87d51205817c93e9a8d42c4baestevel * following information is exported.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * o Board status information
03831d35f7499c87d51205817c93e9a8d42c4baestevel * o Keyswitch position
03831d35f7499c87d51205817c93e9a8d42c4baestevel * o Environmental Readings
03831d35f7499c87d51205817c93e9a8d42c4baestevel#include <sys/sgfrutypes.h> /* HPU type information */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Board Status Information
03831d35f7499c87d51205817c93e9a8d42c4baestevel * ========================
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* name of kstat returning board status info */
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Masks to determine which LEDs are on */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Calculate the number of boards, who's info readings that were
03831d35f7499c87d51205817c93e9a8d42c4baestevel * returned by this kstat
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_NUM_BOARD_READINGS(ksp) ((ksp)->ks_data_size / \
03831d35f7499c87d51205817c93e9a8d42c4baestevel int condition; /* see <sbd_cond_t> in <sbdp_ioctl.h> */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Keyswitch Information
03831d35f7499c87d51205817c93e9a8d42c4baestevel * =====================
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* name of kstat returning keyswitch info */
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Kstat structure used to pass Keyswitch data to userland.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The position is stored in the 32-bit integer value of the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * kstat_named_t union <keyswitch_position>.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * (i.e. to get the position - read keyswitch_position.value.ui32)
03831d35f7499c87d51205817c93e9a8d42c4baesteveltypedef struct {
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Environmental Information
03831d35f7499c87d51205817c93e9a8d42c4baestevel * =========================
03831d35f7499c87d51205817c93e9a8d42c4baestevel * the environmental kstat exports an array of env_sensor_t structs
03831d35f7499c87d51205817c93e9a8d42c4baestevel * sd_infostamp access macros and return values
03831d35f7499c87d51205817c93e9a8d42c4baestevel * N.b. None of the values need shifting. This means the
03831d35f7499c87d51205817c93e9a8d42c4baestevel * UTC time in nanoseconds since The Epoch has, at best,
03831d35f7499c87d51205817c93e9a8d42c4baestevel * a resolution of c.256 nanoseconds (since the lo-order
03831d35f7499c87d51205817c93e9a8d42c4baestevel * c.8-bits are overlaid with other information).
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_INFO_TIMESTATUS(info) ((int)((info) & _SG_INFO_TIMSTSMSK))
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_INFO_VALUESTATUS(info) ((int)((info) & _SG_INFO_VALSTSMSK))
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_INFO_NANOSECONDS(info) ((hrtime_t)((info) & _SG_INFO_TIMVALMSK))
03831d35f7499c87d51205817c93e9a8d42c4baestevel (((hrtime_t)~0) & ~(_SG_INFO_TIMSTSMSK | _SG_INFO_VALSTSMSK))
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* Calculate the number of sensor readings that were returned by this kstat */
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_NUM_ENV_READINGS(ksp) ((ksp)->ks_data_size / \
03831d35f7499c87d51205817c93e9a8d42c4baestevel/* used to calculate the status of a sensor reading from <sd_status> */
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_GET_SENSOR_STATUS(status) ((status) & SG_STATUS_MASK)
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SG_GET_PREV_SENSOR_STATUS(status) ((status) >> SG_STATUS_SHIFT)
03831d35f7499c87d51205817c93e9a8d42c4baestevel status |= (((value) & SG_STATUS_MASK) << SG_STATUS_SHIFT)
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The possible states a sensor reading can be in.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * The raw env. info. kstat is made up of an array of these structures.
03831d35f7499c87d51205817c93e9a8d42c4baestevel * Events Information
03831d35f7499c87d51205817c93e9a8d42c4baestevel * ==================
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_OK "returned to the normal operating range"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_LO_WARN "dropped below low warning threshold"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_HI_WARN "exceeded high warning threshold"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_LO_DANGER "dropped below low warning limit"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_HI_DANGER "exceeded high warning limit"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#define SGENV_EVENT_MSG_UNKNOWN "changed to an unknown status"
03831d35f7499c87d51205817c93e9a8d42c4baestevel#endif /* _SYS_SGENV_H */