2 * ebus.h: PCI to Ebus pseudo driver software state.
4 * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
5 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
8 #ifndef __SPARC64_EBUS_H
9 #define __SPARC64_EBUS_H
11 #include <asm/oplib.h>
13 #include <asm/of_device.h>
15 struct linux_ebus_child {
16 struct linux_ebus_child *next;
17 struct linux_ebus_device *parent;
18 struct linux_ebus *bus;
19 struct device_node *prom_node;
20 struct resource resource[PROMREG_MAX];
22 unsigned int irqs[PROMINTR_MAX];
26 struct linux_ebus_device {
27 struct of_device ofdev;
28 struct linux_ebus_device *next;
29 struct linux_ebus_child *children;
30 struct linux_ebus *bus;
31 struct device_node *prom_node;
32 struct resource resource[PROMREG_MAX];
34 unsigned int irqs[PROMINTR_MAX];
37 #define to_ebus_device(d) container_of(d, struct linux_ebus_device, ofdev.dev)
40 struct of_device ofdev;
41 struct linux_ebus *next;
42 struct linux_ebus_device *devices;
46 struct device_node *prom_node;
48 #define to_ebus(d) container_of(d, struct linux_ebus, ofdev.dev)
50 struct ebus_dma_info {
55 #define EBUS_DMA_FLAG_USE_EBDMA_HANDLER 0x00000001
56 #define EBUS_DMA_FLAG_TCI_DISABLE 0x00000002
58 /* These are only valid is EBUS_DMA_FLAG_USE_EBDMA_HANDLER is
61 void (*callback)(struct ebus_dma_info *p, int event, void *cookie);
64 #define EBUS_DMA_EVENT_ERROR 1
65 #define EBUS_DMA_EVENT_DMA 2
66 #define EBUS_DMA_EVENT_DEVICE 4
68 unsigned char name[64];
71 extern int ebus_dma_register(struct ebus_dma_info *p);
72 extern int ebus_dma_irq_enable(struct ebus_dma_info *p, int on);
73 extern void ebus_dma_unregister(struct ebus_dma_info *p);
74 extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
76 extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
77 extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
78 extern unsigned int ebus_dma_addr(struct ebus_dma_info *p);
79 extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
81 extern struct linux_ebus *ebus_chain;
83 extern void ebus_init(void);
85 #define for_each_ebus(bus) \
86 for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
88 #define for_each_ebusdev(dev, bus) \
89 for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
91 #define for_each_edevchild(dev, child) \
92 for((child) = (dev)->children; (child); (child) = (child)->next)
94 #endif /* !(__SPARC64_EBUS_H) */