linux/drivers/acpi/apei/einj-core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * APEI Error INJection support
 *
 * EINJ provides a hardware error injection mechanism, this is useful
 * for debugging and testing of other APEI and RAS features.
 *
 * For more information about EINJ, please refer to ACPI Specification
 * version 4.0, section 17.5.
 *
 * Copyright 2009-2010 Intel Corp.
 *   Author: Huang Ying <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/nmi.h>
#include <linux/delay.h>
#include <linux/mm.h>
#include <linux/platform_device.h>
#include <linux/unaligned.h>

#include "apei-internal.h"

#undef pr_fmt
#define pr_fmt(fmt)

#define SLEEP_UNIT_MIN
#define SLEEP_UNIT_MAX
/* Firmware should respond within 1 seconds */
#define FIRMWARE_TIMEOUT
#define ACPI5_VENDOR_BIT
#define MEM_ERROR_MASK
#define CXL_ERROR_MASK

/*
 * ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action.
 */
static int acpi5;

struct set_error_type_with_address {};
enum {};

/*
 * Vendor extensions for platform specific operations
 */
struct vendor_error_type_extension {};

static u32 notrigger;

static u32 vendor_flags;
static struct debugfs_blob_wrapper vendor_blob;
static struct debugfs_blob_wrapper vendor_errors;
static char vendor_dev[64];

/*
 * Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the
 * EINJ table through an unpublished extension. Use with caution as
 * most will ignore the parameter and make their own choice of address
 * for error injection.  This extension is used only if
 * param_extension module parameter is specified.
 */
struct einj_parameter {};

#define EINJ_OP_BUSY
#define EINJ_STATUS_SUCCESS
#define EINJ_STATUS_FAIL
#define EINJ_STATUS_INVAL

#define EINJ_TAB_ENTRY(tab)

static bool param_extension;
module_param(param_extension, bool, 0);

static struct acpi_table_einj *einj_tab;

static struct apei_resources einj_resources;

static struct apei_exec_ins_type einj_ins_type[] =;

/*
 * Prevent EINJ interpreter to run simultaneously, because the
 * corresponding firmware implementation may not work properly when
 * invoked simultaneously.
 */
static DEFINE_MUTEX(einj_mutex);

/*
 * Exported APIs use this flag to exit early if einj_probe() failed.
 */
bool einj_initialized __ro_after_init;

static void *einj_param;

static void einj_exec_ctx_init(struct apei_exec_context *ctx)
{}

static int __einj_get_available_error_type(u32 *type)
{}

/* Get error injection capabilities of the platform */
int einj_get_available_error_type(u32 *type)
{}

static int einj_timedout(u64 *t)
{}

static void get_oem_vendor_struct(u64 paddr, int offset,
				  struct vendor_error_type_extension *v)
{}

static void check_vendor_extension(u64 paddr,
				   struct set_error_type_with_address *v5param)
{}

static void *einj_get_parameter_address(void)
{}

/* do sanity check to trigger table */
static int einj_check_trigger_header(struct acpi_einj_trigger *trigger_tab)
{}

static struct acpi_generic_address *einj_get_trigger_parameter_region(
	struct acpi_einj_trigger *trigger_tab, u64 param1, u64 param2)
{}
/* Execute instructions in trigger error action table */
static int __einj_error_trigger(u64 trigger_paddr, u32 type,
				u64 param1, u64 param2)
{}

static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
			       u64 param3, u64 param4)
{}

/* Inject the specified hardware error */
int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3,
		      u64 param4)
{}

int einj_cxl_rch_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
			      u64 param3, u64 param4)
{}

static u32 error_type;
static u32 error_flags;
static u64 error_param1;
static u64 error_param2;
static u64 error_param3;
static u64 error_param4;
static struct dentry *einj_debug_dir;
static struct {} const einj_error_type_string[] =;

static int available_error_type_show(struct seq_file *m, void *v)
{}

DEFINE_SHOW_ATTRIBUTE();

static int error_type_get(void *data, u64 *val)
{}

bool einj_is_cxl_error_type(u64 type)
{}

int einj_validate_error_type(u64 type)
{}

static int error_type_set(void *data, u64 val)
{}

DEFINE_DEBUGFS_ATTRIBUTE();

static int error_inject_set(void *data, u64 val)
{}

DEFINE_DEBUGFS_ATTRIBUTE();

static int einj_check_table(struct acpi_table_einj *einj_tab)
{}

static int __init einj_probe(struct platform_device *pdev)
{}

static void __exit einj_remove(struct platform_device *pdev)
{}

static struct platform_device *einj_dev;
/*
 * einj_remove() lives in .exit.text. For drivers registered via
 * platform_driver_probe() this is ok because they cannot get unbound at
 * runtime. So mark the driver struct with __refdata to prevent modpost
 * triggering a section mismatch warning.
 */
static struct platform_driver einj_driver __refdata =;

static int __init einj_init(void)
{}

static void __exit einj_exit(void)
{}

module_init();
module_exit(einj_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();