summaryrefslogtreecommitdiff
path: root/src/include/cpu/amd/sc520.h
blob: a0390adc04efd2c56634d35477cffe5bc0446e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
#ifndef __CPU_AMD_SC520_H__
#define __CPU_AMD_SC520_H__

/* handy dandy stuff for the sc520 MMCR */

/* default location of the MMCR */
#define MMCR 0xfffef000

/* the PAR register struct definition, the location in memory,
  * and a handy pointer for you to use
  */

struct parreg {
	unsigned long reg[16];
};

#define PARREG ((struct parreg *)0xfffef088)
//static volatile struct parreg *par = PARREG;


#define MMCRPIC ((struct mmcrpic *) 0xfffefd00)
//static volatile struct mmcrpic *pic = MMCRPIC;

#define M_GINT_MODE     1
#define M_S1_MODE       2
#define M_S2_MODE       4


/* here is the real mmcr struct */

struct memregs {
	/* make these shorts, we are lsb and the hardware seems to like it
	 * better
	 */
	unsigned short drcctl;
	unsigned short drctmctl;
	unsigned short drccfg;
	unsigned char pad1[2];
	unsigned char drcbendadr[4];
	unsigned char pad2[4];
	unsigned char eccctl;
	unsigned char eccsta;
	unsigned char eccckbpos;
	unsigned char ecccktest;
	unsigned long eccsbadd;
	unsigned long eccmbadd;
	unsigned char pad3[18];
};
struct dbctl {
	unsigned char dbctl;
	unsigned char pad4[15];
};

struct romregs {
	unsigned char bootcs;
	unsigned char pad5[3];
	unsigned char romcs1;
	unsigned char pad6[1];
	unsigned char romcs2;
	unsigned char pad7[6];
};


struct hostbridge {
	unsigned short ctl;
	unsigned short tgtirqctl;
	unsigned short tgtirqsta;
	unsigned short mstirqctl;
	unsigned short mstirqsta;
	unsigned char pad8[2];
	unsigned long mstintadd;
};

struct sysarb {
	unsigned char ctl;
	unsigned char sta;
	unsigned char menb;
	unsigned long prictl;
	unsigned char pad9[8];
};

struct sysmap {
	unsigned char adddecctl;
	unsigned char pada[1];
	unsigned short wpvsta;
	unsigned char padb[4];
	unsigned long par[16];
	unsigned char padc[0xb38];
};

struct gpctl {
	unsigned char gpecho;
	unsigned char gpcsdw;
	unsigned char gpcsqual;
	unsigned char padd[5];
	unsigned char gpcsrt;
	unsigned char gpcspw;
	unsigned char gpcsoff;
	unsigned char gprdw;
	unsigned char gprdoff;
	unsigned char gpwrw;
	unsigned char gpwroff;
	unsigned char gpalew;
	unsigned char gpaleoff;
	unsigned char pade[15];
};

struct pio {
	unsigned short pfs15_0;
	unsigned short pfs31_16;
	unsigned char cspfs;
	unsigned char padf[1];
	unsigned char clksel;
	unsigned char padg[1];
	unsigned short dsctl;
	unsigned short dir15_0;
	unsigned short dir31_16;
	unsigned short padh;
	unsigned short data15_0;
	unsigned short data31_16;
	unsigned short set15_0;
	unsigned short set31_16;
	unsigned short clr15_0;
	unsigned short clr31_16;
	unsigned char padi[0x24];
};

struct swtmr {
	unsigned short swtmrmilli;
	unsigned short swtmrmicro;
	unsigned char swtmrcfg;
	unsigned char padj[0xb];
};

struct gptmr {
	unsigned short ctl;
	unsigned short cnt;
	unsigned short maxcmpa, maxcmpb;
};

struct gptimers {
	unsigned char status;
	unsigned char pad;
	struct gptmr timer[2];
	/* yes, they REALLY DID make timer 2 different. */
	/* yikes */
	unsigned short ctl2;
	unsigned short cnt2;
	unsigned char paddumb[8];
	unsigned short maxcmpa2;

	unsigned char pada[0x20];
};

struct watchdog {
	unsigned short ctl;
	unsigned short cntll;
	unsigned short cntlh;
	unsigned char pad[10];
};

struct uart {
	unsigned char ctl, sta, fcrshad, pad;
};

struct uarts {
	struct uart uart[2];
	unsigned char pad[8];
};

struct ssi {
	unsigned char ctl, xmit, cmd, sta, rcv;
	unsigned char pad[0x2b];
};


/* interrupt control registers */
/* defined this way for portability. Shame we can't just use plan 9 c. */
struct pic {
	unsigned char pcicr;
	unsigned char pad1;
	unsigned char mpicmode;
	unsigned char sl1picmode;
	unsigned char sl2picmode;
	unsigned char pad2[3];
	unsigned char swint16_1;
	unsigned char pad3;
	unsigned char swint22_17;
	unsigned char pad4[5];
	unsigned short intpinpol;
	unsigned char pad5[2];
	unsigned char pichostmap;
	unsigned char pad6[3];
	unsigned char eccmap;
	unsigned char pad7[1];
	unsigned char gptmr0map;
	unsigned char gptmr1map;
	unsigned char gptmr2map;
	unsigned char pad8[3];
	unsigned char pit0map;
	unsigned char pit1map;
	unsigned char pit2map;
	unsigned char pad9[5];
	unsigned char uart1map;
	unsigned char uart2map;
	unsigned char pad99[6];
	unsigned char pciintamap;
	unsigned char pciintbmap;
	unsigned char pciintcmap;
	unsigned char pciintdmap;
	unsigned char pad10[12];
	unsigned char dmabcintmap;
	unsigned char ssimap;
	unsigned char wdtmap;
	unsigned char rtcmap;
	unsigned char wpvmap;
	unsigned char icemap;
	unsigned char ferrmap;
	unsigned char pad11[9];
	unsigned char gp0imap;
	unsigned char gp1imap;
	unsigned char gp2imap;
	unsigned char gp3imap;
	unsigned char gp4imap;
	unsigned char gp5imap;
	unsigned char gp6imap;
	unsigned char gp7imap;
	unsigned char gp8imap;
	unsigned char gp9imap;
	unsigned char gp10imap;
	unsigned char padend[0x14];
};

struct reset {
	unsigned char sysinfo;
	unsigned char pad1;
	unsigned char rescfg;
	unsigned char pad2;
	unsigned char ressta;
	unsigned char pad3[0xb];
};

struct dmacontrol {
	unsigned char ctl;
	unsigned char mmio;
	unsigned short extchanmapa;
	unsigned short extchanmapb;
	unsigned char extpg0;
	unsigned char extpg1;
	unsigned char extpg2;
	unsigned char extpg3;
	unsigned char extpg5;
	unsigned char extpg6;
	unsigned char extpg7;
	unsigned char pad[3];
	unsigned char exttc3;
	unsigned char exttc5;
	unsigned char exttc6;
	unsigned char exttc7;
	unsigned char pad1[4];
	unsigned char bcctl;
	unsigned char bcsta;
	unsigned char bsintenb;
	unsigned char bcval;
	unsigned char pad2[4];
	unsigned short nxtaddl3;
	unsigned short nxtaddh3;
	unsigned short nxtaddl5;
	unsigned short nxtaddh5;
	unsigned short nxtaddl6;
	unsigned short nxtaddh6;
	unsigned short nxtaddl7;
	unsigned short nxtaddh7;
	unsigned short nxtttcl3;
	unsigned char nxtttch3;
	unsigned char pad3;
	unsigned short nxtttcl5;
	unsigned char nxtttch5;
	unsigned char pad5;
	unsigned short nxtttcl6;
	unsigned char nxtttch6;
	unsigned char pad6;
	unsigned short nxtttcl7;
	unsigned char nxtttch7;
	unsigned char pad7;
};




struct mmcr {
	unsigned short revid;
	unsigned char cpucontrol;
	unsigned char pad1[11];
	struct memregs memregs;
	struct dbctl dbctl;
	struct romregs romregs;
	struct hostbridge hostbridge;
	struct sysarb sysarb;
	struct sysmap sysmap;
	struct gpctl gpctl;
	struct pio pio;
	struct swtmr swtmr;
	struct gptimers gptimers;
	struct watchdog watchdog;
	struct uarts uarts;
	struct ssi ssi;
	struct pic pic;
	struct reset reset;
	struct dmacontrol dmacontrol;
	unsigned char padend[0x23d];
};


#define MMCRDEFAULT ((struct mmcr *) 0xfffef000)

#endif /* __CPU_AMD_SC520_H__ */