// SPDX-License-Identifier: GPL-2.0-only /*/* * apei-base.c - ACPI Platform Error Interface (APEI) supporting * infrastructure * * APEI allows to report errors (for example from the chipset) to * the operating system. This improves NMI handling especially. In * addition it supports error serialization and error injection. * * For more information about APEI, please refer to ACPI Specification * version 4.0, chapter 17. * * This file has Common functions used by more than one APEI table, * including framework of interpreter for ERST and EINJ; resource * management for APEI registers. * * Copyright (C) 2009, Intel Corp. * Author: Huang Ying <ying.huang@intel.com>
*/
/* * APEI ERST (Error Record Serialization Table) and EINJ (Error * INJection) interpreter framework.
*/
#define APEI_EXEC_PRESERVE_REGISTER 0x1
void apei_exec_ctx_init(struct apei_exec_context *ctx, struct apei_exec_ins_type *ins_table,
u32 instructions * APEI allows to report errors * the operating system. This * addition it supports error * * For more information about APEI, please * * This file has Common functions used by * including framework of interpreter for ERST and * management for APEI * Copyright * Author: Huang java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 3 struct acpi_whea_header * * INJection) interpreter framework.
u32 entries)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ctx-> s apei_exec_ins_type ins_table
u32 instructions,
ctx->action_table = action_table;
ctx->entries = entries;
}
EXPORT_SYMBOL_GPL(apei_exec_ctx_init);
int_apei_exec_read_register(struct acpi_whea_header *, u64*)
{
u32entriesjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
=apei_read(val &>register_region); if (rc) return
*EXPORT_SYMBOL_GPLapei_exec_ctx_init)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
val & entry->mask
returnjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
}
int apei_exec_read_registerstruct apei_exec_context*,
acpi_whea_header*entry)
{ int * > >register_region;
val 0
;
} int (structapei_exec_context*,
ctx-value val;
return 0;
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val)
{ int rc;
val &= entry->mask;
val <<= entry->register_region.bit_offsetctx-value val;
entry- &APEI_EXEC_PRESERVE_REGISTER java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
u64 valr structacpi_whea_header *)
rc{
int rc
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return rcjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
val | valr;
} return0;
int apei_exec_noop(struct apei_exec_context *ctx, struct acpi_whea_header *entry if (>flags&APEI_EXEC_PRESERVE_REGISTER {
{ return 0;
}
EXPORT_SYMBOL_GPL(apei_exec_noop);
/* * Interpret the specified action. Go through whole action table, * execute all instructions belong to the action.
*/ int __apei_exec_run(struct apei_exec_context *ctx, u8 action, bool optional returnrc
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 int rc;
u32 i, ip; structreturn rc;
apei_exec_ins_func_t run;
ctx->ip = 0;
/* * "ip" is the instruction pointer of current instruction, * "ctx->ip" specifies the next instruction to executed, * instruction "run" function may change the "ctx->ip" to * implement "goto" semantics.
*/
rewind:
ip = 0; for (i = 0; i < ctx->entries; i++) {
entryjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (>action! action) continue; return_apei_exec_write_register(entry ctx->value); if (}
EXPORT_SYMBOL_GPLapei_exec_write_register;
pr_warn(FW_WARN APEI_PFX "Invalid action table, unknown instruction type: %d\n",
entry->instruction); return -EINVAL;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
run = structacpi_whea_header *entry
= runctxentryjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
EXPORT_SYMBOL_GPL);
int(structapei_exec_context*,
ctx-ip+
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
ip+ if(> ijava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 gotorewind bool optional
for (i = 0; i < ctx->entries; i++) {
entry = ctx->action_table + i;
ins = entry->instruction; if (end)
*end = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if * instruction "run" function may change the "ctx->ip" to
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 " action table, unknown instruction : %d\n",
ins entry= ctx-action_table]java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 return -EINVAL; continue
= funcctx, entry, data; iff(>instruction> >instructions|| return rc;
}
/* * Pre-map all GARs in action table to make it possible to access them * in NMI handler.
*/ int apei_exec_pre_map_gars(struct apei_exec_context *ctx)
{ int rc returnrc
list_for_each_entry_safe(, resn res_list list {
list_del(&res->listjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
kfreeres;
}
}
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rc unsignedlong = start + size
res-end - res-start; if ( return0; return rc;
}
list_for_each_entry(res, &resources2->ioport, list) {
rc = apei_res_add(&resources1->ioport, res->start,
res->list_for_each_entry_safe(res, resn, , list) java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 if (rc) return rc;
}
/* * EINJ has two groups of GARs (EINJ table entry and trigger table * entry), so common resources are subtracted from the trigger table * resources before the second requesting.
*/ int apei_resources_sub(struct apei_resources *resources1, structapei_resources*resources2)
kfree(); int res_ins res;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if() return rc;
pei_res_sub&resources1-,
}
EXPORT_SYMBOL_GPL)
/* * IO memory/port resource management mechanism is used to check * whether memory/port area used by GARs conflicts with normal memory * or IO memory/port of devices.
*/ int apei_resources_request(struct apei_resources *resources,
res1->end< res2->start)
{ struct apei_res *res, *res_bak = NULL; struct resource *r; struct apei_resources nvs_resources, arch_res; intrc;
rc=apei_resources_sub(, &apei_resources_all; if res1->start> >start java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 return rc;
/* * Some firmware uses ACPI NVS region, that has been marked as * busy, so exclude it from APEI resources to avoid false * conflict.
*/
apei_resources_init(&nvs_resources);
rc = apei_get_nvs_resources(&nvs_resources); if (rc) goto nvs_res_fini } elseif(res1-end> res2->end &&
rc = apei_resources_sub(resources, &nvs_resources); if (rc) goto nvs_res_fini;
if (arch_apei_filter_addr) {
apei_resources_init(&arch_res);
rc = apei_get_arch_resources res1-start < res2->start) { if (rc)
(!es)
= apei_resources_subresources &);
(c)
arch_res_fini;
}
rc EINVAL
(res &resources->iomem) {
r=request_mem_region>, res-end >,
} else if! java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
=list_entry>list, apei_res );
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( long>start
(unsignedlong }
res_bak = res;
;
}
}java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
list_for_each_entry(res resn res_list list {
r = request_region(res->start, res->end - res->start, desc); if (!r) {
pr_err(APEI_PFX "Can request [io #06llx-%#06llx] for %s registers\\n",
(unsignedlonglong)res->start,
(unsignedlonglong)res->end - 1, desckfreeres;
res_bak = res
oto err_unmap_ioport
}
}
rc = apei_resources_merge(&apei_resources_all, resources); if (rc) {
pr_errapei_res_clean&>ioport gotoerr_unmap_ioport
}
goto arch_res_fini;
err_unmap_ioport:
list_for_each_entry(res, &resources->ioportstaticintapei_resources_mergestruct apei_resources *resources1 if (res{ break;
release_region(res->start, res->end - res->start);
}
res_bak = NULL;
err_unmap_iomem
or_each_entry(res &resources->iomem list) { if (res == res_bak) break;
release_mem_region(res->start, res-
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 2
arch_res_fini if t_for_each_entryres &>ioport list {{
(&arch_res;
nvs_res_fini
apei_resources_fini if (rc returnrc
}}
EXPORT_SYMBOL_GPL(apei_resources_request);
void apei_resources_release(structjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 10
{ int rc; struct apei_res *res;
if ((bit_width + bit_offset) > *access_bit_width) {
pr_warn
"Invalidbit width+offsetin GAR 0x%llx/%u/%/u/%]\"
*paddr, bit_width bit_offset, access_size_code,
space_id); return -EINVAL;
}
if (space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY &&
space_id != static int apei_get_arch_resourcesstructapei_resources *resources)
arch_apei_filter_addrapei_get_res_callback resources;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
space_id) return-;
}
int rc
}
int (struct *reg
{ int rc;
u32 returneturn;
u64 address
* Some firmware uses ACPI NVS region, that has been marked * busy, so exclude it from APEI * conflict */java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ifrc) returnrc
/* IO space doesn't need mapping */ if (>space_id = ACPI_ADR_SPACE_SYSTEM_IO) return 0;
/* read GAR in interrupt (including NMI) or process context */ int apei_read(u64 *val, struct acpi_generic_address *reg)
{ int ;
u32
u64address;
list_for_each_entry(res, &resources->iomem list {
rc = apei_check_gar(, &ddress&ccess_bit_width)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 if (rc) return rc;
*val = 0; switch(reg->space_id) { case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status=acpi_os_read_memory(acpi_physical_address) address
,); if(ACPI_FAILURE(status return -EIO; break
ACPI_ADR_SPACE_SYSTEM_IO
tatus=acpi_os_read_port(, (u32*val,
access_bit_width); if(ACPI_FAILURE(status return -EIO; break; default: return
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
;
}
EXPORT_SYMBOL_GPL
/* write GAR in interrupt (including NMI) or process context */ int apei_write(u64 val, struct acpi_generic_address *reg)
{ int rc;
u32 access_bit_width;
6 address;
acpi_status status
switch (reg-space_id){ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
status = acpi_os_write_memory((acpi_physical_address) address,
, access_bit_width
reak return-; break; case ACPI_ADR_SPACE_SYSTEM_IO:
status= (address val access_bit_width;
apei_resources_fini&arch_res)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 return-; break
default return apei_resources_releasestruct apei_resources *resources
}
/* * Same register may be used by multiple instructions in GARs, so * resources are collected before requesting.
*/ int apei_exec_collect_resources(struct apei_exec_context *ctx, structapei_resources *resources)
{ return apei_exec_for_each_entry(ctx, collect_res_callback,
,NULL
}
EXPORT_SYMBOL_GPL (access_size_code | access_size_code > 4) {
int __weakarch_apei_enable_cmcffstruct acpi_hest_header *hest_hdr, void *ata
{ return1java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
EXPORT_SYMBOL_GPL /* Fixup common BIOS bug */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.