2
0

ghes.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Support for generating APEI tables and recording CPER for Guests
  3. *
  4. * Copyright (c) 2020 HUAWEI TECHNOLOGIES CO., LTD.
  5. *
  6. * Author: Dongjiu Geng <gengdongjiu@huawei.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef ACPI_GHES_H
  20. #define ACPI_GHES_H
  21. #include "hw/acpi/bios-linker-loader.h"
  22. #include "qapi/error.h"
  23. /*
  24. * Values for Hardware Error Notification Type field
  25. */
  26. enum AcpiGhesNotifyType {
  27. /* Polled */
  28. ACPI_GHES_NOTIFY_POLLED = 0,
  29. /* External Interrupt */
  30. ACPI_GHES_NOTIFY_EXTERNAL = 1,
  31. /* Local Interrupt */
  32. ACPI_GHES_NOTIFY_LOCAL = 2,
  33. /* SCI */
  34. ACPI_GHES_NOTIFY_SCI = 3,
  35. /* NMI */
  36. ACPI_GHES_NOTIFY_NMI = 4,
  37. /* CMCI, ACPI 5.0: 18.3.2.7, Table 18-290 */
  38. ACPI_GHES_NOTIFY_CMCI = 5,
  39. /* MCE, ACPI 5.0: 18.3.2.7, Table 18-290 */
  40. ACPI_GHES_NOTIFY_MCE = 6,
  41. /* GPIO-Signal, ACPI 6.0: 18.3.2.7, Table 18-332 */
  42. ACPI_GHES_NOTIFY_GPIO = 7,
  43. /* ARMv8 SEA, ACPI 6.1: 18.3.2.9, Table 18-345 */
  44. ACPI_GHES_NOTIFY_SEA = 8,
  45. /* ARMv8 SEI, ACPI 6.1: 18.3.2.9, Table 18-345 */
  46. ACPI_GHES_NOTIFY_SEI = 9,
  47. /* External Interrupt - GSIV, ACPI 6.1: 18.3.2.9, Table 18-345 */
  48. ACPI_GHES_NOTIFY_GSIV = 10,
  49. /* Software Delegated Exception, ACPI 6.2: 18.3.2.9, Table 18-383 */
  50. ACPI_GHES_NOTIFY_SDEI = 11,
  51. /* 12 and greater are reserved */
  52. ACPI_GHES_NOTIFY_RESERVED = 12
  53. };
  54. enum {
  55. ACPI_HEST_SRC_ID_SEA = 0,
  56. /* future ids go here */
  57. ACPI_GHES_ERROR_SOURCE_COUNT
  58. };
  59. typedef struct AcpiGhesState {
  60. uint64_t hw_error_le;
  61. bool present; /* True if GHES is present at all on this board */
  62. } AcpiGhesState;
  63. void acpi_build_hest(GArray *table_data, GArray *hardware_errors,
  64. BIOSLinker *linker,
  65. const char *oem_id, const char *oem_table_id);
  66. void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s,
  67. GArray *hardware_errors);
  68. int acpi_ghes_memory_errors(uint16_t source_id, uint64_t error_physical_addr);
  69. /**
  70. * acpi_ghes_present: Report whether ACPI GHES table is present
  71. *
  72. * Returns: true if the system has an ACPI GHES table and it is
  73. * safe to call acpi_ghes_memory_errors() to record a memory error.
  74. */
  75. bool acpi_ghes_present(void);
  76. #endif