linux/drivers/acpi/apei/hest.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * APEI Hardware Error Source Table support
 *
 * HEST describes error sources in detail; communicates operational
 * parameters (i.e. severity levels, masking bits, and threshold
 * values) to Linux as necessary. It also allows the BIOS to report
 * non-standard error sources to Linux (for example, chipset-specific
 * error registers).
 *
 * For more information about HEST, please refer to ACPI Specification
 * version 4.0, section 17.3.2.
 *
 * Copyright 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/kdebug.h>
#include <linux/highmem.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <acpi/apei.h>
#include <acpi/ghes.h>

#include "apei-internal.h"

#define HEST_PFX

int hest_disable;
EXPORT_SYMBOL_GPL();

/* HEST table parsing */

static struct acpi_table_hest *__read_mostly hest_tab;

/*
 * Since GHES_ASSIST is not supported, skip initialization of GHES_ASSIST
 * structures for MCA.
 * During HEST parsing, detected MCA error sources are cached from early
 * table entries so that the Flags and Source Id fields from these cached
 * values are then referred to in later table entries to determine if the
 * encountered GHES_ASSIST structure should be initialized.
 */
static struct {} mces;

static const int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] =;

static inline bool is_generic_error(struct acpi_hest_header *hest_hdr)
{}

static int hest_esrc_len(struct acpi_hest_header *hest_hdr)
{
	u16 hest_type = hest_hdr->type;
	int len;

	if (hest_type >= ACPI_HEST_TYPE_RESERVED)
		return 0;

	len = hest_esrc_len_tab[hest_type];

	if (hest_type == ACPI_HEST_TYPE_IA32_CORRECTED_CHECK) {
		struct acpi_hest_ia_corrected *cmc;
		cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
		len = sizeof(*cmc) + cmc->num_hardware_banks *
			sizeof(struct acpi_hest_ia_error_bank);
		mces.cmc = cmc;
	} else if (hest_type == ACPI_HEST_TYPE_IA32_CHECK) {
		struct acpi_hest_ia_machine_check *mc;
		mc = (struct acpi_hest_ia_machine_check *)hest_hdr;
		len = sizeof(*mc) + mc->num_hardware_banks *
			sizeof(struct acpi_hest_ia_error_bank);
		mces.mc = mc;
	} else if (hest_type == ACPI_HEST_TYPE_IA32_DEFERRED_CHECK) {
		struct acpi_hest_ia_deferred_check *mc;
		mc = (struct acpi_hest_ia_deferred_check *)hest_hdr;
		len = sizeof(*mc) + mc->num_hardware_banks *
			sizeof(struct acpi_hest_ia_error_bank);
		mces.dmc = mc;
	}
	BUG_ON(len == -1);

	return len;
};

/*
 * GHES and GHESv2 structures share the same format, starting from
 * Source Id and ending in Error Status Block Length (inclusive).
 */
static bool is_ghes_assist_struct(struct acpi_hest_header *hest_hdr)
{}

apei_hest_func_t;

static int apei_hest_parse(apei_hest_func_t func, void *data)
{}

/*
 * Check if firmware advertises firmware first mode. We need FF bit to be set
 * along with a set of MC banks which work in FF mode.
 */
static int __init hest_parse_cmc(struct acpi_hest_header *hest_hdr, void *data)
{}

struct ghes_arr {};

static int __init hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
{}

static int __init hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
{}

static int __init hest_ghes_dev_register(unsigned int ghes_count)
{}

static int __init setup_hest_disable(char *str)
{}

__setup();

void __init acpi_hest_init(void)
{}