]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ACPI: processor: Add acpi_get_processor_handle() helper
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 29 May 2024 13:34:34 +0000 (14:34 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 28 Jun 2024 17:38:28 +0000 (18:38 +0100)
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>
drivers/acpi/acpi_processor.c
include/linux/acpi.h

index 0bc0419adf6b9570200ed5466793990def2e0279..56592462d2fbacafefaff1f9f8eb430b63be9208 100644 (file)
@@ -35,6 +35,17 @@ EXPORT_PER_CPU_SYMBOL(processors);
 struct acpi_processor_errata errata __read_mostly;
 EXPORT_SYMBOL_GPL(errata);
 
+acpi_handle acpi_get_processor_handle(int cpu)
+{
+       struct acpi_processor *pr;
+
+       pr = per_cpu(processors, cpu);
+       if (pr)
+               return pr->handle;
+
+       return NULL;
+}
+
 static int acpi_processor_errata_piix4(struct pci_dev *dev)
 {
        u8 value1 = 0;
index 28c3fb2bef0daacbd524476dc3a4fd97de29b22c..fd45bfab66b8fd34154939c86a020822f5bfcc6f 100644 (file)
@@ -304,6 +304,8 @@ int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
 int acpi_unmap_cpu(int cpu);
 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
 
+acpi_handle acpi_get_processor_handle(int cpu);
+
 #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
 int acpi_get_ioapic_id(acpi_handle handle, u32 gsi_base, u64 *phys_addr);
 #endif
@@ -1076,6 +1078,11 @@ static inline bool acpi_sleep_state_supported(u8 sleep_state)
        return false;
 }
 
+static inline acpi_handle acpi_get_processor_handle(int cpu)
+{
+       return NULL;
+}
+
 #endif /* !CONFIG_ACPI */
 
 extern void arch_post_acpi_subsys_init(void);