summaryrefslogtreecommitdiff
path: root/src/arch/x86/boot
diff options
context:
space:
mode:
authorzbao <fishbaozi@gmail.com>2012-04-13 13:57:14 +0800
committerPeter Stuge <peter@stuge.se>2012-04-16 04:56:05 +0200
commitcaf494c83170e97b192e2174bc461482699a3712 (patch)
tree2efa5ce9d290d80f7c16d4a89fc1bcb3139337fe /src/arch/x86/boot
parent90655c83d03f51105ab561928224a1b50cebe829 (diff)
ACPI HEST table.
HEST feature starts from ACPI 4.0. HEST is one of four kinds of tables of ACPI Platform Error Interfaces (APEI). In Windows world, APEI is called Windows Hardware Error Architecture (WHEA). APEI consists of four separate tables: 1. Error Record Serialization Table (ERST) 2. BOOT Error Record Table (BERT) 3. Hardware Error Source Table (HEST) 4. Error Injection Table (EINJ) All these 4 tables have the same header as FADT, MADT, etc. They are pointed by RSDP. For the HEST, it contains the error source. The types of them are defined as type description 1. Machine Check Exception (MCE) 2. Corrected Machine Check (CMC) 3. NMI Error 6. PCI Express Root Port AER 7. PCI Express Device AER 8. PCI Express Bridge AER 9. Generic Hardware Error Source Error source types 3, 4, and 5 are reserved for legacy reasons and must not be used. Currently AMD board only provide part of "Machine Check Exception (MCE)" & Corrected Machine Check (CMC)". we need to provide the header of each error source. Other types of Error Sources is in TODO list. Only persimmon is tested. Linux can add HEST feature. The dmesg says, ACPI: HEST 0000000066fe5010 00198 (v03 CORE COREBOOT 00000000 CORE 00000000) ...... HEST: Table parsing has been initialized. No more message is got. Windows can boot with this patch. Havent found a way to test it. Change-Id: I447e7f57b8e8f0433a145a43d0710910afabf00f Signed-off-by: Zheng Bao <zheng.bao@amd.com> Signed-off-by: zbao <fishbaozi@gmail.com> Reviewed-on: http://review.coreboot.org/888 Reviewed-by: Peter Stuge <peter@stuge.se> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/arch/x86/boot')
-rw-r--r--src/arch/x86/boot/acpi.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/arch/x86/boot/acpi.c b/src/arch/x86/boot/acpi.c
index f17e73e3f6..010ba9f6ff 100644
--- a/src/arch/x86/boot/acpi.c
+++ b/src/arch/x86/boot/acpi.c
@@ -467,6 +467,89 @@ void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt, acpi_xsdt_t *xsdt)
rsdp->ext_checksum = acpi_checksum((void *)rsdp, sizeof(acpi_rsdp_t));
}
+unsigned long __attribute__((weak)) acpi_fill_hest(acpi_hest_t *hest)
+{
+ return (unsigned long)hest;
+}
+
+unsigned long acpi_create_hest_error_source(acpi_hest_t *hest, acpi_hest_esd_t *esd, u16 type, void *data, u16 data_len)
+{
+ acpi_header_t *header = &(hest->header);
+ acpi_hest_hen_t *hen;
+ void *pos;
+ u16 len;
+
+ pos = esd;
+ memset(pos, 0, sizeof(acpi_hest_esd_t));
+ len = 0;
+ esd->type = type; /* MCE */
+ esd->source_id = hest->error_source_count;
+ esd->flags = 0; /* FIRMWARE_FIRST */
+ esd->enabled = 1;
+ esd->prealloc_erecords = 1;
+ esd->max_section_per_record = 0x1;
+
+ len += sizeof(acpi_hest_esd_t);
+ pos = esd + 1;
+
+ switch (type) {
+ case 0: /* MCE */
+ break;
+ case 1: /* CMC */
+ hen = (acpi_hest_hen_t *) (pos);
+ memset(pos, 0, sizeof(acpi_hest_hen_t));
+ hen->type = 3; /* SCI? */
+ hen->length = sizeof(acpi_hest_hen_t);
+ hen->conf_we = 0; /* Configuration Write Enable. */
+ hen->poll_interval = 0;
+ hen->vector = 0;
+ hen->sw2poll_threshold_val = 0;
+ hen->sw2poll_threshold_win = 0;
+ hen->error_threshold_val = 0;
+ hen->error_threshold_win = 0;
+ len += sizeof(acpi_hest_hen_t);
+ pos = hen + 1;
+ break;
+ case 2: /* NMI */
+ case 6: /* AER Root Port */
+ case 7: /* AER Endpoint */
+ case 8: /* AER Bridge */
+ case 9: /* Generic Hardware Error Source. */
+ /* TODO: */
+ break;
+ default:
+ printk(BIOS_DEBUG, "Invalid type of Error Source.");
+ break;
+ }
+ hest->error_source_count ++;
+
+ memcpy(pos, data, data_len);
+ len += data_len;
+ header->length += len;
+
+ return len;
+}
+
+/* ACPI 4.0 */
+void acpi_write_hest(acpi_hest_t *hest)
+{
+ acpi_header_t *header = &(hest->header);
+
+ memset(hest, 0, sizeof(acpi_hest_t));
+
+ memcpy(header->signature, "HEST", 4);
+ memcpy(header->oem_id, OEM_ID, 6);
+ memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8);
+ memcpy(header->asl_compiler_id, ASLC, 4);
+ header->length += sizeof(acpi_hest_t);
+ header->revision = 1;
+
+ acpi_fill_hest(hest);
+
+ /* Calculate checksums. */
+ header->checksum = acpi_checksum((void *)hest, header->length);
+}
+
#if CONFIG_HAVE_ACPI_RESUME == 1
void suspend_resume(void)
{