18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * arch/arm/include/asm/bL_switcher.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Created by: Nicolas Pitre, April 2012 68c2ecf20Sopenharmony_ci * Copyright: (C) 2012-2013 Linaro Limited 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef ASM_BL_SWITCHER_H 108c2ecf20Sopenharmony_ci#define ASM_BL_SWITCHER_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <linux/compiler.h> 138c2ecf20Sopenharmony_ci#include <linux/types.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_citypedef void (*bL_switch_completion_handler)(void *cookie); 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciint bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id, 188c2ecf20Sopenharmony_ci bL_switch_completion_handler completer, 198c2ecf20Sopenharmony_ci void *completer_cookie); 208c2ecf20Sopenharmony_cistatic inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id) 218c2ecf20Sopenharmony_ci{ 228c2ecf20Sopenharmony_ci return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL); 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * Register here to be notified about runtime enabling/disabling of 278c2ecf20Sopenharmony_ci * the switcher. 288c2ecf20Sopenharmony_ci * 298c2ecf20Sopenharmony_ci * The notifier chain is called with the switcher activation lock held: 308c2ecf20Sopenharmony_ci * the switcher will not be enabled or disabled during callbacks. 318c2ecf20Sopenharmony_ci * Callbacks must not call bL_switcher_{get,put}_enabled(). 328c2ecf20Sopenharmony_ci */ 338c2ecf20Sopenharmony_ci#define BL_NOTIFY_PRE_ENABLE 0 348c2ecf20Sopenharmony_ci#define BL_NOTIFY_POST_ENABLE 1 358c2ecf20Sopenharmony_ci#define BL_NOTIFY_PRE_DISABLE 2 368c2ecf20Sopenharmony_ci#define BL_NOTIFY_POST_DISABLE 3 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#ifdef CONFIG_BL_SWITCHER 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ciint bL_switcher_register_notifier(struct notifier_block *nb); 418c2ecf20Sopenharmony_ciint bL_switcher_unregister_notifier(struct notifier_block *nb); 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci/* 448c2ecf20Sopenharmony_ci * Use these functions to temporarily prevent enabling/disabling of 458c2ecf20Sopenharmony_ci * the switcher. 468c2ecf20Sopenharmony_ci * bL_switcher_get_enabled() returns true if the switcher is currently 478c2ecf20Sopenharmony_ci * enabled. Each call to bL_switcher_get_enabled() must be followed 488c2ecf20Sopenharmony_ci * by a call to bL_switcher_put_enabled(). These functions are not 498c2ecf20Sopenharmony_ci * recursive. 508c2ecf20Sopenharmony_ci */ 518c2ecf20Sopenharmony_cibool bL_switcher_get_enabled(void); 528c2ecf20Sopenharmony_civoid bL_switcher_put_enabled(void); 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciint bL_switcher_trace_trigger(void); 558c2ecf20Sopenharmony_ciint bL_switcher_get_logical_index(u32 mpidr); 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#else 588c2ecf20Sopenharmony_cistatic inline int bL_switcher_register_notifier(struct notifier_block *nb) 598c2ecf20Sopenharmony_ci{ 608c2ecf20Sopenharmony_ci return 0; 618c2ecf20Sopenharmony_ci} 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_cistatic inline int bL_switcher_unregister_notifier(struct notifier_block *nb) 648c2ecf20Sopenharmony_ci{ 658c2ecf20Sopenharmony_ci return 0; 668c2ecf20Sopenharmony_ci} 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_cistatic inline bool bL_switcher_get_enabled(void) { return false; } 698c2ecf20Sopenharmony_cistatic inline void bL_switcher_put_enabled(void) { } 708c2ecf20Sopenharmony_cistatic inline int bL_switcher_trace_trigger(void) { return 0; } 718c2ecf20Sopenharmony_cistatic inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; } 728c2ecf20Sopenharmony_ci#endif /* CONFIG_BL_SWITCHER */ 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci#endif 75