Hi Tomasz, Today I see your a APEI test tool patch: https://lists.linaro.org/pipermail/linaro-acpi/2013-September/000706.html, and have a question, whether could you have a confirmation about it? thanks.
+static int bfapei_hest(char **buf, int *size, uint64_t paddr, int status) +{ + struct acpi_hest_generic_status *block_ptr; + struct acpi_hest_generic_data *gdata; + struct cper_sec_mem_err *mem_err; + uint64_t *add_ptr; + int reqr_size = sizeof(uint64_t) + + sizeof(struct acpi_hest_generic_status) + + sizeof(struct acpi_hest_generic_data) + + sizeof (struct cper_sec_mem_err); + + if (*size < reqr_size) { + *buf = realloc(*buf, *size + reqr_size); + if (!(*buf)) { + printf("Error during memory allocation!\n"); + return BFAPEI_FAIL; + } + memset(*buf + *size, 0, reqr_size - *size); + *size += reqr_size; + } + + /* + * Fill in blob which will be parsed by GHES driver. + */ + + /* First point to generic error status block */ + add_ptr = (uint64_t *) *buf; + *add_ptr = paddr + sizeof(uint64_t);
May be this here is not right, please confirm it, thank you. should the add_ptr's content is "paddr" instead of "paddr + sizeof(uint64_t)"?
*add_ptr = paddr;
+ + /* Fill in generic error status block */ + block_ptr = (struct acpi_hest_generic_status *) (++add_ptr); + block_ptr->block_status = status; + block_ptr->data_length = sizeof(struct acpi_hest_generic_data); + block_ptr->error_severity = GHES_SEV_CORRECTED; + + /* Fill in generic error data entry */ + gdata = (struct acpi_hest_generic_data *) (block_ptr + 1); + memcpy(gdata->section_type, (void *) &CPER_SEC_PLATFORM_MEM, + sizeof(uuid_le)); + gdata->error_data_length = sizeof(struct cper_sec_mem_err); + block_ptr->data_length += gdata->error_data_length; + + mem_err = (struct cper_sec_mem_err *) (gdata + 1); + /* Place for more specific err info */ + + return BFAPEI_OK; +} +