162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * arch/arm/include/asm/bL_switcher.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Created by: Nicolas Pitre, April 2012 662306a36Sopenharmony_ci * Copyright: (C) 2012-2013 Linaro Limited 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef ASM_BL_SWITCHER_H 1062306a36Sopenharmony_ci#define ASM_BL_SWITCHER_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/compiler.h> 1362306a36Sopenharmony_ci#include <linux/types.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_citypedef void (*bL_switch_completion_handler)(void *cookie); 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciint bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id, 1862306a36Sopenharmony_ci bL_switch_completion_handler completer, 1962306a36Sopenharmony_ci void *completer_cookie); 2062306a36Sopenharmony_cistatic inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id) 2162306a36Sopenharmony_ci{ 2262306a36Sopenharmony_ci return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL); 2362306a36Sopenharmony_ci} 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* 2662306a36Sopenharmony_ci * Register here to be notified about runtime enabling/disabling of 2762306a36Sopenharmony_ci * the switcher. 2862306a36Sopenharmony_ci * 2962306a36Sopenharmony_ci * The notifier chain is called with the switcher activation lock held: 3062306a36Sopenharmony_ci * the switcher will not be enabled or disabled during callbacks. 3162306a36Sopenharmony_ci * Callbacks must not call bL_switcher_{get,put}_enabled(). 3262306a36Sopenharmony_ci */ 3362306a36Sopenharmony_ci#define BL_NOTIFY_PRE_ENABLE 0 3462306a36Sopenharmony_ci#define BL_NOTIFY_POST_ENABLE 1 3562306a36Sopenharmony_ci#define BL_NOTIFY_PRE_DISABLE 2 3662306a36Sopenharmony_ci#define BL_NOTIFY_POST_DISABLE 3 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#ifdef CONFIG_BL_SWITCHER 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ciint bL_switcher_register_notifier(struct notifier_block *nb); 4162306a36Sopenharmony_ciint bL_switcher_unregister_notifier(struct notifier_block *nb); 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci/* 4462306a36Sopenharmony_ci * Use these functions to temporarily prevent enabling/disabling of 4562306a36Sopenharmony_ci * the switcher. 4662306a36Sopenharmony_ci * bL_switcher_get_enabled() returns true if the switcher is currently 4762306a36Sopenharmony_ci * enabled. Each call to bL_switcher_get_enabled() must be followed 4862306a36Sopenharmony_ci * by a call to bL_switcher_put_enabled(). These functions are not 4962306a36Sopenharmony_ci * recursive. 5062306a36Sopenharmony_ci */ 5162306a36Sopenharmony_cibool bL_switcher_get_enabled(void); 5262306a36Sopenharmony_civoid bL_switcher_put_enabled(void); 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ciint bL_switcher_trace_trigger(void); 5562306a36Sopenharmony_ciint bL_switcher_get_logical_index(u32 mpidr); 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci#else 5862306a36Sopenharmony_cistatic inline int bL_switcher_register_notifier(struct notifier_block *nb) 5962306a36Sopenharmony_ci{ 6062306a36Sopenharmony_ci return 0; 6162306a36Sopenharmony_ci} 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_cistatic inline int bL_switcher_unregister_notifier(struct notifier_block *nb) 6462306a36Sopenharmony_ci{ 6562306a36Sopenharmony_ci return 0; 6662306a36Sopenharmony_ci} 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_cistatic inline bool bL_switcher_get_enabled(void) { return false; } 6962306a36Sopenharmony_cistatic inline void bL_switcher_put_enabled(void) { } 7062306a36Sopenharmony_cistatic inline int bL_switcher_trace_trigger(void) { return 0; } 7162306a36Sopenharmony_cistatic inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; } 7262306a36Sopenharmony_ci#endif /* CONFIG_BL_SWITCHER */ 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci#endif 75