2021-05-30 18:31:11 -04:00
/* 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
2021-11-17 13:44:53 -05:00
# define TLMI_INDEX_MAX 32
2021-05-30 18:31:11 -04:00
/* Possible error values */
struct tlmi_err_codes {
const char * err_str ;
int err_code ;
} ;
enum encoding_option {
TLMI_ENCODING_ASCII ,
TLMI_ENCODING_SCANCODE ,
} ;
2021-11-17 13:44:53 -05:00
enum level_option {
TLMI_LEVEL_USER ,
TLMI_LEVEL_MASTER ,
} ;
2021-05-30 18:31:11 -04:00
/* password configuration details */
2021-11-17 13:44:53 -05:00
struct tlmi_pwdcfg_core {
2021-05-30 18:31:11 -04:00
uint32_t password_mode ;
uint32_t password_state ;
uint32_t min_length ;
uint32_t max_length ;
uint32_t supported_encodings ;
uint32_t supported_keyboard ;
} ;
2021-11-17 13:44:53 -05:00
struct tlmi_pwdcfg_ext {
uint32_t hdd_user_password ;
uint32_t hdd_master_password ;
uint32_t nvme_user_password ;
uint32_t nvme_master_password ;
} ;
struct tlmi_pwdcfg {
struct tlmi_pwdcfg_core core ;
struct tlmi_pwdcfg_ext ext ;
} ;
2021-05-30 18:31:11 -04:00
/* 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 ] ;
2021-11-17 13:44:53 -05:00
int index ; /*Used for HDD and NVME auth */
enum level_option level ;
2022-03-17 17:40:08 -04:00
bool cert_installed ;
char * signature ;
char * save_signature ;
2021-05-30 18:31:11 -04:00
} ;
/* 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 ;
bool can_set_bios_settings ;
bool can_get_bios_selections ;
bool can_set_bios_password ;
bool can_get_password_settings ;
2021-06-28 18:28:46 -04:00
bool pending_changes ;
2021-08-16 20:15:01 -04:00
bool can_debug_cmd ;
2021-11-17 13:44:53 -05:00
bool opcode_support ;
2022-03-17 17:40:08 -04:00
bool certificate_support ;
2021-05-30 18:31:11 -04:00
struct tlmi_attr_setting * setting [ TLMI_SETTINGS_COUNT ] ;
struct device * class_dev ;
struct kset * attribute_kset ;
struct kset * authentication_kset ;
2021-11-17 13:44:53 -05:00
struct tlmi_pwdcfg pwdcfg ;
2021-05-30 18:31:11 -04:00
struct tlmi_pwd_setting * pwd_admin ;
struct tlmi_pwd_setting * pwd_power ;
2021-11-17 13:44:53 -05:00
struct tlmi_pwd_setting * pwd_system ;
struct tlmi_pwd_setting * pwd_hdd ;
struct tlmi_pwd_setting * pwd_nvme ;
2021-05-30 18:31:11 -04:00
} ;
# endif /* !_THINK_LMI_H_ */