diff options
author | Tyler Baicar <tbaicar@codeaurora.org> | 2017-06-21 12:17:05 -0600 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2017-06-22 15:43:47 +0100 |
commit | bbcc2e7b642ed241651fee50ac6ed59643cb1736 (patch) | |
tree | 695cd84d0db3136d5a6fb397626712d7992d8fa8 /include/acpi | |
parent | 42aa560446622da6c33dce54fc8f4cd81516e906 (diff) | |
download | blackbird-op-linux-bbcc2e7b642ed241651fee50ac6ed59643cb1736.tar.gz blackbird-op-linux-bbcc2e7b642ed241651fee50ac6ed59643cb1736.zip |
ras: acpi/apei: cper: add support for generic data v3 structure
The ACPI 6.1 spec adds a new revision of the generic error data
entry structure. Add support to handle the new structure as well
as properly verify and iterate through the generic data entries.
Signed-off-by: Tyler Baicar <tbaicar@codeaurora.org>
CC: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'include/acpi')
-rw-r--r-- | include/acpi/ghes.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index 68f088a92398..8f8fea004df5 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -73,3 +73,39 @@ static inline void ghes_edac_unregister(struct ghes *ghes) { } #endif + +static inline int acpi_hest_get_version(struct acpi_hest_generic_data *gdata) +{ + return gdata->revision >> 8; +} + +static inline void *acpi_hest_get_payload(struct acpi_hest_generic_data *gdata) +{ + if (acpi_hest_get_version(gdata) >= 3) + return (void *)(((struct acpi_hest_generic_data_v300 *)(gdata)) + 1); + + return gdata + 1; +} + +static inline int acpi_hest_get_error_length(struct acpi_hest_generic_data *gdata) +{ + return ((struct acpi_hest_generic_data *)(gdata))->error_data_length; +} + +static inline int acpi_hest_get_size(struct acpi_hest_generic_data *gdata) +{ + if (acpi_hest_get_version(gdata) >= 3) + return sizeof(struct acpi_hest_generic_data_v300); + + return sizeof(struct acpi_hest_generic_data); +} + +static inline int acpi_hest_get_record_size(struct acpi_hest_generic_data *gdata) +{ + return (acpi_hest_get_size(gdata) + acpi_hest_get_error_length(gdata)); +} + +static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata) +{ + return (void *)(gdata) + acpi_hest_get_record_size(gdata); +} |