utils.c (a976c2951d8f376112361830aa7762beff83a205) | utils.c (3b6a70be5ac81673af1ca8b4dae84743cb9fcc87) |
---|---|
1/* 2 * X86 ACPI Utility Functions 3 * 4 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 5 * 6 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: 7 * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License version 2 as 11 * published by the Free Software Foundation. 12 */ 13 14#include <linux/acpi.h> | 1/* 2 * X86 ACPI Utility Functions 3 * 4 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com> 5 * 6 * Based on various non upstream patches to support the CHT Whiskey Cove PMIC: 7 * Copyright (C) 2013-2015 Intel Corporation. All rights reserved. 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License version 2 as 11 * published by the Free Software Foundation. 12 */ 13 14#include <linux/acpi.h> |
15#include <linux/dmi.h> |
|
15#include <asm/cpu_device_id.h> 16#include <asm/intel-family.h> 17#include "../internal.h" 18 19/* 20 * Some ACPI devices are hidden (status == 0x0) in recent BIOS-es because 21 * some recent Windows drivers bind to one device but poke at multiple 22 * devices at the same time, so the others get hidden. | 16#include <asm/cpu_device_id.h> 17#include <asm/intel-family.h> 18#include "../internal.h" 19 20/* 21 * Some ACPI devices are hidden (status == 0x0) in recent BIOS-es because 22 * some recent Windows drivers bind to one device but poke at multiple 23 * devices at the same time, so the others get hidden. |
24 * 25 * Some BIOS-es (temporarily) hide specific APCI devices to work around Windows 26 * driver bugs. We use DMI matching to match known cases of this. 27 * |
|
23 * We work around this by always reporting ACPI_STA_DEFAULT for these 24 * devices. Note this MUST only be done for devices where this is safe. 25 * 26 * This forcing of devices to be present is limited to specific CPU (SoC) 27 * models both to avoid potentially causing trouble on other models and 28 * because some HIDs are re-used on different SoCs for completely 29 * different devices. 30 */ 31struct always_present_id { 32 struct acpi_device_id hid[2]; 33 struct x86_cpu_id cpu_ids[2]; | 28 * We work around this by always reporting ACPI_STA_DEFAULT for these 29 * devices. Note this MUST only be done for devices where this is safe. 30 * 31 * This forcing of devices to be present is limited to specific CPU (SoC) 32 * models both to avoid potentially causing trouble on other models and 33 * because some HIDs are re-used on different SoCs for completely 34 * different devices. 35 */ 36struct always_present_id { 37 struct acpi_device_id hid[2]; 38 struct x86_cpu_id cpu_ids[2]; |
39 struct dmi_system_id dmi_ids[2]; /* Optional */ |
|
34 const char *uid; 35}; 36 37#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } 38 | 40 const char *uid; 41}; 42 43#define ICPU(model) { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, } 44 |
39#define ENTRY(hid, uid, cpu_models) { \ | 45#define ENTRY(hid, uid, cpu_models, dmi...) { \ |
40 { { hid, }, {} }, \ 41 { cpu_models, {} }, \ | 46 { { hid, }, {} }, \ 47 { cpu_models, {} }, \ |
48 { { .matches = dmi }, {} }, \ |
|
42 uid, \ 43} 44 45static const struct always_present_id always_present_ids[] = { 46 /* 47 * Bay / Cherry Trail PWM directly poked by GPU driver in win10, 48 * but Linux uses a separate PWM driver, harmless if not used. 49 */ | 49 uid, \ 50} 51 52static const struct always_present_id always_present_ids[] = { 53 /* 54 * Bay / Cherry Trail PWM directly poked by GPU driver in win10, 55 * but Linux uses a separate PWM driver, harmless if not used. 56 */ |
50 ENTRY("80860F09", "1", ICPU(INTEL_FAM6_ATOM_SILVERMONT1)), 51 ENTRY("80862288", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)), | 57 ENTRY("80860F09", "1", ICPU(INTEL_FAM6_ATOM_SILVERMONT1), {}), 58 ENTRY("80862288", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}), |
52 /* 53 * The INT0002 device is necessary to clear wakeup interrupt sources 54 * on Cherry Trail devices, without it we get nobody cared IRQ msgs. 55 */ | 59 /* 60 * The INT0002 device is necessary to clear wakeup interrupt sources 61 * on Cherry Trail devices, without it we get nobody cared IRQ msgs. 62 */ |
56 ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT)), | 63 ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}), |
57}; 58 59bool acpi_device_always_present(struct acpi_device *adev) 60{ 61 u32 *status = (u32 *)&adev->status; 62 u32 old_status = *status; 63 bool ret = false; 64 unsigned int i; --- 6 unchanged lines hidden (view full) --- 71 72 if (!adev->pnp.unique_id || 73 strcmp(adev->pnp.unique_id, always_present_ids[i].uid)) 74 continue; 75 76 if (!x86_match_cpu(always_present_ids[i].cpu_ids)) 77 continue; 78 | 64}; 65 66bool acpi_device_always_present(struct acpi_device *adev) 67{ 68 u32 *status = (u32 *)&adev->status; 69 u32 old_status = *status; 70 bool ret = false; 71 unsigned int i; --- 6 unchanged lines hidden (view full) --- 78 79 if (!adev->pnp.unique_id || 80 strcmp(adev->pnp.unique_id, always_present_ids[i].uid)) 81 continue; 82 83 if (!x86_match_cpu(always_present_ids[i].cpu_ids)) 84 continue; 85 |
86 if (always_present_ids[i].dmi_ids[0].matches[0].slot && 87 !dmi_check_system(always_present_ids[i].dmi_ids)) 88 continue; 89 |
|
79 if (old_status != ACPI_STA_DEFAULT) /* Log only once */ 80 dev_info(&adev->dev, 81 "Device [%s] is in always present list\n", 82 adev->pnp.bus_id); 83 84 ret = true; 85 break; 86 } 87 *status = old_status; 88 89 return ret; 90} | 90 if (old_status != ACPI_STA_DEFAULT) /* Log only once */ 91 dev_info(&adev->dev, 92 "Device [%s] is in always present list\n", 93 adev->pnp.bus_id); 94 95 ret = true; 96 break; 97 } 98 *status = old_status; 99 100 return ret; 101} |