xref: /titanic_50/usr/src/uts/i86pc/cpu/authenticamd/authamd.h (revision 2032ea7bd13069ba4884066ed18f83bf12b3e247)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _AUTHAMD_H
28 #define	_AUTHAMD_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <sys/mca_amd.h>
34 #include <sys/cpu_module_ms_impl.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #define	AUTHAMD_MAX_CHIPS		8	/* max number of chips */
41 #define	AUTHAMD_DRAM_NCHANNEL		2	/* dram channels per chip */
42 #define	AUTHAMD_DRAM_NCS		8	/* chip-selects per channel */
43 
44 #define	AUTHAMD_FAMILY_6		0x6
45 #define	AUTHAMD_FAMILY_F		0xf
46 #define	AUTHAMD_FAMILY_10		0x10
47 
48 #define	AUTHAMD_SYNDTYPE_64_8		0x0
49 #define	AUTHAMD_SYNDTYPE_128_16		0x1
50 
51 typedef struct authamd_data authamd_data_t;
52 
53 typedef struct authamd_error_disp {
54 	const char *aad_subclass;
55 	const char *aad_leafclass;
56 	uint64_t aad_ereport_members;
57 } authamd_error_disp_t;
58 
59 /*
60  * Model-specific logout structure.
61  */
62 #pragma pack(1)
63 typedef struct authamd_logout {
64 	uint8_t aal_eccerrcnt[AUTHAMD_DRAM_NCHANNEL][AUTHAMD_DRAM_NCS];
65 } authamd_logout_t;
66 #pragma pack()
67 
68 /*
69  * Per chip shared state
70  */
71 struct authamd_chipshared {
72 	uint_t acs_chipid;
73 	uint_t acs_family;		/* family number */
74 	uint32_t acs_rev;		/* revision per cpuid_getchiprev */
75 	volatile ulong_t acs_cfgonce;	/* Config performed once per chip */
76 };
77 
78 enum authamd_cfgonce_bitnum {
79 	AUTHAMD_CFGONCE_ONLNSPRCFG,
80 	AUTHAMD_CFGONCE_NBTHRESH
81 };
82 
83 /*
84  * Per-CPU model-specific state
85  */
86 struct authamd_data {
87 	cmi_hdl_t amd_hdl;			/* cpu we're associated with */
88 	uint64_t amd_hwcr;
89 	struct authamd_chipshared *amd_shared;
90 };
91 
92 #ifdef _KERNEL
93 
94 /*
95  * Our cms_ops operations and function prototypes for all non-NULL members.
96  */
97 extern const cms_ops_t _cms_ops;
98 
99 extern int authamd_init(cmi_hdl_t, void **);
100 extern size_t authamd_logout_size(cmi_hdl_t);
101 extern uint64_t authamd_mcgctl_val(cmi_hdl_t, int, uint64_t);
102 extern boolean_t authamd_bankctl_skipinit(cmi_hdl_t, int);
103 extern uint64_t authamd_bankctl_val(cmi_hdl_t, int, uint64_t);
104 extern void authamd_mca_init(cmi_hdl_t, int);
105 extern void authamd_bank_logout(cmi_hdl_t, int, uint64_t, uint64_t,
106     uint64_t, void *);
107 extern uint32_t authamd_error_action(cmi_hdl_t, int, int, uint64_t,
108     uint64_t, uint64_t, void *);
109 extern cms_cookie_t authamd_disp_match(cmi_hdl_t, int, uint64_t, uint64_t,
110     uint64_t, void *);
111 extern void authamd_ereport_class(cmi_hdl_t, cms_cookie_t, const char **,
112     const char **);
113 extern void authamd_ereport_add_logout(cmi_hdl_t, nvlist_t *,
114     nv_alloc_t *, int, uint64_t, uint64_t, uint64_t, void *, cms_cookie_t);
115 extern cms_errno_t authamd_msrinject(cmi_hdl_t, uint_t, uint64_t);
116 
117 #endif /* _KERNEL */
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif /* _AUTHAMD_H */
124