Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-or-later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Xen Event Channels (internal header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2013 Citrix Systems R&D Ltd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef __EVENTS_INTERNAL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define __EVENTS_INTERNAL_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) struct evtchn_loop_ctrl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) struct evtchn_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	unsigned (*max_channels)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	unsigned (*nr_channels)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	int (*setup)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	void (*remove)(evtchn_port_t port, unsigned int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	void (*bind_to_cpu)(evtchn_port_t evtchn, unsigned int cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 			    unsigned int old_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	void (*clear_pending)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	void (*set_pending)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	bool (*is_pending)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	void (*mask)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	void (*unmask)(evtchn_port_t port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	void (*handle_events)(unsigned cpu, struct evtchn_loop_ctrl *ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	void (*resume)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	int (*percpu_init)(unsigned int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	int (*percpu_deinit)(unsigned int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) extern const struct evtchn_ops *evtchn_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) int get_evtchn_to_irq(evtchn_port_t evtchn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) unsigned int cpu_from_evtchn(evtchn_port_t evtchn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static inline unsigned xen_evtchn_max_channels(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	return evtchn_ops->max_channels();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  * Do any ABI specific setup for a bound event channel before it can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * be unmasked and used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static inline int xen_evtchn_port_setup(evtchn_port_t evtchn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	if (evtchn_ops->setup)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		return evtchn_ops->setup(evtchn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) static inline void xen_evtchn_port_remove(evtchn_port_t evtchn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 					  unsigned int cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	if (evtchn_ops->remove)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		evtchn_ops->remove(evtchn, cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static inline void xen_evtchn_port_bind_to_cpu(evtchn_port_t evtchn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 					       unsigned int cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 					       unsigned int old_cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	evtchn_ops->bind_to_cpu(evtchn, cpu, old_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static inline void clear_evtchn(evtchn_port_t port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	evtchn_ops->clear_pending(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) static inline void set_evtchn(evtchn_port_t port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	evtchn_ops->set_pending(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) static inline bool test_evtchn(evtchn_port_t port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	return evtchn_ops->is_pending(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static inline void mask_evtchn(evtchn_port_t port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	return evtchn_ops->mask(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) static inline void unmask_evtchn(evtchn_port_t port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	return evtchn_ops->unmask(port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static inline void xen_evtchn_handle_events(unsigned cpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 					    struct evtchn_loop_ctrl *ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	return evtchn_ops->handle_events(cpu, ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static inline void xen_evtchn_resume(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	if (evtchn_ops->resume)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		evtchn_ops->resume();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) void xen_evtchn_2l_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) int xen_evtchn_fifo_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) #endif /* #ifndef __EVENTS_INTERNAL_H__ */