1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 1999-2001, 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _PSVC_OBJECTS_CLASS_H 28*7c478bd9Sstevel@tonic-gate #define _PSVC_OBJECTS_CLASS_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * Platform Services Framework private definitions 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate #include <pthread.h> 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #define NAMELEN 32 42*7c478bd9Sstevel@tonic-gate #define PATHLEN 256 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* Logical device class */ 45*7c478bd9Sstevel@tonic-gate typedef struct { 46*7c478bd9Sstevel@tonic-gate int32_t class; 47*7c478bd9Sstevel@tonic-gate int32_t subclass; 48*7c478bd9Sstevel@tonic-gate int32_t instance; 49*7c478bd9Sstevel@tonic-gate uint64_t features; 50*7c478bd9Sstevel@tonic-gate uint64_t addr_spec; 51*7c478bd9Sstevel@tonic-gate char state[32]; 52*7c478bd9Sstevel@tonic-gate char previous_state[32]; 53*7c478bd9Sstevel@tonic-gate char fault_id[32]; 54*7c478bd9Sstevel@tonic-gate boolean_t present; 55*7c478bd9Sstevel@tonic-gate boolean_t previous_presence; 56*7c478bd9Sstevel@tonic-gate boolean_t enabled; 57*7c478bd9Sstevel@tonic-gate char label[32]; 58*7c478bd9Sstevel@tonic-gate int32_t (*constructor)(); 59*7c478bd9Sstevel@tonic-gate int32_t (*destructor)(); 60*7c478bd9Sstevel@tonic-gate int32_t (*get_attr)(); 61*7c478bd9Sstevel@tonic-gate int32_t (*set_attr)(); 62*7c478bd9Sstevel@tonic-gate } EObj_t; 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate typedef struct { 65*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 66*7c478bd9Sstevel@tonic-gate int32_t hw_lo_shut; 67*7c478bd9Sstevel@tonic-gate int32_t lo_warn; /* low warning threshold */ 68*7c478bd9Sstevel@tonic-gate int32_t lo_shut; /* low shutdown threshold */ 69*7c478bd9Sstevel@tonic-gate int32_t opt_temp; 70*7c478bd9Sstevel@tonic-gate int32_t hi_warn; /* high warning threshold */ 71*7c478bd9Sstevel@tonic-gate int32_t hi_shut; /* high shutdown threshold */ 72*7c478bd9Sstevel@tonic-gate int32_t hw_hi_shut; 73*7c478bd9Sstevel@tonic-gate } ETempSensor_t; 74*7c478bd9Sstevel@tonic-gate 75*7c478bd9Sstevel@tonic-gate typedef struct { 76*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 77*7c478bd9Sstevel@tonic-gate int16_t setpoint; 78*7c478bd9Sstevel@tonic-gate int16_t hysteresis; 79*7c478bd9Sstevel@tonic-gate int16_t loopgain; 80*7c478bd9Sstevel@tonic-gate int16_t loopbias; 81*7c478bd9Sstevel@tonic-gate float temp_differential[PSVC_MAXERRORS]; 82*7c478bd9Sstevel@tonic-gate int16_t temp_differential_index; 83*7c478bd9Sstevel@tonic-gate } EFan_t; 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate typedef struct { 86*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 87*7c478bd9Sstevel@tonic-gate } ESystem_t; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate typedef struct { 90*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 91*7c478bd9Sstevel@tonic-gate int32_t lo_warn; /* low warning threshold */ 92*7c478bd9Sstevel@tonic-gate int32_t lo_shut; /* low shutdown threshold */ 93*7c478bd9Sstevel@tonic-gate int32_t hi_warn; /* high warning threshold */ 94*7c478bd9Sstevel@tonic-gate int32_t hi_shut; /* high shutdown threshold */ 95*7c478bd9Sstevel@tonic-gate } EDigiSensor_t; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate typedef struct { 98*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 99*7c478bd9Sstevel@tonic-gate } EDigiControl_t; 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate typedef struct { 102*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 103*7c478bd9Sstevel@tonic-gate } EBoolSensor_t; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate typedef struct { 106*7c478bd9Sstevel@tonic-gate EObj_t ld; 107*7c478bd9Sstevel@tonic-gate } EGPIO8_t; 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate typedef struct { 110*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 111*7c478bd9Sstevel@tonic-gate int16_t lit_count; 112*7c478bd9Sstevel@tonic-gate char color[32]; 113*7c478bd9Sstevel@tonic-gate char is_locator[8]; 114*7c478bd9Sstevel@tonic-gate char locator_name[32]; 115*7c478bd9Sstevel@tonic-gate } ELed_t; 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate typedef struct { 118*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 119*7c478bd9Sstevel@tonic-gate int32_t lo_warn; /* low warning threshold */ 120*7c478bd9Sstevel@tonic-gate int32_t lo_shut; /* low shutdown threshold */ 121*7c478bd9Sstevel@tonic-gate int32_t hi_warn; /* high warning threshold */ 122*7c478bd9Sstevel@tonic-gate int32_t hi_shut; /* high shutdown threshold */ 123*7c478bd9Sstevel@tonic-gate } EFanTach_t; 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate typedef struct { 126*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 127*7c478bd9Sstevel@tonic-gate char switch_state[32]; 128*7c478bd9Sstevel@tonic-gate } ESwitch_t; 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate typedef struct { 131*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 132*7c478bd9Sstevel@tonic-gate } EKeySwitch_t; 133*7c478bd9Sstevel@tonic-gate 134*7c478bd9Sstevel@tonic-gate typedef struct { 135*7c478bd9Sstevel@tonic-gate EObj_t ld; /* logical device */ 136*7c478bd9Sstevel@tonic-gate int32_t (*get_temperature)(); 137*7c478bd9Sstevel@tonic-gate int32_t (*get_fanspeed)(); 138*7c478bd9Sstevel@tonic-gate int32_t (*get_bit)(); 139*7c478bd9Sstevel@tonic-gate int32_t (*set_bit)(); 140*7c478bd9Sstevel@tonic-gate int32_t (*get_port)(); 141*7c478bd9Sstevel@tonic-gate int32_t (*set_port)(); 142*7c478bd9Sstevel@tonic-gate int32_t (*get_reg)(); 143*7c478bd9Sstevel@tonic-gate int32_t (*set_reg)(); 144*7c478bd9Sstevel@tonic-gate int32_t (*get_output)(); 145*7c478bd9Sstevel@tonic-gate int32_t (*set_output)(); 146*7c478bd9Sstevel@tonic-gate int32_t (*get_input)(); 147*7c478bd9Sstevel@tonic-gate } EPhysDev_t; 148*7c478bd9Sstevel@tonic-gate 149*7c478bd9Sstevel@tonic-gate typedef struct { 150*7c478bd9Sstevel@tonic-gate uint8_t cell_type; 151*7c478bd9Sstevel@tonic-gate uint32_t size; 152*7c478bd9Sstevel@tonic-gate int64_t *table; 153*7c478bd9Sstevel@tonic-gate } ETable_t; 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate typedef struct { 156*7c478bd9Sstevel@tonic-gate char antecedent_id[NAMELEN]; 157*7c478bd9Sstevel@tonic-gate int32_t ant_key; 158*7c478bd9Sstevel@tonic-gate char dependent_id[NAMELEN]; 159*7c478bd9Sstevel@tonic-gate } EAssoc_t; 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate typedef struct { 162*7c478bd9Sstevel@tonic-gate char name[NAMELEN]; 163*7c478bd9Sstevel@tonic-gate uint32_t count; 164*7c478bd9Sstevel@tonic-gate EAssoc_t *table; 165*7c478bd9Sstevel@tonic-gate } EAssocList_t; 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate /* structure for translating string to id */ 168*7c478bd9Sstevel@tonic-gate typedef struct { 169*7c478bd9Sstevel@tonic-gate int32_t id; 170*7c478bd9Sstevel@tonic-gate char name[NAMELEN]; 171*7c478bd9Sstevel@tonic-gate } EStringId_t; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate typedef struct { 174*7c478bd9Sstevel@tonic-gate uint32_t controller; 175*7c478bd9Sstevel@tonic-gate uint32_t bus; 176*7c478bd9Sstevel@tonic-gate uint32_t addr; 177*7c478bd9Sstevel@tonic-gate uint32_t port; 178*7c478bd9Sstevel@tonic-gate char path[PATHLEN]; 179*7c478bd9Sstevel@tonic-gate } EDevice_t; 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* translate name to object (or table) pointer */ 182*7c478bd9Sstevel@tonic-gate typedef struct { 183*7c478bd9Sstevel@tonic-gate char name[NAMELEN]; 184*7c478bd9Sstevel@tonic-gate int32_t key; 185*7c478bd9Sstevel@tonic-gate EObj_t *objp; 186*7c478bd9Sstevel@tonic-gate int32_t type; /* object or table */ 187*7c478bd9Sstevel@tonic-gate } ENamePtr_t; 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate typedef struct { 190*7c478bd9Sstevel@tonic-gate ENamePtr_t *obj_tbl; /* object name to pointer translation */ 191*7c478bd9Sstevel@tonic-gate uint32_t obj_count; /* number of objects */ 192*7c478bd9Sstevel@tonic-gate uint32_t nextid; /* next open object slot */ 193*7c478bd9Sstevel@tonic-gate } ETable_Array; 194*7c478bd9Sstevel@tonic-gate 195*7c478bd9Sstevel@tonic-gate #define PSVC_OBJ 0 196*7c478bd9Sstevel@tonic-gate #define PSVC_TBL 1 197*7c478bd9Sstevel@tonic-gate #define PSVC_MAX_TABLE_ARRAYS 10 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate typedef struct { 200*7c478bd9Sstevel@tonic-gate ETable_Array tbl_arry[PSVC_MAX_TABLE_ARRAYS]; 201*7c478bd9Sstevel@tonic-gate uint32_t total_obj_count; /* Total number of objects */ 202*7c478bd9Sstevel@tonic-gate EStringId_t *othr_tbl; /* assoc string to id translations */ 203*7c478bd9Sstevel@tonic-gate uint32_t othr_count; /* number of assoc strings */ 204*7c478bd9Sstevel@tonic-gate EAssocList_t *assoc_tbl; /* associations between objects */ 205*7c478bd9Sstevel@tonic-gate uint32_t assoc_count; /* number of associations */ 206*7c478bd9Sstevel@tonic-gate EDevice_t *dev_tbl; /* device paths */ 207*7c478bd9Sstevel@tonic-gate uint32_t dev_count; /* number of device paths */ 208*7c478bd9Sstevel@tonic-gate FILE *fp; /* config file */ 209*7c478bd9Sstevel@tonic-gate pthread_mutex_t mutex; /* multi threaded protection */ 210*7c478bd9Sstevel@tonic-gate } EHdl_t; 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate /* String lookup table for attributes */ 213*7c478bd9Sstevel@tonic-gate static char *attr_str_tab[] = { 214*7c478bd9Sstevel@tonic-gate "_class", /* 0 */ 215*7c478bd9Sstevel@tonic-gate "Subclass", /* 1 */ 216*7c478bd9Sstevel@tonic-gate "Presence", /* 2 */ 217*7c478bd9Sstevel@tonic-gate "Previous-presence", /* 3 */ 218*7c478bd9Sstevel@tonic-gate "State", /* 4 */ 219*7c478bd9Sstevel@tonic-gate "Previous-state", /* 5 */ 220*7c478bd9Sstevel@tonic-gate "Enabled", /* 6 */ 221*7c478bd9Sstevel@tonic-gate "FaultInformation", /* 7 */ 222*7c478bd9Sstevel@tonic-gate "Features", /* 8 */ 223*7c478bd9Sstevel@tonic-gate "Label", /* 9 */ 224*7c478bd9Sstevel@tonic-gate "Fruid", /* 10 */ 225*7c478bd9Sstevel@tonic-gate "Instance", /* 11 */ 226*7c478bd9Sstevel@tonic-gate "Led-color", /* 12 */ 227*7c478bd9Sstevel@tonic-gate "Lo-warn", /* 13 */ 228*7c478bd9Sstevel@tonic-gate "Lo-shut", /* 14 */ 229*7c478bd9Sstevel@tonic-gate "Hi-warn", /* 15 */ 230*7c478bd9Sstevel@tonic-gate "Hi-shut", /* 16 */ 231*7c478bd9Sstevel@tonic-gate "Opt-temp", /* 17 */ 232*7c478bd9Sstevel@tonic-gate "Hw-hi-shut", /* 18 */ 233*7c478bd9Sstevel@tonic-gate "Hw-lo-shut", /* 19 */ 234*7c478bd9Sstevel@tonic-gate "Setpoint", /* 20 */ 235*7c478bd9Sstevel@tonic-gate "Hysteresis", /* 21 */ 236*7c478bd9Sstevel@tonic-gate "Loopgain", /* 22 */ 237*7c478bd9Sstevel@tonic-gate "Loopbias", /* 23 */ 238*7c478bd9Sstevel@tonic-gate "Temp_differential", /* 24 */ 239*7c478bd9Sstevel@tonic-gate "Temp_differential_index", /* 25 */ 240*7c478bd9Sstevel@tonic-gate "Sensor-value", /* 26 */ 241*7c478bd9Sstevel@tonic-gate "Gpio-value", /* 27 */ 242*7c478bd9Sstevel@tonic-gate "#Bits", /* 28 */ 243*7c478bd9Sstevel@tonic-gate "Control-value", /* 29 */ 244*7c478bd9Sstevel@tonic-gate "Led-state", /* 30 */ 245*7c478bd9Sstevel@tonic-gate "Switch-state", /* 31 */ 246*7c478bd9Sstevel@tonic-gate "Probe-result", /* 32 */ 247*7c478bd9Sstevel@tonic-gate "Table_value", /* 33 */ 248*7c478bd9Sstevel@tonic-gate "Assoc_id", /* 34 */ 249*7c478bd9Sstevel@tonic-gate "Assoc_matches", /* 35 */ 250*7c478bd9Sstevel@tonic-gate "Addr-spec", /* 36 */ 251*7c478bd9Sstevel@tonic-gate "Object-id", /* 37 */ 252*7c478bd9Sstevel@tonic-gate "Led-lit-count", /* 38 */ 253*7c478bd9Sstevel@tonic-gate "FRU-info", /* 39 */ 254*7c478bd9Sstevel@tonic-gate "IsLocator", /* 40 */ 255*7c478bd9Sstevel@tonic-gate "LocatorName" /* 41 */ 256*7c478bd9Sstevel@tonic-gate }; 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate int ATTR_STR_TAB_SIZE = sizeof (attr_str_tab) / sizeof (char *); 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 261*7c478bd9Sstevel@tonic-gate } 262*7c478bd9Sstevel@tonic-gate #endif 263*7c478bd9Sstevel@tonic-gate 264*7c478bd9Sstevel@tonic-gate #endif /* _PSVC_OBJECTS_CLASS_H */ 265