]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
UBUNTU: SAUCE: ACPI / bus: Add some Lenovo laptops in list of acpi table term list
authorAaron Ma <aaron.ma@canonical.com>
Tue, 2 Apr 2019 04:10:13 +0000 (12:10 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Wed, 24 Apr 2019 06:52:03 +0000 (02:52 -0400)
BugLink: https://bugs.launchpad.net/bugs/1819921
Some Lenovo laptops failed to boot because of no package handling
with module-level code which is supported from v4.17-rc1.

Due to the regression concerns, add these series of laptops in a quirk
list to be handled.

V2:
Fix non-x86 building error.

Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Acked-by: AceLan Kao <acelan.kao@canonical.com>
Acked-by: hwang4 <hui.wang@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/acpi/bus.c

index f0348e388d01b8a561a085042ecdd903a5642bbc..0b306a7cef775ad13ae0a04fcc5a9345e76ce20a 100644 (file)
@@ -109,10 +109,43 @@ static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
        },
        {}
 };
+
+static const char * const acpi_quirk_lenovo_bios_ids[] = {
+       "N2H", /* first 3 bytes of Lenovo BIOS version */
+       NULL
+};
+
+bool acpi_quirk_matches_bios_ids(const char * const ids[])
+{
+       const char *bios_vendor = dmi_get_system_info(DMI_BIOS_VENDOR);
+       const char *bios_ver = dmi_get_system_info(DMI_BIOS_VERSION);
+       int i;
+
+       if ((!bios_vendor) && (!bios_ver) && strncmp(bios_vendor, "LENOVO", 6))
+               return false;
+
+       for (i = 0; ids[i]; i++)
+               if (!strncmp(bios_ver, ids[i], 3)) {
+                       acpi_gbl_parse_table_as_term_list = 1;
+                       return true;
+               }
+
+       return false;
+}
+
 #else
 static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
        {}
 };
+
+static const char * const acpi_quirk_lenovo_bios_ids[] = {
+       NULL
+};
+
+bool acpi_quirk_matches_bios_ids(const char * const ids[])
+{
+       return false;
+}
 #endif
 
 /* --------------------------------------------------------------------------
@@ -1036,6 +1069,7 @@ void __init acpi_early_init(void)
 
        /* Check machine-specific quirks */
        dmi_check_system(acpi_quirks_dmi_table);
+       acpi_quirk_matches_bios_ids(acpi_quirk_lenovo_bios_ids);
 
        status = acpi_reallocate_root_table();
        if (ACPI_FAILURE(status)) {