2222 * Some BIOS-es (temporarily) hide specific APCI devices to work around Windows
2323 * driver bugs. We use DMI matching to match known cases of this.
2424 *
25- * We work around this by always reporting ACPI_STA_DEFAULT for these
26- * devices. Note this MUST only be done for devices where this is safe .
25+ * Likewise sometimes some not-actually present devices are sometimes
26+ * reported as present, which may cause issues .
2727 *
28- * This forcing of devices to be present is limited to specific CPU (SoC)
29- * models both to avoid potentially causing trouble on other models and
30- * because some HIDs are re-used on different SoCs for completely
31- * different devices.
28+ * We work around this by using the below quirk list to override the status
29+ * reported by the _STA method with a fixed value (ACPI_STA_DEFAULT or 0).
30+ * Note this MUST only be done for devices where this is safe.
31+ *
32+ * This status overriding is limited to specific CPU (SoC) models both to
33+ * avoid potentially causing trouble on other models and because some HIDs
34+ * are re-used on different SoCs for completely different devices.
3235 */
33- struct always_present_id {
36+ struct override_status_id {
3437 struct acpi_device_id hid [2 ];
3538 struct x86_cpu_id cpu_ids [2 ];
3639 struct dmi_system_id dmi_ids [2 ]; /* Optional */
3740 const char * uid ;
41+ unsigned long long status ;
3842};
3943
40- #define X86_MATCH (model ) X86_MATCH_INTEL_FAM6_MODEL(model, NULL)
41-
42- #define ENTRY (hid , uid , cpu_models , dmi ...) { \
44+ #define ENTRY (status , hid , uid , cpu_model , dmi ...) { \
4345 { { hid, }, {} }, \
44- { cpu_models, {} }, \
46+ { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \
4547 { { .matches = dmi }, {} }, \
4648 uid, \
49+ status, \
4750}
4851
49- static const struct always_present_id always_present_ids [] = {
52+ #define PRESENT_ENTRY_HID (hid , uid , cpu_model , dmi ...) \
53+ ENTRY(ACPI_STA_DEFAULT, hid, uid, cpu_model, dmi)
54+
55+ #define NOT_PRESENT_ENTRY_HID (hid , uid , cpu_model , dmi ...) \
56+ ENTRY(0, hid, uid, cpu_model, dmi)
57+
58+ static const struct override_status_id override_status_ids [] = {
5059 /*
5160 * Bay / Cherry Trail PWM directly poked by GPU driver in win10,
5261 * but Linux uses a separate PWM driver, harmless if not used.
5362 */
54- ENTRY ("80860F09" , "1" , X86_MATCH ( ATOM_SILVERMONT ) , {}),
55- ENTRY ("80862288" , "1" , X86_MATCH ( ATOM_AIRMONT ) , {}),
63+ PRESENT_ENTRY_HID ("80860F09" , "1" , ATOM_SILVERMONT , {}),
64+ PRESENT_ENTRY_HID ("80862288" , "1" , ATOM_AIRMONT , {}),
5665
5766 /*
5867 * The INT0002 device is necessary to clear wakeup interrupt sources
5968 * on Cherry Trail devices, without it we get nobody cared IRQ msgs.
6069 */
61- ENTRY ("INT0002" , "1" , X86_MATCH ( ATOM_AIRMONT ) , {}),
70+ PRESENT_ENTRY_HID ("INT0002" , "1" , ATOM_AIRMONT , {}),
6271 /*
6372 * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides
6473 * the touchscreen ACPI device until a certain time
6574 * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed
6675 * *and* _STA has been called at least 3 times since.
6776 */
68- ENTRY ("SYNA7500" , "1" , X86_MATCH ( HASWELL_L ) , {
77+ PRESENT_ENTRY_HID ("SYNA7500" , "1" , HASWELL_L , {
6978 DMI_MATCH (DMI_SYS_VENDOR , "Dell Inc." ),
7079 DMI_MATCH (DMI_PRODUCT_NAME , "Venue 11 Pro 7130" ),
7180 }),
72- ENTRY ("SYNA7500" , "1" , X86_MATCH ( HASWELL_L ) , {
81+ PRESENT_ENTRY_HID ("SYNA7500" , "1" , HASWELL_L , {
7382 DMI_MATCH (DMI_SYS_VENDOR , "Dell Inc." ),
7483 DMI_MATCH (DMI_PRODUCT_NAME , "Venue 11 Pro 7139" ),
7584 }),
@@ -85,46 +94,47 @@ static const struct always_present_id always_present_ids[] = {
8594 * was copy-pasted from the GPD win, so it has a disabled KIOX000A
8695 * node which we should not enable, thus we also check the BIOS date.
8796 */
88- ENTRY ("KIOX000A" , "1" , X86_MATCH ( ATOM_AIRMONT ) , {
97+ PRESENT_ENTRY_HID ("KIOX000A" , "1" , ATOM_AIRMONT , {
8998 DMI_MATCH (DMI_BOARD_VENDOR , "AMI Corporation" ),
9099 DMI_MATCH (DMI_BOARD_NAME , "Default string" ),
91100 DMI_MATCH (DMI_PRODUCT_NAME , "Default string" ),
92101 DMI_MATCH (DMI_BIOS_DATE , "02/21/2017" )
93102 }),
94- ENTRY ("KIOX000A" , "1" , X86_MATCH ( ATOM_AIRMONT ) , {
103+ PRESENT_ENTRY_HID ("KIOX000A" , "1" , ATOM_AIRMONT , {
95104 DMI_MATCH (DMI_BOARD_VENDOR , "AMI Corporation" ),
96105 DMI_MATCH (DMI_BOARD_NAME , "Default string" ),
97106 DMI_MATCH (DMI_PRODUCT_NAME , "Default string" ),
98107 DMI_MATCH (DMI_BIOS_DATE , "03/20/2017" )
99108 }),
100- ENTRY ("KIOX000A" , "1" , X86_MATCH ( ATOM_AIRMONT ) , {
109+ PRESENT_ENTRY_HID ("KIOX000A" , "1" , ATOM_AIRMONT , {
101110 DMI_MATCH (DMI_BOARD_VENDOR , "AMI Corporation" ),
102111 DMI_MATCH (DMI_BOARD_NAME , "Default string" ),
103112 DMI_MATCH (DMI_PRODUCT_NAME , "Default string" ),
104113 DMI_MATCH (DMI_BIOS_DATE , "05/25/2017" )
105114 }),
106115};
107116
108- bool acpi_device_always_present (struct acpi_device * adev )
117+ bool acpi_device_override_status (struct acpi_device * adev , unsigned long long * status )
109118{
110119 bool ret = false;
111120 unsigned int i ;
112121
113- for (i = 0 ; i < ARRAY_SIZE (always_present_ids ); i ++ ) {
114- if (acpi_match_device_ids (adev , always_present_ids [i ].hid ))
122+ for (i = 0 ; i < ARRAY_SIZE (override_status_ids ); i ++ ) {
123+ if (acpi_match_device_ids (adev , override_status_ids [i ].hid ))
115124 continue ;
116125
117126 if (!adev -> pnp .unique_id ||
118- strcmp (adev -> pnp .unique_id , always_present_ids [i ].uid ))
127+ strcmp (adev -> pnp .unique_id , override_status_ids [i ].uid ))
119128 continue ;
120129
121- if (!x86_match_cpu (always_present_ids [i ].cpu_ids ))
130+ if (!x86_match_cpu (override_status_ids [i ].cpu_ids ))
122131 continue ;
123132
124- if (always_present_ids [i ].dmi_ids [0 ].matches [0 ].slot &&
125- !dmi_check_system (always_present_ids [i ].dmi_ids ))
133+ if (override_status_ids [i ].dmi_ids [0 ].matches [0 ].slot &&
134+ !dmi_check_system (override_status_ids [i ].dmi_ids ))
126135 continue ;
127136
137+ * status = override_status_ids [i ].status ;
128138 ret = true;
129139 break ;
130140 }
0 commit comments