[PATCH 1/1] UBUNTU: SAUCE: ACPI / bus: Add some Lenovo laptops in list of acpi table term list

Alex Hung alex.hung at canonical.com
Mon Mar 25 18:34:43 UTC 2019


Looks good without affecting other systems. Plus, module-level code is
enabled in newer kernel too.

Acked-by: Alex Hung <alex.hung at canonical.com>

On Fri, Mar 22, 2019 at 1:35 AM Aaron Ma <aaron.ma at canonical.com> wrote:
>
> 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.
>
> Signed-off-by: Aaron Ma <aaron.ma at canonical.com>
> ---
>  drivers/acpi/bus.c | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index f0348e388d01..4297316bfea1 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -109,10 +109,39 @@ 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 = {
>         {}
>  };
> +
> +bool acpi_quirk_matches_bios_ids(const char * const ids[])
> +{
> +       return false;
> +}
>  #endif
>
>  /* --------------------------------------------------------------------------
> @@ -1036,6 +1065,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)) {
> --
> 2.17.1
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team



-- 
Cheers,
Alex Hung



More information about the kernel-team mailing list