xref: /openbmc/linux/drivers/platform/x86/think-lmi.h (revision 2326f3cd)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef _THINK_LMI_H_
4 #define _THINK_LMI_H_
5 
6 #include <linux/types.h>
7 
8 #define TLMI_SETTINGS_COUNT  256
9 #define TLMI_SETTINGS_MAXLEN 512
10 #define TLMI_PWD_BUFSIZE     129
11 #define TLMI_LANG_MAXLEN       4
12 
13 /* Possible error values */
14 struct tlmi_err_codes {
15 	const char *err_str;
16 	int err_code;
17 };
18 
19 enum encoding_option {
20 	TLMI_ENCODING_ASCII,
21 	TLMI_ENCODING_SCANCODE,
22 };
23 
24 /* password configuration details */
25 struct tlmi_pwdcfg {
26 	uint32_t password_mode;
27 	uint32_t password_state;
28 	uint32_t min_length;
29 	uint32_t max_length;
30 	uint32_t supported_encodings;
31 	uint32_t supported_keyboard;
32 };
33 
34 /* password setting details */
35 struct tlmi_pwd_setting {
36 	struct kobject kobj;
37 	bool valid;
38 	char password[TLMI_PWD_BUFSIZE];
39 	const char *pwd_type;
40 	const char *role;
41 	int minlen;
42 	int maxlen;
43 	enum encoding_option encoding;
44 	char kbdlang[TLMI_LANG_MAXLEN];
45 };
46 
47 /* Attribute setting details */
48 struct tlmi_attr_setting {
49 	struct kobject kobj;
50 	int index;
51 	char display_name[TLMI_SETTINGS_MAXLEN];
52 	char *possible_values;
53 };
54 
55 struct think_lmi {
56 	struct wmi_device *wmi_device;
57 
58 	int settings_count;
59 	bool can_set_bios_settings;
60 	bool can_get_bios_selections;
61 	bool can_set_bios_password;
62 	bool can_get_password_settings;
63 	bool pending_changes;
64 	bool can_debug_cmd;
65 
66 	struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT];
67 	struct device *class_dev;
68 	struct kset *attribute_kset;
69 	struct kset *authentication_kset;
70 	struct tlmi_pwd_setting *pwd_admin;
71 	struct tlmi_pwd_setting *pwd_power;
72 };
73 
74 #endif /* !_THINK_LMI_H_ */
75