Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * arch/arm/include/asm/bL_switcher.h
0004  *
0005  * Created by:  Nicolas Pitre, April 2012
0006  * Copyright:   (C) 2012-2013  Linaro Limited
0007  */
0008 
0009 #ifndef ASM_BL_SWITCHER_H
0010 #define ASM_BL_SWITCHER_H
0011 
0012 #include <linux/compiler.h>
0013 #include <linux/types.h>
0014 
0015 typedef void (*bL_switch_completion_handler)(void *cookie);
0016 
0017 int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
0018              bL_switch_completion_handler completer,
0019              void *completer_cookie);
0020 static inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
0021 {
0022     return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
0023 }
0024 
0025 /*
0026  * Register here to be notified about runtime enabling/disabling of
0027  * the switcher.
0028  *
0029  * The notifier chain is called with the switcher activation lock held:
0030  * the switcher will not be enabled or disabled during callbacks.
0031  * Callbacks must not call bL_switcher_{get,put}_enabled().
0032  */
0033 #define BL_NOTIFY_PRE_ENABLE    0
0034 #define BL_NOTIFY_POST_ENABLE   1
0035 #define BL_NOTIFY_PRE_DISABLE   2
0036 #define BL_NOTIFY_POST_DISABLE  3
0037 
0038 #ifdef CONFIG_BL_SWITCHER
0039 
0040 int bL_switcher_register_notifier(struct notifier_block *nb);
0041 int bL_switcher_unregister_notifier(struct notifier_block *nb);
0042 
0043 /*
0044  * Use these functions to temporarily prevent enabling/disabling of
0045  * the switcher.
0046  * bL_switcher_get_enabled() returns true if the switcher is currently
0047  * enabled.  Each call to bL_switcher_get_enabled() must be followed
0048  * by a call to bL_switcher_put_enabled().  These functions are not
0049  * recursive.
0050  */
0051 bool bL_switcher_get_enabled(void);
0052 void bL_switcher_put_enabled(void);
0053 
0054 int bL_switcher_trace_trigger(void);
0055 int bL_switcher_get_logical_index(u32 mpidr);
0056 
0057 #else
0058 static inline int bL_switcher_register_notifier(struct notifier_block *nb)
0059 {
0060     return 0;
0061 }
0062 
0063 static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
0064 {
0065     return 0;
0066 }
0067 
0068 static inline bool bL_switcher_get_enabled(void) { return false; }
0069 static inline void bL_switcher_put_enabled(void) { }
0070 static inline int bL_switcher_trace_trigger(void) { return 0; }
0071 static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; }
0072 #endif /* CONFIG_BL_SWITCHER */
0073 
0074 #endif