Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 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 |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 11 | #define TLMI_LANG_MAXLEN 4 |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 12 | #define TLMI_INDEX_MAX 32 |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 13 | |
| 14 | /* Possible error values */ |
| 15 | struct tlmi_err_codes { |
| 16 | const char *err_str; |
| 17 | int err_code; |
| 18 | }; |
| 19 | |
| 20 | enum encoding_option { |
| 21 | TLMI_ENCODING_ASCII, |
| 22 | TLMI_ENCODING_SCANCODE, |
| 23 | }; |
| 24 | |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 25 | enum level_option { |
| 26 | TLMI_LEVEL_USER, |
| 27 | TLMI_LEVEL_MASTER, |
| 28 | }; |
| 29 | |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 30 | /* password configuration details */ |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 31 | struct tlmi_pwdcfg_core { |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 32 | uint32_t password_mode; |
| 33 | uint32_t password_state; |
| 34 | uint32_t min_length; |
| 35 | uint32_t max_length; |
| 36 | uint32_t supported_encodings; |
| 37 | uint32_t supported_keyboard; |
| 38 | }; |
| 39 | |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 40 | struct tlmi_pwdcfg_ext { |
| 41 | uint32_t hdd_user_password; |
| 42 | uint32_t hdd_master_password; |
| 43 | uint32_t nvme_user_password; |
| 44 | uint32_t nvme_master_password; |
| 45 | }; |
| 46 | |
| 47 | struct tlmi_pwdcfg { |
| 48 | struct tlmi_pwdcfg_core core; |
| 49 | struct tlmi_pwdcfg_ext ext; |
| 50 | }; |
| 51 | |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 52 | /* password setting details */ |
| 53 | struct tlmi_pwd_setting { |
| 54 | struct kobject kobj; |
| 55 | bool valid; |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 56 | char password[TLMI_PWD_BUFSIZE]; |
| 57 | const char *pwd_type; |
| 58 | const char *role; |
| 59 | int minlen; |
| 60 | int maxlen; |
| 61 | enum encoding_option encoding; |
| 62 | char kbdlang[TLMI_LANG_MAXLEN]; |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 63 | int index; /*Used for HDD and NVME auth */ |
| 64 | enum level_option level; |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | /* Attribute setting details */ |
| 68 | struct tlmi_attr_setting { |
| 69 | struct kobject kobj; |
| 70 | int index; |
| 71 | char display_name[TLMI_SETTINGS_MAXLEN]; |
| 72 | char *possible_values; |
| 73 | }; |
| 74 | |
| 75 | struct think_lmi { |
| 76 | struct wmi_device *wmi_device; |
| 77 | |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 78 | bool can_set_bios_settings; |
| 79 | bool can_get_bios_selections; |
| 80 | bool can_set_bios_password; |
| 81 | bool can_get_password_settings; |
Mark Pearson | 95d4292 | 2021-06-28 18:28:46 -0400 | [diff] [blame] | 82 | bool pending_changes; |
Mark Pearson | f5bc015 | 2021-08-16 20:15:01 -0400 | [diff] [blame] | 83 | bool can_debug_cmd; |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 84 | bool opcode_support; |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 85 | |
| 86 | struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT]; |
| 87 | struct device *class_dev; |
| 88 | struct kset *attribute_kset; |
| 89 | struct kset *authentication_kset; |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 90 | |
| 91 | struct tlmi_pwdcfg pwdcfg; |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 92 | struct tlmi_pwd_setting *pwd_admin; |
| 93 | struct tlmi_pwd_setting *pwd_power; |
Mark Pearson | 640a5fa | 2021-11-17 13:44:53 -0500 | [diff] [blame] | 94 | struct tlmi_pwd_setting *pwd_system; |
| 95 | struct tlmi_pwd_setting *pwd_hdd; |
| 96 | struct tlmi_pwd_setting *pwd_nvme; |
Mark Pearson | a40cd7e | 2021-05-30 18:31:11 -0400 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | #endif /* !_THINK_LMI_H_ */ |