1
2 #ifndef _SPARC64_MDESC_H
3 #define _SPARC64_MDESC_H
4
5 #include <linux/types.h>
6 #include <linux/cpumask.h>
7 #include <asm/prom.h>
8
9 struct mdesc_handle;
10
11
12
13
14
15
16 struct mdesc_handle *mdesc_grab(void);
17 void mdesc_release(struct mdesc_handle *);
18
19 #define MDESC_NODE_NULL (~(u64)0)
20 #define MDESC_MAX_STR_LEN 256
21
22 u64 mdesc_node_by_name(struct mdesc_handle *handle,
23 u64 from_node, const char *name);
24 #define mdesc_for_each_node_by_name(__hdl, __node, __name) \
25 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
26 (__node) != MDESC_NODE_NULL; \
27 __node = mdesc_node_by_name(__hdl, __node, __name))
28
29
30
31
32
33
34
35
36
37
38
39 const void *mdesc_get_property(struct mdesc_handle *handle,
40 u64 node, const char *name, int *lenp);
41 const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
42
43
44
45
46
47
48
49
50
51
52 #define MDESC_ARC_TYPE_FWD "fwd"
53 #define MDESC_ARC_TYPE_BACK "back"
54
55 u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
56 const char *arc_type);
57 #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
58 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
59 (__arc) != MDESC_NODE_NULL; \
60 __arc = mdesc_next_arc(__hdl, __arc, __type))
61
62 u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
63
64 void mdesc_update(void);
65
66 struct mdesc_notifier_client {
67 void (*add)(struct mdesc_handle *handle, u64 node,
68 const char *node_name);
69 void (*remove)(struct mdesc_handle *handle, u64 node,
70 const char *node_name);
71 const char *node_name;
72 struct mdesc_notifier_client *next;
73 };
74
75 void mdesc_register_notifier(struct mdesc_notifier_client *client);
76
77 union md_node_info {
78 struct vdev_port {
79 u64 id;
80 u64 parent_cfg_hdl;
81 const char *name;
82 } vdev_port;
83 struct ds_port {
84 u64 id;
85 } ds_port;
86 };
87
88 u64 mdesc_get_node(struct mdesc_handle *hp, const char *node_name,
89 union md_node_info *node_info);
90 int mdesc_get_node_info(struct mdesc_handle *hp, u64 node,
91 const char *node_name, union md_node_info *node_info);
92
93 void mdesc_fill_in_cpu_data(cpumask_t *mask);
94 void mdesc_populate_present_mask(cpumask_t *mask);
95 void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask);
96
97 void sun4v_mdesc_init(void);
98
99 #endif