1 /* $Id: ebus.h,v 1.10 2001/03/14 05:00:55 davem Exp $
2  * ebus.h: PCI to Ebus pseudo driver software state.
3  *
4  * Copyright (C) 1997 Eddie C. Dost (ecd@skynet.be)
5  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
6  */
7 
8 #ifndef __SPARC64_EBUS_H
9 #define __SPARC64_EBUS_H
10 
11 #include <asm/pbm.h>
12 #include <asm/oplib.h>
13 
14 struct linux_ebus_child {
15 	struct linux_ebus_child		*next;
16 	struct linux_ebus_device	*parent;
17 	struct linux_ebus		*bus;
18 	int				 prom_node;
19 	char				 prom_name[64];
20 	struct resource			 resource[PROMREG_MAX];
21 	int				 num_addrs;
22 	unsigned int			 irqs[PROMINTR_MAX];
23 	int				 num_irqs;
24 };
25 
26 struct linux_ebus_device {
27 	struct linux_ebus_device	*next;
28 	struct linux_ebus_child		*children;
29 	struct linux_ebus		*bus;
30 	int				 prom_node;
31 	char				 prom_name[64];
32 	struct resource			 resource[PROMREG_MAX];
33 	int				 num_addrs;
34 	unsigned int			 irqs[PROMINTR_MAX];
35 	int				 num_irqs;
36 };
37 
38 struct linux_ebus {
39 	struct linux_ebus		*next;
40 	struct linux_ebus_device	*devices;
41 	struct pci_pbm_info		*parent;
42 	struct pci_dev			*self;
43 	int				 index;
44 	int				 is_rio;
45 	int				 prom_node;
46 	char				 prom_name[64];
47 	struct linux_prom_ebus_ranges	 ebus_ranges[PROMREG_MAX];
48 	int				 num_ebus_ranges;
49 	struct linux_prom_ebus_intmap	 ebus_intmap[PROMREG_MAX];
50 	int				 num_ebus_intmap;
51 	struct linux_prom_ebus_intmask	 ebus_intmask;
52 };
53 
54 struct linux_ebus_dma {
55 	unsigned int dcsr;
56 	unsigned int dacr;
57 	unsigned int dbcr;
58 };
59 
60 #define EBUS_DCSR_INT_PEND	0x00000001
61 #define EBUS_DCSR_ERR_PEND	0x00000002
62 #define EBUS_DCSR_DRAIN		0x00000004
63 #define EBUS_DCSR_INT_EN	0x00000010
64 #define EBUS_DCSR_RESET		0x00000080
65 #define EBUS_DCSR_WRITE		0x00000100
66 #define EBUS_DCSR_EN_DMA	0x00000200
67 #define EBUS_DCSR_CYC_PEND	0x00000400
68 #define EBUS_DCSR_DIAG_RD_DONE	0x00000800
69 #define EBUS_DCSR_DIAG_WR_DONE	0x00001000
70 #define EBUS_DCSR_EN_CNT	0x00002000
71 #define EBUS_DCSR_TC		0x00004000
72 #define EBUS_DCSR_DIS_CSR_DRN	0x00010000
73 #define EBUS_DCSR_BURST_SZ_MASK	0x000c0000
74 #define EBUS_DCSR_BURST_SZ_1	0x00080000
75 #define EBUS_DCSR_BURST_SZ_4	0x00000000
76 #define EBUS_DCSR_BURST_SZ_8	0x00040000
77 #define EBUS_DCSR_BURST_SZ_16	0x000c0000
78 #define EBUS_DCSR_DIAG_EN	0x00100000
79 #define EBUS_DCSR_DIS_ERR_PEND	0x00400000
80 #define EBUS_DCSR_TCI_DIS	0x00800000
81 #define EBUS_DCSR_EN_NEXT	0x01000000
82 #define EBUS_DCSR_DMA_ON	0x02000000
83 #define EBUS_DCSR_A_LOADED	0x04000000
84 #define EBUS_DCSR_NA_LOADED	0x08000000
85 #define EBUS_DCSR_DEV_ID_MASK	0xf0000000
86 
87 extern struct linux_ebus		*ebus_chain;
88 
89 extern void ebus_init(void);
90 
91 #define for_each_ebus(bus)						\
92         for((bus) = ebus_chain; (bus); (bus) = (bus)->next)
93 
94 #define for_each_ebusdev(dev, bus)					\
95         for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
96 
97 #define for_each_edevchild(dev, child)					\
98         for((child) = (dev)->children; (child); (child) = (child)->next)
99 
100 #endif /* !(__SPARC64_EBUS_H) */
101