1cd1aebf5SMark Rutland /* 2cd1aebf5SMark Rutland * Copyright (C) 2013 ARM Ltd. 3cd1aebf5SMark Rutland * 4cd1aebf5SMark Rutland * This program is free software; you can redistribute it and/or modify 5cd1aebf5SMark Rutland * it under the terms of the GNU General Public License version 2 as 6cd1aebf5SMark Rutland * published by the Free Software Foundation. 7cd1aebf5SMark Rutland * 8cd1aebf5SMark Rutland * This program is distributed in the hope that it will be useful, 9cd1aebf5SMark Rutland * but WITHOUT ANY WARRANTY; without even the implied warranty of 10cd1aebf5SMark Rutland * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11cd1aebf5SMark Rutland * GNU General Public License for more details. 12cd1aebf5SMark Rutland * 13cd1aebf5SMark Rutland * You should have received a copy of the GNU General Public License 14cd1aebf5SMark Rutland * along with this program. If not, see <http://www.gnu.org/licenses/>. 15cd1aebf5SMark Rutland */ 16cd1aebf5SMark Rutland #ifndef __ASM_CPU_OPS_H 17cd1aebf5SMark Rutland #define __ASM_CPU_OPS_H 18cd1aebf5SMark Rutland 19cd1aebf5SMark Rutland #include <linux/init.h> 20cd1aebf5SMark Rutland #include <linux/threads.h> 21cd1aebf5SMark Rutland 22cd1aebf5SMark Rutland struct device_node; 23cd1aebf5SMark Rutland 24652af899SMark Rutland /** 25652af899SMark Rutland * struct cpu_operations - Callback operations for hotplugging CPUs. 26652af899SMark Rutland * 27652af899SMark Rutland * @name: Name of the property as appears in a devicetree cpu node's 28652af899SMark Rutland * enable-method property. 29652af899SMark Rutland * @cpu_init: Reads any data necessary for a specific enable-method from the 30652af899SMark Rutland * devicetree, for a given cpu node and proposed logical id. 31652af899SMark Rutland * @cpu_prepare: Early one-time preparation step for a cpu. If there is a 32652af899SMark Rutland * mechanism for doing so, tests whether it is possible to boot 33652af899SMark Rutland * the given CPU. 34652af899SMark Rutland * @cpu_boot: Boots a cpu into the kernel. 35652af899SMark Rutland * @cpu_postboot: Optionally, perform any post-boot cleanup or necesary 36652af899SMark Rutland * synchronisation. Called from the cpu being booted. 379327e2c6SMark Rutland * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific 389327e2c6SMark Rutland * reason, which will cause the hot unplug to be aborted. Called 399327e2c6SMark Rutland * from the cpu to be killed. 409327e2c6SMark Rutland * @cpu_die: Makes a cpu leave the kernel. Must not fail. Called from the 419327e2c6SMark Rutland * cpu being killed. 42c814ca02SAshwin Chaugule * @cpu_kill: Ensures a cpu has left the kernel. Called from another cpu. 43*af3cfdbfSLorenzo Pieralisi * @cpu_init_idle: Reads any data necessary to initialize CPU idle states from 44*af3cfdbfSLorenzo Pieralisi * devicetree, for a given cpu node and proposed logical id. 4595322526SLorenzo Pieralisi * @cpu_suspend: Suspends a cpu and saves the required context. May fail owing 4695322526SLorenzo Pieralisi * to wrong parameters or error conditions. Called from the 4795322526SLorenzo Pieralisi * CPU being suspended. Must be called with IRQs disabled. 48652af899SMark Rutland */ 49cd1aebf5SMark Rutland struct cpu_operations { 50cd1aebf5SMark Rutland const char *name; 51cd1aebf5SMark Rutland int (*cpu_init)(struct device_node *, unsigned int); 52cd1aebf5SMark Rutland int (*cpu_prepare)(unsigned int); 53652af899SMark Rutland int (*cpu_boot)(unsigned int); 54652af899SMark Rutland void (*cpu_postboot)(void); 559327e2c6SMark Rutland #ifdef CONFIG_HOTPLUG_CPU 569327e2c6SMark Rutland int (*cpu_disable)(unsigned int cpu); 579327e2c6SMark Rutland void (*cpu_die)(unsigned int cpu); 58c814ca02SAshwin Chaugule int (*cpu_kill)(unsigned int cpu); 599327e2c6SMark Rutland #endif 60*af3cfdbfSLorenzo Pieralisi #ifdef CONFIG_CPU_IDLE 61*af3cfdbfSLorenzo Pieralisi int (*cpu_init_idle)(struct device_node *, unsigned int); 6295322526SLorenzo Pieralisi int (*cpu_suspend)(unsigned long); 6395322526SLorenzo Pieralisi #endif 64cd1aebf5SMark Rutland }; 65cd1aebf5SMark Rutland 66cd1aebf5SMark Rutland extern const struct cpu_operations *cpu_ops[NR_CPUS]; 670a6479b0SGeoff Levand int __init cpu_read_ops(struct device_node *dn, int cpu); 680a6479b0SGeoff Levand void __init cpu_read_bootcpu_ops(void); 69cd1aebf5SMark Rutland 70cd1aebf5SMark Rutland #endif /* ifndef __ASM_CPU_OPS_H */ 71