1 /*
2  * (C) Copyright 2009 Reinhard Arlt, reinhard.arlt@esd-electronics.com
3  *
4  * base on universe.h by
5  *
6  * (C) Copyright 2003 Stefan Roese, stefan.roese@esd-electronics.com
7  *
8  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24  * MA 02111-1307 USA
25  */
26 
27 #ifndef _tsi148_h
28 #define _tsi148_h
29 
30 #ifndef PCI_DEVICE_ID_TUNDRA_TSI148
31 #define PCI_DEVICE_ID_TUNDRA_TSI148 0x0148
32 #endif
33 
34 typedef struct _TSI148 TSI148;
35 typedef struct _OUTBOUND OUTBOUND;
36 typedef struct _INBOUND  INBOUND;
37 typedef struct _TDMA_CMD_PACKET TDMA_CMD_PACKET;
38 
39 struct _OUTBOUND {
40 	unsigned int otsau;                   /* 0x000 Outbound start       upper */
41 	unsigned int otsal;                   /* 0x004 Outbouud start       lower */
42 	unsigned int oteau;                   /* 0x008 Outbound end         upper */
43 	unsigned int oteal;                   /* 0x00c Outbound end         lower */
44 	unsigned int otofu;                   /* 0x010 Outbound translation upper */
45 	unsigned int otofl;                   /* 0x014 Outbound translation lower */
46 	unsigned int otbs;                    /* 0x018 Outbound translation 2eSST */
47 	unsigned int otat;                    /* 0x01c Outbound translation attr  */
48 };
49 
50 struct _INBOUND {
51 	unsigned int itsau;                   /* 0x000 inbound  start       upper */
52 	unsigned int itsal;                   /* 0x004 inbouud  start       lower */
53 	unsigned int iteau;                   /* 0x008 inbound  end         upper */
54 	unsigned int iteal;                   /* 0x00c inbound  end         lower */
55 	unsigned int itofu;                   /* 0x010 inbound  translation upper */
56 	unsigned int itofl;                   /* 0x014 inbound  translation lower */
57 	unsigned int itat;                    /* 0x018 inbound  translation attr  */
58 	unsigned int spare;                   /* 0x01c not used                   */
59 };
60 
61 struct _TSI148 {
62 	unsigned int pci_id;                  /* 0x000         */
63 	unsigned int pci_csr;                 /* 0x004         */
64 	unsigned int pci_class;               /* 0x008         */
65 	unsigned int pci_misc0;               /* 0x00c         */
66 	unsigned int pci_mbarl;               /* 0x010         */
67 	unsigned int pci_mbarh;               /* 0x014         */
68 	unsigned int spare0[(0x03c-0x018)/4]; /* 0x018         */
69 	unsigned int pci_misc1;               /* 0x03c         */
70 	unsigned int pci_pcixcap;             /* 0x040         */
71 	unsigned int pci_pcixstat;            /* 0x044         */
72 	unsigned int spare1[(0x100-0x048)/4]; /* 0x048         */
73 	OUTBOUND     outbound[8];             /* 0x100         */
74 	unsigned int viack[8];                /* 0x204         */
75 	unsigned int rmwau;                   /* 0x220         */
76 	unsigned int rmwal;                   /* 0x224         */
77 	unsigned int rmwen;                   /* 0x228         */
78 	unsigned int rmwc;                    /* 0x22c         */
79 	unsigned int rmws;                    /* 0x230         */
80 	unsigned int vmctrl;                  /* 0x234         */
81 	unsigned int vctrl;                   /* 0x238         */
82 	unsigned int vstat;                   /* 0x23c         */
83 	unsigned int pcsr;                    /* 0x240         */
84 	unsigned int spare2[3];               /* 0x244 - 0x24c */
85 	unsigned int vmefl;                   /* 0x250         */
86 	unsigned int spare3[3];               /* 0x254 - 0x25c */
87 	unsigned int veau;                    /* 0x260         */
88 	unsigned int veal;                    /* 0x264         */
89 	unsigned int veat;                    /* 0x268         */
90 	unsigned int spare4[1];               /* 0x26c         */
91 	unsigned int edpau;                   /* 0x270         */
92 	unsigned int edpal;                   /* 0x274         */
93 	unsigned int edpxa;                   /* 0x278         */
94 	unsigned int edpxs;                   /* 0x27c         */
95 	unsigned int edpat;                   /* 0x280         */
96 	unsigned int spare5[31];              /* 0x284 - 0x2fc */
97 	INBOUND      inbound[8];              /* 0x100         */
98 	unsigned int gbau;                    /* 0x400         */
99 	unsigned int gbal;                    /* 0x404         */
100 	unsigned int gcsrat;                  /* 0x408         */
101 	unsigned int cbau;                    /* 0x40c         */
102 	unsigned int cbal;                    /* 0x410         */
103 	unsigned int crgat;                   /* 0x414         */
104 	unsigned int crou;                    /* 0x418         */
105 	unsigned int crol;                    /* 0x41c         */
106 	unsigned int crat;                    /* 0x420         */
107 	unsigned int lmbau;                   /* 0x424         */
108 	unsigned int lmbal;                   /* 0x428         */
109 	unsigned int lmat;                    /* 0x42c         */
110 	unsigned int r64bcu;                  /* 0x430         */
111 	unsigned int r64bcl;                  /* 0x434         */
112 	unsigned int bpgtr;                   /* 0x438         */
113 	unsigned int bpctr;                   /* 0x43c         */
114 	unsigned int vicr;                    /* 0x440         */
115 	unsigned int spare6[1];               /* 0x444         */
116 	unsigned int inten;                   /* 0x448         */
117 	unsigned int inteo;                   /* 0x44c         */
118 	unsigned int ints;                    /* 0x450         */
119 	unsigned int intc;                    /* 0x454         */
120 	unsigned int intm1;                   /* 0x458         */
121 	unsigned int intm2;                   /* 0x45c         */
122 	unsigned int spare7[40];              /* 0x460 - 0x4fc */
123 	unsigned int dctl0;                   /* 0x500         */
124 	unsigned int dsta0;                   /* 0x504         */
125 	unsigned int dcsau0;                  /* 0x508         */
126 	unsigned int dcsal0;                  /* 0x50c         */
127 	unsigned int dcdau0;                  /* 0x510         */
128 	unsigned int dcdal0;                  /* 0x514         */
129 	unsigned int dclau0;                  /* 0x518         */
130 	unsigned int dclal0;                  /* 0x51c         */
131 	unsigned int dsau0;                   /* 0x520         */
132 	unsigned int dsal0;                   /* 0x524         */
133 	unsigned int ddau0;                   /* 0x528         */
134 	unsigned int ddal0;                   /* 0x52c         */
135 	unsigned int dsat0;                   /* 0x530         */
136 	unsigned int ddat0;                   /* 0x534         */
137 	unsigned int dnlau0;                  /* 0x538         */
138 	unsigned int dnlal0;                  /* 0x53c         */
139 	unsigned int dcnt0;                   /* 0x540         */
140 	unsigned int ddbs0;                   /* 0x544         */
141 	unsigned int r20[14];                 /* 0x548 - 0x57c */
142 	unsigned int dctl1;                   /* 0x580         */
143 	unsigned int dsta1;                   /* 0x584         */
144 	unsigned int dcsau1;                  /* 0x588         */
145 	unsigned int dcsal1;                  /* 0x58c         */
146 	unsigned int dcdau1;                  /* 0x590         */
147 	unsigned int dcdal1;                  /* 0x594         */
148 	unsigned int dclau1;                  /* 0x598         */
149 	unsigned int dclal1;                  /* 0x59c         */
150 	unsigned int dsau1;                   /* 0x5a0         */
151 	unsigned int dsal1;                   /* 0x5a4         */
152 	unsigned int ddau1;                   /* 0x5a8         */
153 	unsigned int ddal1;                   /* 0x5ac         */
154 	unsigned int dsat1;                   /* 0x5b0         */
155 	unsigned int ddat1;                   /* 0x5b4         */
156 	unsigned int dnlau1;                  /* 0x5b8         */
157 	unsigned int dnlal1;                  /* 0x5bc         */
158 	unsigned int dcnt1;                   /* 0x5c0         */
159 	unsigned int ddbs1;                   /* 0x5c4         */
160 	unsigned int r21[14];                 /* 0x5c8 - 0x5fc */
161 	unsigned int devi_veni_2;             /* 0x600         */
162 	unsigned int gctrl_ga_revid;          /* 0x604         */
163 	unsigned int semaphore0_1_2_3;        /* 0x608         */
164 	unsigned int semaphore4_5_6_7;        /* 0x60c         */
165 	unsigned int mbox0;                   /* 0x610         */
166 	unsigned int mbox1;                   /* 0x614         */
167 	unsigned int mbox2;                   /* 0x618         */
168 	unsigned int mbox3;                   /* 0x61c         */
169 	unsigned int r22[629];                /* 0x620 - 0xff0 */
170 	unsigned int csrbcr;                  /* 0xff4         */
171 	unsigned int csrbsr;                  /* 0xff8         */
172 	unsigned int cbar;                    /* 0xffc         */
173 };
174 
175 #define IRQ_VOWN	0x0001
176 #define IRQ_VIRQ1	0x0002
177 #define IRQ_VIRQ2	0x0004
178 #define IRQ_VIRQ3	0x0008
179 #define IRQ_VIRQ4	0x0010
180 #define IRQ_VIRQ5	0x0020
181 #define IRQ_VIRQ6	0x0040
182 #define IRQ_VIRQ7	0x0080
183 #define IRQ_DMA		0x0100
184 #define IRQ_LERR	0x0200
185 #define IRQ_VERR	0x0400
186 #define IRQ_res		0x0800
187 #define IRQ_IACK	0x1000
188 #define IRQ_SWINT	0x2000
189 #define IRQ_SYSFAIL	0x4000
190 #define IRQ_ACFAIL	0x8000
191 
192 struct _TDMA_CMD_PACKET {
193 	unsigned int dctl;   /* DMA Control         */
194 	unsigned int dtbc;   /* Transfer Byte Count */
195 	unsigned int dlv;    /* PCI Address         */
196 	unsigned int res1;   /* Reserved            */
197 	unsigned int dva;    /* Vme Address         */
198 	unsigned int res2;   /* Reserved            */
199 	unsigned int dcpp;   /* Pointer to Numed Cmd Packet with rPN */
200 	unsigned int res3;   /* Reserved                             */
201 };
202 
203 #define VME_AM_A16		0x01
204 #define VME_AM_A24		0x02
205 #define VME_AM_A32		0x03
206 #define VME_AM_Axx		0x03
207 #define VME_AM_USR		0x04
208 #define VME_AM_SUP		0x08
209 #define VME_AM_DATA		0x10
210 #define VME_AM_PROG		0x20
211 #define VME_AM_Mxx		(VME_AM_DATA | VME_AM_PROG)
212 
213 #define VME_FLAG_D8		0x01
214 #define VME_FLAG_D16		0x02
215 #define VME_FLAG_D32		0x03
216 #define VME_FLAG_Dxx		0x03
217 
218 #endif
219