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 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 _SYS_LOM_PRIV_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_LOM_PRIV_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate /* 33*7c478bd9Sstevel@tonic-gate * Project private LOMlite definitions. 34*7c478bd9Sstevel@tonic-gate * The definitions here are not used by the end user. 35*7c478bd9Sstevel@tonic-gate */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 38*7c478bd9Sstevel@tonic-gate extern "C" { 39*7c478bd9Sstevel@tonic-gate #endif 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 42*7c478bd9Sstevel@tonic-gate #ifdef __sparc 43*7c478bd9Sstevel@tonic-gate #include <sys/cpu_sgnblk_defs.h> 44*7c478bd9Sstevel@tonic-gate #endif /* __sparc */ 45*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate /* 48*7c478bd9Sstevel@tonic-gate * Data structures which are passed to the driver via the LOMIOCPROG ioctl. 49*7c478bd9Sstevel@tonic-gate * 50*7c478bd9Sstevel@tonic-gate * The userland utility constructs an image which begins with a 51*7c478bd9Sstevel@tonic-gate * lom_prog_data_t structure and is followed by platform specific data 52*7c478bd9Sstevel@tonic-gate * the contents of which are identified by the 'platmagic' value. 53*7c478bd9Sstevel@tonic-gate */ 54*7c478bd9Sstevel@tonic-gate typedef struct { 55*7c478bd9Sstevel@tonic-gate union { 56*7c478bd9Sstevel@tonic-gate uint32_t magic; 57*7c478bd9Sstevel@tonic-gate struct { 58*7c478bd9Sstevel@tonic-gate uint16_t size; 59*7c478bd9Sstevel@tonic-gate uint16_t loadaddr; 60*7c478bd9Sstevel@tonic-gate } old_prog; 61*7c478bd9Sstevel@tonic-gate } header; 62*7c478bd9Sstevel@tonic-gate uint32_t platmagic; 63*7c478bd9Sstevel@tonic-gate /* Platform specific */ 64*7c478bd9Sstevel@tonic-gate union { 65*7c478bd9Sstevel@tonic-gate struct { 66*7c478bd9Sstevel@tonic-gate uint32_t loadaddr; 67*7c478bd9Sstevel@tonic-gate uint32_t size; 68*7c478bd9Sstevel@tonic-gate } bscv; 69*7c478bd9Sstevel@tonic-gate } platform; 70*7c478bd9Sstevel@tonic-gate } lom_prog_data_t; 71*7c478bd9Sstevel@tonic-gate 72*7c478bd9Sstevel@tonic-gate /* 73*7c478bd9Sstevel@tonic-gate * header.magic value - this is chosen because it never occurs on the old 74*7c478bd9Sstevel@tonic-gate * programming data 75*7c478bd9Sstevel@tonic-gate */ 76*7c478bd9Sstevel@tonic-gate #define PROG_MAGIC 0 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate /* 79*7c478bd9Sstevel@tonic-gate * platmagic values. 80*7c478bd9Sstevel@tonic-gate * Top two bytes assigned to specific lom implementations/platform 81*7c478bd9Sstevel@tonic-gate * Bottom two bytes assigned by the implementations/platform. 82*7c478bd9Sstevel@tonic-gate * 83*7c478bd9Sstevel@tonic-gate * 0x4c56 "LV" - bscv and derivatives. 84*7c478bd9Sstevel@tonic-gate * 0x4c564c4f "LVLO" - firmware downloader. 85*7c478bd9Sstevel@tonic-gate * 0x4c56494d "LVIM" - firmware image. 86*7c478bd9Sstevel@tonic-gate * 0x5347 "SG" - serengeti based lom. 87*7c478bd9Sstevel@tonic-gate * Not specified here. 88*7c478bd9Sstevel@tonic-gate */ 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate #define PROG_PLAT_BSCV_LOADER 0x4c564c4f 91*7c478bd9Sstevel@tonic-gate #define PROG_PLAT_BSCV_IMAGE 0x4c56494d 92*7c478bd9Sstevel@tonic-gate #define PROG_PLAT_SG_IMAGE 0x5347494d 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* defn for top byte of 16bit event code */ 95*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_NONE 0x00 96*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_ALARM 0x01 97*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_TEMP 0x02 98*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_OVERTEMP 0x03 99*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_FAN 0x04 100*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_SUPPLY 0x05 101*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_BREAKER 0x06 102*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_PSU 0x07 103*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_USER 0x08 104*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_PHONEHOME 0x09 105*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_LOM 0x0a 106*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_HOST 0x0b 107*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_EVENTLOG 0x0c 108*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_EXTRA 0x0d /* reserved for future use */ 109*7c478bd9Sstevel@tonic-gate #define EVENT_SUBSYS_LED 0x0e 110*7c478bd9Sstevel@tonic-gate 111*7c478bd9Sstevel@tonic-gate #define EVENT_MASK_SHUTDOWN_REQD 0x20 112*7c478bd9Sstevel@tonic-gate #define EVENT_MASK_FAULT 0x40 113*7c478bd9Sstevel@tonic-gate #define EVENT_MASK_FATAL 0x80 114*7c478bd9Sstevel@tonic-gate 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #define EVENT_NONE 0x00 117*7c478bd9Sstevel@tonic-gate #define EVENT_STATE_ON 0x01 118*7c478bd9Sstevel@tonic-gate #define EVENT_STATE_OFF 0x02 119*7c478bd9Sstevel@tonic-gate #define EVENT_STATE_CHANGE 0x03 120*7c478bd9Sstevel@tonic-gate #define EVENT_POWER_ON 0x04 121*7c478bd9Sstevel@tonic-gate #define EVENT_POWER_OFF 0x05 122*7c478bd9Sstevel@tonic-gate #define EVENT_UNEXPECTED_POWER_OFF 0x06 123*7c478bd9Sstevel@tonic-gate #define EVENT_UNEXPECTED_RESET 0x07 124*7c478bd9Sstevel@tonic-gate #define EVENT_BOOTED 0x08 125*7c478bd9Sstevel@tonic-gate #define EVENT_WATCHDOG_ON 0x09 126*7c478bd9Sstevel@tonic-gate #define EVENT_WATCHDOG_OFF 0x0a 127*7c478bd9Sstevel@tonic-gate #define EVENT_WATCHDOG_TRIGGER 0x0b 128*7c478bd9Sstevel@tonic-gate #define EVENT_FAILED 0x0c 129*7c478bd9Sstevel@tonic-gate #define EVENT_RECOVERED 0x0d 130*7c478bd9Sstevel@tonic-gate #define EVENT_RESET 0x0e 131*7c478bd9Sstevel@tonic-gate #define EVENT_ABORT 0x0f 132*7c478bd9Sstevel@tonic-gate #define EVENT_CONSOLE_SELECT 0x10 133*7c478bd9Sstevel@tonic-gate #define EVENT_TIME_REFERENCE 0x11 134*7c478bd9Sstevel@tonic-gate #define EVENT_SCRIPT_FAILURE 0x12 135*7c478bd9Sstevel@tonic-gate #define EVENT_MODEM_ACCESS_FAIL 0x13 136*7c478bd9Sstevel@tonic-gate #define EVENT_MODEM_DIAL_FAIL 0x14 137*7c478bd9Sstevel@tonic-gate #define EVENT_BAD_CHECKSUM 0x15 138*7c478bd9Sstevel@tonic-gate #define EVENT_USER_ADDED 0x16 139*7c478bd9Sstevel@tonic-gate #define EVENT_USER_REMOVED 0x17 140*7c478bd9Sstevel@tonic-gate #define EVENT_USER_PERMSCHANGED 0x18 141*7c478bd9Sstevel@tonic-gate #define EVENT_USER_LOGIN 0x19 142*7c478bd9Sstevel@tonic-gate #define EVENT_USER_PASSWORD_CHANGE 0x1a 143*7c478bd9Sstevel@tonic-gate #define EVENT_USER_LOGINFAIL 0x1b 144*7c478bd9Sstevel@tonic-gate #define EVENT_USER_LOGOUT 0x1c 145*7c478bd9Sstevel@tonic-gate #define EVENT_FLASH_DOWNLOAD 0x1d 146*7c478bd9Sstevel@tonic-gate #define EVENT_DATA_LOST 0x1e 147*7c478bd9Sstevel@tonic-gate #define EVENT_DEVICE_BUSY 0x1f 148*7c478bd9Sstevel@tonic-gate #define EVENT_FAULT_LED 0x20 149*7c478bd9Sstevel@tonic-gate #define EVENT_OVERHEAT 0x21 150*7c478bd9Sstevel@tonic-gate #define EVENT_SEVERE_OVERHEAT 0x22 151*7c478bd9Sstevel@tonic-gate #define EVENT_NO_OVERHEAT 0x23 152*7c478bd9Sstevel@tonic-gate #define EVENT_SCC_STATUS 0x24 153*7c478bd9Sstevel@tonic-gate /* bscv only */ 154*7c478bd9Sstevel@tonic-gate #define EVENT_DEVICE_INACCESSIBLE 0x25 155*7c478bd9Sstevel@tonic-gate #define EVENT_HOSTNAME_CHANGE 0x26 156*7c478bd9Sstevel@tonic-gate #define EVENT_CPUSIG_TIMEOUT 0x27 157*7c478bd9Sstevel@tonic-gate #define EVENT_BOOTMODE_CHANGE 0x28 158*7c478bd9Sstevel@tonic-gate #define EVENT_WATCHDOG_CHANGE_POLICY 0x29 159*7c478bd9Sstevel@tonic-gate #define EVENT_WATCHDOG_CHANGE_TIMEOUT 0x2a 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate /* 162*7c478bd9Sstevel@tonic-gate * Event "detail" information - bscv only 163*7c478bd9Sstevel@tonic-gate */ 164*7c478bd9Sstevel@tonic-gate #define LOM_RESET_DETAIL_BYUSER 1 165*7c478bd9Sstevel@tonic-gate #define LOM_RESET_DETAIL_REPROGRAMMING 2 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate #define LOM_WDOGTRIGGER_DETAIL_HARD 0 168*7c478bd9Sstevel@tonic-gate #define LOM_WDOGTRIGGER_DETAIL_SOFT 1 169*7c478bd9Sstevel@tonic-gate 170*7c478bd9Sstevel@tonic-gate #define LOM_UNEXPECTEDRESET_MASK_BADTRAP 0x80 171*7c478bd9Sstevel@tonic-gate #define EBUS_BOOTMODE_FORCE_CONSOLE 0x01 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate /* 174*7c478bd9Sstevel@tonic-gate * Event log filtering 175*7c478bd9Sstevel@tonic-gate */ 176*7c478bd9Sstevel@tonic-gate #define EVENT_LEVEL_USER 4 177*7c478bd9Sstevel@tonic-gate #define EVENT_LEVEL_NOTICE 3 178*7c478bd9Sstevel@tonic-gate #define EVENT_LEVEL_FAULT 2 179*7c478bd9Sstevel@tonic-gate #define EVENT_LEVEL_FATAL 1 180*7c478bd9Sstevel@tonic-gate 181*7c478bd9Sstevel@tonic-gate /* 182*7c478bd9Sstevel@tonic-gate * Event data 183*7c478bd9Sstevel@tonic-gate */ 184*7c478bd9Sstevel@tonic-gate typedef struct { 185*7c478bd9Sstevel@tonic-gate uint8_t ev_subsys; 186*7c478bd9Sstevel@tonic-gate uint8_t ev_event; 187*7c478bd9Sstevel@tonic-gate uint8_t ev_resource; 188*7c478bd9Sstevel@tonic-gate uint8_t ev_detail; 189*7c478bd9Sstevel@tonic-gate uint8_t ev_data[4]; 190*7c478bd9Sstevel@tonic-gate } lom_event_t; 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate 193*7c478bd9Sstevel@tonic-gate #define EVENT_DECODE_SUBSYS(evcode) ((evcode) & 0x1f) 194*7c478bd9Sstevel@tonic-gate #define EVENT_DECODE_FAULT(evcode) ((evcode) & (EVENT_MASK_FAULT| \ 195*7c478bd9Sstevel@tonic-gate EVENT_MASK_FATAL| \ 196*7c478bd9Sstevel@tonic-gate EVENT_MASK_SHUTDOWN_REQD)) 197*7c478bd9Sstevel@tonic-gate 198*7c478bd9Sstevel@tonic-gate /* Magic numbers for reading values from conf files */ 199*7c478bd9Sstevel@tonic-gate #define LOM_TEMP_PROP_NOT_SET 0x80000000 /* Use current setting */ 200*7c478bd9Sstevel@tonic-gate #define LOM_TEMP_PROP_MIN 40 /* Minimum temp settable */ 201*7c478bd9Sstevel@tonic-gate #define LOM_TEMP_PROP_MAX 120 /* Maximum temp settable */ 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate #define LOM_SERIAL_TOUT_DEFAULT 0 /* Default value */ 204*7c478bd9Sstevel@tonic-gate #define LOM_SERIAL_TOUT_MIN 5 /* Minimum timeout period */ 205*7c478bd9Sstevel@tonic-gate #define LOM_SERIAL_TOUT_MAX 0xff /* Maximum timeout period */ 206*7c478bd9Sstevel@tonic-gate 207*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 208*7c478bd9Sstevel@tonic-gate /* Inter Driver Interface */ 209*7c478bd9Sstevel@tonic-gate 210*7c478bd9Sstevel@tonic-gate #define SUNW_KERN_BSCV_MODULENAME "bscv" 211*7c478bd9Sstevel@tonic-gate #define SUNW_KERN_BSCV_IDI_FN "bscv_idi_set" 212*7c478bd9Sstevel@tonic-gate 213*7c478bd9Sstevel@tonic-gate enum bscv_idi_type { 214*7c478bd9Sstevel@tonic-gate BSCV_IDI_NULL = 0, 215*7c478bd9Sstevel@tonic-gate BSCV_IDI_NODENAME, 216*7c478bd9Sstevel@tonic-gate BSCV_IDI_SIG, 217*7c478bd9Sstevel@tonic-gate BSCV_IDI_WDOG_PAT, 218*7c478bd9Sstevel@tonic-gate BSCV_IDI_WDOG_CFG 219*7c478bd9Sstevel@tonic-gate }; 220*7c478bd9Sstevel@tonic-gate 221*7c478bd9Sstevel@tonic-gate #ifdef __sparc 222*7c478bd9Sstevel@tonic-gate typedef 223*7c478bd9Sstevel@tonic-gate struct { 224*7c478bd9Sstevel@tonic-gate uint32_t cpu; 225*7c478bd9Sstevel@tonic-gate sig_state_t sig_info; 226*7c478bd9Sstevel@tonic-gate } bscv_sig_t; 227*7c478bd9Sstevel@tonic-gate #endif /* __sparc */ 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate typedef 230*7c478bd9Sstevel@tonic-gate struct { 231*7c478bd9Sstevel@tonic-gate /* 232*7c478bd9Sstevel@tonic-gate * Enable the watchdog. This must be done before patting is done. 233*7c478bd9Sstevel@tonic-gate */ 234*7c478bd9Sstevel@tonic-gate uint8_t enable_wdog; 235*7c478bd9Sstevel@tonic-gate 236*7c478bd9Sstevel@tonic-gate /* 237*7c478bd9Sstevel@tonic-gate * wdog_timeout_s seconds before watchdog expires; minimum 238*7c478bd9Sstevel@tonic-gate * value is 1, maximum value is 127. The dog must be patted 239*7c478bd9Sstevel@tonic-gate * once per second. 240*7c478bd9Sstevel@tonic-gate */ 241*7c478bd9Sstevel@tonic-gate uint_t wdog_timeout_s; 242*7c478bd9Sstevel@tonic-gate 243*7c478bd9Sstevel@tonic-gate /* 244*7c478bd9Sstevel@tonic-gate * reset_system_on_timeout false means the microcontroller will only 245*7c478bd9Sstevel@tonic-gate * log the fact that the watchdog expired, rather than actually 246*7c478bd9Sstevel@tonic-gate * resetting the host. 247*7c478bd9Sstevel@tonic-gate */ 248*7c478bd9Sstevel@tonic-gate uint8_t reset_system_on_timeout; 249*7c478bd9Sstevel@tonic-gate 250*7c478bd9Sstevel@tonic-gate } bscv_wdog_t; 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate struct bscv_idi_info { 253*7c478bd9Sstevel@tonic-gate enum bscv_idi_type type; 254*7c478bd9Sstevel@tonic-gate void *data; 255*7c478bd9Sstevel@tonic-gate size_t size; 256*7c478bd9Sstevel@tonic-gate }; 257*7c478bd9Sstevel@tonic-gate 258*7c478bd9Sstevel@tonic-gate void bscv_idi_set(struct bscv_idi_info info); 259*7c478bd9Sstevel@tonic-gate 260*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 263*7c478bd9Sstevel@tonic-gate } 264*7c478bd9Sstevel@tonic-gate #endif 265*7c478bd9Sstevel@tonic-gate 266*7c478bd9Sstevel@tonic-gate #endif /* _SYS_LOM_PRIV_H */ 267