0001
0002
0003 #ifndef _THINK_LMI_H_
0004 #define _THINK_LMI_H_
0005
0006 #include <linux/types.h>
0007
0008 #define TLMI_SETTINGS_COUNT 256
0009 #define TLMI_SETTINGS_MAXLEN 512
0010 #define TLMI_PWD_BUFSIZE 129
0011 #define TLMI_LANG_MAXLEN 4
0012 #define TLMI_INDEX_MAX 32
0013
0014
0015 struct tlmi_err_codes {
0016 const char *err_str;
0017 int err_code;
0018 };
0019
0020 enum encoding_option {
0021 TLMI_ENCODING_ASCII,
0022 TLMI_ENCODING_SCANCODE,
0023 };
0024
0025 enum level_option {
0026 TLMI_LEVEL_USER,
0027 TLMI_LEVEL_MASTER,
0028 };
0029
0030
0031 struct tlmi_pwdcfg_core {
0032 uint32_t password_mode;
0033 uint32_t password_state;
0034 uint32_t min_length;
0035 uint32_t max_length;
0036 uint32_t supported_encodings;
0037 uint32_t supported_keyboard;
0038 };
0039
0040 struct tlmi_pwdcfg_ext {
0041 uint32_t hdd_user_password;
0042 uint32_t hdd_master_password;
0043 uint32_t nvme_user_password;
0044 uint32_t nvme_master_password;
0045 };
0046
0047 struct tlmi_pwdcfg {
0048 struct tlmi_pwdcfg_core core;
0049 struct tlmi_pwdcfg_ext ext;
0050 };
0051
0052
0053 struct tlmi_pwd_setting {
0054 struct kobject kobj;
0055 bool valid;
0056 char password[TLMI_PWD_BUFSIZE];
0057 const char *pwd_type;
0058 const char *role;
0059 int minlen;
0060 int maxlen;
0061 enum encoding_option encoding;
0062 char kbdlang[TLMI_LANG_MAXLEN];
0063 int index;
0064 enum level_option level;
0065 bool cert_installed;
0066 char *signature;
0067 char *save_signature;
0068 };
0069
0070
0071 struct tlmi_attr_setting {
0072 struct kobject kobj;
0073 int index;
0074 char display_name[TLMI_SETTINGS_MAXLEN];
0075 char *possible_values;
0076 };
0077
0078 struct think_lmi {
0079 struct wmi_device *wmi_device;
0080
0081 bool can_set_bios_settings;
0082 bool can_get_bios_selections;
0083 bool can_set_bios_password;
0084 bool can_get_password_settings;
0085 bool pending_changes;
0086 bool can_debug_cmd;
0087 bool opcode_support;
0088 bool certificate_support;
0089
0090 struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT];
0091 struct device *class_dev;
0092 struct kset *attribute_kset;
0093 struct kset *authentication_kset;
0094
0095 struct tlmi_pwdcfg pwdcfg;
0096 struct tlmi_pwd_setting *pwd_admin;
0097 struct tlmi_pwd_setting *pwd_power;
0098 struct tlmi_pwd_setting *pwd_system;
0099 struct tlmi_pwd_setting *pwd_hdd;
0100 struct tlmi_pwd_setting *pwd_nvme;
0101 };
0102
0103 #endif