acpi_{Device,Battery}IsPresent: restore pre-r330957 behaviour
Specifically, assume that the device is present if evaluation of _STA method fails. Before r330957 we ignored any _STA evaluation failure (which was performed by AcpiGetObjectInfo in ACPICA contrib code) for the purpose of acpi_DeviceIsPresent and acpi_BatteryIsPresent. ACPICA 20180313 removed evaluation of _STA from AcpiGetObjectInfo. So, we added evaluation of _STA to acpi_DeviceIsPresent and acpi_BatteryIsPresent. One important difference is that the new code ignored a failure only if _STA did not exist (AE_NOT_FOUND). Any other kind of failure was treated as a fatal failure. Apparently, on some systems we can get AE_NOT_EXIST when evaluating _STA. And that error is not an evil twin of AE_NOT_FOUND, despite a very similar name, but a distinct error related to a missing handler for an ACPI operation region. It's possible that for some people the problem was already fixed by changes in ACPICA and/or in acpi_ec driver (or even in BIOS) that fixed the AE_NOT_EXIST failure related to EC operation region. This work is based on a great analysis by cem and an earlier patch by Ali Abdallah <aliovx@gmail.com>. PR: 227191 Reported by: 0mp MFC after: 2 weeks
This commit is contained in:
parent
89a9a5b5c9
commit
817b71bbb9
@ -2203,8 +2203,6 @@ acpi_DeviceIsPresent(device_t dev)
|
||||
h = acpi_get_handle(dev);
|
||||
if (h == NULL)
|
||||
return (FALSE);
|
||||
status = acpi_GetInteger(h, "_STA", &s);
|
||||
|
||||
/*
|
||||
* Certain Treadripper boards always returns 0 for FreeBSD because it
|
||||
* only returns non-zero for the OS string "Windows 2015". Otherwise it
|
||||
@ -2214,9 +2212,14 @@ acpi_DeviceIsPresent(device_t dev)
|
||||
if (acpi_MatchHid(h, "AMDI0020") || acpi_MatchHid(h, "AMDI0010"))
|
||||
return (TRUE);
|
||||
|
||||
/* If no _STA method, must be present */
|
||||
status = acpi_GetInteger(h, "_STA", &s);
|
||||
|
||||
/*
|
||||
* If no _STA method or if it failed, then assume that
|
||||
* the device is present.
|
||||
*/
|
||||
if (ACPI_FAILURE(status))
|
||||
return (status == AE_NOT_FOUND ? TRUE : FALSE);
|
||||
return (TRUE);
|
||||
|
||||
return (ACPI_DEVICE_PRESENT(s) ? TRUE : FALSE);
|
||||
}
|
||||
@ -2236,9 +2239,12 @@ acpi_BatteryIsPresent(device_t dev)
|
||||
return (FALSE);
|
||||
status = acpi_GetInteger(h, "_STA", &s);
|
||||
|
||||
/* If no _STA method, must be present */
|
||||
/*
|
||||
* If no _STA method or if it failed, then assume that
|
||||
* the device is present.
|
||||
*/
|
||||
if (ACPI_FAILURE(status))
|
||||
return (status == AE_NOT_FOUND ? TRUE : FALSE);
|
||||
return (TRUE);
|
||||
|
||||
return (ACPI_BATTERY_PRESENT(s) ? TRUE : FALSE);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user