Re: [RFC PATCH 2/3] ACPI: PHAT: Add generic helper to parse PHAT records
From: K Prateek Nayak
Date: Fri Jun 05 2026 - 00:09:28 EST
Hello Mario,
On 6/3/2026 7:55 PM, Mario Limonciello wrote:
>> +/**
>> + * acpi_phat_get_vendor_reset_reason - Find a "Vendor Specific Reset Reason
>> + * Entry" with the matching @guid from the "Firmware Health Data Record". If
>> + * successfully located, the function will allocate an object of the size
>> + * "acpi_phat_vendor_element.length" and return a pointer populated with the
>> + * content of the record.
>> + *
>> + * @guid: The "Vendor Data ID" of the reset reason record.
>> + *
>> + * Return: A valid pointer to an allocated "acpi_phat_vendor_element" populated
>> + * with the data from the record with matching @guid; an ERR_PTR() otherwise if
>> + * no matching records were found, or if the element could not be allocated.
>> + * If a valid pointer was returned, the user must call
>> + * acpi_phat_put_vendor_reset_reason() for the object once done to reclaim the
>> + * allocated memory.
>> + */
>> +struct acpi_phat_vendor_element *acpi_phat_get_vendor_reset_reason(guid_t *guid)
>> +{
>> + struct acpi_table_header *phat_tbl __free(acpi_put_table) = NULL;
>> + struct acpi_phat_health_data *fw_health_data;
>> + struct acpi_phat_device_data *dev_data;
>> + acpi_status status;
>> + void *data;
>> + int i;
>> +
>> + status = acpi_get_table(ACPI_SIG_PHAT, 0, &phat_tbl);
>> + if (ACPI_FAILURE(status))
>> + return ERR_PTR(-ENODEV);
>
> For some further sanity checking, should you look at the PHAT revision
> here matches 2 as well? Table 55 in the linked spec.
Good catch! I'll add in that check in the next version.
--
Thanks and Regards,
Prateek