aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc64')
-rw-r--r--include/asm-sparc64/mdesc.h67
-rw-r--r--include/asm-sparc64/vio.h23
2 files changed, 48 insertions, 42 deletions
diff --git a/include/asm-sparc64/mdesc.h b/include/asm-sparc64/mdesc.h
index c6383982b53d..bbb0c0bed486 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
7struct mdesc_node; 7struct mdesc_handle;
8struct 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.
13struct mdesc_node { 13 */
14 const char *name; 14extern struct mdesc_handle *mdesc_grab(void);
15 u64 node; 15extern 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; 19extern 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))
25extern struct mdesc_node *md_find_node_by_name(struct mdesc_node *from, 25
26 const char *name); 26extern 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"
31extern struct property *md_find_property(const struct mdesc_node *mp, 31
32 const char *name, 32extern u64 mdesc_next_arc(struct mdesc_handle *handle, u64 from,
33 int *lenp); 33 const char *arc_type);
34extern 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
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);
37 44
38extern void sun4v_mdesc_init(void); 45extern void sun4v_mdesc_init(void);
39 46
diff --git a/include/asm-sparc64/vio.h b/include/asm-sparc64/vio.h
index 47c3da76dcb8..a8a53e6fc250 100644
--- a/include/asm-sparc64/vio.h
+++ b/include/asm-sparc64/vio.h
@@ -265,13 +265,18 @@ static inline u32 vio_dring_avail(struct vio_dring_state *dr,
265} 265}
266 266
267struct vio_dev { 267struct vio_dev {
268 struct mdesc_node *mp; 268 u64 mp;
269 struct device_node *dp; 269 struct device_node *dp;
270 270
271 const char *type; 271 const char *type;
272 const char *compat; 272 const char *compat;
273 int compat_len; 273 int compat_len;
274 274
275 unsigned long channel_id;
276
277 unsigned int tx_irq;
278 unsigned int rx_irq;
279
275 struct device dev; 280 struct device dev;
276}; 281};
277 282
@@ -345,16 +350,10 @@ struct vio_driver_state {
345 350
346 struct vio_dev *vdev; 351 struct vio_dev *vdev;
347 352
348 unsigned long channel_id;
349 unsigned int tx_irq;
350 unsigned int rx_irq;
351
352 struct timer_list timer; 353 struct timer_list timer;
353 354
354 struct vio_version ver; 355 struct vio_version ver;
355 356
356 struct mdesc_node *endpoint;
357
358 struct vio_version *ver_table; 357 struct vio_version *ver_table;
359 int ver_table_entries; 358 int ver_table_entries;
360 359
@@ -365,7 +364,8 @@ struct vio_driver_state {
365 364
366#define viodbg(TYPE, f, a...) \ 365#define viodbg(TYPE, f, a...) \
367do { if (vio->debug & VIO_DEBUG_##TYPE) \ 366do { if (vio->debug & VIO_DEBUG_##TYPE) \
368 printk(KERN_INFO "vio: ID[%lu] " f, vio->channel_id, ## a); \ 367 printk(KERN_INFO "vio: ID[%lu] " f, \
368 vio->vdev->channel_id, ## a); \
369} while (0) 369} while (0)
370 370
371extern int vio_register_driver(struct vio_driver *drv); 371extern int vio_register_driver(struct vio_driver *drv);
@@ -392,11 +392,10 @@ extern int vio_ldc_alloc(struct vio_driver_state *vio,
392 struct ldc_channel_config *base_cfg, void *event_arg); 392 struct ldc_channel_config *base_cfg, void *event_arg);
393extern void vio_ldc_free(struct vio_driver_state *vio); 393extern void vio_ldc_free(struct vio_driver_state *vio);
394extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev, 394extern int vio_driver_init(struct vio_driver_state *vio, struct vio_dev *vdev,
395 u8 dev_class, struct mdesc_node *channel_endpoint, 395 u8 dev_class, struct vio_version *ver_table,
396 struct vio_version *ver_table, int ver_table_size, 396 int ver_table_size, struct vio_driver_ops *ops,
397 struct vio_driver_ops *ops, char *name); 397 char *name);
398 398
399extern struct mdesc_node *vio_find_endpoint(struct vio_dev *vdev);
400extern void vio_port_up(struct vio_driver_state *vio); 399extern void vio_port_up(struct vio_driver_state *vio);
401 400
402#endif /* _SPARC64_VIO_H */ 401#endif /* _SPARC64_VIO_H */