diff options
Diffstat (limited to 'include/asm-sparc64/mdesc.h')
-rw-r--r-- | include/asm-sparc64/mdesc.h | 88 |
1 files changed, 58 insertions, 30 deletions
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h index c6383982b53d..e97c43133752 100644 --- a/include/asm-sparc64/mdesc.h +++ b/include/asm-sparc64/mdesc.h | |||
@@ -2,38 +2,66 @@ | |||
2 | #define _SPARC64_MDESC_H | 2 | #define _SPARC64_MDESC_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/cpumask.h> | ||
5 | #include <asm/prom.h> | 6 | #include <asm/prom.h> |
6 | 7 | ||
7 | struct mdesc_node; | 8 | struct mdesc_handle; |
8 | struct mdesc_arc { | 9 | |
9 | const char *name; | 10 | /* Machine description operations are to be surrounded by grab and |
10 | struct mdesc_node *arc; | 11 | * release calls. The mdesc_handle returned from the grab is |
11 | }; | 12 | * the first argument to all of the operational calls that work |
12 | 13 | * on mdescs. | |
13 | struct mdesc_node { | 14 | */ |
14 | const char *name; | 15 | extern struct mdesc_handle *mdesc_grab(void); |
15 | u64 node; | 16 | extern void mdesc_release(struct mdesc_handle *); |
16 | unsigned int unique_id; | 17 | |
17 | unsigned int num_arcs; | 18 | #define MDESC_NODE_NULL (~(u64)0) |
18 | unsigned int irqs[2]; | 19 | |
19 | struct property *properties; | 20 | extern u64 mdesc_node_by_name(struct mdesc_handle *handle, |
20 | struct mdesc_node *hash_next; | 21 | u64 from_node, const char *name); |
21 | struct mdesc_node *allnodes_next; | 22 | #define mdesc_for_each_node_by_name(__hdl, __node, __name) \ |
22 | struct mdesc_arc arcs[0]; | 23 | for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ |
23 | }; | 24 | (__node) != MDESC_NODE_NULL; \ |
24 | 25 | __node = mdesc_node_by_name(__hdl, __node, __name)) | |
25 | extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, | 26 | |
26 | const char *name); | 27 | /* Access to property values returned from mdesc_get_property() are |
27 | #define md_for_each_node_by_name(__mn, __name) \ | 28 | * only valid inside of a mdesc_grab()/mdesc_release() sequence. |
28 | for (__mn = md_find_node_by_name(NULL, __name); __mn; \ | 29 | * Once mdesc_release() is called, the memory backed up by these |
29 | __mn = md_find_node_by_name(__mn, __name)) | 30 | * pointers may reference freed up memory. |
30 | 31 | * | |
31 | extern struct property *md_find_property(const struct mdesc_node *mp, | 32 | * Therefore callers must make copies of any property values |
32 | const char *name, | 33 | * they need. |
33 | int *lenp); | 34 | * |
34 | extern const void *md_get_property(const struct mdesc_node *mp, | 35 | * These same rules apply to mdesc_node_name(). |
35 | const char *name, | 36 | */ |
36 | int *lenp); | 37 | extern const void *mdesc_get_property(struct mdesc_handle *handle, |
38 | u64 node, const char *name, int *lenp); | ||
39 | extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); | ||
40 | |||
41 | /* MD arc iteration, the standard sequence is: | ||
42 | * | ||
43 | * unsigned long arc; | ||
44 | * mdesc_for_each_arc(arc, handle, node, MDESC_ARC_TYPE_{FWD,BACK}) { | ||
45 | * unsigned long target = mdesc_arc_target(handle, arc); | ||
46 | * ... | ||
47 | * } | ||
48 | */ | ||
49 | |||
50 | #define MDESC_ARC_TYPE_FWD "fwd" | ||
51 | #define MDESC_ARC_TYPE_BACK "back" | ||
52 | |||
53 | extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, | ||
54 | const char *arc_type); | ||
55 | #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ | ||
56 | for (__arc = mdesc_next_arc(__hdl, __node, __type); \ | ||
57 | (__arc) != MDESC_NODE_NULL; \ | ||
58 | __arc = mdesc_next_arc(__hdl, __arc, __type)) | ||
59 | |||
60 | extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); | ||
61 | |||
62 | extern void mdesc_update(void); | ||
63 | |||
64 | extern void mdesc_fill_in_cpu_data(cpumask_t mask); | ||
37 | 65 | ||
38 | extern void sun4v_mdesc_init(void); | 66 | extern void sun4v_mdesc_init(void); |
39 | 67 | ||