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