summaryrefslogtreecommitdiff
path: root/usr/src/uts/i86pc/cpu/authenticamd/authamd.h
blob: a77cd79f33d4a01cd6650db03ba751a073fa2101 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
 */

#ifndef _AUTHAMD_H
#define	_AUTHAMD_H

#include <sys/types.h>
#include <sys/mca_amd.h>
#include <sys/cpu_module_ms_impl.h>

#ifdef __cplusplus
extern "C" {
#endif

#define	AUTHAMD_MAX_NODES		8	/* max number of nodes */
#define	AUTHAMD_DRAM_NCHANNEL		2	/* dram channels per node */
#define	AUTHAMD_DRAM_NCS		8	/* chip-selects per channel */

#define	AUTHAMD_FAMILY_6		0x6
#define	AUTHAMD_FAMILY_F		0xf
#define	AUTHAMD_FAMILY_10		0x10

#define	AUTHAMD_SYNDTYPE_64_8		0x0
#define	AUTHAMD_SYNDTYPE_128_16		0x1

typedef struct authamd_data authamd_data_t;

typedef struct authamd_error_disp {
	const char *aad_subclass;
	const char *aad_leafclass;
	uint64_t aad_ereport_members;
} authamd_error_disp_t;

/*
 * Model-specific logout structure.
 */
#pragma pack(1)
typedef struct authamd_logout {
	uint8_t aal_eccerrcnt[AUTHAMD_DRAM_NCHANNEL][AUTHAMD_DRAM_NCS];
} authamd_logout_t;
#pragma pack()

/*
 * Per node shared state
 */
struct authamd_nodeshared {
	uint_t ans_chipid;
	uint_t ans_procnodeid;
	uint_t ans_family;		/* family number */
	uint32_t ans_rev;		/* revision per cpuid_getchiprev */
	volatile ulong_t ans_cfgonce;	/* Config performed once per chip */
	hrtime_t ans_poll_timestamp;	/* Checks poll owner is alive */
	cmi_hdl_t ans_pollowner;	/* poller of shared resources */
	char *ans_eccsymsz;		/* DRAM ChipKill ECC Symbol Size */
};

enum authamd_cfgonce_bitnum {
	AUTHAMD_CFGONCE_ONLNSPRCFG,
	AUTHAMD_CFGONCE_NBTHRESH,
	AUTHAMD_CFGONCE_NBMCACFG,
	AUTHAMD_CFGONCE_CACHESCRUB,
	AUTHAMD_CFGONCE_NBMCA,
	AUTHAMD_CFGONCE_ECCSYMSZ
};

/*
 * Per-CPU model-specific state
 */
struct authamd_data {
	cmi_hdl_t amd_hdl;			/* cpu we're associated with */
	uint64_t amd_hwcr;
	struct authamd_nodeshared *amd_shared;
};

#ifdef _KERNEL

/*
 * Our cms_ops operations and function prototypes for all non-NULL members.
 */
extern const cms_ops_t _cms_ops;

extern int authamd_init(cmi_hdl_t, void **);
extern size_t authamd_logout_size(cmi_hdl_t);
extern uint64_t authamd_mcgctl_val(cmi_hdl_t, int, uint64_t);
extern boolean_t authamd_bankctl_skipinit(cmi_hdl_t, int);
extern uint64_t authamd_bankctl_val(cmi_hdl_t, int, uint64_t);
extern void authamd_mca_init(cmi_hdl_t, int);
extern void authamd_bank_logout(cmi_hdl_t, int, uint64_t, uint64_t,
    uint64_t, void *);
extern uint32_t authamd_error_action(cmi_hdl_t, int, int, uint64_t,
    uint64_t, uint64_t, void *);
extern cms_cookie_t authamd_disp_match(cmi_hdl_t, int, int, uint64_t, uint64_t,
    uint64_t, void *);
extern void authamd_ereport_class(cmi_hdl_t, cms_cookie_t, const char **,
    const char **);
extern void authamd_ereport_add_logout(cmi_hdl_t, nvlist_t *,
    nv_alloc_t *, int, uint64_t, uint64_t, uint64_t, void *, cms_cookie_t);
extern cms_errno_t authamd_msrinject(cmi_hdl_t, uint_t, uint64_t);

#endif /* _KERNEL */

#ifdef __cplusplus
}
#endif

#endif /* _AUTHAMD_H */