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 2004 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_FM_UTIL_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_FM_UTIL_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 #include <sys/nvpair.h> 37*7c478bd9Sstevel@tonic-gate #include <sys/errorq.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate /* 40*7c478bd9Sstevel@tonic-gate * Shared user/kernel definitions for class length, error channel name, 41*7c478bd9Sstevel@tonic-gate * and kernel event publisher string. 42*7c478bd9Sstevel@tonic-gate */ 43*7c478bd9Sstevel@tonic-gate #define FM_MAX_CLASS 100 44*7c478bd9Sstevel@tonic-gate #define FM_ERROR_CHAN "com.sun:fm:error" 45*7c478bd9Sstevel@tonic-gate #define FM_PUB "fm" 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate /* 48*7c478bd9Sstevel@tonic-gate * ereport dump device transport support 49*7c478bd9Sstevel@tonic-gate * 50*7c478bd9Sstevel@tonic-gate * Ereports are written out to the dump device at a proscribed offset from the 51*7c478bd9Sstevel@tonic-gate * end, similar to in-transit log messages. The ereports are represented as a 52*7c478bd9Sstevel@tonic-gate * erpt_dump_t header followed by ed_size bytes of packed native nvlist data. 53*7c478bd9Sstevel@tonic-gate * 54*7c478bd9Sstevel@tonic-gate * NOTE: All of these constants and the header must be defined so they have the 55*7c478bd9Sstevel@tonic-gate * same representation for *both* 32-bit and 64-bit producers and consumers. 56*7c478bd9Sstevel@tonic-gate */ 57*7c478bd9Sstevel@tonic-gate #define ERPT_MAGIC 0xf00d4eddU 58*7c478bd9Sstevel@tonic-gate #define ERPT_MAX_ERRS 32 59*7c478bd9Sstevel@tonic-gate #define ERPT_DATA_SZ (3 * 1024) 60*7c478bd9Sstevel@tonic-gate #define ERPT_EVCH_MAX 256 61*7c478bd9Sstevel@tonic-gate #define ERPT_HIWAT 64 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate typedef struct erpt_dump { 64*7c478bd9Sstevel@tonic-gate uint32_t ed_magic; /* ERPT_MAGIC or zero to indicate end */ 65*7c478bd9Sstevel@tonic-gate uint32_t ed_chksum; /* checksum32() of packed nvlist data */ 66*7c478bd9Sstevel@tonic-gate uint32_t ed_size; /* ereport (nvl) fixed buf size */ 67*7c478bd9Sstevel@tonic-gate uint32_t ed_pad; /* reserved for future use */ 68*7c478bd9Sstevel@tonic-gate hrtime_t ed_hrt_nsec; /* hrtime of this ereport */ 69*7c478bd9Sstevel@tonic-gate hrtime_t ed_hrt_base; /* hrtime sample corresponding to ed_tod_base */ 70*7c478bd9Sstevel@tonic-gate struct { 71*7c478bd9Sstevel@tonic-gate uint64_t sec; /* seconds since gettimeofday() Epoch */ 72*7c478bd9Sstevel@tonic-gate uint64_t nsec; /* nanoseconds past ed_tod_base.sec */ 73*7c478bd9Sstevel@tonic-gate } ed_tod_base; 74*7c478bd9Sstevel@tonic-gate } erpt_dump_t; 75*7c478bd9Sstevel@tonic-gate 76*7c478bd9Sstevel@tonic-gate #ifdef _KERNEL 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate #define FM_ERR_PIL 2 /* PIL for ereport_errorq drain processing */ 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate extern errorq_t *ereport_errorq; 81*7c478bd9Sstevel@tonic-gate extern void *ereport_dumpbuf; 82*7c478bd9Sstevel@tonic-gate extern size_t ereport_dumplen; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate extern void fm_init(void); 85*7c478bd9Sstevel@tonic-gate extern void fm_nvprint(nvlist_t *); 86*7c478bd9Sstevel@tonic-gate extern void fm_panic(const char *, ...); 87*7c478bd9Sstevel@tonic-gate extern void fm_banner(void); 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate extern void fm_ereport_dump(void); 90*7c478bd9Sstevel@tonic-gate extern void fm_ereport_post(nvlist_t *, int); 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 95*7c478bd9Sstevel@tonic-gate } 96*7c478bd9Sstevel@tonic-gate #endif 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate #endif /* _SYS_FM_UTIL_H */ 99