mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
f2645fa317
It's important for the driver to provide a R/W ioctl to ensure that two competing userspace processes don't race to provide or read each others data. This userspace character device will be used to perform SMBIOS calls from any applications. It provides an ioctl that will allow passing the WMI calling interface buffer between userspace and kernel space. This character device is intended to deprecate the dcdbas kernel module and the interface that it provides to userspace. To perform an SMBIOS IOCTL call using the character device userspace will perform a read() on the the character device. The WMI bus will provide a u64 variable containing the necessary size of the IOCTL buffer. The API for interacting with this interface is defined in documentation as well as the WMI uapi header provides the format of the structures. Not all userspace requests will be accepted. The dell-smbios filtering functionality will be used to prevent access to certain tokens and calls. All whitelisted commands and tokens are now shared out to userspace so applications don't need to define them in their own headers. Signed-off-by: Mario Limonciello <mario.limonciello@dell.com> Reviewed-by: Edward O'Callaghan <quasisec@google.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
78 lines
2.2 KiB
C
78 lines
2.2 KiB
C
/*
|
|
* Common functions for kernel modules using Dell SMBIOS
|
|
*
|
|
* Copyright (c) Red Hat <mjg@redhat.com>
|
|
* Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com>
|
|
* Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com>
|
|
*
|
|
* Based on documentation in the libsmbios package:
|
|
* Copyright (C) 2005-2014 Dell Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef _DELL_SMBIOS_H_
|
|
#define _DELL_SMBIOS_H_
|
|
|
|
#include <linux/device.h>
|
|
#include <uapi/linux/wmi.h>
|
|
|
|
/* Classes and selects used only in kernel drivers */
|
|
#define CLASS_KBD_BACKLIGHT 4
|
|
#define SELECT_KBD_BACKLIGHT 11
|
|
|
|
/* Tokens used in kernel drivers, any of these
|
|
* should be filtered from userspace access
|
|
*/
|
|
#define BRIGHTNESS_TOKEN 0x007d
|
|
#define KBD_LED_AC_TOKEN 0x0451
|
|
#define KBD_LED_OFF_TOKEN 0x01E1
|
|
#define KBD_LED_ON_TOKEN 0x01E2
|
|
#define KBD_LED_AUTO_TOKEN 0x01E3
|
|
#define KBD_LED_AUTO_25_TOKEN 0x02EA
|
|
#define KBD_LED_AUTO_50_TOKEN 0x02EB
|
|
#define KBD_LED_AUTO_75_TOKEN 0x02EC
|
|
#define KBD_LED_AUTO_100_TOKEN 0x02F6
|
|
#define GLOBAL_MIC_MUTE_ENABLE 0x0364
|
|
#define GLOBAL_MIC_MUTE_DISABLE 0x0365
|
|
|
|
struct notifier_block;
|
|
|
|
struct calling_interface_token {
|
|
u16 tokenID;
|
|
u16 location;
|
|
union {
|
|
u16 value;
|
|
u16 stringlength;
|
|
};
|
|
};
|
|
|
|
struct calling_interface_structure {
|
|
struct dmi_header header;
|
|
u16 cmdIOAddress;
|
|
u8 cmdIOCode;
|
|
u32 supportedCmds;
|
|
struct calling_interface_token tokens[];
|
|
} __packed;
|
|
|
|
int dell_smbios_register_device(struct device *d, void *call_fn);
|
|
void dell_smbios_unregister_device(struct device *d);
|
|
|
|
int dell_smbios_error(int value);
|
|
int dell_smbios_call_filter(struct device *d,
|
|
struct calling_interface_buffer *buffer);
|
|
int dell_smbios_call(struct calling_interface_buffer *buffer);
|
|
|
|
struct calling_interface_token *dell_smbios_find_token(int tokenid);
|
|
|
|
enum dell_laptop_notifier_actions {
|
|
DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED,
|
|
};
|
|
|
|
int dell_laptop_register_notifier(struct notifier_block *nb);
|
|
int dell_laptop_unregister_notifier(struct notifier_block *nb);
|
|
void dell_laptop_call_notifier(unsigned long action, void *data);
|
|
|
|
#endif
|