@@ -185,8 +185,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
/* Initialization */
static int acpi_processor_make_present(struct acpi_processor *pr)
{
- unsigned long long sta;
- acpi_status status;
int ret;
if (!IS_ENABLED(CONFIG_ACPI_HOTPLUG_CPU))
@@ -195,9 +193,9 @@ static int acpi_processor_make_present(struct acpi_processor *pr)
if (invalid_phys_cpuid(pr->phys_id))
return -ENODEV;
- status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
- if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
- return -ENODEV;
+ ret = acpi_sta_enabled(pr->handle);
+ if (ret)
+ return ret;
cpu_maps_update_begin();
cpus_write_lock();
@@ -744,6 +744,27 @@ acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function)
}
EXPORT_SYMBOL(acpi_evaluate_reg);
+int acpi_sta_enabled(acpi_handle handle)
+{
+ unsigned long long sta;
+ bool present, enabled;
+ acpi_status status;
+
+ if (acpi_has_method(handle, "_STA")) {
+ status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+ if (ACPI_FAILURE(status))
+ return -ENODEV;
+
+ present = sta & ACPI_STA_DEVICE_PRESENT;
+ enabled = sta & ACPI_STA_DEVICE_ENABLED;
+ if (!present || !enabled) {
+ return -EPROBE_DEFER;
+ }
+ return 0;
+ }
+ return 0; /* No _STA means always on! */
+}
+
/**
* acpi_evaluate_dsm - evaluate device's _DSM method
* @handle: ACPI device handle
@@ -51,6 +51,7 @@ bool acpi_ata_match(acpi_handle handle);
bool acpi_bay_match(acpi_handle handle);
bool acpi_dock_match(acpi_handle handle);
+int acpi_sta_enabled(acpi_handle handle);
bool acpi_check_dsm(acpi_handle handle, const guid_t *guid, u64 rev, u64 funcs);
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const guid_t *guid,
u64 rev, u64 func, union acpi_object *argv4);
A device is enabled only if both the present and enabled bits are set in the result of calling the _STA method, or the _STA method is not present (in which case the device is always present and enabled). Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> --- v5: New patch --- drivers/acpi/acpi_processor.c | 8 +++----- drivers/acpi/utils.c | 21 +++++++++++++++++++++ include/acpi/acpi_bus.h | 1 + 3 files changed, 25 insertions(+), 5 deletions(-)