linux/drivers/acpi/apei/apei-base.c

// 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 <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/acpi.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/kref.h>
#include <linux/interrupt.h>
#include <linux/debugfs.h>
#include <acpi/apei.h>
#include <linux/unaligned.h>

#include "apei-internal.h"

#define APEI_PFX

/*
 * APEI ERST (Error Record Serialization Table) and EINJ (Error
 * INJection) interpreter framework.
 */

#define APEI_EXEC_PRESERVE_REGISTER

void apei_exec_ctx_init(struct apei_exec_context *ctx,
			struct apei_exec_ins_type *ins_table,
			u32 instructions,
			struct acpi_whea_header *action_table,
			u32 entries)
{}
EXPORT_SYMBOL_GPL();

int __apei_exec_read_register(struct acpi_whea_header *entry, u64 *val)
{}

int apei_exec_read_register(struct apei_exec_context *ctx,
			    struct acpi_whea_header *entry)
{}
EXPORT_SYMBOL_GPL();

int apei_exec_read_register_value(struct apei_exec_context *ctx,
				  struct acpi_whea_header *entry)
{}
EXPORT_SYMBOL_GPL();

int __apei_exec_write_register(struct acpi_whea_header *entry, u64 val)
{}

int apei_exec_write_register(struct apei_exec_context *ctx,
			     struct acpi_whea_header *entry)
{}
EXPORT_SYMBOL_GPL();

int apei_exec_write_register_value(struct apei_exec_context *ctx,
				   struct acpi_whea_header *entry)
{}
EXPORT_SYMBOL_GPL();

int apei_exec_noop(struct apei_exec_context *ctx,
		   struct acpi_whea_header *entry)
{}
EXPORT_SYMBOL_GPL();

/*
 * 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)
{}
EXPORT_SYMBOL_GPL();

apei_exec_entry_func_t;

static int apei_exec_for_each_entry(struct apei_exec_context *ctx,
				    apei_exec_entry_func_t func,
				    void *data,
				    int *end)
{}

static int pre_map_gar_callback(struct apei_exec_context *ctx,
				struct acpi_whea_header *entry,
				void *data)
{}

/*
 * 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)
{}
EXPORT_SYMBOL_GPL();

static int post_unmap_gar_callback(struct apei_exec_context *ctx,
				   struct acpi_whea_header *entry,
				   void *data)
{}

/* Post-unmap all GAR in action table. */
int apei_exec_post_unmap_gars(struct apei_exec_context *ctx)
{}
EXPORT_SYMBOL_GPL();

/*
 * Resource management for GARs in APEI
 */
struct apei_res {};

/* Collect all resources requested, to avoid conflict */
static struct apei_resources apei_resources_all =;

static int apei_res_add(struct list_head *res_list,
			unsigned long start, unsigned long size)
{}

static int apei_res_sub(struct list_head *res_list1,
			struct list_head *res_list2)
{}

static void apei_res_clean(struct list_head *res_list)
{}

void apei_resources_fini(struct apei_resources *resources)
{}
EXPORT_SYMBOL_GPL();

static int apei_resources_merge(struct apei_resources *resources1,
				struct apei_resources *resources2)
{}

int apei_resources_add(struct apei_resources *resources,
		       unsigned long start, unsigned long size,
		       bool iomem)
{}
EXPORT_SYMBOL_GPL();

/*
 * 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,
		       struct apei_resources *resources2)
{}
EXPORT_SYMBOL_GPL();

static int apei_get_res_callback(__u64 start, __u64 size, void *data)
{}

static int apei_get_nvs_resources(struct apei_resources *resources)
{}

int (*arch_apei_filter_addr)(int (*func)(__u64 start, __u64 size,
				     void *data), void *data);
static int apei_get_arch_resources(struct apei_resources *resources)

{}

/*
 * 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,
			   const char *desc)
{}
EXPORT_SYMBOL_GPL();

void apei_resources_release(struct apei_resources *resources)
{}
EXPORT_SYMBOL_GPL();

static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
				u32 *access_bit_width)
{}

int apei_map_generic_address(struct acpi_generic_address *reg)
{}
EXPORT_SYMBOL_GPL();

/* read GAR in interrupt (including NMI) or process context */
int apei_read(u64 *val, struct acpi_generic_address *reg)
{}
EXPORT_SYMBOL_GPL();

/* write GAR in interrupt (including NMI) or process context */
int apei_write(u64 val, struct acpi_generic_address *reg)
{}
EXPORT_SYMBOL_GPL();

static int collect_res_callback(struct apei_exec_context *ctx,
				struct acpi_whea_header *entry,
				void *data)
{}

/*
 * 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,
				struct apei_resources *resources)
{}
EXPORT_SYMBOL_GPL();

struct dentry *apei_get_debugfs_dir(void)
{}
EXPORT_SYMBOL_GPL();

int __weak arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr,
				  void *data)
{}
EXPORT_SYMBOL_GPL();

void __weak arch_apei_report_mem_error(int sev,
				       struct cper_sec_mem_err *mem_err)
{}
EXPORT_SYMBOL_GPL();

int apei_osc_setup(void)
{}
EXPORT_SYMBOL_GPL();