sgenv_impl.h revision a5df24e138c7634fb7704d29d0b0054a504013af
/*
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SGENV_IMPL_H
#define _SYS_SGENV_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* sgenv_impl.h - Serengeti Environmental Driver
*
* This header file contains the private environmental definitions for
* the Serengeti platform. (used only by sgenv driver)
*
*/
/* get the public definitions */
/* named field of keyswitch kstat */
#define POSITION_KSTAT_NAME "position"
/* Mailbox message sub-types */
#define SG_GET_ENV_HPU_KEYS 0x4000
#define SG_GET_ENV_CONSTANTS 0x4004
#define SG_GET_ENV_VOLATILES 0x4002
#define SG_GET_ENV_THRESHOLDS 0x4003
/*
* Max time sgenv waits for mailbox to respond before
* it decides to timeout. (measured in seconds)
*/
#define SGENV_DEFAULT_MAX_MBOX_WAIT_TIME 30
#define SGENV_MAX_HPUS_PER_DOMAIN 24
#define SGENV_MAX_HPU_KEYS (SSM_MAX_INSTANCES * \
#define SGENV_MAX_SENSORS (SGENV_MAX_SENSORS_PER_KEY * \
#define SGENV_NO_NODE_EXISTS 0x0
#define SGENV_NODE_TYPE_DS 0x3FF
#define BOARD_CACHE 0x1
#define ENV_CACHE 0x2
/*
* Event Publisher definitions for sysevent.
*/
/*
* Event definitions
*/
#define MAX_TAG_ID_STR_LEN 100
#define HPU_ENTRY(value_macro) { \
value_macro, \
value_macro ## _STR, \
value_macro ## _ID \
}
#define PART_VALUE(value_macro) { \
value_macro, \
value_macro ## _STR \
}
value_macro, \
value_macro ## _STR, \
value_macro ## _UNITS, \
scale \
}
typedef struct hpu_value {
unsigned value;
const char *name;
const char *IDstr;
} hpu_value_t;
typedef struct part_value {
unsigned value;
const char *name;
} part_value_t;
typedef struct type_value {
unsigned value;
const char *name;
const char *units;
} type_value_t;
/*
* SGENV soft state structure.
*/
typedef struct sgenv_soft_state {
int instance; /* instance number */
/*
* Environmental Info Structures.
*/
typedef int32_t envresp_key_t;
typedef struct envresp_constants {
/* no padding required, 3x4-bytes in total length */
typedef struct envresp_volatiles {
typedef struct envresp_thresholds {
/* no padding required, 2x4-bytes in total length */
/*
* functions local to this driver.
*/
static int sgenv_create_cache_update_threads(void);
static int sgenv_remove_cache_update_threads(void);
static void sgenv_indicate_cache_update_needed(int cache);
static void sgenv_init_env_cache(void);
static void sgenv_update_env_cache(void);
static int sgenv_get_env_info_data(void);
static void sgenv_destroy_env_cache(void);
static void sgenv_clear_env_cache_entry(int key_posn);
static int sgenv_create_env_cache_entry(int key_posn);
static void sgenv_init_board_cache(void);
static void sgenv_update_board_cache(void);
static int sgenv_get_board_info_data(void);
static int sgenv_add_intr_handlers(void);
static int sgenv_remove_intr_handlers(void);
static uint_t sgenv_keyswitch_handler(char *);
static uint_t sgenv_env_data_handler(char *);
static uint_t sgenv_fan_status_handler(char *);
static uint_t sgenv_dr_event_handler(char *);
static uint_t sgenv_check_sensor_thresholds(void);
/*
* Debug stuff
*/
#ifdef DEBUG
extern uint_t sgenv_debug;
#define SGENV_DEBUG_NONE 0x00
#define SGENV_DEBUG_POLL 0x01
#define SGENV_DEBUG_EVENT 0x02
#define SGENV_DEBUG_CACHE 0x04
#define SGENV_DEBUG_MSG 0x08
#define SGENV_DEBUG_THREAD 0x10
#define SGENV_DEBUG_ALL 0xFF
#define DCMN_ERR_S(v, s) static fn_t (v) = (s)
#define SGENV_PRINT_MBOX_MSG(x, str) \
#define SGENV_PRINT_ENV_INFO(x) \
"Inf=%llx St=%x PSt=%x", \
#define SGENV_PRINT_POLL_INFO(x) \
#else
#define DCMN_ERR_EVENT if (0) _DCMN_ERR
#define DCMN_ERR_CACHE if (0) _DCMN_ERR
#define DCMN_ERR_THREAD if (0) _DCMN_ERR
#define SGENV_PRINT_MBOX_MSG
#define SGENV_PRINT_ENV_INFO
#define SGENV_PRINT_POLL_INFO
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SGENV_IMPL_H */