1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <acpi/acpi.h>
#include <acpi/acpigen.h>
#include <arch/bert_storage.h>
#include <console/console.h>
#include <intelblocks/acpi.h>
#include <intelblocks/crashlog.h>
void acpi_soc_fill_bert(acpi_bert_t *bert,
void **region,
size_t *length)
{
acpi_generic_error_status_t *status = NULL;
size_t cpu_record_size, pmc_record_size;
void *cl_data = NULL;
if (!cl_get_total_data_size()) {
printk(BIOS_ERR, "Error: No crashlog record present\n");
return;
}
status = bert_new_event(&CPER_SEC_FW_ERR_REC_REF_GUID);
if (!status) {
printk(BIOS_ERR, "Error: unable to allocate GSB\n");
return;
}
if (cl_get_total_data_size() > bert_storage_remaining()) {
printk(BIOS_ERR, "Error: Crashlog entry would exceed "
"available region\n");
return;
}
cpu_record_size = cl_get_cpu_record_size();
if (cpu_record_size) {
cl_data = new_cper_fw_error_crashlog(status, cpu_record_size);
if (!cl_data) {
printk(BIOS_ERR, "Error: Crashlog CPU entry(size %lu) "
"would exceed available region\n",
cpu_record_size);
return;
}
printk(BIOS_DEBUG, "cl_data %p, cpu_record_size %lu\n",
cl_data, cpu_record_size);
cl_fill_cpu_records(cl_data);
}
pmc_record_size = cl_get_pmc_record_size();
if (pmc_record_size) {
/* Allocate new FW ERR structure in case CPU crashlog is present */
if (cpu_record_size && !bert_append_fw_err(status)) {
printk(BIOS_ERR, "Error: Crashlog PMC entry would "
"exceed available region\n");
return;
}
cl_data = new_cper_fw_error_crashlog(status, pmc_record_size);
if (!cl_data) {
printk(BIOS_ERR, "Error: Crashlog PMC entry(size %lu) "
"would exceed available region\n",
pmc_record_size);
return;
}
printk(BIOS_DEBUG, "cl_data %p, pmc_record_size %lu\n",
cl_data, pmc_record_size);
cl_fill_pmc_records(cl_data);
}
*length = status->raw_data_length;
*region = (void *)status;
}
bool acpi_is_boot_error_src_present(void)
{
if (!CONFIG(SOC_INTEL_CRASHLOG)) {
printk(BIOS_DEBUG, "Crashlog disabled.\n");
return false;
}
if (!discover_crashlog()) {
printk(BIOS_SPEW, "Crashlog discovery result: crashlog not found\n");
return false;
}
collect_pmc_and_cpu_crashlog_from_srams();
/* Discovery tables sizes can be larger than the actual valid collected data */
u32 crashlog_size = cl_get_total_data_size();
return (crashlog_size > 0);
}
|