18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2013 ARM Ltd. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef __ASM_CPU_OPS_H 68c2ecf20Sopenharmony_ci#define __ASM_CPU_OPS_H 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#include <linux/init.h> 98c2ecf20Sopenharmony_ci#include <linux/threads.h> 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/** 128c2ecf20Sopenharmony_ci * struct cpu_operations - Callback operations for hotplugging CPUs. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * @name: Name of the property as appears in a devicetree cpu node's 158c2ecf20Sopenharmony_ci * enable-method property. On systems booting with ACPI, @name 168c2ecf20Sopenharmony_ci * identifies the struct cpu_operations entry corresponding to 178c2ecf20Sopenharmony_ci * the boot protocol specified in the ACPI MADT table. 188c2ecf20Sopenharmony_ci * @cpu_init: Reads any data necessary for a specific enable-method for a 198c2ecf20Sopenharmony_ci * proposed logical id. 208c2ecf20Sopenharmony_ci * @cpu_prepare: Early one-time preparation step for a cpu. If there is a 218c2ecf20Sopenharmony_ci * mechanism for doing so, tests whether it is possible to boot 228c2ecf20Sopenharmony_ci * the given CPU. 238c2ecf20Sopenharmony_ci * @cpu_boot: Boots a cpu into the kernel. 248c2ecf20Sopenharmony_ci * @cpu_postboot: Optionally, perform any post-boot cleanup or necessary 258c2ecf20Sopenharmony_ci * synchronisation. Called from the cpu being booted. 268c2ecf20Sopenharmony_ci * @cpu_can_disable: Determines whether a CPU can be disabled based on 278c2ecf20Sopenharmony_ci * mechanism-specific information. 288c2ecf20Sopenharmony_ci * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific 298c2ecf20Sopenharmony_ci * reason, which will cause the hot unplug to be aborted. Called 308c2ecf20Sopenharmony_ci * from the cpu to be killed. 318c2ecf20Sopenharmony_ci * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the 328c2ecf20Sopenharmony_ci * cpu being killed. 338c2ecf20Sopenharmony_ci * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu. 348c2ecf20Sopenharmony_ci * @cpu_init_idle: Reads any data necessary to initialize CPU idle states for 358c2ecf20Sopenharmony_ci * a proposed logical id. 368c2ecf20Sopenharmony_ci * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing 378c2ecf20Sopenharmony_ci * to wrong parameters or error conditions. Called from the 388c2ecf20Sopenharmony_ci * CPU being suspended. Must be called with IRQs disabled. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_cistruct cpu_operations { 418c2ecf20Sopenharmony_ci const char *name; 428c2ecf20Sopenharmony_ci int (*cpu_init)(unsigned int); 438c2ecf20Sopenharmony_ci int (*cpu_prepare)(unsigned int); 448c2ecf20Sopenharmony_ci int (*cpu_boot)(unsigned int); 458c2ecf20Sopenharmony_ci void (*cpu_postboot)(void); 468c2ecf20Sopenharmony_ci#ifdef CONFIG_HOTPLUG_CPU 478c2ecf20Sopenharmony_ci bool (*cpu_can_disable)(unsigned int cpu); 488c2ecf20Sopenharmony_ci int (*cpu_disable)(unsigned int cpu); 498c2ecf20Sopenharmony_ci void (*cpu_die)(unsigned int cpu); 508c2ecf20Sopenharmony_ci int (*cpu_kill)(unsigned int cpu); 518c2ecf20Sopenharmony_ci#endif 528c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_IDLE 538c2ecf20Sopenharmony_ci int (*cpu_init_idle)(unsigned int); 548c2ecf20Sopenharmony_ci int (*cpu_suspend)(unsigned long); 558c2ecf20Sopenharmony_ci#endif 568c2ecf20Sopenharmony_ci}; 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciint __init init_cpu_ops(int cpu); 598c2ecf20Sopenharmony_ciextern const struct cpu_operations *get_cpu_ops(int cpu); 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_cistatic inline void __init init_bootcpu_ops(void) 628c2ecf20Sopenharmony_ci{ 638c2ecf20Sopenharmony_ci init_cpu_ops(0); 648c2ecf20Sopenharmony_ci} 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#endif /* ifndef __ASM_CPU_OPS_H */ 67