Skip to content

Commit 36b9216

Browse files
jic23ctmarinas
authored andcommitted
ACPI: processor: Add acpi_get_processor_handle() helper
If CONFIG_ACPI_PROCESSOR provide a helper to retrieve the acpi_handle for a given CPU allowing access to methods in DSDT. Tested-by: Miguel Luis <miguel.luis@oracle.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20240529133446.28446-8-Jonathan.Cameron@huawei.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent cd92396 commit 36b9216

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/acpi/acpi_processor.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ EXPORT_PER_CPU_SYMBOL(processors);
3535
struct acpi_processor_errata errata __read_mostly;
3636
EXPORT_SYMBOL_GPL(errata);
3737

38+
acpi_handle acpi_get_processor_handle(int cpu)
39+
{
40+
struct acpi_processor *pr;
41+
42+
pr = per_cpu(processors, cpu);
43+
if (pr)
44+
return pr->handle;
45+
46+
return NULL;
47+
}
48+
3849
static int acpi_processor_errata_piix4(struct pci_dev *dev)
3950
{
4051
u8 value1 = 0;

include/linux/acpi.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,8 @@ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
304304
int acpi_unmap_cpu(int cpu);
305305
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
306306

307+
acpi_handle acpi_get_processor_handle(int cpu);
308+
307309
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
308310
int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr);
309311
#endif
@@ -1076,6 +1078,11 @@ static inline bool acpi_sleep_state_supported(u8 sleep_state)
10761078
return false;
10771079
}
10781080

1081+
static inline acpi_handle acpi_get_processor_handle(int cpu)
1082+
{
1083+
return NULL;
1084+
}
1085+
10791086
#endif /* !CONFIG_ACPI */
10801087

10811088
extern void arch_post_acpi_subsys_init(void);

0 commit comments

Comments
 (0)