xref: /titanic_50/usr/src/uts/i86pc/cpu/authenticamd/authamd.h (revision c84b7bbef5ecc2a27799422588073deefd9db715)
120c794b3Sgavinm /*
220c794b3Sgavinm  * CDDL HEADER START
320c794b3Sgavinm  *
420c794b3Sgavinm  * The contents of this file are subject to the terms of the
520c794b3Sgavinm  * Common Development and Distribution License (the "License").
620c794b3Sgavinm  * You may not use this file except in compliance with the License.
720c794b3Sgavinm  *
820c794b3Sgavinm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
920c794b3Sgavinm  * or http://www.opensolaris.org/os/licensing.
1020c794b3Sgavinm  * See the License for the specific language governing permissions
1120c794b3Sgavinm  * and limitations under the License.
1220c794b3Sgavinm  *
1320c794b3Sgavinm  * When distributing Covered Code, include this CDDL HEADER in each
1420c794b3Sgavinm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1520c794b3Sgavinm  * If applicable, add the following below this CDDL HEADER, with the
1620c794b3Sgavinm  * fields enclosed by brackets "[]" replaced with your own identifying
1720c794b3Sgavinm  * information: Portions Copyright [yyyy] [name of copyright owner]
1820c794b3Sgavinm  *
1920c794b3Sgavinm  * CDDL HEADER END
2020c794b3Sgavinm  */
2120c794b3Sgavinm 
2220c794b3Sgavinm /*
23*c84b7bbeSAdrian Frost  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
2420c794b3Sgavinm  */
2520c794b3Sgavinm 
2620c794b3Sgavinm #ifndef _AUTHAMD_H
2720c794b3Sgavinm #define	_AUTHAMD_H
2820c794b3Sgavinm 
2920c794b3Sgavinm #include <sys/types.h>
3020c794b3Sgavinm #include <sys/mca_amd.h>
3120c794b3Sgavinm #include <sys/cpu_module_ms_impl.h>
3220c794b3Sgavinm 
3320c794b3Sgavinm #ifdef __cplusplus
3420c794b3Sgavinm extern "C" {
3520c794b3Sgavinm #endif
3620c794b3Sgavinm 
378031591dSSrihari Venkatesan #define	AUTHAMD_MAX_NODES		8	/* max number of nodes */
388031591dSSrihari Venkatesan #define	AUTHAMD_DRAM_NCHANNEL		2	/* dram channels per node */
3920c794b3Sgavinm #define	AUTHAMD_DRAM_NCS		8	/* chip-selects per channel */
4020c794b3Sgavinm 
4120c794b3Sgavinm #define	AUTHAMD_FAMILY_6		0x6
4220c794b3Sgavinm #define	AUTHAMD_FAMILY_F		0xf
4320c794b3Sgavinm #define	AUTHAMD_FAMILY_10		0x10
4420c794b3Sgavinm 
4520c794b3Sgavinm #define	AUTHAMD_SYNDTYPE_64_8		0x0
4620c794b3Sgavinm #define	AUTHAMD_SYNDTYPE_128_16		0x1
4720c794b3Sgavinm 
4820c794b3Sgavinm typedef struct authamd_data authamd_data_t;
4920c794b3Sgavinm 
5020c794b3Sgavinm typedef struct authamd_error_disp {
5120c794b3Sgavinm 	const char *aad_subclass;
5220c794b3Sgavinm 	const char *aad_leafclass;
5320c794b3Sgavinm 	uint64_t aad_ereport_members;
5420c794b3Sgavinm } authamd_error_disp_t;
5520c794b3Sgavinm 
5620c794b3Sgavinm /*
5720c794b3Sgavinm  * Model-specific logout structure.
5820c794b3Sgavinm  */
5920c794b3Sgavinm #pragma pack(1)
6020c794b3Sgavinm typedef struct authamd_logout {
6120c794b3Sgavinm 	uint8_t aal_eccerrcnt[AUTHAMD_DRAM_NCHANNEL][AUTHAMD_DRAM_NCS];
6220c794b3Sgavinm } authamd_logout_t;
6320c794b3Sgavinm #pragma pack()
6420c794b3Sgavinm 
6520c794b3Sgavinm /*
668031591dSSrihari Venkatesan  * Per node shared state
6720c794b3Sgavinm  */
688031591dSSrihari Venkatesan struct authamd_nodeshared {
695667185bSSrihari Venkatesan 	uint_t ans_chipid;
705667185bSSrihari Venkatesan 	uint_t ans_procnodeid;
715667185bSSrihari Venkatesan 	uint_t ans_family;		/* family number */
725667185bSSrihari Venkatesan 	uint32_t ans_rev;		/* revision per cpuid_getchiprev */
735667185bSSrihari Venkatesan 	volatile ulong_t ans_cfgonce;	/* Config performed once per chip */
745667185bSSrihari Venkatesan 	hrtime_t ans_poll_timestamp;	/* Checks poll owner is alive */
755667185bSSrihari Venkatesan 	cmi_hdl_t ans_pollowner;	/* poller of shared resources */
765667185bSSrihari Venkatesan 	char *ans_eccsymsz;		/* DRAM ChipKill ECC Symbol Size */
7720c794b3Sgavinm };
7820c794b3Sgavinm 
7920c794b3Sgavinm enum authamd_cfgonce_bitnum {
8020c794b3Sgavinm 	AUTHAMD_CFGONCE_ONLNSPRCFG,
8125f47677Sgavinm 	AUTHAMD_CFGONCE_NBTHRESH,
8225f47677Sgavinm 	AUTHAMD_CFGONCE_NBMCACFG,
83a4e4e13fSgavinm 	AUTHAMD_CFGONCE_CACHESCRUB,
845667185bSSrihari Venkatesan 	AUTHAMD_CFGONCE_NBMCA,
855667185bSSrihari Venkatesan 	AUTHAMD_CFGONCE_ECCSYMSZ
8620c794b3Sgavinm };
8720c794b3Sgavinm 
8820c794b3Sgavinm /*
8920c794b3Sgavinm  * Per-CPU model-specific state
9020c794b3Sgavinm  */
9120c794b3Sgavinm struct authamd_data {
9220c794b3Sgavinm 	cmi_hdl_t amd_hdl;			/* cpu we're associated with */
9320c794b3Sgavinm 	uint64_t amd_hwcr;
948031591dSSrihari Venkatesan 	struct authamd_nodeshared *amd_shared;
9520c794b3Sgavinm };
9620c794b3Sgavinm 
9720c794b3Sgavinm #ifdef _KERNEL
9820c794b3Sgavinm 
9920c794b3Sgavinm /*
10020c794b3Sgavinm  * Our cms_ops operations and function prototypes for all non-NULL members.
10120c794b3Sgavinm  */
10220c794b3Sgavinm extern const cms_ops_t _cms_ops;
10320c794b3Sgavinm 
10420c794b3Sgavinm extern int authamd_init(cmi_hdl_t, void **);
10520c794b3Sgavinm extern size_t authamd_logout_size(cmi_hdl_t);
10620c794b3Sgavinm extern uint64_t authamd_mcgctl_val(cmi_hdl_t, int, uint64_t);
10720c794b3Sgavinm extern boolean_t authamd_bankctl_skipinit(cmi_hdl_t, int);
10820c794b3Sgavinm extern uint64_t authamd_bankctl_val(cmi_hdl_t, int, uint64_t);
10920c794b3Sgavinm extern void authamd_mca_init(cmi_hdl_t, int);
11020c794b3Sgavinm extern void authamd_bank_logout(cmi_hdl_t, int, uint64_t, uint64_t,
11120c794b3Sgavinm     uint64_t, void *);
11220c794b3Sgavinm extern uint32_t authamd_error_action(cmi_hdl_t, int, int, uint64_t,
11320c794b3Sgavinm     uint64_t, uint64_t, void *);
114*c84b7bbeSAdrian Frost extern cms_cookie_t authamd_disp_match(cmi_hdl_t, int, int, uint64_t, uint64_t,
11520c794b3Sgavinm     uint64_t, void *);
11620c794b3Sgavinm extern void authamd_ereport_class(cmi_hdl_t, cms_cookie_t, const char **,
11720c794b3Sgavinm     const char **);
11820c794b3Sgavinm extern void authamd_ereport_add_logout(cmi_hdl_t, nvlist_t *,
11920c794b3Sgavinm     nv_alloc_t *, int, uint64_t, uint64_t, uint64_t, void *, cms_cookie_t);
12020c794b3Sgavinm extern cms_errno_t authamd_msrinject(cmi_hdl_t, uint_t, uint64_t);
12120c794b3Sgavinm 
12220c794b3Sgavinm #endif /* _KERNEL */
12320c794b3Sgavinm 
12420c794b3Sgavinm #ifdef __cplusplus
12520c794b3Sgavinm }
12620c794b3Sgavinm #endif
12720c794b3Sgavinm 
12820c794b3Sgavinm #endif /* _AUTHAMD_H */
129