diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2007-07-12 16:47:50 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-16 07:04:28 -0400 |
commit | 43fdf27470b216ebdef47e09ff83bed2f2894b13 (patch) | |
tree | 76b9b838089e5679471026037c93325c228df84a /include/asm-sparc64/mdesc.h | |
parent | 133f09a169f3022be3de671b29658b7ecb375022 (diff) |
[SPARC64]: Abstract out mdesc accesses for better MD update handling.
Since we have to be able to handle MD updates, having an in-tree
set of data structures representing the MD objects actually makes
things more painful.
The MD itself is easy to parse, and we can implement the existing
interfaces using direct parsing of the MD binary image.
The MD is now reference counted, so accesses have to now take the
form:
handle = mdesc_grab();
... operations on MD ...
mdesc_release(handle);
The only remaining issue are cases where code holds on to references
to MD property values. mdesc_get_property() returns a direct pointer
to the property value, most cases just pull in the information they
need and discard the pointer, but there are few that use the pointer
directly over a long lifetime. Those will be fixed up in a subsequent
changeset.
A preliminary handler for MD update events from domain services is
there, it is rudimentry but it works and handles all of the reference
counting. It does not check the generation number of the MDs,
and it does not generate a "add/delete" list for notification to
interesting parties about MD changes but that will be forthcoming.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/mdesc.h')
-rw-r--r-- | include/asm-sparc64/mdesc.h | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h index c6383982b53..bbb0c0bed48 100644 --- a/include/asm-sparc64/mdesc.h +++ b/include/asm-sparc64/mdesc.h | |||
@@ -4,36 +4,43 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <asm/prom.h> | 5 | #include <asm/prom.h> |
6 | 6 | ||
7 | struct mdesc_node; | 7 | struct mdesc_handle; |
8 | struct mdesc_arc { | 8 | |
9 | const char *name; | 9 | /* Machine description operations are to be surrounded by grab and |
10 | struct mdesc_node *arc; | 10 | * release calls. The mdesc_handle returned from the grab is |
11 | }; | 11 | * the first argument to all of the operational calls that work |
12 | 12 | * on mdescs. | |
13 | struct mdesc_node { | 13 | */ |
14 | const char *name; | 14 | extern struct mdesc_handle *mdesc_grab(void); |
15 | u64 node; | 15 | extern void mdesc_release(struct mdesc_handle *); |
16 | unsigned int unique_id; | 16 | |
17 | unsigned int num_arcs; | 17 | #define MDESC_NODE_NULL (~(u64)0) |
18 | unsigned int irqs[2]; | 18 | |
19 | struct property *properties; | 19 | extern u64 mdesc_node_by_name(struct mdesc_handle *handle, |
20 | struct mdesc_node *hash_next; | 20 | u64 from_node, const char *name); |
21 | struct mdesc_node *allnodes_next; | 21 | #define mdesc_for_each_node_by_name(__hdl, __node, __name) \ |
22 | struct mdesc_arc arcs[0]; | 22 | for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \ |
23 | }; | 23 | (__node) != MDESC_NODE_NULL; \ |
24 | 24 | __node = mdesc_node_by_name(__hdl, __node, __name)) | |
25 | extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, | 25 | |
26 | const char *name); | 26 | extern const void *mdesc_get_property(struct mdesc_handle *handle, |
27 | #define md_for_each_node_by_name(__mn, __name) \ | 27 | u64 node, const char *name, int *lenp); |
28 | for (__mn = md_find_node_by_name(NULL, __name); __mn; \ | 28 | |
29 | __mn = md_find_node_by_name(__mn, __name)) | 29 | #define MDESC_ARC_TYPE_FWD "fwd" |
30 | 30 | #define MDESC_ARC_TYPE_BACK "back" | |
31 | extern struct property *md_find_property(const struct mdesc_node *mp, | 31 | |
32 | const char *name, | 32 | extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from, |
33 | int *lenp); | 33 | const char *arc_type); |
34 | extern const void *md_get_property(const struct mdesc_node *mp, | 34 | #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \ |
35 | const char *name, | 35 | for (__arc = mdesc_next_arc(__hdl, __node, __type); \ |
36 | int *lenp); | 36 | (__arc) != MDESC_NODE_NULL; \ |
37 | __arc = mdesc_next_arc(__hdl, __arc, __type)) | ||
38 | |||
39 | extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc); | ||
40 | |||
41 | extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node); | ||
42 | |||
43 | extern void mdesc_update(void); | ||
37 | 44 | ||
38 | extern void sun4v_mdesc_init(void); | 45 | extern void sun4v_mdesc_init(void); |
39 | 46 | ||