0001
0002 #ifndef _SPARC64_MDESC_H
0003 #define _SPARC64_MDESC_H
0004
0005 #include <linux/types.h>
0006 #include <linux/cpumask.h>
0007 #include <asm/prom.h>
0008
0009 struct mdesc_handle;
0010
0011
0012
0013
0014
0015
0016 struct mdesc_handle *mdesc_grab(void);
0017 void mdesc_release(struct mdesc_handle *);
0018
0019 #define MDESC_NODE_NULL (~(u64)0)
0020 #define MDESC_MAX_STR_LEN 256
0021
0022 u64 mdesc_node_by_name(struct mdesc_handle *handle,
0023 u64 from_node, const char *name);
0024 #define mdesc_for_each_node_by_name(__hdl, __node, __name) \
0025 for (__node = mdesc_node_by_name(__hdl, MDESC_NODE_NULL, __name); \
0026 (__node) != MDESC_NODE_NULL; \
0027 __node = mdesc_node_by_name(__hdl, __node, __name))
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 const void *mdesc_get_property(struct mdesc_handle *handle,
0040 u64 node, const char *name, int *lenp);
0041 const char *mdesc_node_name(struct mdesc_handle *hp, u64 node);
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052 #define MDESC_ARC_TYPE_FWD "fwd"
0053 #define MDESC_ARC_TYPE_BACK "back"
0054
0055 u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
0056 const char *arc_type);
0057 #define mdesc_for_each_arc(__arc, __hdl, __node, __type) \
0058 for (__arc = mdesc_next_arc(__hdl, __node, __type); \
0059 (__arc) != MDESC_NODE_NULL; \
0060 __arc = mdesc_next_arc(__hdl, __arc, __type))
0061
0062 u64 mdesc_arc_target(struct mdesc_handle *hp, u64 arc);
0063
0064 void mdesc_update(void);
0065
0066 struct mdesc_notifier_client {
0067 void (*add)(struct mdesc_handle *handle, u64 node,
0068 const char *node_name);
0069 void (*remove)(struct mdesc_handle *handle, u64 node,
0070 const char *node_name);
0071 const char *node_name;
0072 struct mdesc_notifier_client *next;
0073 };
0074
0075 void mdesc_register_notifier(struct mdesc_notifier_client *client);
0076
0077 union md_node_info {
0078 struct vdev_port {
0079 u64 id;
0080 u64 parent_cfg_hdl;
0081 const char *name;
0082 } vdev_port;
0083 struct ds_port {
0084 u64 id;
0085 } ds_port;
0086 };
0087
0088 u64 mdesc_get_node(struct mdesc_handle *hp, const char *node_name,
0089 union md_node_info *node_info);
0090 int mdesc_get_node_info(struct mdesc_handle *hp, u64 node,
0091 const char *node_name, union md_node_info *node_info);
0092
0093 void mdesc_fill_in_cpu_data(cpumask_t *mask);
0094 void mdesc_populate_present_mask(cpumask_t *mask);
0095 void mdesc_get_page_sizes(cpumask_t *mask, unsigned long *pgsz_mask);
0096
0097 void sun4v_mdesc_init(void);
0098
0099 #endif