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 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #ifndef _SPARC64_MDESC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #define _SPARC64_MDESC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/cpumask.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <asm/prom.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) struct mdesc_handle;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) /* Machine description operations are to be surrounded by grab and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * release calls.  The mdesc_handle returned from the grab is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * the first argument to all of the operational calls that work
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * on mdescs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) struct mdesc_handle *mdesc_grab(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void mdesc_release(struct mdesc_handle *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define MDESC_NODE_NULL		(~(u64)0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define MDESC_MAX_STR_LEN	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) u64 mdesc_node_by_name(struct mdesc_handle *handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		       u64 from_node, const char *name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define mdesc_for_each_node_by_name(__hdl, __node, __name) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	     (__node) != MDESC_NODE_NULL; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	     __node = mdesc_node_by_name(__hdl, __node, __name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) /* Access to property values returned from mdesc_get_property() are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  * only valid inside of a mdesc_grab()/mdesc_release() sequence.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  * Once mdesc_release() is called, the memory backed up by these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)  * pointers may reference freed up memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  * Therefore callers must make copies of any property values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  * they need.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  * These same rules apply to mdesc_node_name().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) const void *mdesc_get_property(struct mdesc_handle *handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 			       u64 node, const char *name, int *lenp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* MD arc iteration, the standard sequence is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  *	unsigned long arc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  *	mdesc_for_each_arc(arc, handle, node, MDESC_ARC_TYPE_{FWD,BACK}) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  *		unsigned long target = mdesc_arc_target(handle, arc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  *		...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  *	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define MDESC_ARC_TYPE_FWD	"fwd"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define MDESC_ARC_TYPE_BACK	"back"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 		   const char *arc_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	for (__arc = mdesc_next_arc(__hdl, __node, __type); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	     (__arc) != MDESC_NODE_NULL; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	     __arc = mdesc_next_arc(__hdl, __arc, __type))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) void mdesc_update(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct mdesc_notifier_client {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	void (*add)(struct mdesc_handle *handle, u64 node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		    const char *node_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	void (*remove)(struct mdesc_handle *handle, u64 node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 		       const char *node_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	const char			*node_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	struct mdesc_notifier_client	*next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) void mdesc_register_notifier(struct mdesc_notifier_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) union md_node_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	struct vdev_port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 		u64 id;				/* id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 		u64 parent_cfg_hdl;		/* parent config handle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 		const char *name;		/* name (property) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 	} vdev_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 	struct ds_port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 		u64 id;				/* id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 	} ds_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) u64 mdesc_get_node(struct mdesc_handle *hp, const char *node_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 		   union md_node_info *node_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) int mdesc_get_node_info(struct mdesc_handle *hp, u64 node,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 			const char *node_name, union md_node_info *node_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) void mdesc_fill_in_cpu_data(cpumask_t *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) void mdesc_populate_present_mask(cpumask_t *mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) void sun4v_mdesc_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #endif