1 /*
   2  * CDDL HEADER START
   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _PICLENVMOND_H
  28 #define _PICLENVMOND_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /* debug flags */
  37 #define DEBUG           0x1     /* generic debug messages */
  38 #define EVENTS          0x2     /* only events related debug message */
  39 #define PTREE           0x4     /* messages relating to picltree search */
  40 #define SP_MONITOR      0x8     /* AC health monitoring messages only */
  41 #define CHASSIS_INFO    0x10    /* Chassis related debug information */
  42 #define PICLEVENTS      0x20    /* Display only PICL events received */
  43 
  44 #define PICL_NODE_CHASSIS       "chassis"
  45 #define PICL_NODE_CPU           "CPU"
  46 #define PICL_NODE_RTM           "RTM"
  47 #define PICL_PROP_CONF_FILE     "conf_name"
  48 #define TEMPERATURE_SENSOR_TYPE (0x1u)
  49 
  50 typedef enum {
  51         LOC_STATE_UNKNOWN = 0,
  52         LOC_STATE_EMPTY,
  53         LOC_STATE_DISCONNECTING,
  54         LOC_STATE_DISCONNECTED,
  55         LOC_STATE_CONNECTING,
  56         LOC_STATE_CONNECTED,
  57         FRU_STATE_UNKNOWN,
  58         FRU_STATE_UNCONFIGURING,
  59         FRU_STATE_UNCONFIGURED,
  60         FRU_STATE_CONFIGURING,
  61         FRU_STATE_CONFIGURED,
  62         FRU_COND_OK,
  63         FRU_COND_FAILING,
  64         FRU_COND_FAILED,
  65         FRU_COND_DEGRADED,
  66         FRU_COND_UNKNOWN,
  67         FRU_COND_TESTING
  68 } env_state_event_t;
  69 
  70 typedef enum {NO_COND_TIMEDWAIT = 0, COND_TIMEDWAIT, NO_WAIT} env_wait_state_t;
  71 
  72 #define NULLREAD        (int (*)(ptree_rarg_t *, void *))0
  73 #define NULLWRITE       (int (*)(ptree_warg_t *, const void *))0
  74 #define POLL_TIMEOUT    5000
  75 #define DEFAULT_FD      -1
  76 #define DEFAULT_SEQN    0xff
  77 
  78 /* byte of pointer to signed integer */
  79 #define BYTE_0(_X)                      (*((int8_t *)(_X) + 0))
  80 #define BYTE_1(_X)                      (*((int8_t *)(_X) + 1))
  81 #define BYTE_2(_X)                      (*((int8_t *)(_X) + 2))
  82 #define BYTE_3(_X)                      (*((int8_t *)(_X) + 3))
  83 #define BYTE_4(_X)                      (*((int8_t *)(_X) + 4))
  84 #define BYTE_5(_X)                      (*((int8_t *)(_X) + 5))
  85 #define BYTE_6(_X)                      (*((int8_t *)(_X) + 6))
  86 #define BYTE_7(_X)                      (*((int8_t *)(_X) + 7))
  87 #define BYTE_8(_X)                      (*((int8_t *)(_X) + 8))
  88 
  89 #define BIT_0(_X)                       ((_X) & 0x01)
  90 #define BIT_1(_X)                       ((_X) & 0x02)
  91 #define BIT_2(_X)                       ((_X) & 0x04)
  92 #define BIT_3(_X)                       ((_X) & 0x08)
  93 #define BIT_4(_X)                       ((_X) & 0x10)
  94 #define BIT_5(_X)                       ((_X) & 0x20)
  95 #define BIT_6(_X)                       ((_X) & 0x40)
  96 #define BIT_7(_X)                       ((_X) & 0x80)
  97 
  98 #define PICL_ADMINLOCK_DISABLED "disabled"
  99 #define PICL_ADMINLOCK_ENABLED  "enabled"
 100 
 101 #define PTREE_INIT_PROPINFO_FAILED_MSG \
 102         gettext("SUNW_envmond:ptree_init_propinfo() failed, error = %d")
 103 #define PTREE_CREATE_AND_ADD_PROP_FAILED_MSG \
 104         gettext("SUNW_envmond: ptree_create_and_add_prop() failed error = %d")
 105 
 106 #ifdef  __cplusplus
 107 }
 108 #endif
 109 
 110 #endif  /* _PICLENVMOND_H */