162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2013 ARM Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __ASM_CPU_OPS_H
662306a36Sopenharmony_ci#define __ASM_CPU_OPS_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#include <linux/init.h>
962306a36Sopenharmony_ci#include <linux/threads.h>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/**
1262306a36Sopenharmony_ci * struct cpu_operations - Callback operations for hotplugging CPUs.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * @name:	Name of the property as appears in a devicetree cpu node's
1562306a36Sopenharmony_ci *		enable-method property. On systems booting with ACPI, @name
1662306a36Sopenharmony_ci *		identifies the struct cpu_operations entry corresponding to
1762306a36Sopenharmony_ci *		the boot protocol specified in the ACPI MADT table.
1862306a36Sopenharmony_ci * @cpu_init:	Reads any data necessary for a specific enable-method for a
1962306a36Sopenharmony_ci *		proposed logical id.
2062306a36Sopenharmony_ci * @cpu_prepare: Early one-time preparation step for a cpu. If there is a
2162306a36Sopenharmony_ci *		mechanism for doing so, tests whether it is possible to boot
2262306a36Sopenharmony_ci *		the given CPU.
2362306a36Sopenharmony_ci * @cpu_boot:	Boots a cpu into the kernel.
2462306a36Sopenharmony_ci * @cpu_postboot: Optionally, perform any post-boot cleanup or necessary
2562306a36Sopenharmony_ci *		synchronisation. Called from the cpu being booted.
2662306a36Sopenharmony_ci * @cpu_can_disable: Determines whether a CPU can be disabled based on
2762306a36Sopenharmony_ci *		mechanism-specific information.
2862306a36Sopenharmony_ci * @cpu_disable: Prepares a cpu to die. May fail for some mechanism-specific
2962306a36Sopenharmony_ci * 		reason, which will cause the hot unplug to be aborted. Called
3062306a36Sopenharmony_ci * 		from the cpu to be killed.
3162306a36Sopenharmony_ci * @cpu_die:	Makes a cpu leave the kernel. Must not fail. Called from the
3262306a36Sopenharmony_ci *		cpu being killed.
3362306a36Sopenharmony_ci * @cpu_kill:  Ensures a cpu has left the kernel. Called from another cpu.
3462306a36Sopenharmony_ci */
3562306a36Sopenharmony_cistruct cpu_operations {
3662306a36Sopenharmony_ci	const char	*name;
3762306a36Sopenharmony_ci	int		(*cpu_init)(unsigned int);
3862306a36Sopenharmony_ci	int		(*cpu_prepare)(unsigned int);
3962306a36Sopenharmony_ci	int		(*cpu_boot)(unsigned int);
4062306a36Sopenharmony_ci	void		(*cpu_postboot)(void);
4162306a36Sopenharmony_ci#ifdef CONFIG_HOTPLUG_CPU
4262306a36Sopenharmony_ci	bool		(*cpu_can_disable)(unsigned int cpu);
4362306a36Sopenharmony_ci	int		(*cpu_disable)(unsigned int cpu);
4462306a36Sopenharmony_ci	void		(*cpu_die)(unsigned int cpu);
4562306a36Sopenharmony_ci	int		(*cpu_kill)(unsigned int cpu);
4662306a36Sopenharmony_ci#endif
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciint __init init_cpu_ops(int cpu);
5062306a36Sopenharmony_ciextern const struct cpu_operations *get_cpu_ops(int cpu);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_cistatic inline void __init init_bootcpu_ops(void)
5362306a36Sopenharmony_ci{
5462306a36Sopenharmony_ci	init_cpu_ops(0);
5562306a36Sopenharmony_ci}
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#endif /* ifndef __ASM_CPU_OPS_H */
58