think-lmi.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. #ifndef _THINK_LMI_H_
  3. #define _THINK_LMI_H_
  4. #include <linux/types.h>
  5. #define TLMI_SETTINGS_COUNT 256
  6. #define TLMI_SETTINGS_MAXLEN 512
  7. #define TLMI_PWD_BUFSIZE 129
  8. #define TLMI_LANG_MAXLEN 4
  9. #define TLMI_INDEX_MAX 32
  10. /* Possible error values */
  11. struct tlmi_err_codes {
  12. const char *err_str;
  13. int err_code;
  14. };
  15. enum encoding_option {
  16. TLMI_ENCODING_ASCII,
  17. TLMI_ENCODING_SCANCODE,
  18. };
  19. enum level_option {
  20. TLMI_LEVEL_USER,
  21. TLMI_LEVEL_MASTER,
  22. };
  23. /* password configuration details */
  24. struct tlmi_pwdcfg_core {
  25. uint32_t password_mode;
  26. uint32_t password_state;
  27. uint32_t min_length;
  28. uint32_t max_length;
  29. uint32_t supported_encodings;
  30. uint32_t supported_keyboard;
  31. };
  32. struct tlmi_pwdcfg_ext {
  33. uint32_t hdd_user_password;
  34. uint32_t hdd_master_password;
  35. uint32_t nvme_user_password;
  36. uint32_t nvme_master_password;
  37. };
  38. struct tlmi_pwdcfg {
  39. struct tlmi_pwdcfg_core core;
  40. struct tlmi_pwdcfg_ext ext;
  41. };
  42. /* password setting details */
  43. struct tlmi_pwd_setting {
  44. struct kobject kobj;
  45. bool valid;
  46. char password[TLMI_PWD_BUFSIZE];
  47. const char *pwd_type;
  48. const char *role;
  49. int minlen;
  50. int maxlen;
  51. enum encoding_option encoding;
  52. char kbdlang[TLMI_LANG_MAXLEN];
  53. int index; /*Used for HDD and NVME auth */
  54. enum level_option level;
  55. bool cert_installed;
  56. char *signature;
  57. char *save_signature;
  58. };
  59. /* Attribute setting details */
  60. struct tlmi_attr_setting {
  61. struct kobject kobj;
  62. int index;
  63. char display_name[TLMI_SETTINGS_MAXLEN];
  64. char *possible_values;
  65. };
  66. struct think_lmi {
  67. struct wmi_device *wmi_device;
  68. bool can_set_bios_settings;
  69. bool can_get_bios_selections;
  70. bool can_set_bios_password;
  71. bool can_get_password_settings;
  72. bool pending_changes;
  73. bool can_debug_cmd;
  74. bool opcode_support;
  75. bool certificate_support;
  76. struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT];
  77. struct device *class_dev;
  78. struct kset *attribute_kset;
  79. struct kset *authentication_kset;
  80. struct tlmi_pwdcfg pwdcfg;
  81. struct tlmi_pwd_setting *pwd_admin;
  82. struct tlmi_pwd_setting *pwd_power;
  83. struct tlmi_pwd_setting *pwd_system;
  84. struct tlmi_pwd_setting *pwd_hdd;
  85. struct tlmi_pwd_setting *pwd_nvme;
  86. };
  87. #endif /* !_THINK_LMI_H_ */