xref: /openbmc/linux/arch/arm64/include/asm/cpu_ops.h (revision 9327e2c6bb8cb0131b38a07847cd58c78dc095e9)
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.
37*9327e2c6SMark Rutland  * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
38*9327e2c6SMark Rutland  * 		reason, which will cause the hot unplug to be aborted. Called
39*9327e2c6SMark Rutland  * 		from the cpu to be killed.
40*9327e2c6SMark Rutland  * @cpu_die:	Makes a cpu leave the kernel. Must not fail. Called from the
41*9327e2c6SMark Rutland  *		cpu being killed.
42652af899SMark Rutland  */
43cd1aebf5SMark Rutland struct cpu_operations {
44cd1aebf5SMark Rutland 	const char	*name;
45cd1aebf5SMark Rutland 	int		(*cpu_init)(struct device_node *, unsigned int);
46cd1aebf5SMark Rutland 	int		(*cpu_prepare)(unsigned int);
47652af899SMark Rutland 	int		(*cpu_boot)(unsigned int);
48652af899SMark Rutland 	void		(*cpu_postboot)(void);
49*9327e2c6SMark Rutland #ifdef CONFIG_HOTPLUG_CPU
50*9327e2c6SMark Rutland 	int		(*cpu_disable)(unsigned int cpu);
51*9327e2c6SMark Rutland 	void		(*cpu_die)(unsigned int cpu);
52*9327e2c6SMark Rutland #endif
53cd1aebf5SMark Rutland };
54cd1aebf5SMark Rutland 
55cd1aebf5SMark Rutland extern const struct cpu_operations *cpu_ops[NR_CPUS];
56e8765b26SMark Rutland extern int __init cpu_read_ops(struct device_node *dn, int cpu);
57e8765b26SMark Rutland extern void __init cpu_read_bootcpu_ops(void);
58cd1aebf5SMark Rutland 
59cd1aebf5SMark Rutland #endif /* ifndef __ASM_CPU_OPS_H */
60