summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/think-lmi.h
blob: f8e26823075fde7bc399ff80557d4d4c8513442a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* SPDX-License-Identifier: GPL-2.0-or-later */

#ifndef _THINK_LMI_H_
#define _THINK_LMI_H_

#include <linux/types.h>

#define TLMI_SETTINGS_COUNT  256
#define TLMI_SETTINGS_MAXLEN 512
#define TLMI_PWD_BUFSIZE     129
#define TLMI_LANG_MAXLEN       4

/* Possible error values */
struct tlmi_err_codes {
	const char *err_str;
	int err_code;
};

enum encoding_option {
	TLMI_ENCODING_ASCII,
	TLMI_ENCODING_SCANCODE,
};

/* password configuration details */
struct tlmi_pwdcfg {
	uint32_t password_mode;
	uint32_t password_state;
	uint32_t min_length;
	uint32_t max_length;
	uint32_t supported_encodings;
	uint32_t supported_keyboard;
};

/* password setting details */
struct tlmi_pwd_setting {
	struct kobject kobj;
	bool valid;
	char password[TLMI_PWD_BUFSIZE];
	const char *pwd_type;
	const char *role;
	int minlen;
	int maxlen;
	enum encoding_option encoding;
	char kbdlang[TLMI_LANG_MAXLEN];
};

/* Attribute setting details */
struct tlmi_attr_setting {
	struct kobject kobj;
	int index;
	char display_name[TLMI_SETTINGS_MAXLEN];
	char *possible_values;
};

struct think_lmi {
	struct wmi_device *wmi_device;

	int settings_count;
	bool can_set_bios_settings;
	bool can_get_bios_selections;
	bool can_set_bios_password;
	bool can_get_password_settings;
	bool pending_changes;
	bool can_debug_cmd;

	struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT];
	struct device *class_dev;
	struct kset *attribute_kset;
	struct kset *authentication_kset;
	struct tlmi_pwd_setting *pwd_admin;
	struct tlmi_pwd_setting *pwd_power;
};

#endif /* !_THINK_LMI_H_ */