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