apei.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Arch-specific APEI-related functions.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <acpi/apei.h>
  15. #include <asm/mce.h>
  16. #include <asm/tlbflush.h>
  17. int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data)
  18. {
  19. #ifdef CONFIG_X86_MCE
  20. int i;
  21. struct acpi_hest_ia_corrected *cmc;
  22. struct acpi_hest_ia_error_bank *mc_bank;
  23. if (hest_hdr->type != ACPI_HEST_TYPE_IA32_CORRECTED_CHECK)
  24. return 0;
  25. cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
  26. if (!cmc->enabled)
  27. return 0;
  28. /*
  29. * We expect HEST to provide a list of MC banks that report errors
  30. * in firmware first mode. Otherwise, return non-zero value to
  31. * indicate that we are done parsing HEST.
  32. */
  33. if (!(cmc->flags & ACPI_HEST_FIRMWARE_FIRST) ||
  34. !cmc->num_hardware_banks)
  35. return 1;
  36. pr_info("HEST: Enabling Firmware First mode for corrected errors.\n");
  37. mc_bank = (struct acpi_hest_ia_error_bank *)(cmc + 1);
  38. for (i = 0; i < cmc->num_hardware_banks; i++, mc_bank++)
  39. mce_disable_bank(mc_bank->bank_number);
  40. #endif
  41. return 1;
  42. }
  43. void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
  44. {
  45. #ifdef CONFIG_X86_MCE
  46. apei_mce_report_mem_error(sev, mem_err);
  47. #endif
  48. }
  49. void arch_apei_flush_tlb_one(unsigned long addr)
  50. {
  51. __flush_tlb_one(addr);
  52. }