blob: bbb0c0bed486051527a26ee5f75b5ed6707c6259 [file] [log] [blame]
David S. Miller5cbc3072007-05-25 15:49:59 -07001#ifndef _SPARC64_MDESC_H
2#define _SPARC64_MDESC_H
3
4#include <linux/types.h>
5#include <asm/prom.h>
6
David S. Miller43fdf272007-07-12 13:47:50 -07007struct mdesc_handle;
David S. Miller5cbc3072007-05-25 15:49:59 -07008
David S. Miller43fdf272007-07-12 13:47:50 -07009/* Machine description operations are to be surrounded by grab and
10 * release calls. The mdesc_handle returned from the grab is
11 * the first argument to all of the operational calls that work
12 * on mdescs.
13 */
14extern struct mdesc_handle *mdesc_grab(void);
15extern void mdesc_release(struct mdesc_handle *);
David S. Miller5cbc3072007-05-25 15:49:59 -070016
David S. Miller43fdf272007-07-12 13:47:50 -070017#define MDESC_NODE_NULL (~(u64)0)
David S. Miller5cbc3072007-05-25 15:49:59 -070018
David S. Miller43fdf272007-07-12 13:47:50 -070019extern u64 mdesc_node_by_name(struct mdesc_handle *handle,
20 u64 from_node, const char *name);
21#define mdesc_for_each_node_by_name(__hdl, __node, __name) \
22 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
23 (__node) != MDESC_NODE_NULL; \
24 __node = mdesc_node_by_name(__hdl, __node, __name))
25
26extern const void *mdesc_get_property(struct mdesc_handle *handle,
27 u64 node, const char *name, int *lenp);
28
29#define MDESC_ARC_TYPE_FWD "fwd"
30#define MDESC_ARC_TYPE_BACK "back"
31
32extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
33 const char *arc_type);
34#define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
35 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
36 (__arc) != MDESC_NODE_NULL; \
37 __arc = mdesc_next_arc(__hdl, __arc, __type))
38
39extern u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
40
41extern const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
42
43extern void mdesc_update(void);
David S. Miller5cbc3072007-05-25 15:49:59 -070044
45extern void sun4v_mdesc_init(void);
46
47#endif