Skip to content

Instantly share code, notes, and snippets.

@sameo
Created November 7, 2018 17:51
Show Gist options
  • Save sameo/669f2f2d8f13be950bcfb9bfedb99b2b to your computer and use it in GitHub Desktop.
Save sameo/669f2f2d8f13be950bcfb9bfedb99b2b to your computer and use it in GitHub Desktop.
#define ACPI_PROCESSOR_OBJECT_HID "LNXCPU"
#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
static const struct acpi_device_id processor_device_ids[] = {
{ ACPI_PROCESSOR_OBJECT_HID, },
{ ACPI_PROCESSOR_DEVICE_HID, },
{ }
};
static struct acpi_scan_handler processor_handler = {
.ids = processor_device_ids,
.attach = acpi_processor_add,
#ifdef CONFIG_ACPI_HOTPLUG_CPU
.detach = acpi_processor_remove,
#endif
.hotplug = {
.enabled = true,
},
};
acpi_processor_init:
acpi_scan_add_handler_with_hotplug(&processor_handler, "processor");
acpi_processor_add:
acpi_processor_get_info:
if (invalid_logical_cpuid(pr->id) || !cpu_present(pr->id)) {
int ret = acpi_processor_hotadd_init(pr);
if (ret)
return ret;
}
acpi_processor_hotadd_init:
status = acpi_evaluate_integer(pr->handle, "_STA", NULL, &sta);
arch_register_cpu()
ACPI scan
acpi_scan_add_handler_with_hotplug:
acpi_scan_add_handler:
list_add_tail(&handler->list_node, &acpi_scan_handlers_list);
acpi_scan_match_handler:
list_for_each_entry(handler, &acpi_scan_handlers_list, list_node)
if (acpi_scan_handler_matching(handler, idstr, matchid))
return handler;
acpi_bus_init:
acpi_install_notify_handler(ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY,
&acpi_bus_notify, NULL);
acpi_bus_notify:
if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type)))
return;
acpi_hotplug_schedule:
INIT_WORK(&hpw->work, acpi_hotplug_work_fn);
queue_work(kacpi_hotplug_wq, &hpw->work)
acpi_hotplug_work_fn:
acpi_device_hotplug:
acpi_generic_hotplug_event:
acpi_scan_bus_check
acpi_scan_device_check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment