xref: /openbmc/qemu/include/hw/acpi/ghes.h (revision 14e996ef)
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 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef ACPI_GHES_H
23 #define ACPI_GHES_H
24 
25 #include "hw/acpi/bios-linker-loader.h"
26 
27 /*
28  * Values for Hardware Error Notification Type field
29  */
30 enum AcpiGhesNotifyType {
31     /* Polled */
32     ACPI_GHES_NOTIFY_POLLED = 0,
33     /* External Interrupt */
34     ACPI_GHES_NOTIFY_EXTERNAL = 1,
35     /* Local Interrupt */
36     ACPI_GHES_NOTIFY_LOCAL = 2,
37     /* SCI */
38     ACPI_GHES_NOTIFY_SCI = 3,
39     /* NMI */
40     ACPI_GHES_NOTIFY_NMI = 4,
41     /* CMCI, ACPI 5.0: 18.3.2.7, Table 18-290 */
42     ACPI_GHES_NOTIFY_CMCI = 5,
43     /* MCE, ACPI 5.0: 18.3.2.7, Table 18-290 */
44     ACPI_GHES_NOTIFY_MCE = 6,
45     /* GPIO-Signal, ACPI 6.0: 18.3.2.7, Table 18-332 */
46     ACPI_GHES_NOTIFY_GPIO = 7,
47     /* ARMv8 SEA, ACPI 6.1: 18.3.2.9, Table 18-345 */
48     ACPI_GHES_NOTIFY_SEA = 8,
49     /* ARMv8 SEI, ACPI 6.1: 18.3.2.9, Table 18-345 */
50     ACPI_GHES_NOTIFY_SEI = 9,
51     /* External Interrupt - GSIV, ACPI 6.1: 18.3.2.9, Table 18-345 */
52     ACPI_GHES_NOTIFY_GSIV = 10,
53     /* Software Delegated Exception, ACPI 6.2: 18.3.2.9, Table 18-383 */
54     ACPI_GHES_NOTIFY_SDEI = 11,
55     /* 12 and greater are reserved */
56     ACPI_GHES_NOTIFY_RESERVED = 12
57 };
58 
59 enum {
60     ACPI_HEST_SRC_ID_SEA = 0,
61     /* future ids go here */
62     ACPI_HEST_SRC_ID_RESERVED,
63 };
64 
65 typedef struct AcpiGhesState {
66     uint64_t ghes_addr_le;
67 } AcpiGhesState;
68 
69 void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker);
70 void acpi_build_hest(GArray *table_data, BIOSLinker *linker,
71                      const char *oem_id, const char *oem_table_id);
72 void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s,
73                           GArray *hardware_errors);
74 int acpi_ghes_record_errors(uint8_t notify, uint64_t error_physical_addr);
75 #endif
76