linux/drivers/acpi/nfit/core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
 */
#include <linux/list_sort.h>
#include <linux/libnvdimm.h>
#include <linux/module.h>
#include <linux/nospec.h>
#include <linux/mutex.h>
#include <linux/ndctl.h>
#include <linux/sysfs.h>
#include <linux/delay.h>
#include <linux/list.h>
#include <linux/acpi.h>
#include <linux/sort.h>
#include <linux/io.h>
#include <linux/nd.h>
#include <asm/cacheflush.h>
#include <acpi/nfit.h>
#include "intel.h"
#include "nfit.h"

/*
 * For readq() and writeq() on 32-bit builds, the hi-lo, lo-hi order is
 * irrelevant.
 */
#include <linux/io-64-nonatomic-hi-lo.h>

static bool force_enable_dimms;
module_param(force_enable_dimms, bool, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();

static bool disable_vendor_specific;
module_param(disable_vendor_specific, bool, S_IRUGO);
MODULE_PARM_DESC();

static unsigned long override_dsm_mask;
module_param(override_dsm_mask, ulong, S_IRUGO);
MODULE_PARM_DESC();

static int default_dsm_family =;
module_param(default_dsm_family, int, S_IRUGO);
MODULE_PARM_DESC();

static bool no_init_ars;
module_param(no_init_ars, bool, 0644);
MODULE_PARM_DESC();

static bool force_labels;
module_param(force_labels, bool, 0444);
MODULE_PARM_DESC();

LIST_HEAD();
DEFINE_MUTEX();

static struct workqueue_struct *nfit_wq;

struct nfit_table_prev {};

static guid_t nfit_uuid[NFIT_UUID_MAX];

const guid_t *to_nfit_uuid(enum nfit_uuids id)
{}
EXPORT_SYMBOL();

static const guid_t *to_nfit_bus_uuid(int family)
{}

static struct acpi_device *to_acpi_dev(struct acpi_nfit_desc *acpi_desc)
{}

static int xlat_bus_status(void *buf, unsigned int cmd, u32 status)
{}

#define ACPI_LABELS_LOCKED

static int xlat_nvdimm_status(struct nvdimm *nvdimm, void *buf, unsigned int cmd,
		u32 status)
{}

static int xlat_status(struct nvdimm *nvdimm, void *buf, unsigned int cmd,
		u32 status)
{}

/* convert _LS{I,R} packages to the buffer object acpi_nfit_ctl expects */
static union acpi_object *pkg_to_buf(union acpi_object *pkg)
{}

static union acpi_object *int_to_buf(union acpi_object *integer)
{}

static union acpi_object *acpi_label_write(acpi_handle handle, u32 offset,
		u32 len, void *data)
{}

static union acpi_object *acpi_label_read(acpi_handle handle, u32 offset,
		u32 len)
{}

static union acpi_object *acpi_label_info(acpi_handle handle)
{}

static u8 nfit_dsm_revid(unsigned family, unsigned func)
{}

static bool payload_dumpable(struct nvdimm *nvdimm, unsigned int func)
{}

static int cmd_to_func(struct nfit_mem *nfit_mem, unsigned int cmd,
		struct nd_cmd_pkg *call_pkg, int *family)
{}

int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
		unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc)
{}
EXPORT_SYMBOL_GPL();

static const char *spa_type_name(u16 type)
{}

int nfit_spa_type(struct acpi_nfit_system_address *spa)
{}

static size_t sizeof_spa(struct acpi_nfit_system_address *spa)
{}

static bool add_spa(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_system_address *spa)
{}

static bool add_memdev(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_memory_map *memdev)
{}

int nfit_get_smbios_id(u32 device_handle, u16 *flags)
{}
EXPORT_SYMBOL_GPL();

/*
 * An implementation may provide a truncated control region if no block windows
 * are defined.
 */
static size_t sizeof_dcr(struct acpi_nfit_control_region *dcr)
{}

static bool add_dcr(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_control_region *dcr)
{}

static bool add_bdw(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_data_region *bdw)
{}

static size_t sizeof_idt(struct acpi_nfit_interleave *idt)
{}

static bool add_idt(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_interleave *idt)
{}

static size_t sizeof_flush(struct acpi_nfit_flush_address *flush)
{}

static bool add_flush(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev,
		struct acpi_nfit_flush_address *flush)
{}

static bool add_platform_cap(struct acpi_nfit_desc *acpi_desc,
		struct acpi_nfit_capabilities *pcap)
{}

static void *add_table(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev, void *table, const void *end)
{}

static int __nfit_mem_init(struct acpi_nfit_desc *acpi_desc,
		struct acpi_nfit_system_address *spa)
{}

static int nfit_mem_cmp(void *priv, const struct list_head *_a,
		const struct list_head *_b)
{}

static int nfit_mem_init(struct acpi_nfit_desc *acpi_desc)
{}

static ssize_t bus_dsm_mask_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static struct device_attribute dev_attr_bus_dsm_mask =;

static ssize_t revision_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(revision);

static ssize_t hw_error_scrub_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

/*
 * The 'hw_error_scrub' attribute can have the following values written to it:
 * '0': Switch to the default mode where an exception will only insert
 *      the address of the memory error into the poison and badblocks lists.
 * '1': Enable a full scrub to happen if an exception for a memory error is
 *      received.
 */
static ssize_t hw_error_scrub_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{}
static DEVICE_ATTR_RW(hw_error_scrub);

/*
 * This shows the number of full Address Range Scrubs that have been
 * completed since driver load time. Userspace can wait on this using
 * select/poll etc. A '+' at the end indicates an ARS is in progress
 */
static ssize_t scrub_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}

static ssize_t scrub_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{}
static DEVICE_ATTR_RW(scrub);

static bool ars_supported(struct nvdimm_bus *nvdimm_bus)
{}

static umode_t nfit_visible(struct kobject *kobj, struct attribute *a, int n)
{}

static struct attribute *acpi_nfit_attributes[] =;

static const struct attribute_group acpi_nfit_attribute_group =;

static const struct attribute_group *acpi_nfit_attribute_groups[] =;

static struct acpi_nfit_memory_map *to_nfit_memdev(struct device *dev)
{}

static struct acpi_nfit_control_region *to_nfit_dcr(struct device *dev)
{}

static ssize_t handle_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(handle);

static ssize_t phys_id_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(phys_id);

static ssize_t vendor_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(vendor);

static ssize_t rev_id_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(rev_id);

static ssize_t device_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(device);

static ssize_t subsystem_vendor_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(subsystem_vendor);

static ssize_t subsystem_rev_id_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(subsystem_rev_id);

static ssize_t subsystem_device_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(subsystem_device);

static int num_nvdimm_formats(struct nvdimm *nvdimm)
{}

static ssize_t format_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(format);

static ssize_t format1_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(format1);

static ssize_t formats_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(formats);

static ssize_t serial_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(serial);

static ssize_t family_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(family);

static ssize_t dsm_mask_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(dsm_mask);

static ssize_t flags_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(flags);

static ssize_t id_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(id);

static ssize_t dirty_shutdown_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(dirty_shutdown);

static struct attribute *acpi_nfit_dimm_attributes[] =;

static umode_t acpi_nfit_dimm_attr_visible(struct kobject *kobj,
		struct attribute *a, int n)
{}

static const struct attribute_group acpi_nfit_dimm_attribute_group =;

static const struct attribute_group *acpi_nfit_dimm_attribute_groups[] =;

static struct nvdimm *acpi_nfit_dimm_by_handle(struct acpi_nfit_desc *acpi_desc,
		u32 device_handle)
{}

void __acpi_nvdimm_notify(struct device *dev, u32 event)
{}
EXPORT_SYMBOL_GPL();

static void acpi_nvdimm_notify(acpi_handle handle, u32 event, void *data)
{}

static bool acpi_nvdimm_has_method(struct acpi_device *adev, char *method)
{}

__weak void nfit_intel_shutdown_status(struct nfit_mem *nfit_mem)
{}

static void populate_shutdown_status(struct nfit_mem *nfit_mem)
{}

static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
		struct nfit_mem *nfit_mem, u32 device_handle)
{}

static void shutdown_dimm_notify(void *data)
{}

static const struct nvdimm_security_ops *acpi_nfit_get_security_ops(int family)
{}

static const struct nvdimm_fw_ops *acpi_nfit_get_fw_ops(
		struct nfit_mem *nfit_mem)
{}

static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
{}

/*
 * These constants are private because there are no kernel consumers of
 * these commands.
 */
enum nfit_aux_cmds {};

static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
{}

static ssize_t range_index_show(struct device *dev,
		struct device_attribute *attr, char *buf)
{}
static DEVICE_ATTR_RO(range_index);

static struct attribute *acpi_nfit_region_attributes[] =;

static const struct attribute_group acpi_nfit_region_attribute_group =;

static const struct attribute_group *acpi_nfit_region_attribute_groups[] =;

/* enough info to uniquely specify an interleave set */
struct nfit_set_info {};

struct nfit_set_info2 {};

static int cmp_map_compat(const void *m0, const void *m1)
{}

static int cmp_map(const void *m0, const void *m1)
{}

static int cmp_map2(const void *m0, const void *m1)
{}

/* Retrieve the nth entry referencing this spa */
static struct acpi_nfit_memory_map *memdev_from_spa(
		struct acpi_nfit_desc *acpi_desc, u16 range_index, int n)
{}

static int acpi_nfit_init_interleave_set(struct acpi_nfit_desc *acpi_desc,
		struct nd_region_desc *ndr_desc,
		struct acpi_nfit_system_address *spa)
{}

static int ars_get_cap(struct acpi_nfit_desc *acpi_desc,
		struct nd_cmd_ars_cap *cmd, struct nfit_spa *nfit_spa)
{}

static int ars_start(struct acpi_nfit_desc *acpi_desc,
		struct nfit_spa *nfit_spa, enum nfit_ars_state req_type)
{}

static int ars_continue(struct acpi_nfit_desc *acpi_desc)
{}

static int ars_get_status(struct acpi_nfit_desc *acpi_desc)
{}

static void ars_complete(struct acpi_nfit_desc *acpi_desc,
		struct nfit_spa *nfit_spa)
{}

static int ars_status_process_records(struct acpi_nfit_desc *acpi_desc)
{}

static void acpi_nfit_remove_resource(void *data)
{}

static int acpi_nfit_insert_resource(struct acpi_nfit_desc *acpi_desc,
		struct nd_region_desc *ndr_desc)
{}

static int acpi_nfit_init_mapping(struct acpi_nfit_desc *acpi_desc,
		struct nd_mapping_desc *mapping, struct nd_region_desc *ndr_desc,
		struct acpi_nfit_memory_map *memdev,
		struct nfit_spa *nfit_spa)
{}

static bool nfit_spa_is_virtual(struct acpi_nfit_system_address *spa)
{}

static bool nfit_spa_is_volatile(struct acpi_nfit_system_address *spa)
{}

static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc,
		struct nfit_spa *nfit_spa)
{}

static int ars_status_alloc(struct acpi_nfit_desc *acpi_desc)
{}

static int acpi_nfit_query_poison(struct acpi_nfit_desc *acpi_desc)
{}

static int ars_register(struct acpi_nfit_desc *acpi_desc,
		struct nfit_spa *nfit_spa)
{}

static void ars_complete_all(struct acpi_nfit_desc *acpi_desc)
{}

static unsigned int __acpi_nfit_scrub(struct acpi_nfit_desc *acpi_desc,
		int query_rc)
{}

static void __sched_ars(struct acpi_nfit_desc *acpi_desc, unsigned int tmo)
{}

static void sched_ars(struct acpi_nfit_desc *acpi_desc)
{}

static void notify_ars_done(struct acpi_nfit_desc *acpi_desc)
{}

static void acpi_nfit_scrub(struct work_struct *work)
{}

static void acpi_nfit_init_ars(struct acpi_nfit_desc *acpi_desc,
		struct nfit_spa *nfit_spa)
{}

static int acpi_nfit_register_regions(struct acpi_nfit_desc *acpi_desc)
{}

static int acpi_nfit_check_deletions(struct acpi_nfit_desc *acpi_desc,
		struct nfit_table_prev *prev)
{}

static int acpi_nfit_desc_init_scrub_attr(struct acpi_nfit_desc *acpi_desc)
{}

static void acpi_nfit_unregister(void *data)
{}

int acpi_nfit_init(struct acpi_nfit_desc *acpi_desc, void *data, acpi_size sz)
{}
EXPORT_SYMBOL_GPL();

static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc)
{}

static int __acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
		struct nvdimm *nvdimm, unsigned int cmd)
{}

/*
 * Prevent security and firmware activate commands from being issued via
 * ioctl.
 */
static int acpi_nfit_clear_to_send(struct nvdimm_bus_descriptor *nd_desc,
		struct nvdimm *nvdimm, unsigned int cmd, void *buf)
{}

int acpi_nfit_ars_rescan(struct acpi_nfit_desc *acpi_desc,
		enum nfit_ars_state req_type)
{}

void acpi_nfit_desc_init(struct acpi_nfit_desc *acpi_desc, struct device *dev)
{}
EXPORT_SYMBOL_GPL();

static void acpi_nfit_put_table(void *table)
{}

static void acpi_nfit_notify(acpi_handle handle, u32 event, void *data)
{}

static void acpi_nfit_remove_notify_handler(void *data)
{}

void acpi_nfit_shutdown(void *data)
{}
EXPORT_SYMBOL_GPL();

static int acpi_nfit_add(struct acpi_device *adev)
{}

static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)
{}

static void acpi_nfit_uc_error_notify(struct device *dev, acpi_handle handle)
{}

void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event)
{}
EXPORT_SYMBOL_GPL();

static const struct acpi_device_id acpi_nfit_ids[] =;
MODULE_DEVICE_TABLE(acpi, acpi_nfit_ids);

static struct acpi_driver acpi_nfit_driver =;

static __init int nfit_init(void)
{}

static __exit void nfit_exit(void)
{}

module_init();
module_exit(nfit_exit);
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_AUTHOR();