Merge branch 'work-next' into staging-next
[zen-stable.git] / drivers / edac / mce_amd.c
blobd0864d9c38ad18b4b44026f22cd83549cd75b45c
1 #include <linux/module.h>
2 #include <linux/slab.h>
4 #include "mce_amd.h"
6 static struct amd_decoder_ops *fam_ops;
8 static u8 xec_mask = 0xf;
9 static u8 nb_err_cpumask = 0xf;
11 static bool report_gart_errors;
12 static void (*nb_bus_decoder)(int node_id, struct mce *m);
14 void amd_report_gart_errors(bool v)
16 report_gart_errors = v;
18 EXPORT_SYMBOL_GPL(amd_report_gart_errors);
20 void amd_register_ecc_decoder(void (*f)(int, struct mce *))
22 nb_bus_decoder = f;
24 EXPORT_SYMBOL_GPL(amd_register_ecc_decoder);
26 void amd_unregister_ecc_decoder(void (*f)(int, struct mce *))
28 if (nb_bus_decoder) {
29 WARN_ON(nb_bus_decoder != f);
31 nb_bus_decoder = NULL;
34 EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder);
37 * string representation for the different MCA reported error types, see F3x48
38 * or MSR0000_0411.
41 /* transaction type */
42 const char *tt_msgs[] = { "INSN", "DATA", "GEN", "RESV" };
43 EXPORT_SYMBOL_GPL(tt_msgs);
45 /* cache level */
46 const char *ll_msgs[] = { "RESV", "L1", "L2", "L3/GEN" };
47 EXPORT_SYMBOL_GPL(ll_msgs);
49 /* memory transaction type */
50 const char *rrrr_msgs[] = {
51 "GEN", "RD", "WR", "DRD", "DWR", "IRD", "PRF", "EV", "SNP"
53 EXPORT_SYMBOL_GPL(rrrr_msgs);
55 /* participating processor */
56 const char *pp_msgs[] = { "SRC", "RES", "OBS", "GEN" };
57 EXPORT_SYMBOL_GPL(pp_msgs);
59 /* request timeout */
60 const char *to_msgs[] = { "no timeout", "timed out" };
61 EXPORT_SYMBOL_GPL(to_msgs);
63 /* memory or i/o */
64 const char *ii_msgs[] = { "MEM", "RESV", "IO", "GEN" };
65 EXPORT_SYMBOL_GPL(ii_msgs);
67 static const char *f10h_nb_mce_desc[] = {
68 "HT link data error",
69 "Protocol error (link, L3, probe filter, etc.)",
70 "Parity error in NB-internal arrays",
71 "Link Retry due to IO link transmission error",
72 "L3 ECC data cache error",
73 "ECC error in L3 cache tag",
74 "L3 LRU parity bits error",
75 "ECC Error in the Probe Filter directory"
78 static const char * const f15h_ic_mce_desc[] = {
79 "UC during a demand linefill from L2",
80 "Parity error during data load from IC",
81 "Parity error for IC valid bit",
82 "Main tag parity error",
83 "Parity error in prediction queue",
84 "PFB data/address parity error",
85 "Parity error in the branch status reg",
86 "PFB promotion address error",
87 "Tag error during probe/victimization",
88 "Parity error for IC probe tag valid bit",
89 "PFB non-cacheable bit parity error",
90 "PFB valid bit parity error", /* xec = 0xd */
91 "patch RAM", /* xec = 010 */
92 "uop queue",
93 "insn buffer",
94 "predecode buffer",
95 "fetch address FIFO"
98 static const char * const f15h_cu_mce_desc[] = {
99 "Fill ECC error on data fills", /* xec = 0x4 */
100 "Fill parity error on insn fills",
101 "Prefetcher request FIFO parity error",
102 "PRQ address parity error",
103 "PRQ data parity error",
104 "WCC Tag ECC error",
105 "WCC Data ECC error",
106 "WCB Data parity error",
107 "VB Data/ECC error",
108 "L2 Tag ECC error", /* xec = 0x10 */
109 "Hard L2 Tag ECC error",
110 "Multiple hits on L2 tag",
111 "XAB parity error",
112 "PRB address parity error"
115 static const char * const fr_ex_mce_desc[] = {
116 "CPU Watchdog timer expire",
117 "Wakeup array dest tag",
118 "AG payload array",
119 "EX payload array",
120 "IDRF array",
121 "Retire dispatch queue",
122 "Mapper checkpoint array",
123 "Physical register file EX0 port",
124 "Physical register file EX1 port",
125 "Physical register file AG0 port",
126 "Physical register file AG1 port",
127 "Flag register file",
128 "DE correctable error could not be corrected"
131 static bool f12h_dc_mce(u16 ec, u8 xec)
133 bool ret = false;
135 if (MEM_ERROR(ec)) {
136 u8 ll = LL(ec);
137 ret = true;
139 if (ll == LL_L2)
140 pr_cont("during L1 linefill from L2.\n");
141 else if (ll == LL_L1)
142 pr_cont("Data/Tag %s error.\n", R4_MSG(ec));
143 else
144 ret = false;
146 return ret;
149 static bool f10h_dc_mce(u16 ec, u8 xec)
151 if (R4(ec) == R4_GEN && LL(ec) == LL_L1) {
152 pr_cont("during data scrub.\n");
153 return true;
155 return f12h_dc_mce(ec, xec);
158 static bool k8_dc_mce(u16 ec, u8 xec)
160 if (BUS_ERROR(ec)) {
161 pr_cont("during system linefill.\n");
162 return true;
165 return f10h_dc_mce(ec, xec);
168 static bool f14h_dc_mce(u16 ec, u8 xec)
170 u8 r4 = R4(ec);
171 bool ret = true;
173 if (MEM_ERROR(ec)) {
175 if (TT(ec) != TT_DATA || LL(ec) != LL_L1)
176 return false;
178 switch (r4) {
179 case R4_DRD:
180 case R4_DWR:
181 pr_cont("Data/Tag parity error due to %s.\n",
182 (r4 == R4_DRD ? "load/hw prf" : "store"));
183 break;
184 case R4_EVICT:
185 pr_cont("Copyback parity error on a tag miss.\n");
186 break;
187 case R4_SNOOP:
188 pr_cont("Tag parity error during snoop.\n");
189 break;
190 default:
191 ret = false;
193 } else if (BUS_ERROR(ec)) {
195 if ((II(ec) != II_MEM && II(ec) != II_IO) || LL(ec) != LL_LG)
196 return false;
198 pr_cont("System read data error on a ");
200 switch (r4) {
201 case R4_RD:
202 pr_cont("TLB reload.\n");
203 break;
204 case R4_DWR:
205 pr_cont("store.\n");
206 break;
207 case R4_DRD:
208 pr_cont("load.\n");
209 break;
210 default:
211 ret = false;
213 } else {
214 ret = false;
217 return ret;
220 static bool f15h_dc_mce(u16 ec, u8 xec)
222 bool ret = true;
224 if (MEM_ERROR(ec)) {
226 switch (xec) {
227 case 0x0:
228 pr_cont("Data Array access error.\n");
229 break;
231 case 0x1:
232 pr_cont("UC error during a linefill from L2/NB.\n");
233 break;
235 case 0x2:
236 case 0x11:
237 pr_cont("STQ access error.\n");
238 break;
240 case 0x3:
241 pr_cont("SCB access error.\n");
242 break;
244 case 0x10:
245 pr_cont("Tag error.\n");
246 break;
248 case 0x12:
249 pr_cont("LDQ access error.\n");
250 break;
252 default:
253 ret = false;
255 } else if (BUS_ERROR(ec)) {
257 if (!xec)
258 pr_cont("during system linefill.\n");
259 else
260 pr_cont(" Internal %s condition.\n",
261 ((xec == 1) ? "livelock" : "deadlock"));
262 } else
263 ret = false;
265 return ret;
268 static void amd_decode_dc_mce(struct mce *m)
270 u16 ec = EC(m->status);
271 u8 xec = XEC(m->status, xec_mask);
273 pr_emerg(HW_ERR "Data Cache Error: ");
275 /* TLB error signatures are the same across families */
276 if (TLB_ERROR(ec)) {
277 if (TT(ec) == TT_DATA) {
278 pr_cont("%s TLB %s.\n", LL_MSG(ec),
279 ((xec == 2) ? "locked miss"
280 : (xec ? "multimatch" : "parity")));
281 return;
283 } else if (fam_ops->dc_mce(ec, xec))
285 else
286 pr_emerg(HW_ERR "Corrupted DC MCE info?\n");
289 static bool k8_ic_mce(u16 ec, u8 xec)
291 u8 ll = LL(ec);
292 bool ret = true;
294 if (!MEM_ERROR(ec))
295 return false;
297 if (ll == 0x2)
298 pr_cont("during a linefill from L2.\n");
299 else if (ll == 0x1) {
300 switch (R4(ec)) {
301 case R4_IRD:
302 pr_cont("Parity error during data load.\n");
303 break;
305 case R4_EVICT:
306 pr_cont("Copyback Parity/Victim error.\n");
307 break;
309 case R4_SNOOP:
310 pr_cont("Tag Snoop error.\n");
311 break;
313 default:
314 ret = false;
315 break;
317 } else
318 ret = false;
320 return ret;
323 static bool f14h_ic_mce(u16 ec, u8 xec)
325 u8 r4 = R4(ec);
326 bool ret = true;
328 if (MEM_ERROR(ec)) {
329 if (TT(ec) != 0 || LL(ec) != 1)
330 ret = false;
332 if (r4 == R4_IRD)
333 pr_cont("Data/tag array parity error for a tag hit.\n");
334 else if (r4 == R4_SNOOP)
335 pr_cont("Tag error during snoop/victimization.\n");
336 else
337 ret = false;
339 return ret;
342 static bool f15h_ic_mce(u16 ec, u8 xec)
344 bool ret = true;
346 if (!MEM_ERROR(ec))
347 return false;
349 switch (xec) {
350 case 0x0 ... 0xa:
351 pr_cont("%s.\n", f15h_ic_mce_desc[xec]);
352 break;
354 case 0xd:
355 pr_cont("%s.\n", f15h_ic_mce_desc[xec-2]);
356 break;
358 case 0x10 ... 0x14:
359 pr_cont("Decoder %s parity error.\n", f15h_ic_mce_desc[xec-4]);
360 break;
362 default:
363 ret = false;
365 return ret;
368 static void amd_decode_ic_mce(struct mce *m)
370 u16 ec = EC(m->status);
371 u8 xec = XEC(m->status, xec_mask);
373 pr_emerg(HW_ERR "Instruction Cache Error: ");
375 if (TLB_ERROR(ec))
376 pr_cont("%s TLB %s.\n", LL_MSG(ec),
377 (xec ? "multimatch" : "parity error"));
378 else if (BUS_ERROR(ec)) {
379 bool k8 = (boot_cpu_data.x86 == 0xf && (m->status & BIT_64(58)));
381 pr_cont("during %s.\n", (k8 ? "system linefill" : "NB data read"));
382 } else if (fam_ops->ic_mce(ec, xec))
384 else
385 pr_emerg(HW_ERR "Corrupted IC MCE info?\n");
388 static void amd_decode_bu_mce(struct mce *m)
390 u16 ec = EC(m->status);
391 u8 xec = XEC(m->status, xec_mask);
393 pr_emerg(HW_ERR "Bus Unit Error");
395 if (xec == 0x1)
396 pr_cont(" in the write data buffers.\n");
397 else if (xec == 0x3)
398 pr_cont(" in the victim data buffers.\n");
399 else if (xec == 0x2 && MEM_ERROR(ec))
400 pr_cont(": %s error in the L2 cache tags.\n", R4_MSG(ec));
401 else if (xec == 0x0) {
402 if (TLB_ERROR(ec))
403 pr_cont(": %s error in a Page Descriptor Cache or "
404 "Guest TLB.\n", TT_MSG(ec));
405 else if (BUS_ERROR(ec))
406 pr_cont(": %s/ECC error in data read from NB: %s.\n",
407 R4_MSG(ec), PP_MSG(ec));
408 else if (MEM_ERROR(ec)) {
409 u8 r4 = R4(ec);
411 if (r4 >= 0x7)
412 pr_cont(": %s error during data copyback.\n",
413 R4_MSG(ec));
414 else if (r4 <= 0x1)
415 pr_cont(": %s parity/ECC error during data "
416 "access from L2.\n", R4_MSG(ec));
417 else
418 goto wrong_bu_mce;
419 } else
420 goto wrong_bu_mce;
421 } else
422 goto wrong_bu_mce;
424 return;
426 wrong_bu_mce:
427 pr_emerg(HW_ERR "Corrupted BU MCE info?\n");
430 static void amd_decode_cu_mce(struct mce *m)
432 u16 ec = EC(m->status);
433 u8 xec = XEC(m->status, xec_mask);
435 pr_emerg(HW_ERR "Combined Unit Error: ");
437 if (TLB_ERROR(ec)) {
438 if (xec == 0x0)
439 pr_cont("Data parity TLB read error.\n");
440 else if (xec == 0x1)
441 pr_cont("Poison data provided for TLB fill.\n");
442 else
443 goto wrong_cu_mce;
444 } else if (BUS_ERROR(ec)) {
445 if (xec > 2)
446 goto wrong_cu_mce;
448 pr_cont("Error during attempted NB data read.\n");
449 } else if (MEM_ERROR(ec)) {
450 switch (xec) {
451 case 0x4 ... 0xc:
452 pr_cont("%s.\n", f15h_cu_mce_desc[xec - 0x4]);
453 break;
455 case 0x10 ... 0x14:
456 pr_cont("%s.\n", f15h_cu_mce_desc[xec - 0x7]);
457 break;
459 default:
460 goto wrong_cu_mce;
464 return;
466 wrong_cu_mce:
467 pr_emerg(HW_ERR "Corrupted CU MCE info?\n");
470 static void amd_decode_ls_mce(struct mce *m)
472 u16 ec = EC(m->status);
473 u8 xec = XEC(m->status, xec_mask);
475 if (boot_cpu_data.x86 >= 0x14) {
476 pr_emerg("You shouldn't be seeing an LS MCE on this cpu family,"
477 " please report on LKML.\n");
478 return;
481 pr_emerg(HW_ERR "Load Store Error");
483 if (xec == 0x0) {
484 u8 r4 = R4(ec);
486 if (!BUS_ERROR(ec) || (r4 != R4_DRD && r4 != R4_DWR))
487 goto wrong_ls_mce;
489 pr_cont(" during %s.\n", R4_MSG(ec));
490 } else
491 goto wrong_ls_mce;
493 return;
495 wrong_ls_mce:
496 pr_emerg(HW_ERR "Corrupted LS MCE info?\n");
499 static bool k8_nb_mce(u16 ec, u8 xec)
501 bool ret = true;
503 switch (xec) {
504 case 0x1:
505 pr_cont("CRC error detected on HT link.\n");
506 break;
508 case 0x5:
509 pr_cont("Invalid GART PTE entry during GART table walk.\n");
510 break;
512 case 0x6:
513 pr_cont("Unsupported atomic RMW received from an IO link.\n");
514 break;
516 case 0x0:
517 case 0x8:
518 if (boot_cpu_data.x86 == 0x11)
519 return false;
521 pr_cont("DRAM ECC error detected on the NB.\n");
522 break;
524 case 0xd:
525 pr_cont("Parity error on the DRAM addr/ctl signals.\n");
526 break;
528 default:
529 ret = false;
530 break;
533 return ret;
536 static bool f10h_nb_mce(u16 ec, u8 xec)
538 bool ret = true;
539 u8 offset = 0;
541 if (k8_nb_mce(ec, xec))
542 return true;
544 switch(xec) {
545 case 0xa ... 0xc:
546 offset = 10;
547 break;
549 case 0xe:
550 offset = 11;
551 break;
553 case 0xf:
554 if (TLB_ERROR(ec))
555 pr_cont("GART Table Walk data error.\n");
556 else if (BUS_ERROR(ec))
557 pr_cont("DMA Exclusion Vector Table Walk error.\n");
558 else
559 ret = false;
561 goto out;
562 break;
564 case 0x19:
565 if (boot_cpu_data.x86 == 0x15)
566 pr_cont("Compute Unit Data Error.\n");
567 else
568 ret = false;
570 goto out;
571 break;
573 case 0x1c ... 0x1f:
574 offset = 24;
575 break;
577 default:
578 ret = false;
580 goto out;
581 break;
584 pr_cont("%s.\n", f10h_nb_mce_desc[xec - offset]);
586 out:
587 return ret;
590 static bool nb_noop_mce(u16 ec, u8 xec)
592 return false;
595 void amd_decode_nb_mce(struct mce *m)
597 struct cpuinfo_x86 *c = &boot_cpu_data;
598 int node_id = amd_get_nb_id(m->extcpu);
599 u16 ec = EC(m->status);
600 u8 xec = XEC(m->status, 0x1f);
602 pr_emerg(HW_ERR "Northbridge Error (node %d): ", node_id);
604 switch (xec) {
605 case 0x2:
606 pr_cont("Sync error (sync packets on HT link detected).\n");
607 return;
609 case 0x3:
610 pr_cont("HT Master abort.\n");
611 return;
613 case 0x4:
614 pr_cont("HT Target abort.\n");
615 return;
617 case 0x7:
618 pr_cont("NB Watchdog timeout.\n");
619 return;
621 case 0x9:
622 pr_cont("SVM DMA Exclusion Vector error.\n");
623 return;
625 default:
626 break;
629 if (!fam_ops->nb_mce(ec, xec))
630 goto wrong_nb_mce;
632 if (c->x86 == 0xf || c->x86 == 0x10 || c->x86 == 0x15)
633 if ((xec == 0x8 || xec == 0x0) && nb_bus_decoder)
634 nb_bus_decoder(node_id, m);
636 return;
638 wrong_nb_mce:
639 pr_emerg(HW_ERR "Corrupted NB MCE info?\n");
641 EXPORT_SYMBOL_GPL(amd_decode_nb_mce);
643 static void amd_decode_fr_mce(struct mce *m)
645 struct cpuinfo_x86 *c = &boot_cpu_data;
646 u8 xec = XEC(m->status, xec_mask);
648 if (c->x86 == 0xf || c->x86 == 0x11)
649 goto wrong_fr_mce;
651 if (c->x86 != 0x15 && xec != 0x0)
652 goto wrong_fr_mce;
654 pr_emerg(HW_ERR "%s Error: ",
655 (c->x86 == 0x15 ? "Execution Unit" : "FIROB"));
657 if (xec == 0x0 || xec == 0xc)
658 pr_cont("%s.\n", fr_ex_mce_desc[xec]);
659 else if (xec < 0xd)
660 pr_cont("%s parity error.\n", fr_ex_mce_desc[xec]);
661 else
662 goto wrong_fr_mce;
664 return;
666 wrong_fr_mce:
667 pr_emerg(HW_ERR "Corrupted FR MCE info?\n");
670 static void amd_decode_fp_mce(struct mce *m)
672 u8 xec = XEC(m->status, xec_mask);
674 pr_emerg(HW_ERR "Floating Point Unit Error: ");
676 switch (xec) {
677 case 0x1:
678 pr_cont("Free List");
679 break;
681 case 0x2:
682 pr_cont("Physical Register File");
683 break;
685 case 0x3:
686 pr_cont("Retire Queue");
687 break;
689 case 0x4:
690 pr_cont("Scheduler table");
691 break;
693 case 0x5:
694 pr_cont("Status Register File");
695 break;
697 default:
698 goto wrong_fp_mce;
699 break;
702 pr_cont(" parity error.\n");
704 return;
706 wrong_fp_mce:
707 pr_emerg(HW_ERR "Corrupted FP MCE info?\n");
710 static inline void amd_decode_err_code(u16 ec)
713 pr_emerg(HW_ERR "cache level: %s", LL_MSG(ec));
715 if (BUS_ERROR(ec))
716 pr_cont(", mem/io: %s", II_MSG(ec));
717 else
718 pr_cont(", tx: %s", TT_MSG(ec));
720 if (MEM_ERROR(ec) || BUS_ERROR(ec)) {
721 pr_cont(", mem-tx: %s", R4_MSG(ec));
723 if (BUS_ERROR(ec))
724 pr_cont(", part-proc: %s (%s)", PP_MSG(ec), TO_MSG(ec));
727 pr_cont("\n");
731 * Filter out unwanted MCE signatures here.
733 static bool amd_filter_mce(struct mce *m)
735 u8 xec = (m->status >> 16) & 0x1f;
738 * NB GART TLB error reporting is disabled by default.
740 if (m->bank == 4 && xec == 0x5 && !report_gart_errors)
741 return true;
743 return false;
746 int amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
748 struct mce *m = (struct mce *)data;
749 struct cpuinfo_x86 *c = &boot_cpu_data;
750 int ecc;
752 if (amd_filter_mce(m))
753 return NOTIFY_STOP;
755 pr_emerg(HW_ERR "CPU:%d\tMC%d_STATUS[%s|%s|%s|%s|%s",
756 m->extcpu, m->bank,
757 ((m->status & MCI_STATUS_OVER) ? "Over" : "-"),
758 ((m->status & MCI_STATUS_UC) ? "UE" : "CE"),
759 ((m->status & MCI_STATUS_MISCV) ? "MiscV" : "-"),
760 ((m->status & MCI_STATUS_PCC) ? "PCC" : "-"),
761 ((m->status & MCI_STATUS_ADDRV) ? "AddrV" : "-"));
763 if (c->x86 == 0x15)
764 pr_cont("|%s|%s",
765 ((m->status & BIT_64(44)) ? "Deferred" : "-"),
766 ((m->status & BIT_64(43)) ? "Poison" : "-"));
768 /* do the two bits[14:13] together */
769 ecc = (m->status >> 45) & 0x3;
770 if (ecc)
771 pr_cont("|%sECC", ((ecc == 2) ? "C" : "U"));
773 pr_cont("]: 0x%016llx\n", m->status);
775 if (m->status & MCI_STATUS_ADDRV)
776 pr_emerg(HW_ERR "\tMC%d_ADDR: 0x%016llx\n", m->bank, m->addr);
778 switch (m->bank) {
779 case 0:
780 amd_decode_dc_mce(m);
781 break;
783 case 1:
784 amd_decode_ic_mce(m);
785 break;
787 case 2:
788 if (c->x86 == 0x15)
789 amd_decode_cu_mce(m);
790 else
791 amd_decode_bu_mce(m);
792 break;
794 case 3:
795 amd_decode_ls_mce(m);
796 break;
798 case 4:
799 amd_decode_nb_mce(m);
800 break;
802 case 5:
803 amd_decode_fr_mce(m);
804 break;
806 case 6:
807 amd_decode_fp_mce(m);
808 break;
810 default:
811 break;
814 amd_decode_err_code(m->status & 0xffff);
816 return NOTIFY_STOP;
818 EXPORT_SYMBOL_GPL(amd_decode_mce);
820 static struct notifier_block amd_mce_dec_nb = {
821 .notifier_call = amd_decode_mce,
824 static int __init mce_amd_init(void)
826 struct cpuinfo_x86 *c = &boot_cpu_data;
828 if (c->x86_vendor != X86_VENDOR_AMD)
829 return 0;
831 if ((c->x86 < 0xf || c->x86 > 0x12) &&
832 (c->x86 != 0x14 || c->x86_model > 0xf) &&
833 (c->x86 != 0x15 || c->x86_model > 0xf))
834 return 0;
836 fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL);
837 if (!fam_ops)
838 return -ENOMEM;
840 switch (c->x86) {
841 case 0xf:
842 fam_ops->dc_mce = k8_dc_mce;
843 fam_ops->ic_mce = k8_ic_mce;
844 fam_ops->nb_mce = k8_nb_mce;
845 break;
847 case 0x10:
848 fam_ops->dc_mce = f10h_dc_mce;
849 fam_ops->ic_mce = k8_ic_mce;
850 fam_ops->nb_mce = f10h_nb_mce;
851 break;
853 case 0x11:
854 fam_ops->dc_mce = k8_dc_mce;
855 fam_ops->ic_mce = k8_ic_mce;
856 fam_ops->nb_mce = f10h_nb_mce;
857 break;
859 case 0x12:
860 fam_ops->dc_mce = f12h_dc_mce;
861 fam_ops->ic_mce = k8_ic_mce;
862 fam_ops->nb_mce = nb_noop_mce;
863 break;
865 case 0x14:
866 nb_err_cpumask = 0x3;
867 fam_ops->dc_mce = f14h_dc_mce;
868 fam_ops->ic_mce = f14h_ic_mce;
869 fam_ops->nb_mce = nb_noop_mce;
870 break;
872 case 0x15:
873 xec_mask = 0x1f;
874 fam_ops->dc_mce = f15h_dc_mce;
875 fam_ops->ic_mce = f15h_ic_mce;
876 fam_ops->nb_mce = f10h_nb_mce;
877 break;
879 default:
880 printk(KERN_WARNING "Huh? What family is that: %d?!\n", c->x86);
881 kfree(fam_ops);
882 return -EINVAL;
885 pr_info("MCE: In-kernel MCE decoding enabled.\n");
887 atomic_notifier_chain_register(&x86_mce_decoder_chain, &amd_mce_dec_nb);
889 return 0;
891 early_initcall(mce_amd_init);
893 #ifdef MODULE
894 static void __exit mce_amd_exit(void)
896 atomic_notifier_chain_unregister(&x86_mce_decoder_chain, &amd_mce_dec_nb);
897 kfree(fam_ops);
900 MODULE_DESCRIPTION("AMD MCE decoder");
901 MODULE_ALIAS("edac-mce-amd");
902 MODULE_LICENSE("GPL");
903 module_exit(mce_amd_exit);
904 #endif