17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 57c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 67c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 77c478bd9Sstevel@tonic-gate * with the License. 87c478bd9Sstevel@tonic-gate * 97c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate * and limitations under the License. 137c478bd9Sstevel@tonic-gate * 147c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate * 207c478bd9Sstevel@tonic-gate * CDDL HEADER END 217c478bd9Sstevel@tonic-gate */ 227c478bd9Sstevel@tonic-gate /* 237c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_FM_PROTOCOL_H 287c478bd9Sstevel@tonic-gate #define _SYS_FM_PROTOCOL_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #ifdef _KERNEL 377c478bd9Sstevel@tonic-gate #include <sys/varargs.h> 387c478bd9Sstevel@tonic-gate #include <sys/nvpair.h> 397c478bd9Sstevel@tonic-gate #else 407c478bd9Sstevel@tonic-gate #include <libnvpair.h> 417c478bd9Sstevel@tonic-gate #include <stdarg.h> 427c478bd9Sstevel@tonic-gate #endif 437c478bd9Sstevel@tonic-gate #include <sys/processor.h> 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* FM common member names */ 467c478bd9Sstevel@tonic-gate #define FM_CLASS "class" 477c478bd9Sstevel@tonic-gate #define FM_VERSION "version" 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gate /* FM event class values */ 507c478bd9Sstevel@tonic-gate #define FM_EREPORT_CLASS "ereport" 517c478bd9Sstevel@tonic-gate #define FM_FAULT_CLASS "fault" 527c478bd9Sstevel@tonic-gate #define FM_RSRC_CLASS "resource" 537c478bd9Sstevel@tonic-gate #define FM_LIST_EVENT "list" 547c478bd9Sstevel@tonic-gate #define FM_LIST_SUSPECT_CLASS FM_LIST_EVENT ".suspect" 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* ereport class subcategory values */ 577c478bd9Sstevel@tonic-gate #define FM_ERROR_CPU "cpu" 587c478bd9Sstevel@tonic-gate #define FM_ERROR_IO "io" 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate /* ereport version and payload member names */ 617c478bd9Sstevel@tonic-gate #define FM_EREPORT_VERS0 0 627c478bd9Sstevel@tonic-gate #define FM_EREPORT_VERSION FM_EREPORT_VERS0 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* ereport payload member names */ 657c478bd9Sstevel@tonic-gate #define FM_EREPORT_DETECTOR "detector" 667c478bd9Sstevel@tonic-gate #define FM_EREPORT_ENA "ena" 677c478bd9Sstevel@tonic-gate 687c478bd9Sstevel@tonic-gate /* list event payload member names */ 697c478bd9Sstevel@tonic-gate #define FM_LIST_EVENT_SIZE "list-sz" 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate /* list.suspect versions and payload member names */ 727c478bd9Sstevel@tonic-gate #define FM_SUSPECT_UUID "uuid" 737c478bd9Sstevel@tonic-gate #define FM_SUSPECT_DIAG_CODE "code" 747c478bd9Sstevel@tonic-gate #define FM_SUSPECT_DIAG_TIME "diag-time" 757c478bd9Sstevel@tonic-gate #define FM_SUSPECT_DE "de" 767c478bd9Sstevel@tonic-gate #define FM_SUSPECT_FAULT_LIST "fault-list" 777c478bd9Sstevel@tonic-gate #define FM_SUSPECT_FAULT_SZ "fault-list-sz" 787c478bd9Sstevel@tonic-gate #define FM_SUSPECT_MESSAGE "message" 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate #define FM_SUSPECT_VERS0 0 817c478bd9Sstevel@tonic-gate #define FM_SUSPECT_VERSION FM_SUSPECT_VERS0 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* fault event versions and payload member names */ 847c478bd9Sstevel@tonic-gate #define FM_FAULT_VERS0 0 857c478bd9Sstevel@tonic-gate #define FM_FAULT_VERSION FM_FAULT_VERS0 867c478bd9Sstevel@tonic-gate 877c478bd9Sstevel@tonic-gate #define FM_FAULT_ASRU "asru" 887c478bd9Sstevel@tonic-gate #define FM_FAULT_FRU "fru" 897c478bd9Sstevel@tonic-gate #define FM_FAULT_FRU_LABEL "fru-label" 907c478bd9Sstevel@tonic-gate #define FM_FAULT_CERTAINTY "certainty" 917c478bd9Sstevel@tonic-gate #define FM_FAULT_RESOURCE "resource" 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate /* resource event versions and payload member names */ 947c478bd9Sstevel@tonic-gate #define FM_RSRC_VERS0 0 957c478bd9Sstevel@tonic-gate #define FM_RSRC_VERSION FM_RSRC_VERS0 967c478bd9Sstevel@tonic-gate #define FM_RSRC_RESOURCE "resource" 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate /* resource.*.asru.* payload member names */ 997c478bd9Sstevel@tonic-gate #define FM_RSRC_ASRU_UUID "uuid" 1007c478bd9Sstevel@tonic-gate #define FM_RSRC_ASRU_FAULTY "faulty" 1017c478bd9Sstevel@tonic-gate #define FM_RSRC_ASRU_UNUSABLE "unusable" 1027c478bd9Sstevel@tonic-gate #define FM_RSRC_ASRU_EVENT "event" 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate /* 1057c478bd9Sstevel@tonic-gate * FM ENA Format Macros 1067c478bd9Sstevel@tonic-gate */ 1077c478bd9Sstevel@tonic-gate #define ENA_FORMAT_MASK 0x3 1087c478bd9Sstevel@tonic-gate #define ENA_FORMAT(ena) ((ena) & ENA_FORMAT_MASK) 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate /* ENA format types */ 1117c478bd9Sstevel@tonic-gate #define FM_ENA_FMT0 0 1127c478bd9Sstevel@tonic-gate #define FM_ENA_FMT1 1 1137c478bd9Sstevel@tonic-gate #define FM_ENA_FMT2 2 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* Format 1 */ 1167c478bd9Sstevel@tonic-gate #define ENA_FMT1_GEN_MASK 0x00000000000003FCull 1177c478bd9Sstevel@tonic-gate #define ENA_FMT1_ID_MASK 0xFFFFFFFFFFFFFC00ull 1187c478bd9Sstevel@tonic-gate #define ENA_FMT1_CPUID_MASK 0x00000000000FFC00ull 1197c478bd9Sstevel@tonic-gate #define ENA_FMT1_TIME_MASK 0xFFFFFFFFFFF00000ull 1207c478bd9Sstevel@tonic-gate #define ENA_FMT1_GEN_SHFT 2 1217c478bd9Sstevel@tonic-gate #define ENA_FMT1_ID_SHFT 10 1227c478bd9Sstevel@tonic-gate #define ENA_FMT1_CPUID_SHFT ENA_FMT1_ID_SHFT 1237c478bd9Sstevel@tonic-gate #define ENA_FMT1_TIME_SHFT 20 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate /* Format 2 */ 1267c478bd9Sstevel@tonic-gate #define ENA_FMT2_GEN_MASK 0x00000000000003FCull 1277c478bd9Sstevel@tonic-gate #define ENA_FMT2_ID_MASK 0xFFFFFFFFFFFFFC00ull 1287c478bd9Sstevel@tonic-gate #define ENA_FMT2_TIME_MASK ENA_FMT2_ID_MASK 1297c478bd9Sstevel@tonic-gate #define ENA_FMT2_GEN_SHFT 2 1307c478bd9Sstevel@tonic-gate #define ENA_FMT2_ID_SHFT 10 1317c478bd9Sstevel@tonic-gate #define ENA_FMT2_TIME_SHFT ENA_FMT2_ID_SHFT 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate /* Common FMRI type names */ 1347c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTHORITY "authority" 1357c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME "scheme" 1367c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_AUTHORITY "svc-authority" 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* FMRI authority-type member names */ 1397c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_CHASSIS "chassis-id" 1407c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_PRODUCT "product-id" 1417c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_DOMAIN "domain-id" 1427c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_SERVER "server-id" 1437c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_HOST "host-id" 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate #define FM_AUTH_VERS0 0 1467c478bd9Sstevel@tonic-gate #define FM_FMRI_AUTH_VERSION FM_AUTH_VERS0 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* scheme name values */ 1497c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_FMD "fmd" 1507c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_DEV "dev" 1517c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_HC "hc" 1527c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_SVC "svc" 1537c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_CPU "cpu" 1547c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_MEM "mem" 1557c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_MOD "mod" 1567c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_PKG "pkg" 1577c478bd9Sstevel@tonic-gate #define FM_FMRI_SCHEME_LEGACY "legacy-hc" 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate /* Scheme versions */ 1607c478bd9Sstevel@tonic-gate #define FMD_SCHEME_VERSION0 0 1617c478bd9Sstevel@tonic-gate #define FM_FMD_SCHEME_VERSION FMD_SCHEME_VERSION0 1627c478bd9Sstevel@tonic-gate #define DEV_SCHEME_VERSION0 0 1637c478bd9Sstevel@tonic-gate #define FM_DEV_SCHEME_VERSION DEV_SCHEME_VERSION0 1647c478bd9Sstevel@tonic-gate #define FM_HC_VERS0 0 1657c478bd9Sstevel@tonic-gate #define FM_HC_SCHEME_VERSION FM_HC_VERS0 1667c478bd9Sstevel@tonic-gate #define CPU_SCHEME_VERSION0 0 1677c478bd9Sstevel@tonic-gate #define FM_CPU_SCHEME_VERSION CPU_SCHEME_VERSION0 1687c478bd9Sstevel@tonic-gate #define MEM_SCHEME_VERSION0 0 1697c478bd9Sstevel@tonic-gate #define FM_MEM_SCHEME_VERSION MEM_SCHEME_VERSION0 1707c478bd9Sstevel@tonic-gate #define MOD_SCHEME_VERSION0 0 1717c478bd9Sstevel@tonic-gate #define FM_MOD_SCHEME_VERSION MOD_SCHEME_VERSION0 1727c478bd9Sstevel@tonic-gate #define PKG_SCHEME_VERSION0 0 1737c478bd9Sstevel@tonic-gate #define FM_PKG_SCHEME_VERSION PKG_SCHEME_VERSION0 1747c478bd9Sstevel@tonic-gate #define LEGACY_SCHEME_VERSION0 0 1757c478bd9Sstevel@tonic-gate #define FM_LEGACY_SCHEME_VERSION LEGACY_SCHEME_VERSION0 1767c478bd9Sstevel@tonic-gate 1777c478bd9Sstevel@tonic-gate /* hc scheme member names */ 1787c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_SERIAL_ID "serial" 1797c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_PART "part" 1807c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_REVISION "revision" 1817c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_ROOT "hc-root" 1827c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_LIST_SZ "hc-list-sz" 1837c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_LIST "hc-list" 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate /* hc-list version and member names */ 1867c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_NAME "hc-name" 1877c478bd9Sstevel@tonic-gate #define FM_FMRI_HC_ID "hc-id" 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate #define HC_LIST_VERSION0 0 1907c478bd9Sstevel@tonic-gate #define FM_HC_LIST_VERSION HC_LIST_VERSION0 1917c478bd9Sstevel@tonic-gate 1927c478bd9Sstevel@tonic-gate /* fmd module scheme member names */ 1937c478bd9Sstevel@tonic-gate #define FM_FMRI_FMD_NAME "mod-name" 1947c478bd9Sstevel@tonic-gate #define FM_FMRI_FMD_VERSION "mod-version" 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate /* dev scheme member names */ 1977c478bd9Sstevel@tonic-gate #define FM_FMRI_DEV_ID "devid" 1987c478bd9Sstevel@tonic-gate #define FM_FMRI_DEV_PATH "device-path" 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate /* pkg scheme member names */ 2017c478bd9Sstevel@tonic-gate #define FM_FMRI_PKG_BASEDIR "pkg-basedir" 2027c478bd9Sstevel@tonic-gate #define FM_FMRI_PKG_INST "pkg-inst" 2037c478bd9Sstevel@tonic-gate #define FM_FMRI_PKG_VERSION "pkg-version" 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate /* svc scheme member names */ 2067c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_NAME "service-name" 2077c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_VERSION "service-version" 2087c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_INSTANCE "instance" 2097c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_CONTRACT_ID "contract-id" 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate /* svc-authority member names */ 2127c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_AUTH_SCOPE "scope" 2137c478bd9Sstevel@tonic-gate #define FM_FMRI_SVC_AUTH_SYSTEM_FQN "system-FQN" 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate /* cpu scheme member names */ 2167c478bd9Sstevel@tonic-gate #define FM_FMRI_CPU_ID "cpuid" 2177c478bd9Sstevel@tonic-gate #define FM_FMRI_CPU_SERIAL_ID "serial" 2187c478bd9Sstevel@tonic-gate #define FM_FMRI_CPU_MASK "cpumask" 2196dfee483Stsien #define FM_FMRI_CPU_VID "cpuvid" 2206dfee483Stsien #define FM_FMRI_CPU_CPUFRU "cpufru" 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate /* legacy-hc scheme member names */ 2237c478bd9Sstevel@tonic-gate #define FM_FMRI_LEGACY_HC "component" 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gate /* mem scheme member names */ 2267c478bd9Sstevel@tonic-gate #define FM_FMRI_MEM_UNUM "unum" 2277c478bd9Sstevel@tonic-gate #define FM_FMRI_MEM_SERIAL_ID "serial" 2287c478bd9Sstevel@tonic-gate #define FM_FMRI_MEM_PHYSADDR "physaddr" 229822fb41dStsien #define FM_FMRI_MEM_MEMCONFIG "memconfig" 230*d00f0155Sayznaga #define FM_FMRI_MEM_OFFSET "offset" 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate /* mod scheme member names */ 2337c478bd9Sstevel@tonic-gate #define FM_FMRI_MOD_PKG "mod-pkg" 2347c478bd9Sstevel@tonic-gate #define FM_FMRI_MOD_NAME "mod-name" 2357c478bd9Sstevel@tonic-gate #define FM_FMRI_MOD_ID "mod-id" 2367c478bd9Sstevel@tonic-gate #define FM_FMRI_MOD_DESC "mod-desc" 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate extern nv_alloc_t *fm_nva_xcreate(char *, size_t); 2397c478bd9Sstevel@tonic-gate extern void fm_nva_xdestroy(nv_alloc_t *); 2407c478bd9Sstevel@tonic-gate 2417c478bd9Sstevel@tonic-gate extern nvlist_t *fm_nvlist_create(nv_alloc_t *); 2427c478bd9Sstevel@tonic-gate extern void fm_nvlist_destroy(nvlist_t *, int); 2437c478bd9Sstevel@tonic-gate 2447c478bd9Sstevel@tonic-gate #define FM_NVA_FREE 0 /* free allocator on nvlist_destroy */ 2457c478bd9Sstevel@tonic-gate #define FM_NVA_RETAIN 1 /* keep allocator on nvlist_destroy */ 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate extern void fm_ereport_set(nvlist_t *, int, const char *, uint64_t, 2487c478bd9Sstevel@tonic-gate const nvlist_t *, ...); 2497c478bd9Sstevel@tonic-gate extern void fm_payload_set(nvlist_t *, ...); 2507c478bd9Sstevel@tonic-gate extern int i_fm_payload_set(nvlist_t *, const char *, va_list); 2517c478bd9Sstevel@tonic-gate extern void fm_fmri_hc_set(nvlist_t *, int, const nvlist_t *, const char *, 2527c478bd9Sstevel@tonic-gate const char *, const char *, const char *, uint32_t, ...); 2537c478bd9Sstevel@tonic-gate extern void fm_fmri_dev_set(nvlist_t *, int, const nvlist_t *, const char *, 2547c478bd9Sstevel@tonic-gate const char *); 2557c478bd9Sstevel@tonic-gate extern void fm_fmri_de_set(nvlist_t *, int, const nvlist_t *, const char *); 2567c478bd9Sstevel@tonic-gate extern void fm_fmri_cpu_set(nvlist_t *, int, const nvlist_t *, uint32_t, 2577c478bd9Sstevel@tonic-gate uint8_t, uint64_t); 2587c478bd9Sstevel@tonic-gate extern void fm_fmri_mem_set(nvlist_t *, int, const nvlist_t *, const char *, 259*d00f0155Sayznaga const char *, uint64_t); 2607c478bd9Sstevel@tonic-gate extern void fm_authority_set(nvlist_t *, int, const char *, const char *, 2617c478bd9Sstevel@tonic-gate const char *, const char *); 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_increment(uint64_t); 2647c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_generate(uint64_t, uchar_t); 2657c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_generate_cpu(uint64_t, processorid_t, uchar_t); 2667c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_generation_get(uint64_t); 2677c478bd9Sstevel@tonic-gate extern uchar_t fm_ena_format_get(uint64_t); 2687c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_id_get(uint64_t); 2697c478bd9Sstevel@tonic-gate extern uint64_t fm_ena_time_get(uint64_t); 2707c478bd9Sstevel@tonic-gate 2717c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2727c478bd9Sstevel@tonic-gate } 2737c478bd9Sstevel@tonic-gate #endif 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate #endif /* _SYS_FM_PROTOCOL_H */ 276