Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: think-lmi: Certificate support for ThinkCenter

ThinkCenter platforms use a different set of GUIDs along with some
differences in implementation details for their support of
certificate based authentication.

Update the think-lmi driver to work correctly on these platforms.

Tested on M75q Gen 5.

Signed-off-by: Kean Ren <kean0048@gmail.com>
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://lore.kernel.org/r/20250903173824.1472244-3-mpearson-lenovo@squebb.ca
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Mark Pearson and committed by
Ilpo Järvinen
07b93b74 c778f7ac

+50 -7
+49 -7
drivers/platform/x86/lenovo/think-lmi.c
··· 119 119 * You must reboot the computer before the changes will take effect. 120 120 */ 121 121 #define LENOVO_SET_BIOS_CERT_GUID "26861C9F-47E9-44C4-BD8B-DFE7FA2610FE" 122 + #define LENOVO_TC_SET_BIOS_CERT_GUID "955aaf7d-8bc4-4f04-90aa-97469512f167" 122 123 123 124 /* 124 125 * Name: UpdateBiosCert ··· 129 128 * You must reboot the computer before the changes will take effect. 130 129 */ 131 130 #define LENOVO_UPDATE_BIOS_CERT_GUID "9AA3180A-9750-41F7-B9F7-D5D3B1BAC3CE" 131 + #define LENOVO_TC_UPDATE_BIOS_CERT_GUID "5f5bbbb2-c72f-4fb8-8129-228eef4fdbed" 132 132 133 133 /* 134 134 * Name: ClearBiosCert ··· 139 137 * You must reboot the computer before the changes will take effect. 140 138 */ 141 139 #define LENOVO_CLEAR_BIOS_CERT_GUID "B2BC39A7-78DD-4D71-B059-A510DEC44890" 140 + #define LENOVO_TC_CLEAR_BIOS_CERT_GUID "97849cb6-cb44-42d1-a750-26a596a9eec4" 141 + 142 142 /* 143 143 * Name: CertToPassword 144 144 * Description: Switch from certificate to password authentication. ··· 149 145 * You must reboot the computer before the changes will take effect. 150 146 */ 151 147 #define LENOVO_CERT_TO_PASSWORD_GUID "0DE8590D-5510-4044-9621-77C227F5A70D" 148 + #define LENOVO_TC_CERT_TO_PASSWORD_GUID "ef65480d-38c9-420d-b700-ab3d6c8ebaca" 152 149 153 150 /* 154 151 * Name: SetBiosSettingCert ··· 158 153 * Format: "Item,Value,Signature" 159 154 */ 160 155 #define LENOVO_SET_BIOS_SETTING_CERT_GUID "34A008CC-D205-4B62-9E67-31DFA8B90003" 156 + #define LENOVO_TC_SET_BIOS_SETTING_CERT_GUID "19ecba3b-b318-4192-a89b-43d94bc60cea" 161 157 162 158 /* 163 159 * Name: SaveBiosSettingCert ··· 167 161 * Format: "Signature" 168 162 */ 169 163 #define LENOVO_SAVE_BIOS_SETTING_CERT_GUID "C050FB9D-DF5F-4606-B066-9EFC401B2551" 164 + #define LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID "0afaf46f-7cca-450a-b455-a826a0bf1af5" 170 165 171 166 /* 172 167 * Name: CertThumbprint ··· 192 185 .clear_bios_cert = LENOVO_CLEAR_BIOS_CERT_GUID, 193 186 .update_bios_cert = LENOVO_UPDATE_BIOS_CERT_GUID, 194 187 .set_bios_cert = LENOVO_SET_BIOS_CERT_GUID, 188 + }; 189 + 190 + static const struct tlmi_cert_guids thinkcenter_cert_guid = { 191 + .thumbprint = NULL, 192 + .set_bios_setting = LENOVO_TC_SET_BIOS_SETTING_CERT_GUID, 193 + .save_bios_setting = LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID, 194 + .cert_to_password = LENOVO_TC_CERT_TO_PASSWORD_GUID, 195 + .clear_bios_cert = LENOVO_TC_CLEAR_BIOS_CERT_GUID, 196 + .update_bios_cert = LENOVO_TC_UPDATE_BIOS_CERT_GUID, 197 + .set_bios_cert = LENOVO_TC_SET_BIOS_CERT_GUID, 195 198 }; 196 199 197 200 static const struct tlmi_err_codes tlmi_errs[] = { ··· 695 678 const union acpi_object *obj; 696 679 acpi_status status; 697 680 681 + if (!tlmi_priv.cert_guid->thumbprint) 682 + return -EOPNOTSUPP; 683 + 698 684 status = wmi_evaluate_method(tlmi_priv.cert_guid->thumbprint, 0, 0, &input, &output); 699 685 if (ACPI_FAILURE(status)) { 700 686 kfree(output.pointer); ··· 876 856 return -EACCES; 877 857 } 878 858 guid = tlmi_priv.cert_guid->set_bios_cert; 879 - /* Format: 'Certificate, password' */ 880 - auth_str = cert_command(setting, new_cert, setting->password); 859 + if (tlmi_priv.thinkcenter_mode) { 860 + /* Format: 'Certificate, password, encoding, kbdlang' */ 861 + auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s,%s", new_cert, 862 + setting->password, 863 + encoding_options[setting->encoding], 864 + setting->kbdlang); 865 + } else { 866 + /* Format: 'Certificate, password' */ 867 + auth_str = cert_command(setting, new_cert, setting->password); 868 + } 881 869 } 882 870 kfree(new_cert); 883 871 if (!auth_str) ··· 1621 1593 wmi_has_guid(LENOVO_SAVE_BIOS_SETTING_CERT_GUID)) 1622 1594 tlmi_priv.certificate_support = true; 1623 1595 1596 + /* ThinkCenter uses different GUIDs for certificate support */ 1597 + if (wmi_has_guid(LENOVO_TC_SET_BIOS_CERT_GUID) && 1598 + wmi_has_guid(LENOVO_TC_SET_BIOS_SETTING_CERT_GUID) && 1599 + wmi_has_guid(LENOVO_TC_SAVE_BIOS_SETTING_CERT_GUID)) { 1600 + tlmi_priv.certificate_support = true; 1601 + tlmi_priv.thinkcenter_mode = true; 1602 + pr_info("ThinkCenter modified support being used\n"); 1603 + } 1604 + 1624 1605 /* 1625 1606 * Try to find the number of valid settings of this machine 1626 1607 * and use it to create sysfs attributes. ··· 1775 1738 } 1776 1739 1777 1740 if (tlmi_priv.certificate_support) { 1778 - tlmi_priv.cert_guid = &thinkpad_cert_guid; 1779 - tlmi_priv.pwd_admin->cert_installed = 1780 - tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SVC; 1781 - tlmi_priv.pwd_system->cert_installed = 1782 - tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SMC; 1741 + if (tlmi_priv.thinkcenter_mode) { 1742 + tlmi_priv.cert_guid = &thinkcenter_cert_guid; 1743 + tlmi_priv.pwd_admin->cert_installed = tlmi_priv.pwdcfg.core.password_mode; 1744 + } else { 1745 + tlmi_priv.cert_guid = &thinkpad_cert_guid; 1746 + tlmi_priv.pwd_admin->cert_installed = 1747 + tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SVC; 1748 + tlmi_priv.pwd_system->cert_installed = 1749 + tlmi_priv.pwdcfg.core.password_state & TLMI_CERT_SMC; 1750 + } 1783 1751 } 1784 1752 return 0; 1785 1753
+1
drivers/platform/x86/lenovo/think-lmi.h
··· 120 120 enum save_mode save_mode; 121 121 bool save_required; 122 122 bool reboot_required; 123 + bool thinkcenter_mode; 123 124 124 125 struct tlmi_attr_setting *setting[TLMI_SETTINGS_COUNT]; 125 126 struct device *class_dev;