acpi/ghes: Cleanup the code which gets ghes ged state

Move the check logic into a common function and simplify the
code which checks if GHES is enabled and was properly setup.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <2bbb1d3eb88b0a668114adef2f1c2a94deebba0e.1758610789.git.mchehab+huawei@kernel.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Mauro Carvalho Chehab 2025-09-23 09:03:56 +02:00 committed by Michael S. Tsirkin
parent 6d65290d83
commit 1547c5a5ff
4 changed files with 27 additions and 39 deletions

View file

@ -66,7 +66,6 @@ enum {
typedef struct AcpiGhesState {
uint64_t hw_error_le;
bool present; /* True if GHES is present at all on this board */
} AcpiGhesState;
void acpi_build_hest(GArray *table_data, GArray *hardware_errors,
@ -74,15 +73,16 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors,
const char *oem_id, const char *oem_table_id);
void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s,
GArray *hardware_errors);
int acpi_ghes_memory_errors(uint16_t source_id, uint64_t error_physical_addr);
void ghes_record_cper_errors(const void *cper, size_t len,
int acpi_ghes_memory_errors(AcpiGhesState *ags, uint16_t source_id,
uint64_t error_physical_addr);
void ghes_record_cper_errors(AcpiGhesState *ags, const void *cper, size_t len,
uint16_t source_id, Error **errp);
/**
* acpi_ghes_present: Report whether ACPI GHES table is present
* acpi_ghes_get_state: Get a pointer for ACPI ghes state
*
* Returns: true if the system has an ACPI GHES table and it is
* safe to call acpi_ghes_memory_errors() to record a memory error.
* Returns: a pointer to ghes state if the system has an ACPI GHES table,
* NULL, otherwise.
*/
bool acpi_ghes_present(void);
AcpiGhesState *acpi_ghes_get_state(void);
#endif