Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/cpu/amd_opteron/ao_main.c
+++ new/usr/src/uts/i86pc/cpu/amd_opteron/ao_main.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * The CPU module for the AMD Athlon64 and Opteron processors
28 28 */
29 29
30 30 #include <sys/types.h>
31 31 #include <sys/cmn_err.h>
32 32 #include <sys/sunddi.h>
33 33 #include <sys/cpu_module.h>
34 34 #include <sys/cpu_module_ms_impl.h>
35 35 #include <sys/cpuvar.h>
36 36 #include <sys/x86_archext.h>
37 37 #include <sys/kmem.h>
38 38 #include <sys/pghw.h>
39 39 #include <sys/modctl.h>
40 40 #include <sys/mc.h>
41 41 #include <sys/mca_x86.h>
42 42
43 43 #include "ao.h"
44 44
45 45 int ao_ms_support_disable = 0;
46 46
47 47 static struct ao_chipshared *ao_shared[AO_MAX_CHIPS];
48 48
49 49 /*
50 50 * This cpu module supports AMD family 0xf revisions B/C/D/E/F/G. If
51 51 * a family 0xf cpu beyond the rev G model limit is detected then
52 52 * return ENOTSUP and let the generic x86 CPU module load instead.
53 53 */
54 54 uint_t ao_model_limit = 0x6f;
55 55
56 56 int
57 57 ao_ms_init(cmi_hdl_t hdl, void **datap)
58 58 {
59 59 uint_t chipid = cmi_hdl_chipid(hdl);
60 60 struct ao_chipshared *sp, *osp;
61 61 ao_ms_data_t *ao;
62 62 uint64_t cap;
63 63
64 64 if (ao_ms_support_disable || cmi_hdl_model(hdl) >= ao_model_limit)
65 65 return (ENOTSUP);
66 66
67 67 if (!is_x86_feature(x86_featureset, X86FSET_MCA))
68 68 return (ENOTSUP);
69 69
70 70 if (cmi_hdl_rdmsr(hdl, IA32_MSR_MCG_CAP, &cap) != CMI_SUCCESS)
71 71 return (ENOTSUP);
72 72
73 73 if (!(cap & MCG_CAP_CTL_P))
74 74 return (ENOTSUP);
75 75
76 76 if ((cap & MCG_CAP_COUNT_MASK) != AMD_MCA_BANK_COUNT) {
77 77 cmn_err(CE_WARN, "Chip %d core %d has %llu MCA banks, "
78 78 "expected %u: disabling AMD-specific MCA support on "
79 79 "this CPU", chipid, cmi_hdl_coreid(hdl),
80 80 (u_longlong_t)cap & MCG_CAP_COUNT_MASK,
81 81 AMD_MCA_BANK_COUNT);
82 82 return (ENOTSUP);
83 83 }
84 84
85 85 ao = *datap = kmem_zalloc(sizeof (ao_ms_data_t), KM_SLEEP);
86 86 cmi_hdl_hold(hdl); /* release in fini */
87 87 ao->ao_ms_hdl = hdl;
88 88
89 89 /*
90 90 * Allocate the chipshared structure if it appears not to have been
91 91 * allocated already (by a sibling core). Install the newly
92 92 * allocated pointer atomically in case a sibling core beats
93 93 * us to it.
94 94 */
95 95 if ((sp = ao_shared[chipid]) == NULL) {
96 96 sp = kmem_zalloc(sizeof (struct ao_chipshared), KM_SLEEP);
97 97 sp->aos_chiprev = cmi_hdl_chiprev(hdl);
98 98 membar_producer();
99 99
100 100 osp = atomic_cas_ptr(&ao_shared[chipid], NULL, sp);
101 101 if (osp != NULL) {
102 102 kmem_free(sp, sizeof (struct ao_chipshared));
103 103 sp = osp;
104 104 }
105 105 }
106 106 ao->ao_ms_shared = sp;
107 107
108 108 return (0);
109 109 }
110 110
111 111 /*ARGSUSED*/
112 112 void
113 113 ao_ms_post_mpstartup(cmi_hdl_t hdl)
114 114 {
115 115 (void) ddi_install_driver("mc-amd");
116 116 }
117 117
118 118 cms_api_ver_t _cms_api_version = CMS_API_VERSION_2;
119 119
120 120 const cms_ops_t _cms_ops = {
121 121 ao_ms_init, /* cms_init */
122 122 ao_ms_post_startup, /* cms_post_startup */
123 123 ao_ms_post_mpstartup, /* cms_post_mpstartup */
124 124 NULL, /* cms_logout_size */
125 125 ao_ms_mcgctl_val, /* cms_mcgctl_val */
126 126 ao_ms_bankctl_skipinit, /* cms_bankctl_skipinit */
127 127 ao_ms_bankctl_val, /* cms_bankctl_val */
128 128 NULL, /* cms_bankstatus_skipinit */
129 129 NULL, /* cms_bankstatus_val */
130 130 ao_ms_mca_init, /* cms_mca_init */
131 131 ao_ms_poll_ownermask, /* cms_poll_ownermask */
132 132 NULL, /* cms_bank_logout */
133 133 ao_ms_error_action, /* cms_error_action */
134 134 ao_ms_disp_match, /* cms_disp_match */
135 135 ao_ms_ereport_class, /* cms_ereport_class */
136 136 NULL, /* cms_ereport_detector */
137 137 ao_ms_ereport_includestack, /* cms_ereport_includestack */
138 138 ao_ms_ereport_add_logout, /* cms_ereport_add_logout */
139 139 ao_ms_msrinject, /* cms_msrinject */
↓ open down ↓ |
139 lines elided |
↑ open up ↑ |
140 140 NULL, /* cms_fini */
141 141 };
142 142
143 143 static struct modlcpu modlcpu = {
144 144 &mod_cpuops,
145 145 "AMD Athlon64/Opteron Model-Specific Support"
146 146 };
147 147
148 148 static struct modlinkage modlinkage = {
149 149 MODREV_1,
150 - (void *)&modlcpu,
151 - NULL
150 + { (void *)&modlcpu, NULL }
152 151 };
153 152
154 153 int
155 154 _init(void)
156 155 {
157 156 return (mod_install(&modlinkage));
158 157 }
159 158
160 159 int
161 160 _info(struct modinfo *modinfop)
162 161 {
163 162 return (mod_info(&modlinkage, modinfop));
164 163 }
165 164
166 165 int
167 166 _fini(void)
168 167 {
169 168 return (mod_remove(&modlinkage));
170 169 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX