linux/drivers/platform/x86/wmi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  ACPI-WMI mapping driver
 *
 *  Copyright (C) 2007-2008 Carlos Corbacho <[email protected]>
 *
 *  GUID parsing code from ldm.c is:
 *   Copyright (C) 2001,2002 Richard Russon <[email protected]>
 *   Copyright (c) 2001-2007 Anton Altaparmakov
 *   Copyright (C) 2001,2002 Jakob Kemi <[email protected]>
 *
 *  WMI bus infrastructure by Andrew Lutomirski and Darren Hart:
 *    Copyright (C) 2015 Andrew Lutomirski
 *    Copyright (C) 2017 VMware, Inc. All Rights Reserved.
 */

#define pr_fmt(fmt)

#include <linux/acpi.h>
#include <linux/bits.h>
#include <linux/build_bug.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/rwsem.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include <linux/uuid.h>
#include <linux/wmi.h>
#include <linux/fs.h>

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

static LIST_HEAD(wmi_block_list);

struct guid_block {} __packed;
static_assert();
static_assert();
static_assert();

enum {};

struct wmi_block {};


/*
 * If the GUID data block is marked as expensive, we must enable and
 * explicitily disable data collection.
 */
#define ACPI_WMI_EXPENSIVE
#define ACPI_WMI_METHOD
#define ACPI_WMI_STRING
#define ACPI_WMI_EVENT

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

#define dev_to_wblock(__dev)
#define dev_to_wdev(__dev)

/*
 * GUID parsing functions
 */

static bool guid_parse_and_compare(const char *string, const guid_t *guid)
{}

static const void *find_guid_context(struct wmi_block *wblock,
				     struct wmi_driver *wdriver)
{}

static acpi_status wmi_method_enable(struct wmi_block *wblock, bool enable)
{}

#define WMI_ACPI_METHOD_NAME_SIZE

static inline void get_acpi_method_name(const struct wmi_block *wblock,
					const char method,
					char buffer[static WMI_ACPI_METHOD_NAME_SIZE])
{}

static inline acpi_object_type get_param_acpi_type(const struct wmi_block *wblock)
{}

static int wmidev_match_guid(struct device *dev, const void *data)
{}

static const struct bus_type wmi_bus_type;

static struct wmi_device *wmi_find_device_by_guid(const char *guid_string)
{}

static void wmi_device_put(struct wmi_device *wdev)
{}

/*
 * Exported WMI functions
 */

/**
 * wmi_instance_count - Get number of WMI object instances
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 *
 * Get the number of WMI object instances.
 *
 * Returns: Number of WMI object instances or negative error code.
 */
int wmi_instance_count(const char *guid_string)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmidev_instance_count - Get number of WMI object instances
 * @wdev: A wmi bus device from a driver
 *
 * Get the number of WMI object instances.
 *
 * Returns: Number of WMI object instances.
 */
u8 wmidev_instance_count(struct wmi_device *wdev)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_evaluate_method - Evaluate a WMI method (deprecated)
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 * @instance: Instance index
 * @method_id: Method ID to call
 * @in: Mandatory buffer containing input for the method call
 * @out: Empty buffer to return the method results
 *
 * Call an ACPI-WMI method, the caller must free @out.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, u32 method_id,
				const struct acpi_buffer *in, struct acpi_buffer *out)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmidev_evaluate_method - Evaluate a WMI method
 * @wdev: A wmi bus device from a driver
 * @instance: Instance index
 * @method_id: Method ID to call
 * @in: Mandatory buffer containing input for the method call
 * @out: Empty buffer to return the method results
 *
 * Call an ACPI-WMI method, the caller must free @out.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance, u32 method_id,
				   const struct acpi_buffer *in, struct acpi_buffer *out)
{}
EXPORT_SYMBOL_GPL();

static acpi_status __query_block(struct wmi_block *wblock, u8 instance,
				 struct acpi_buffer *out)
{}

/**
 * wmi_query_block - Return contents of a WMI block (deprecated)
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 * @instance: Instance index
 * @out: Empty buffer to return the contents of the data block to
 *
 * Query a ACPI-WMI block, the caller must free @out.
 *
 * Return: ACPI object containing the content of the WMI block.
 */
acpi_status wmi_query_block(const char *guid_string, u8 instance,
			    struct acpi_buffer *out)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmidev_block_query - Return contents of a WMI block
 * @wdev: A wmi bus device from a driver
 * @instance: Instance index
 *
 * Query an ACPI-WMI block, the caller must free the result.
 *
 * Return: ACPI object containing the content of the WMI block.
 */
union acpi_object *wmidev_block_query(struct wmi_device *wdev, u8 instance)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_set_block - Write to a WMI block (deprecated)
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 * @instance: Instance index
 * @in: Buffer containing new values for the data block
 *
 * Write the contents of the input buffer to an ACPI-WMI data block.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmi_set_block(const char *guid_string, u8 instance, const struct acpi_buffer *in)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmidev_block_set - Write to a WMI block
 * @wdev: A wmi bus device from a driver
 * @instance: Instance index
 * @in: Buffer containing new values for the data block
 *
 * Write contents of the input buffer to an ACPI-WMI data block.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmidev_block_set(struct wmi_device *wdev, u8 instance, const struct acpi_buffer *in)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_install_notify_handler - Register handler for WMI events (deprecated)
 * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 * @handler: Function to handle notifications
 * @data: Data to be returned to handler when event is fired
 *
 * Register a handler for events sent to the ACPI-WMI mapper device.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmi_install_notify_handler(const char *guid,
				       wmi_notify_handler handler,
				       void *data)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_remove_notify_handler - Unregister handler for WMI events (deprecated)
 * @guid: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 *
 * Unregister handler for events sent to the ACPI-WMI mapper device.
 *
 * Return: acpi_status signaling success or error.
 */
acpi_status wmi_remove_notify_handler(const char *guid)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_has_guid - Check if a GUID is available
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 *
 * Check if a given GUID is defined by _WDG.
 *
 * Return: True if GUID is available, false otherwise.
 */
bool wmi_has_guid(const char *guid_string)
{}
EXPORT_SYMBOL_GPL();

/**
 * wmi_get_acpi_device_uid() - Get _UID name of ACPI device that defines GUID (deprecated)
 * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
 *
 * Find the _UID of ACPI device associated with this WMI GUID.
 *
 * Return: The ACPI _UID field value or NULL if the WMI GUID was not found.
 */
char *wmi_get_acpi_device_uid(const char *guid_string)
{}
EXPORT_SYMBOL_GPL();

#define drv_to_wdrv(__drv)

/*
 * sysfs interface
 */
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
			     char *buf)
{}
static DEVICE_ATTR_RO(modalias);

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

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

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

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

static ssize_t driver_override_store(struct device *dev, struct device_attribute *attr,
				     const char *buf, size_t count)
{}
static DEVICE_ATTR_RW(driver_override);

static struct attribute *wmi_attrs[] =;
ATTRIBUTE_GROUPS();

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

static struct attribute *wmi_event_attrs[] =;
ATTRIBUTE_GROUPS();

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

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

static struct attribute *wmi_data_attrs[] =;
ATTRIBUTE_GROUPS();

static struct attribute *wmi_method_attrs[] =;
ATTRIBUTE_GROUPS();

static int wmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static void wmi_dev_release(struct device *dev)
{}

static int wmi_dev_match(struct device *dev, const struct device_driver *driver)
{}

static int wmi_dev_probe(struct device *dev)
{}

static void wmi_dev_remove(struct device *dev)
{}

static struct class wmi_bus_class =;

static const struct bus_type wmi_bus_type =;

static const struct device_type wmi_type_event =;

static const struct device_type wmi_type_method =;

static const struct device_type wmi_type_data =;

/*
 * _WDG is a static list that is only parsed at startup,
 * so it's safe to count entries without extra protection.
 */
static int guid_count(const guid_t *guid)
{}

static int wmi_create_device(struct device *wmi_bus_dev,
			     struct wmi_block *wblock,
			     struct acpi_device *device)
{}

static int wmi_add_device(struct platform_device *pdev, struct wmi_device *wdev)
{}

/*
 * Parse the _WDG method for the GUID data blocks
 */
static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
{}

static int wmi_get_notify_data(struct wmi_block *wblock, union acpi_object **obj)
{}

static void wmi_notify_driver(struct wmi_block *wblock, union acpi_object *obj)
{}

static int wmi_notify_device(struct device *dev, void *data)
{}

static void acpi_wmi_notify_handler(acpi_handle handle, u32 event, void *context)
{}

static int wmi_remove_device(struct device *dev, void *data)
{}

static void acpi_wmi_remove(struct platform_device *device)
{}

static void acpi_wmi_remove_notify_handler(void *data)
{}

static void acpi_wmi_remove_bus_device(void *data)
{}

static int acpi_wmi_probe(struct platform_device *device)
{}

int __must_check __wmi_driver_register(struct wmi_driver *driver,
				       struct module *owner)
{}
EXPORT_SYMBOL();

/**
 * wmi_driver_unregister() - Unregister a WMI driver
 * @driver: WMI driver to unregister
 *
 * Unregisters a WMI driver from the WMI bus.
 */
void wmi_driver_unregister(struct wmi_driver *driver)
{}
EXPORT_SYMBOL();

static struct platform_driver acpi_wmi_driver =;

static int __init acpi_wmi_init(void)
{}

static void __exit acpi_wmi_exit(void)
{}

subsys_initcall_sync(acpi_wmi_init);
module_exit(acpi_wmi_exit);