@@ -70,12 +70,22 @@
#include "x86_mca.h"
#include "mce_amd.h"
#include "mcaction.h"
-#include "mce_quirks.h"
#include "vmce.h"
-#define ANY -1
+#define ANY (~0U)
-static const struct mce_quirkdata mce_amd_quirks[] = {
+enum mcequirk_amd_flags {
+ MCEQUIRK_NONE,
+ MCEQUIRK_K8_GART,
+ MCEQUIRK_F10_GART
+};
+
+static const struct mce_quirkdata {
+ unsigned int cpu_family;
+ unsigned int cpu_model;
+ unsigned int cpu_stepping;
+ enum mcequirk_amd_flags quirk;
+} mce_amd_quirks[] = {
{ 0xf /* cpu family */, ANY /* all models */, ANY /* all steppings */,
MCEQUIRK_K8_GART },
{ 0x10 /* cpu family */, ANY /* all models */, ANY /* all steppings */,
@@ -157,10 +167,10 @@ bool mc_amd_addrcheck(uint64_t status, u
}
/* MC quirks */
-enum mcequirk_amd_flags
-mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c)
+static enum mcequirk_amd_flags
+mcequirk_lookup_amd_quirkdata(const struct cpuinfo_x86 *c)
{
- int i;
+ unsigned int i;
BUG_ON(c->x86_vendor != X86_VENDOR_AMD);
@@ -176,10 +186,11 @@ mcequirk_lookup_amd_quirkdata(struct cpu
continue;
return mce_amd_quirks[i].quirk;
}
- return 0;
+
+ return MCEQUIRK_NONE;
}
-int mcequirk_amd_apply(enum mcequirk_amd_flags flags)
+static void mcequirk_amd_apply(enum mcequirk_amd_flags flags)
{
uint64_t val;
@@ -197,11 +208,12 @@ int mcequirk_amd_apply(enum mcequirk_amd
case MCEQUIRK_F10_GART:
if ( rdmsr_safe(MSR_AMD64_MCx_MASK(4), val) == 0 )
- wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
+ wrmsr_safe(MSR_AMD64_MCx_MASK(4), val | (1 << 10));
break;
- }
- return 0;
+ default:
+ ASSERT(flags == MCEQUIRK_NONE);
+ }
}
static struct mcinfo_extended *
@@ -1,53 +0,0 @@
-/* * MCA quirks
- * Copyright (c) 2009 Advanced Micro Devices, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _MCE_QUIRK_H
-#define _MCE_QUIRK_H
-
-#include <xen/types.h>
-
-struct mce_quirkdata {
- int32_t cpu_family;
- int16_t cpu_model;
- int16_t cpu_stepping;
- uint32_t quirk;
-};
-
-/* use a binary flag if multiple quirks apply
- * to one CPU family/model
- */
-
-enum mcequirk_amd_flags {
- MCEQUIRK_K8_GART = 2,
- MCEQUIRK_F10_GART
-};
-
-enum mcequirk_intel_flags {
- MCEQUIRK_DUMMY = 0x1, /* nothing known yet */
-};
-
-enum mcequirk_amd_flags
-mcequirk_lookup_amd_quirkdata(struct cpuinfo_x86 *c);
-
-int mcequirk_amd_apply(enum mcequirk_amd_flags flags);
-
-enum mcequirk_intel_flags
-mcequirk_lookup_intel_quirkdata(struct cpuinfo_x86 *c);
-
-int mcequirk_intel_apply(enum mcequirk_intel_flags flags);
-
-#endif /* _MCE_QUIRK_H */
Signed-off-by: Jan Beulich <jbeulich@suse.com>