1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 24 */ 25 26 #ifndef _AUTHAMD_H 27 #define _AUTHAMD_H 28 29 #include <sys/types.h> 30 #include <sys/mca_amd.h> 31 #include <sys/cpu_module_ms_impl.h> 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 #define AUTHAMD_MAX_NODES 8 /* max number of nodes */ 38 #define AUTHAMD_DRAM_NCHANNEL 2 /* dram channels per node */ 39 #define AUTHAMD_DRAM_NCS 8 /* chip-selects per channel */ 40 41 #define AUTHAMD_FAMILY_6 0x6 42 #define AUTHAMD_FAMILY_F 0xf 43 #define AUTHAMD_FAMILY_10 0x10 44 45 #define AUTHAMD_SYNDTYPE_64_8 0x0 46 #define AUTHAMD_SYNDTYPE_128_16 0x1 47 48 typedef struct authamd_data authamd_data_t; 49 50 typedef struct authamd_error_disp { 51 const char *aad_subclass; 52 const char *aad_leafclass; 53 uint64_t aad_ereport_members; 54 } authamd_error_disp_t; 55 56 /* 57 * Model-specific logout structure. 58 */ 59 #pragma pack(1) 60 typedef struct authamd_logout { 61 uint8_t aal_eccerrcnt[AUTHAMD_DRAM_NCHANNEL][AUTHAMD_DRAM_NCS]; 62 } authamd_logout_t; 63 #pragma pack() 64 65 /* 66 * Per node shared state 67 */ 68 struct authamd_nodeshared { 69 uint_t ans_chipid; 70 uint_t ans_procnodeid; 71 uint_t ans_family; /* family number */ 72 x86_chiprev_t ans_rev; /* revision per cpuid_getchiprev */ 73 volatile ulong_t ans_cfgonce; /* Config performed once per chip */ 74 hrtime_t ans_poll_timestamp; /* Checks poll owner is alive */ 75 cmi_hdl_t ans_pollowner; /* poller of shared resources */ 76 char *ans_eccsymsz; /* DRAM ChipKill ECC Symbol Size */ 77 }; 78 79 enum authamd_cfgonce_bitnum { 80 AUTHAMD_CFGONCE_ONLNSPRCFG, 81 AUTHAMD_CFGONCE_NBTHRESH, 82 AUTHAMD_CFGONCE_NBMCACFG, 83 AUTHAMD_CFGONCE_CACHESCRUB, 84 AUTHAMD_CFGONCE_NBMCA, 85 AUTHAMD_CFGONCE_ECCSYMSZ 86 }; 87 88 /* 89 * Per-CPU model-specific state 90 */ 91 struct authamd_data { 92 cmi_hdl_t amd_hdl; /* cpu we're associated with */ 93 uint64_t amd_hwcr; 94 struct authamd_nodeshared *amd_shared; 95 }; 96 97 #ifdef _KERNEL 98 99 /* 100 * Our cms_ops operations and function prototypes for all non-NULL members. 101 */ 102 extern const cms_ops_t _cms_ops; 103 104 extern int authamd_init(cmi_hdl_t, void **); 105 extern size_t authamd_logout_size(cmi_hdl_t); 106 extern uint64_t authamd_mcgctl_val(cmi_hdl_t, int, uint64_t); 107 extern boolean_t authamd_bankctl_skipinit(cmi_hdl_t, int); 108 extern uint64_t authamd_bankctl_val(cmi_hdl_t, int, uint64_t); 109 extern void authamd_mca_init(cmi_hdl_t, int); 110 extern void authamd_bank_logout(cmi_hdl_t, int, uint64_t, uint64_t, 111 uint64_t, void *); 112 extern uint32_t authamd_error_action(cmi_hdl_t, int, int, uint64_t, 113 uint64_t, uint64_t, void *); 114 extern cms_cookie_t authamd_disp_match(cmi_hdl_t, int, int, uint64_t, uint64_t, 115 uint64_t, void *); 116 extern void authamd_ereport_class(cmi_hdl_t, cms_cookie_t, const char **, 117 const char **); 118 extern void authamd_ereport_add_logout(cmi_hdl_t, nvlist_t *, 119 nv_alloc_t *, int, uint64_t, uint64_t, uint64_t, void *, cms_cookie_t); 120 extern cms_errno_t authamd_msrinject(cmi_hdl_t, uint_t, uint64_t); 121 122 #endif /* _KERNEL */ 123 124 #ifdef __cplusplus 125 } 126 #endif 127 128 #endif /* _AUTHAMD_H */ 129