Import changeset
[linux-flexiantxendom0-3.2.10.git] / include / asm-mips / sgi / sgimc.h
1 /* $Id: sgimc.h,v 1.1.1.1 1997/06/01 03:17:13 ralf Exp $
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * sgimc.h: Definitions for memory controller hardware found on
8  *          SGI IP20, IP22, IP26, and IP28 machines.
9  *
10  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
11  * Copyright (C) 1999 Ralf Baechle
12  * Copyright (C) 1999 Silicon Graphics, Inc.
13  */
14 #ifndef _ASM_SGI_SGIMC_H
15 #define _ASM_SGI_SGIMC_H
16
17 struct sgimc_misc_ctrl {
18         u32 _unused1;
19         volatile u32 cpuctrl0;     /* CPU control register 0, readwrite */
20 #define SGIMC_CCTRL0_REFS         0x0000000f /* REFS mask */
21 #define SGIMC_CCTRL0_EREFRESH     0x00000010 /* Memory refresh enable */
22 #define SGIMC_CCTRL0_EPERRGIO     0x00000020 /* GIO parity error enable */
23 #define SGIMC_CCTRL0_EPERRMEM     0x00000040 /* Main mem parity error enable */
24 #define SGIMC_CCTRL0_EPERRCPU     0x00000080 /* CPU bus parity error enable */
25 #define SGIMC_CCTRL0_WDOG         0x00000100 /* Watchdog timer enable */
26 #define SGIMC_CCTRL0_SYSINIT      0x00000200 /* System init bit */
27 #define SGIMC_CCTRL0_GFXRESET     0x00000400 /* Graphics interface reset */
28 #define SGIMC_CCTRL0_EISALOCK     0x00000800 /* Lock CPU from memory for EISA */
29 #define SGIMC_CCTRL0_EPERRSCMD    0x00001000 /* SysCMD bus parity error enable */
30 #define SGIMC_CCTRL0_IENAB        0x00002000 /* Allow interrupts from MC */
31 #define SGIMC_CCTRL0_ESNOOP       0x00004000 /* Snooping I/O enable */
32 #define SGIMC_CCTRL0_EPROMWR      0x00008000 /* Prom writes from cpu enable */
33 #define SGIMC_CCTRL0_WRESETPMEM   0x00010000 /* Perform warm reset, preserves mem */
34 #define SGIMC_CCTRL0_LENDIAN      0x00020000 /* Put MC in little-endian mode */
35 #define SGIMC_CCTRL0_WRESETDMEM   0x00040000 /* Warm reset, destroys mem contents */
36 #define SGIMC_CCTRL0_CMEMBADPAR   0x02000000 /* Generate bad perr from cpu to mem */
37 #define SGIMC_CCTRL0_R4KNOCHKPARR 0x04000000 /* Don't chk parity on mem data reads */
38 #define SGIMC_CCTRL0_GIOBTOB      0x08000000 /* Allow GIO back to back writes */
39
40         u32 _unused2;
41         volatile u32 cpuctrl1;     /* CPU control register 1, readwrite */
42 #define SGIMC_CCTRL1_EGIOTIMEO    0x00000010 /* GIO bus timeout enable */
43 #define SGIMC_CCTRL1_FIXEDEHPC    0x00001000 /* Fixed HPC endianness */
44 #define SGIMC_CCTRL1_LITTLEHPC    0x00002000 /* Little endian HPC */
45 #define SGIMC_CCTRL1_FIXEDEEXP0   0x00004000 /* Fixed EXP0 endianness */
46 #define SGIMC_CCTRL1_LITTLEEXP0   0x00008000 /* Little endian EXP0 */
47 #define SGIMC_CCTRL1_FIXEDEEXP1   0x00010000 /* Fixed EXP1 endianness */
48 #define SGIMC_CCTRL1_LITTLEEXP1   0x00020000 /* Little endian EXP1 */
49
50         u32 _unused3;
51         volatile u32 watchdogt;    /* Watchdog reg rdonly, write clears */
52
53         u32 _unused4;
54         volatile u32 systemid;     /* MC system ID register, readonly */
55 #define SGIMC_SYSID_MASKREV       0x0000000f /* Revision of MC controller */
56 #define SGIMC_SYSID_EPRESENT      0x00000010 /* Indicates presence of EISA bus */
57
58         u32 _unused5[3];
59         volatile u32 divider;      /* Divider reg for RPSS */
60
61         u32 _unused6;
62         volatile unsigned char eeprom;       /* EEPROM byte reg for r4k */
63 #define SGIMC_EEPROM_PRE          0x00000001 /* eeprom chip PRE pin assertion */
64 #define SGIMC_EEPROM_CSEL         0x00000002 /* Active high, eeprom chip select */
65 #define SGIMC_EEPROM_SECLOCK      0x00000004 /* EEPROM serial clock */
66 #define SGIMC_EEPROM_SDATAO       0x00000008 /* Serial EEPROM data-out */
67 #define SGIMC_EEPROM_SDATAI       0x00000010 /* Serial EEPROM data-in */
68
69         unsigned char _unused7[3];
70         u32 _unused8[3];
71         volatile unsigned short rcntpre;     /* Preload refresh counter */
72
73         unsigned short _unused9;
74         u32 _unused9a;
75         volatile unsigned short rcounter;    /* Readonly refresh counter */
76
77         unsigned short _unused10;
78         u32 _unused11[13];
79         volatile u32 gioparm;      /* Parameter word for GIO64 */
80 #define SGIMC_GIOPARM_HPC64       0x00000001 /* HPC talks to GIO using 64-bits */
81 #define SGIMC_GIOPARM_GFX64       0x00000002 /* GFX talks to GIO using 64-bits */
82 #define SGIMC_GIOPARM_EXP064      0x00000004 /* EXP(slot0) talks using 64-bits */
83 #define SGIMC_GIOPARM_EXP164      0x00000008 /* EXP(slot1) talks using 64-bits */
84 #define SGIMC_GIOPARM_EISA64      0x00000010 /* EISA bus talks 64-bits to GIO */
85 #define SGIMC_GIOPARM_HPC264      0x00000020 /* 2nd HPX talks 64-bits to GIO */
86 #define SGIMC_GIOPARM_RTIMEGFX    0x00000040 /* GFX device has realtime attr */
87 #define SGIMC_GIOPARM_RTIMEEXP0   0x00000080 /* EXP(slot0) has realtime attr */
88 #define SGIMC_GIOPARM_RTIMEEXP1   0x00000100 /* EXP(slot1) has realtime attr */
89 #define SGIMC_GIOPARM_MASTEREISA  0x00000200 /* EISA bus can act as bus master */
90 #define SGIMC_GIOPARM_ONEBUS      0x00000400 /* Exists one GIO64 pipelined bus */
91 #define SGIMC_GIOPARM_MASTERGFX   0x00000800 /* GFX can act as a bus master */
92 #define SGIMC_GIOPARM_MASTEREXP0  0x00001000 /* EXP(slot0) can bus master */
93 #define SGIMC_GIOPARM_MASTEREXP1  0x00002000 /* EXP(slot1) can bus master */
94 #define SGIMC_GIOPARM_PLINEEXP0   0x00004000 /* EXP(slot0) has pipeline attr */
95 #define SGIMC_GIOPARM_PLINEEXP1   0x00008000 /* EXP(slot1) has pipeline attr */
96
97         u32 _unused13;
98         volatile unsigned short cputp;       /* CPU bus arb time period */
99
100         unsigned short _unused14;
101         u32 _unused15[3];
102         volatile unsigned short lbursttp;    /* Time period for long bursts */
103
104         unsigned short _unused16;
105         u32 _unused17[9];
106         volatile u32 mconfig0;     /* Memory config register zero */
107         u32 _unused18;
108         volatile u32 mconfig1;     /* Memory config register one */
109
110         /* These defines apply to both mconfig registers above. */
111 #define SGIMC_MCONFIG_FOURMB     0x00000000  /* Physical ram = 4megs */
112 #define SGIMC_MCONFIG_EIGHTMB    0x00000100  /* Physical ram = 8megs */
113 #define SGIMC_MCONFIG_SXTEENMB   0x00000300  /* Physical ram = 16megs */
114 #define SGIMC_MCONFIG_TTWOMB     0x00000700  /* Physical ram = 32megs */
115 #define SGIMC_MCONFIG_SFOURMB    0x00000f00  /* Physical ram = 64megs */
116 #define SGIMC_MCONFIG_OTEIGHTMB  0x00001f00  /* Physical ram = 128megs */
117 #define SGIMC_MCONFIG_RMASK      0x00001f00  /* Ram config bitmask */
118
119         u32 _unused19;
120         volatile u32 cmacc;        /* Mem access config for CPU */
121         u32 _unused20;
122         volatile u32 gmacc;        /* Mem access config for GIO */
123
124         /* This define applies to both cmacc and gmacc registers above. */
125 #define SGIMC_MACC_ALIASBIG       0x20000000 /* 512MB home for alias */
126
127         /* Error address/status regs from GIO and CPU perspectives. */
128         u32 _unused21;
129         volatile u32 cerr;         /* Error address reg for CPU */
130         u32 _unused22;
131         volatile u32 cstat;        /* Status reg for CPU */
132         u32 _unused23;
133         volatile u32 gerr;         /* Error address reg for GIO */
134         u32 _unused24;
135         volatile u32 gstat;        /* Status reg for GIO */
136
137         /* Special hard bus locking registers. */
138         u32 _unused25;
139         volatile unsigned char syssembit;    /* Uni-bit system semaphore */
140         unsigned char _unused26[3];
141         u32 _unused27;
142         volatile unsigned char mlock;        /* Global GIO memory access lock */
143         unsigned char _unused28[3];
144         u32 _unused29;
145         volatile unsigned char elock;        /* Locks EISA from GIO accesses */
146
147         /* GIO dma control registers. */
148         unsigned char _unused30[3];
149         u32 _unused31[14];
150         volatile u32 gio_dma_trans;/* DMA mask to translation GIO addrs */
151         u32 _unused32;
152         volatile u32 gio_dma_sbits;/* DMA GIO addr substitution bits */
153         u32 _unused33;
154         volatile u32 dma_intr_cause; /* DMA IRQ cause indicator bits */
155         u32 _unused34;
156         volatile u32 dma_ctrl;     /* Main DMA control reg */
157
158         /* DMA TLB entry 0 */
159         u32 _unused35;
160         volatile u32 dtlb_hi0;
161         u32 _unused36;
162         volatile u32 dtlb_lo0;
163
164         /* DMA TLB entry 1 */
165         u32 _unused37;
166         volatile u32 dtlb_hi1;
167         u32 _unused38;
168         volatile u32 dtlb_lo1;
169
170         /* DMA TLB entry 2 */
171         u32 _unused39;
172         volatile u32 dtlb_hi2;
173         u32 _unused40;
174         volatile u32 dtlb_lo2;
175
176         /* DMA TLB entry 3 */
177         u32 _unused41;
178         volatile u32 dtlb_hi3;
179         u32 _unused42;
180         volatile u32 dtlb_lo3;
181 };
182
183 /* MC misc control registers live at physical 0x1fa00000. */
184 extern struct sgimc_misc_ctrl *mcmisc_regs;
185 extern u32 *rpsscounter;          /* Chirps at 100ns */
186
187 struct sgimc_dma_ctrl {
188         u32 _unused1;
189         volatile u32 maddronly;   /* Address DMA goes at */
190         u32 _unused2;
191         volatile u32 maddrpdeflts; /* Same as above, plus set defaults */
192         u32 _unused3;
193         volatile u32 dmasz;       /* DMA count */
194         u32 _unused4;
195         volatile u32 ssize;       /* DMA stride size */
196         u32 _unused5;
197         volatile u32 gmaddronly;  /* Set GIO DMA but do not start trans */
198         u32 _unused6;
199         volatile u32 dmaddnpgo;   /* Set GIO DMA addr + start transfer */
200         u32 _unused7;
201         volatile u32 dmamode;     /* DMA mode config bit settings */
202         u32 _unused8;
203         volatile u32 dmacount;    /* Zoom and byte count for DMA */
204         u32 _unused9;
205         volatile u32 dmastart;    /* Pedal to the metal. */
206         u32 _unused10;
207         volatile u32 dmarunning;  /* DMA op is in progress */
208         u32 _unused11;
209
210         /* Set dma addr, defaults, and kick it */
211         volatile u32 maddr_defl_go; /* go go go! -lm */
212 };
213
214 /* MC controller dma regs live at physical 0x1fa02000. */
215 extern struct sgimc_dma_ctrl *dmactrlregs;
216
217 /* Base location of the two ram banks found in IP2[0268] machines. */
218 #define SGIMC_SEG0_BADDR     0x08000000
219 #define SGIMC_SEG1_BADDR     0x20000000
220
221 /* Maximum size of the above banks are per machine. */
222 extern u32 sgimc_seg0_size, sgimc_seg1_size;
223 #define SGIMC_SEG0_SIZE_ALL         0x10000000 /* 256MB */
224 #define SGIMC_SEG1_SIZE_IP20_IP22   0x08000000 /* 128MB */
225 #define SGIMC_SEG1_SIZE_IP26_IP28   0x20000000 /* 512MB */
226
227 extern void sgimc_init(void);
228
229 #endif /* _ASM_SGI_SGIMC_H */