On Thu, 28 Dec 2017 13:54:10 +0800 Dongjiu Geng <gengdongjiu@xxxxxxxxxx> wrote: > Add Generic Error Status Block structures and some macros > definitions, which is referred to the ACPI 4.0 or ACPI 6.1. The > HEST table generation and CPER record will use them. > > Signed-off-by: Dongjiu Geng <gengdongjiu@xxxxxxxxxx> > --- > Change since v13: > 1. Clean the new added structures and macros definition > > Change since v12: > 1. Address Igor's comments to to get rid of most structures and use > build_append_int_noprefix() API to compose whole error status block > and APEI table in [1] > > [1]: https://lkml.org/lkml/2017/8/29/187 > --- > include/hw/acpi/acpi-defs.h | 52 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) > > diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h > index 72be675..fb2110c 100644 > --- a/include/hw/acpi/acpi-defs.h > +++ b/include/hw/acpi/acpi-defs.h > @@ -298,6 +298,25 @@ typedef struct AcpiMultipleApicTable AcpiMultipleApicTable; > #define ACPI_APIC_RESERVED 16 /* 16 and greater are reserved */ > > /* > + * Hardware Error Notification > + */ > +enum AcpiHestNotifyType { > + ACPI_HEST_NOTIFY_POLLED = 0, > + ACPI_HEST_NOTIFY_EXTERNAL = 1, > + ACPI_HEST_NOTIFY_LOCAL = 2, > + ACPI_HEST_NOTIFY_SCI = 3, > + ACPI_HEST_NOTIFY_NMI = 4, > + ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ for stuff coming from spec comment should be something like this /* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefReturn */ i.e. concrete version, chapter/table otherwise it could be hard to find definition in huge spec > + ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ > + ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */ > + ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */ > + ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */ > + ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */ > + ACPI_HEST_NOTIFY_SDEI = 11, /* ACPI 6.2 */ > + ACPI_HEST_NOTIFY_RESERVED = 12 /* 12 and greater are reserved */ > +}; > + > +/* > * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE) > */ > #define ACPI_SUB_HEADER_DEF /* Common ACPI sub-structure header */\ > @@ -474,6 +493,39 @@ struct AcpiSystemResourceAffinityTable { > } QEMU_PACKED; > typedef struct AcpiSystemResourceAffinityTable AcpiSystemResourceAffinityTable; > > +/* > + * Generic Error Status Block > + */ > +struct AcpiGenericErrorStatus { > + /* It is a bitmask composed of ACPI_GEBS_xxx macros */ > + uint32_t block_status; > + uint32_t raw_data_offset; > + uint32_t raw_data_length; > + uint32_t data_length; > + uint32_t error_severity; > +} QEMU_PACKED; > +typedef struct AcpiGenericErrorStatus AcpiGenericErrorStatus; > + > +/* > + * Masks for Block Status field above > + */ > +#define ACPI_GEBS_UNCORRECTABLE (1) () are usually used with an expression and not with single value, so drop that to be consistent with style of the header > + > +/* > + * Value for Error Severity field above > + */ > +enum AcpiGenericErrorSeverity { > + ACPI_CPER_SEV_RECOVERABLE, > + ACPI_CPER_SEV_FATAL, > + ACPI_CPER_SEV_CORRECTED, > + ACPI_CPER_SEV_NONE, > +}; > + > +/* > + * Generic Hardware Error Source version 2 > + */ > +#define ACPI_HEST_SOURCE_GENERIC_ERROR_V2 (10) ditto > + > #define ACPI_SRAT_PROCESSOR_APIC 0 > #define ACPI_SRAT_MEMORY 1 > #define ACPI_SRAT_PROCESSOR_x2APIC 2