Skip to content

Commit 1b4f02a

Browse files
committed
ACPI: scan: Make acpi_processor_add() check the device enabled bit
Modify acpi_processor_add() return an error if _STA returns the enabled bit clear for the given processor device, so as to avoid using processors that don't decode their resources, as per the ACPI specification. [1] Link: https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status # [1] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 514bcab commit 1b4f02a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

drivers/acpi/acpi_processor.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ static int acpi_processor_add(struct acpi_device *device,
381381
struct device *dev;
382382
int result = 0;
383383

384+
if (!acpi_device_is_enabled(device))
385+
return -ENODEV;
386+
384387
pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL);
385388
if (!pr)
386389
return -ENOMEM;

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ int acpi_device_setup_files(struct acpi_device *dev);
121121
void acpi_device_remove_files(struct acpi_device *dev);
122122
void acpi_device_add_finalize(struct acpi_device *device);
123123
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
124+
bool acpi_device_is_enabled(const struct acpi_device *adev);
124125
bool acpi_device_is_present(const struct acpi_device *adev);
125126
bool acpi_device_is_battery(struct acpi_device *adev);
126127
bool acpi_device_is_first_physical_node(struct acpi_device *adev,

drivers/acpi/scan.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,11 @@ bool acpi_device_is_present(const struct acpi_device *adev)
19451945
return adev->status.present || adev->status.functional;
19461946
}
19471947

1948+
bool acpi_device_is_enabled(const struct acpi_device *adev)
1949+
{
1950+
return adev->status.present && adev->status.enabled;
1951+
}
1952+
19481953
static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler,
19491954
const char *idstr,
19501955
const struct acpi_device_id **matchid)

0 commit comments

Comments
 (0)