1 |
dpavlin |
2 |
/* |
2 |
|
|
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
3 |
|
|
* |
4 |
|
|
* Redistribution and use in source and binary forms, with or without |
5 |
|
|
* modification, are permitted provided that the following conditions are met: |
6 |
|
|
* |
7 |
|
|
* 1. Redistributions of source code must retain the above copyright |
8 |
|
|
* notice, this list of conditions and the following disclaimer. |
9 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
10 |
|
|
* notice, this list of conditions and the following disclaimer in the |
11 |
|
|
* documentation and/or other materials provided with the distribution. |
12 |
|
|
* 3. The name of the author may not be used to endorse or promote products |
13 |
|
|
* derived from this software without specific prior written permission. |
14 |
|
|
* |
15 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
16 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
21 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 |
|
|
* SUCH DAMAGE. |
26 |
|
|
* |
27 |
|
|
* |
28 |
|
|
* $Id: machine.c,v 1.406 2005/04/06 23:13:37 debug Exp $ |
29 |
|
|
* |
30 |
|
|
* Emulation of specific machines. |
31 |
|
|
* |
32 |
|
|
* This module is quite large. Hopefully it is still clear enough to be |
33 |
|
|
* easily understood. The main parts are: |
34 |
|
|
* |
35 |
|
|
* Helper functions. |
36 |
|
|
* |
37 |
|
|
* Machine specific Interrupt routines. |
38 |
|
|
* |
39 |
|
|
* Machine specific Initialization routines. |
40 |
|
|
*/ |
41 |
|
|
|
42 |
|
|
#include <stdio.h> |
43 |
|
|
#include <stdlib.h> |
44 |
|
|
#include <stdarg.h> |
45 |
|
|
#ifdef SOLARIS |
46 |
|
|
#include <strings.h> |
47 |
|
|
#else |
48 |
|
|
#include <string.h> |
49 |
|
|
#endif |
50 |
|
|
#include <time.h> |
51 |
|
|
#include <unistd.h> |
52 |
|
|
|
53 |
|
|
#include "arcbios.h" |
54 |
|
|
#include "bus_pci.h" |
55 |
|
|
#include "cpu.h" |
56 |
|
|
#include "cpu_mips.h" |
57 |
|
|
#include "device.h" |
58 |
|
|
#include "devices.h" |
59 |
|
|
#include "diskimage.h" |
60 |
|
|
#include "emul.h" |
61 |
|
|
#include "machine.h" |
62 |
|
|
#include "memory.h" |
63 |
|
|
#include "misc.h" |
64 |
|
|
#include "mp.h" |
65 |
|
|
#include "net.h" |
66 |
|
|
#include "symbol.h" |
67 |
|
|
|
68 |
|
|
/* For SGI and ARC emulation: */ |
69 |
|
|
#include "sgi_arcbios.h" |
70 |
|
|
#include "arcbios_other.h" |
71 |
|
|
#include "crimereg.h" |
72 |
|
|
|
73 |
|
|
/* For DECstation emulation: */ |
74 |
|
|
#include "dec_prom.h" |
75 |
|
|
#include "dec_bootinfo.h" |
76 |
|
|
#include "dec_5100.h" |
77 |
|
|
#include "dec_kn01.h" |
78 |
|
|
#include "dec_kn02.h" |
79 |
|
|
#include "dec_kn03.h" |
80 |
|
|
#include "dec_kmin.h" |
81 |
|
|
#include "dec_maxine.h" |
82 |
|
|
|
83 |
|
|
/* HPC: */ |
84 |
|
|
#include "hpc_bootinfo.h" |
85 |
|
|
#include "vripreg.h" |
86 |
|
|
|
87 |
|
|
|
88 |
|
|
struct machine_entry_subtype { |
89 |
|
|
int machine_subtype;/* Old-style subtype */ |
90 |
|
|
const char *name; /* Official name */ |
91 |
|
|
int n_aliases; |
92 |
|
|
char **aliases; /* Aliases */ |
93 |
|
|
}; |
94 |
|
|
|
95 |
|
|
struct machine_entry { |
96 |
|
|
struct machine_entry *next; |
97 |
|
|
|
98 |
|
|
/* Machine type: */ |
99 |
|
|
int arch; |
100 |
|
|
int machine_type; /* Old-style type */ |
101 |
|
|
const char *name; /* Official name */ |
102 |
|
|
int n_aliases; |
103 |
|
|
char **aliases; /* Aliases */ |
104 |
|
|
|
105 |
|
|
/* Machine subtypes: */ |
106 |
|
|
int n_subtypes; |
107 |
|
|
struct machine_entry_subtype **subtype; |
108 |
|
|
}; |
109 |
|
|
|
110 |
|
|
/* This is initialized by machine_init(): */ |
111 |
|
|
static struct machine_entry *first_machine_entry = NULL; |
112 |
|
|
|
113 |
|
|
|
114 |
|
|
/* |
115 |
|
|
* machine_new(): |
116 |
|
|
* |
117 |
|
|
* Returns a reasonably initialized struct machine. |
118 |
|
|
*/ |
119 |
|
|
struct machine *machine_new(char *name, struct emul *emul) |
120 |
|
|
{ |
121 |
|
|
struct machine *m; |
122 |
|
|
m = malloc(sizeof(struct machine)); |
123 |
|
|
if (m == NULL) { |
124 |
|
|
fprintf(stderr, "machine_new(): out of memory\n"); |
125 |
|
|
exit(1); |
126 |
|
|
} |
127 |
|
|
|
128 |
|
|
memset(m, 0, sizeof(struct machine)); |
129 |
|
|
|
130 |
|
|
/* Back pointer: */ |
131 |
|
|
m->emul = emul; |
132 |
|
|
|
133 |
|
|
m->name = strdup(name); |
134 |
|
|
|
135 |
|
|
/* Sane default values: */ |
136 |
|
|
m->serial_nr = 0; |
137 |
|
|
m->machine_type = MACHINE_NONE; |
138 |
|
|
m->machine_subtype = MACHINE_NONE; |
139 |
|
|
m->bintrans_enable = 1; |
140 |
|
|
m->prom_emulation = 1; |
141 |
|
|
m->speed_tricks = 1; |
142 |
|
|
m->byte_order_override = NO_BYTE_ORDER_OVERRIDE; |
143 |
|
|
m->boot_kernel_filename = ""; |
144 |
|
|
m->boot_string_argument = NULL; |
145 |
|
|
m->automatic_clock_adjustment = 1; |
146 |
|
|
m->x11_scaledown = 1; |
147 |
|
|
m->n_gfx_cards = 1; |
148 |
|
|
m->dbe_on_nonexistant_memaccess = 1; |
149 |
|
|
m->show_symbolic_register_names = 1; |
150 |
|
|
m->bintrans_size = DEFAULT_BINTRANS_SIZE_IN_MB * 1048576; |
151 |
|
|
symbol_init(&m->symbol_context); |
152 |
|
|
|
153 |
|
|
return m; |
154 |
|
|
} |
155 |
|
|
|
156 |
|
|
|
157 |
|
|
/* |
158 |
|
|
* machine_name_to_type(): |
159 |
|
|
* |
160 |
|
|
* Take a type and a subtype as strings, and convert them into numeric |
161 |
|
|
* values used internally throughout the code. |
162 |
|
|
* |
163 |
|
|
* Return value is 1 on success, 0 if there was no match. |
164 |
|
|
* Also, any errors/warnings are printed using fatal()/debug(). |
165 |
|
|
*/ |
166 |
|
|
int machine_name_to_type(char *stype, char *ssubtype, |
167 |
|
|
int *type, int *subtype, int *arch) |
168 |
|
|
{ |
169 |
|
|
struct machine_entry *me; |
170 |
|
|
int i, j, k; |
171 |
|
|
|
172 |
|
|
*type = MACHINE_NONE; |
173 |
|
|
*subtype = 0; |
174 |
|
|
|
175 |
|
|
me = first_machine_entry; |
176 |
|
|
while (me != NULL) { |
177 |
|
|
for (i=0; i<me->n_aliases; i++) |
178 |
|
|
if (strcasecmp(me->aliases[i], stype) == 0) { |
179 |
|
|
/* Found a type: */ |
180 |
|
|
*type = me->machine_type; |
181 |
|
|
*arch = me->arch; |
182 |
|
|
|
183 |
|
|
if (me->n_subtypes == 0) |
184 |
|
|
return 1; |
185 |
|
|
|
186 |
|
|
/* Check for subtype: */ |
187 |
|
|
for (j=0; j<me->n_subtypes; j++) |
188 |
|
|
for (k=0; k<me->subtype[j]->n_aliases; |
189 |
|
|
k++) |
190 |
|
|
if (strcasecmp(ssubtype, |
191 |
|
|
me->subtype[j]->aliases[k] |
192 |
|
|
) == 0) { |
193 |
|
|
*subtype = me->subtype[ |
194 |
|
|
j]->machine_subtype; |
195 |
|
|
return 1; |
196 |
|
|
} |
197 |
|
|
|
198 |
|
|
fatal("unknown subtype '%s' for emulation" |
199 |
|
|
" '%s'\n", ssubtype, stype); |
200 |
|
|
exit(1); |
201 |
|
|
} |
202 |
|
|
|
203 |
|
|
me = me->next; |
204 |
|
|
} |
205 |
|
|
|
206 |
|
|
fatal("machine_name_to_type(): unknown emulation type '%s' (", stype); |
207 |
|
|
if (ssubtype == NULL) |
208 |
|
|
fatal("no subtype)\n"); |
209 |
|
|
else |
210 |
|
|
fatal("subtype '%s')\n", ssubtype); |
211 |
|
|
|
212 |
|
|
fatal("Use the -H command line option to get a list of available" |
213 |
|
|
" types and subtypes.\n"); |
214 |
|
|
return 0; |
215 |
|
|
} |
216 |
|
|
|
217 |
|
|
|
218 |
|
|
/* |
219 |
|
|
* machine_add_tickfunction(): |
220 |
|
|
* |
221 |
|
|
* Adds a tick function (a function called every now and then, depending on |
222 |
|
|
* clock cycle count) to a machine. |
223 |
|
|
*/ |
224 |
|
|
void machine_add_tickfunction(struct machine *machine, void (*func) |
225 |
|
|
(struct cpu *, void *), void *extra, int clockshift) |
226 |
|
|
{ |
227 |
|
|
int n = machine->n_tick_entries; |
228 |
|
|
|
229 |
|
|
if (n >= MAX_TICK_FUNCTIONS) { |
230 |
|
|
fprintf(stderr, "machine_add_tickfunction(): too " |
231 |
|
|
"many tick functions\n"); |
232 |
|
|
exit(1); |
233 |
|
|
} |
234 |
|
|
|
235 |
|
|
/* Don't use too low clockshifts, that would be too inefficient |
236 |
|
|
with bintrans. */ |
237 |
|
|
if (clockshift < N_SAFE_BINTRANS_LIMIT_SHIFT) |
238 |
|
|
fatal("WARNING! clockshift = %i, less than " |
239 |
|
|
"N_SAFE_BINTRANS_LIMIT_SHIFT (%i)\n", |
240 |
|
|
clockshift, N_SAFE_BINTRANS_LIMIT_SHIFT); |
241 |
|
|
|
242 |
|
|
machine->ticks_till_next[n] = 0; |
243 |
|
|
machine->ticks_reset_value[n] = 1 << clockshift; |
244 |
|
|
machine->tick_func[n] = func; |
245 |
|
|
machine->tick_extra[n] = extra; |
246 |
|
|
|
247 |
|
|
machine->n_tick_entries ++; |
248 |
|
|
} |
249 |
|
|
|
250 |
|
|
|
251 |
|
|
/**************************************************************************** |
252 |
|
|
* * |
253 |
|
|
* Helper functions * |
254 |
|
|
* * |
255 |
|
|
****************************************************************************/ |
256 |
|
|
|
257 |
|
|
|
258 |
|
|
int int_to_bcd(int i) |
259 |
|
|
{ |
260 |
|
|
return (i/10) * 16 + (i % 10); |
261 |
|
|
} |
262 |
|
|
|
263 |
|
|
|
264 |
|
|
/* |
265 |
|
|
* dump_mem_string(): |
266 |
|
|
* |
267 |
|
|
* Dump the contents of emulated RAM as readable text. Bytes that aren't |
268 |
|
|
* readable are dumped in [xx] notation, where xx is in hexadecimal. |
269 |
|
|
* Dumping ends after DUMP_MEM_STRING_MAX bytes, or when a terminating |
270 |
|
|
* zero byte is found. |
271 |
|
|
*/ |
272 |
|
|
#define DUMP_MEM_STRING_MAX 45 |
273 |
|
|
void dump_mem_string(struct cpu *cpu, uint64_t addr) |
274 |
|
|
{ |
275 |
|
|
int i; |
276 |
|
|
for (i=0; i<DUMP_MEM_STRING_MAX; i++) { |
277 |
|
|
unsigned char ch = '\0'; |
278 |
|
|
|
279 |
|
|
cpu->memory_rw(cpu, cpu->mem, addr + i, &ch, sizeof(ch), |
280 |
|
|
MEM_READ, CACHE_DATA | NO_EXCEPTIONS); |
281 |
|
|
if (ch == '\0') |
282 |
|
|
return; |
283 |
|
|
if (ch >= ' ' && ch < 126) |
284 |
|
|
debug("%c", ch); |
285 |
|
|
else |
286 |
|
|
debug("[%02x]", ch); |
287 |
|
|
} |
288 |
|
|
} |
289 |
|
|
|
290 |
|
|
|
291 |
|
|
/* |
292 |
|
|
* store_byte(): |
293 |
|
|
* |
294 |
|
|
* Stores a byte in emulated ram. (Helper function.) |
295 |
|
|
*/ |
296 |
|
|
void store_byte(struct cpu *cpu, uint64_t addr, uint8_t data) |
297 |
|
|
{ |
298 |
|
|
if ((addr >> 32) == 0) |
299 |
|
|
addr = (int64_t)(int32_t)addr; |
300 |
|
|
cpu->memory_rw(cpu, cpu->mem, |
301 |
|
|
addr, &data, sizeof(data), MEM_WRITE, CACHE_DATA); |
302 |
|
|
} |
303 |
|
|
|
304 |
|
|
|
305 |
|
|
/* |
306 |
|
|
* store_string(): |
307 |
|
|
* |
308 |
|
|
* Stores chars into emulated RAM until a zero byte (string terminating |
309 |
|
|
* character) is found. The zero byte is also copied. |
310 |
|
|
* (strcpy()-like helper function, host-RAM-to-emulated-RAM.) |
311 |
|
|
*/ |
312 |
|
|
void store_string(struct cpu *cpu, uint64_t addr, char *s) |
313 |
|
|
{ |
314 |
|
|
do { |
315 |
|
|
store_byte(cpu, addr++, *s); |
316 |
|
|
} while (*s++); |
317 |
|
|
} |
318 |
|
|
|
319 |
|
|
|
320 |
|
|
/* |
321 |
|
|
* add_environment_string(): |
322 |
|
|
* |
323 |
|
|
* Like store_string(), but advances the pointer afterwards. The most |
324 |
|
|
* obvious use is to place a number of strings (such as environment variable |
325 |
|
|
* strings) after one-another in emulated memory. |
326 |
|
|
*/ |
327 |
|
|
void add_environment_string(struct cpu *cpu, char *s, uint64_t *addr) |
328 |
|
|
{ |
329 |
|
|
store_string(cpu, *addr, s); |
330 |
|
|
(*addr) += strlen(s) + 1; |
331 |
|
|
} |
332 |
|
|
|
333 |
|
|
|
334 |
|
|
/* |
335 |
|
|
* store_64bit_word(): |
336 |
|
|
* |
337 |
|
|
* Stores a 64-bit word in emulated RAM. Byte order is taken into account. |
338 |
|
|
* Helper function. |
339 |
|
|
*/ |
340 |
|
|
int store_64bit_word(struct cpu *cpu, uint64_t addr, uint64_t data64) |
341 |
|
|
{ |
342 |
|
|
unsigned char data[8]; |
343 |
|
|
if ((addr >> 32) == 0) |
344 |
|
|
addr = (int64_t)(int32_t)addr; |
345 |
|
|
data[0] = (data64 >> 56) & 255; |
346 |
|
|
data[1] = (data64 >> 48) & 255; |
347 |
|
|
data[2] = (data64 >> 40) & 255; |
348 |
|
|
data[3] = (data64 >> 32) & 255; |
349 |
|
|
data[4] = (data64 >> 24) & 255; |
350 |
|
|
data[5] = (data64 >> 16) & 255; |
351 |
|
|
data[6] = (data64 >> 8) & 255; |
352 |
|
|
data[7] = (data64) & 255; |
353 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
354 |
|
|
int tmp = data[0]; data[0] = data[7]; data[7] = tmp; |
355 |
|
|
tmp = data[1]; data[1] = data[6]; data[6] = tmp; |
356 |
|
|
tmp = data[2]; data[2] = data[5]; data[5] = tmp; |
357 |
|
|
tmp = data[3]; data[3] = data[4]; data[4] = tmp; |
358 |
|
|
} |
359 |
|
|
return cpu->memory_rw(cpu, cpu->mem, |
360 |
|
|
addr, data, sizeof(data), MEM_WRITE, CACHE_DATA); |
361 |
|
|
} |
362 |
|
|
|
363 |
|
|
|
364 |
|
|
/* |
365 |
|
|
* store_32bit_word(): |
366 |
|
|
* |
367 |
|
|
* Stores a 32-bit word in emulated RAM. Byte order is taken into account. |
368 |
|
|
* (This function takes a 64-bit word as argument, to suppress some |
369 |
|
|
* warnings, but only the lowest 32 bits are used.) |
370 |
|
|
*/ |
371 |
|
|
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32) |
372 |
|
|
{ |
373 |
|
|
unsigned char data[4]; |
374 |
|
|
if ((addr >> 32) == 0) |
375 |
|
|
addr = (int64_t)(int32_t)addr; |
376 |
|
|
data[0] = (data32 >> 24) & 255; |
377 |
|
|
data[1] = (data32 >> 16) & 255; |
378 |
|
|
data[2] = (data32 >> 8) & 255; |
379 |
|
|
data[3] = (data32) & 255; |
380 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
381 |
|
|
int tmp = data[0]; data[0] = data[3]; data[3] = tmp; |
382 |
|
|
tmp = data[1]; data[1] = data[2]; data[2] = tmp; |
383 |
|
|
} |
384 |
|
|
return cpu->memory_rw(cpu, cpu->mem, |
385 |
|
|
addr, data, sizeof(data), MEM_WRITE, CACHE_DATA); |
386 |
|
|
} |
387 |
|
|
|
388 |
|
|
|
389 |
|
|
/* |
390 |
|
|
* store_16bit_word(): |
391 |
|
|
* |
392 |
|
|
* Stores a 16-bit word in emulated RAM. Byte order is taken into account. |
393 |
|
|
* (This function takes a 64-bit word as argument, to suppress some |
394 |
|
|
* warnings, but only the lowest 16 bits are used.) |
395 |
|
|
*/ |
396 |
|
|
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16) |
397 |
|
|
{ |
398 |
|
|
unsigned char data[2]; |
399 |
|
|
if ((addr >> 32) == 0) |
400 |
|
|
addr = (int64_t)(int32_t)addr; |
401 |
|
|
data[0] = (data16 >> 8) & 255; |
402 |
|
|
data[1] = (data16) & 255; |
403 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
404 |
|
|
int tmp = data[0]; data[0] = data[1]; data[1] = tmp; |
405 |
|
|
} |
406 |
|
|
return cpu->memory_rw(cpu, cpu->mem, |
407 |
|
|
addr, data, sizeof(data), MEM_WRITE, CACHE_DATA); |
408 |
|
|
} |
409 |
|
|
|
410 |
|
|
|
411 |
|
|
/* |
412 |
|
|
* store_buf(): |
413 |
|
|
* |
414 |
|
|
* memcpy()-like helper function, from host RAM to emulated RAM. |
415 |
|
|
*/ |
416 |
|
|
void store_buf(struct cpu *cpu, uint64_t addr, char *s, size_t len) |
417 |
|
|
{ |
418 |
|
|
if ((addr >> 32) == 0) |
419 |
|
|
addr = (int64_t)(int32_t)addr; |
420 |
|
|
if ((addr & 7) == 0 && (((size_t)s) & 7) == 0) { |
421 |
|
|
while (len >= 8) { |
422 |
|
|
cpu->memory_rw(cpu, cpu->mem, addr, (unsigned char *)s, |
423 |
|
|
8, MEM_WRITE, CACHE_DATA); |
424 |
|
|
addr += 8; |
425 |
|
|
s += 8; |
426 |
|
|
len -= 8; |
427 |
|
|
} |
428 |
|
|
} |
429 |
|
|
|
430 |
|
|
if ((addr & 3) == 0 && (((size_t)s) & 3) == 0) { |
431 |
|
|
while (len >= 4) { |
432 |
|
|
cpu->memory_rw(cpu, cpu->mem, addr, (unsigned char *)s, |
433 |
|
|
4, MEM_WRITE, CACHE_DATA); |
434 |
|
|
addr += 4; |
435 |
|
|
s += 4; |
436 |
|
|
len -= 4; |
437 |
|
|
} |
438 |
|
|
} |
439 |
|
|
|
440 |
|
|
while (len-- != 0) |
441 |
|
|
store_byte(cpu, addr++, *s++); |
442 |
|
|
} |
443 |
|
|
|
444 |
|
|
|
445 |
|
|
/* |
446 |
|
|
* store_pointer_and_advance(): |
447 |
|
|
* |
448 |
|
|
* Stores a 32-bit or 64-bit pointer in emulated RAM, and advances the |
449 |
|
|
* target address. (Used by ARC and SGI initialization.) |
450 |
|
|
*/ |
451 |
|
|
void store_pointer_and_advance(struct cpu *cpu, uint64_t *addrp, |
452 |
|
|
uint64_t data, int flag64) |
453 |
|
|
{ |
454 |
|
|
uint64_t addr = *addrp; |
455 |
|
|
if (flag64) { |
456 |
|
|
store_64bit_word(cpu, addr, data); |
457 |
|
|
addr += 8; |
458 |
|
|
} else { |
459 |
|
|
store_32bit_word(cpu, addr, data); |
460 |
|
|
addr += 4; |
461 |
|
|
} |
462 |
|
|
*addrp = addr; |
463 |
|
|
} |
464 |
|
|
|
465 |
|
|
|
466 |
|
|
/* |
467 |
|
|
* load_32bit_word(): |
468 |
|
|
* |
469 |
|
|
* Helper function. Prints a warning and returns 0, if the read failed. |
470 |
|
|
* Emulated byte order is taken into account. |
471 |
|
|
*/ |
472 |
|
|
uint32_t load_32bit_word(struct cpu *cpu, uint64_t addr) |
473 |
|
|
{ |
474 |
|
|
unsigned char data[4]; |
475 |
|
|
|
476 |
|
|
if ((addr >> 32) == 0) |
477 |
|
|
addr = (int64_t)(int32_t)addr; |
478 |
|
|
cpu->memory_rw(cpu, cpu->mem, |
479 |
|
|
addr, data, sizeof(data), MEM_READ, CACHE_DATA); |
480 |
|
|
|
481 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
482 |
|
|
int tmp = data[0]; data[0] = data[3]; data[3] = tmp; |
483 |
|
|
tmp = data[1]; data[1] = data[2]; data[2] = tmp; |
484 |
|
|
} |
485 |
|
|
|
486 |
|
|
return (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]; |
487 |
|
|
} |
488 |
|
|
|
489 |
|
|
|
490 |
|
|
/* |
491 |
|
|
* store_64bit_word_in_host(): |
492 |
|
|
* |
493 |
|
|
* Stores a 64-bit word in the _host's_ RAM. Emulated byte order is taken |
494 |
|
|
* into account. This is useful when building structs in the host's RAM |
495 |
|
|
* which will later be copied into emulated RAM. |
496 |
|
|
*/ |
497 |
|
|
void store_64bit_word_in_host(struct cpu *cpu, |
498 |
|
|
unsigned char *data, uint64_t data64) |
499 |
|
|
{ |
500 |
|
|
data[0] = (data64 >> 56) & 255; |
501 |
|
|
data[1] = (data64 >> 48) & 255; |
502 |
|
|
data[2] = (data64 >> 40) & 255; |
503 |
|
|
data[3] = (data64 >> 32) & 255; |
504 |
|
|
data[4] = (data64 >> 24) & 255; |
505 |
|
|
data[5] = (data64 >> 16) & 255; |
506 |
|
|
data[6] = (data64 >> 8) & 255; |
507 |
|
|
data[7] = (data64) & 255; |
508 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
509 |
|
|
int tmp = data[0]; data[0] = data[7]; data[7] = tmp; |
510 |
|
|
tmp = data[1]; data[1] = data[6]; data[6] = tmp; |
511 |
|
|
tmp = data[2]; data[2] = data[5]; data[5] = tmp; |
512 |
|
|
tmp = data[3]; data[3] = data[4]; data[4] = tmp; |
513 |
|
|
} |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
|
517 |
|
|
/* |
518 |
|
|
* store_32bit_word_in_host(): |
519 |
|
|
* |
520 |
|
|
* See comment for store_64bit_word_in_host(). |
521 |
|
|
* |
522 |
|
|
* (Note: The data32 parameter is a uint64_t. This is done to suppress |
523 |
|
|
* some warnings.) |
524 |
|
|
*/ |
525 |
|
|
void store_32bit_word_in_host(struct cpu *cpu, |
526 |
|
|
unsigned char *data, uint64_t data32) |
527 |
|
|
{ |
528 |
|
|
data[0] = (data32 >> 24) & 255; |
529 |
|
|
data[1] = (data32 >> 16) & 255; |
530 |
|
|
data[2] = (data32 >> 8) & 255; |
531 |
|
|
data[3] = (data32) & 255; |
532 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
533 |
|
|
int tmp = data[0]; data[0] = data[3]; data[3] = tmp; |
534 |
|
|
tmp = data[1]; data[1] = data[2]; data[2] = tmp; |
535 |
|
|
} |
536 |
|
|
} |
537 |
|
|
|
538 |
|
|
|
539 |
|
|
/* |
540 |
|
|
* store_16bit_word_in_host(): |
541 |
|
|
* |
542 |
|
|
* See comment for store_64bit_word_in_host(). |
543 |
|
|
*/ |
544 |
|
|
void store_16bit_word_in_host(struct cpu *cpu, |
545 |
|
|
unsigned char *data, uint16_t data16) |
546 |
|
|
{ |
547 |
|
|
data[0] = (data16 >> 8) & 255; |
548 |
|
|
data[1] = (data16) & 255; |
549 |
|
|
if (cpu->byte_order == EMUL_LITTLE_ENDIAN) { |
550 |
|
|
int tmp = data[0]; data[0] = data[1]; data[1] = tmp; |
551 |
|
|
} |
552 |
|
|
} |
553 |
|
|
|
554 |
|
|
|
555 |
|
|
/**************************************************************************** |
556 |
|
|
* * |
557 |
|
|
* Machine dependant Interrupt routines * |
558 |
|
|
* * |
559 |
|
|
****************************************************************************/ |
560 |
|
|
|
561 |
|
|
|
562 |
|
|
/* |
563 |
|
|
* DECstation KN02 interrupts: |
564 |
|
|
*/ |
565 |
|
|
void kn02_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
566 |
|
|
{ |
567 |
|
|
int current; |
568 |
|
|
|
569 |
|
|
irq_nr -= 8; |
570 |
|
|
irq_nr &= 0xff; |
571 |
|
|
|
572 |
|
|
if (assrt) { |
573 |
|
|
/* OR in the irq_nr into the CSR: */ |
574 |
|
|
m->kn02_csr->csr[0] |= irq_nr; |
575 |
|
|
} else { |
576 |
|
|
/* AND out the irq_nr from the CSR: */ |
577 |
|
|
m->kn02_csr->csr[0] &= ~irq_nr; |
578 |
|
|
} |
579 |
|
|
|
580 |
|
|
current = m->kn02_csr->csr[0] & m->kn02_csr->csr[2]; |
581 |
|
|
if (current == 0) |
582 |
|
|
cpu_interrupt_ack(cpu, 2); |
583 |
|
|
else |
584 |
|
|
cpu_interrupt(cpu, 2); |
585 |
|
|
} |
586 |
|
|
|
587 |
|
|
|
588 |
|
|
/* |
589 |
|
|
* DECstation KMIN interrupts: |
590 |
|
|
* |
591 |
|
|
* TC slot 3 = system slot. |
592 |
|
|
*/ |
593 |
|
|
void kmin_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
594 |
|
|
{ |
595 |
|
|
irq_nr -= 8; |
596 |
|
|
/* debug("kmin_interrupt(): irq_nr=%i assrt=%i\n", irq_nr, assrt); */ |
597 |
|
|
|
598 |
|
|
if (assrt) |
599 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] |= irq_nr; |
600 |
|
|
else |
601 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] &= ~irq_nr; |
602 |
|
|
|
603 |
|
|
if (m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] |
604 |
|
|
& m->dec_ioasic_data->reg[(IOASIC_IMSK - IOASIC_SLOT_1_START) / 0x10]) |
605 |
|
|
cpu_interrupt(cpu, KMIN_INT_TC3); |
606 |
|
|
else |
607 |
|
|
cpu_interrupt_ack(cpu, KMIN_INT_TC3); |
608 |
|
|
} |
609 |
|
|
|
610 |
|
|
|
611 |
|
|
/* |
612 |
|
|
* DECstation KN03 interrupts: |
613 |
|
|
*/ |
614 |
|
|
void kn03_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
615 |
|
|
{ |
616 |
|
|
irq_nr -= 8; |
617 |
|
|
/* debug("kn03_interrupt(): irq_nr=0x%x assrt=%i\n", irq_nr, assrt); */ |
618 |
|
|
|
619 |
|
|
if (assrt) |
620 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] |= irq_nr; |
621 |
|
|
else |
622 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] &= ~irq_nr; |
623 |
|
|
|
624 |
|
|
if (m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] |
625 |
|
|
& m->dec_ioasic_data->reg[(IOASIC_IMSK - IOASIC_SLOT_1_START) / 0x10]) |
626 |
|
|
cpu_interrupt(cpu, KN03_INT_ASIC); |
627 |
|
|
else |
628 |
|
|
cpu_interrupt_ack(cpu, KN03_INT_ASIC); |
629 |
|
|
} |
630 |
|
|
|
631 |
|
|
|
632 |
|
|
/* |
633 |
|
|
* DECstation MAXINE interrupts: |
634 |
|
|
*/ |
635 |
|
|
void maxine_interrupt(struct machine *m, struct cpu *cpu, |
636 |
|
|
int irq_nr, int assrt) |
637 |
|
|
{ |
638 |
|
|
irq_nr -= 8; |
639 |
|
|
debug("maxine_interrupt(): irq_nr=0x%x assrt=%i\n", irq_nr, assrt); |
640 |
|
|
|
641 |
|
|
if (assrt) |
642 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) |
643 |
|
|
/ 0x10] |= irq_nr; |
644 |
|
|
else |
645 |
|
|
m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) |
646 |
|
|
/ 0x10] &= ~irq_nr; |
647 |
|
|
|
648 |
|
|
if (m->dec_ioasic_data->reg[(IOASIC_INTR - IOASIC_SLOT_1_START) / 0x10] |
649 |
|
|
& m->dec_ioasic_data->reg[(IOASIC_IMSK - IOASIC_SLOT_1_START) |
650 |
|
|
/ 0x10]) |
651 |
|
|
cpu_interrupt(cpu, XINE_INT_TC3); |
652 |
|
|
else |
653 |
|
|
cpu_interrupt_ack(cpu, XINE_INT_TC3); |
654 |
|
|
} |
655 |
|
|
|
656 |
|
|
|
657 |
|
|
/* |
658 |
|
|
* DECstation KN230 interrupts: |
659 |
|
|
*/ |
660 |
|
|
void kn230_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
661 |
|
|
{ |
662 |
|
|
int r2 = 0; |
663 |
|
|
|
664 |
|
|
m->kn230_csr->csr |= irq_nr; |
665 |
|
|
|
666 |
|
|
switch (irq_nr) { |
667 |
|
|
case KN230_CSR_INTR_SII: |
668 |
|
|
case KN230_CSR_INTR_LANCE: |
669 |
|
|
r2 = 3; |
670 |
|
|
break; |
671 |
|
|
case KN230_CSR_INTR_DZ0: |
672 |
|
|
case KN230_CSR_INTR_OPT0: |
673 |
|
|
case KN230_CSR_INTR_OPT1: |
674 |
|
|
r2 = 2; |
675 |
|
|
break; |
676 |
|
|
default: |
677 |
|
|
fatal("kn230_interrupt(): irq_nr = %i ?\n", irq_nr); |
678 |
|
|
} |
679 |
|
|
|
680 |
|
|
if (assrt) { |
681 |
|
|
/* OR in the irq_nr mask into the CSR: */ |
682 |
|
|
m->kn230_csr->csr |= irq_nr; |
683 |
|
|
|
684 |
|
|
/* Assert MIPS interrupt 2 or 3: */ |
685 |
|
|
cpu_interrupt(cpu, r2); |
686 |
|
|
} else { |
687 |
|
|
/* AND out the irq_nr mask from the CSR: */ |
688 |
|
|
m->kn230_csr->csr &= ~irq_nr; |
689 |
|
|
|
690 |
|
|
/* If the CSR interrupt bits are all zero, |
691 |
|
|
clear the bit in the cause register as well. */ |
692 |
|
|
if (r2 == 2) { |
693 |
|
|
/* irq 2: */ |
694 |
|
|
if ((m->kn230_csr->csr & (KN230_CSR_INTR_DZ0 |
695 |
|
|
| KN230_CSR_INTR_OPT0 | KN230_CSR_INTR_OPT1)) == 0) |
696 |
|
|
cpu_interrupt_ack(cpu, r2); |
697 |
|
|
} else { |
698 |
|
|
/* irq 3: */ |
699 |
|
|
if ((m->kn230_csr->csr & (KN230_CSR_INTR_SII | |
700 |
|
|
KN230_CSR_INTR_LANCE)) == 0) |
701 |
|
|
cpu_interrupt_ack(cpu, r2); |
702 |
|
|
} |
703 |
|
|
} |
704 |
|
|
} |
705 |
|
|
|
706 |
|
|
|
707 |
|
|
/* |
708 |
|
|
* Jazz interrupts (for Acer PICA-61 etc): |
709 |
|
|
* |
710 |
|
|
* 0..7 MIPS interrupts |
711 |
|
|
* 8 + x, where x = 0..15 Jazz interrupts |
712 |
|
|
* 8 + x, where x = 16..31 ISA interrupt (irq nr + 16) |
713 |
|
|
*/ |
714 |
|
|
void jazz_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
715 |
|
|
{ |
716 |
|
|
uint32_t irq; |
717 |
|
|
int isa = 0; |
718 |
|
|
|
719 |
|
|
irq_nr -= 8; |
720 |
|
|
|
721 |
|
|
/* debug("jazz_interrupt() irq_nr = %i, assrt = %i\n", |
722 |
|
|
irq_nr, assrt); */ |
723 |
|
|
|
724 |
|
|
if (irq_nr >= 16) { |
725 |
|
|
isa = 1; |
726 |
|
|
irq_nr -= 16; |
727 |
|
|
} |
728 |
|
|
|
729 |
|
|
irq = 1 << irq_nr; |
730 |
|
|
|
731 |
|
|
if (isa) { |
732 |
|
|
if (assrt) |
733 |
|
|
m->jazz_data->isa_int_asserted |= irq; |
734 |
|
|
else |
735 |
|
|
m->jazz_data->isa_int_asserted &= ~irq; |
736 |
|
|
} else { |
737 |
|
|
if (assrt) |
738 |
|
|
m->jazz_data->int_asserted |= irq; |
739 |
|
|
else |
740 |
|
|
m->jazz_data->int_asserted &= ~irq; |
741 |
|
|
} |
742 |
|
|
|
743 |
|
|
/* debug(" %08x %08x\n", m->jazz_data->int_asserted, |
744 |
|
|
m->jazz_data->int_enable_mask); */ |
745 |
|
|
/* debug(" %08x %08x\n", m->jazz_data->isa_int_asserted, |
746 |
|
|
m->jazz_data->isa_int_enable_mask); */ |
747 |
|
|
|
748 |
|
|
if (m->jazz_data->int_asserted /* & m->jazz_data->int_enable_mask */ |
749 |
|
|
& ~0x8000 ) |
750 |
|
|
cpu_interrupt(cpu, 3); |
751 |
|
|
else |
752 |
|
|
cpu_interrupt_ack(cpu, 3); |
753 |
|
|
|
754 |
|
|
if (m->jazz_data->isa_int_asserted & m->jazz_data->isa_int_enable_mask) |
755 |
|
|
cpu_interrupt(cpu, 4); |
756 |
|
|
else |
757 |
|
|
cpu_interrupt_ack(cpu, 4); |
758 |
|
|
|
759 |
|
|
/* TODO: this "15" (0x8000) is the timer... fix this? */ |
760 |
|
|
if (m->jazz_data->int_asserted & 0x8000) |
761 |
|
|
cpu_interrupt(cpu, 6); |
762 |
|
|
else |
763 |
|
|
cpu_interrupt_ack(cpu, 6); |
764 |
|
|
} |
765 |
|
|
|
766 |
|
|
|
767 |
|
|
/* |
768 |
|
|
* VR41xx interrupt routine: |
769 |
|
|
* |
770 |
|
|
* irq_nr = 8 + x |
771 |
|
|
* x = 0..15 for level1 |
772 |
|
|
* x = 16..31 for level2 |
773 |
|
|
* x = 32+y for GIU interrupt y |
774 |
|
|
*/ |
775 |
|
|
void vr41xx_interrupt(struct machine *m, struct cpu *cpu, |
776 |
|
|
int irq_nr, int assrt) |
777 |
|
|
{ |
778 |
|
|
int giu_irq = 0; |
779 |
|
|
|
780 |
|
|
irq_nr -= 8; |
781 |
|
|
if (irq_nr >= 32) { |
782 |
|
|
giu_irq = irq_nr - 32; |
783 |
|
|
|
784 |
|
|
if (assrt) |
785 |
|
|
m->vr41xx_data->giuint |= (1 << giu_irq); |
786 |
|
|
else |
787 |
|
|
m->vr41xx_data->giuint &= ~(1 << giu_irq); |
788 |
|
|
} |
789 |
|
|
|
790 |
|
|
/* TODO: This is wrong. What about GIU bit 8? */ |
791 |
|
|
|
792 |
|
|
if (irq_nr != 8) { |
793 |
|
|
/* If any GIU bit is asserted, then assert the main |
794 |
|
|
GIU interrupt: */ |
795 |
|
|
if (m->vr41xx_data->giuint & m->vr41xx_data->giumask) |
796 |
|
|
vr41xx_interrupt(m, cpu, 8 + 8, 1); |
797 |
|
|
else |
798 |
|
|
vr41xx_interrupt(m, cpu, 8 + 8, 0); |
799 |
|
|
} |
800 |
|
|
|
801 |
|
|
/* debug("vr41xx_interrupt(): irq_nr=%i assrt=%i\n", |
802 |
|
|
irq_nr, assrt); */ |
803 |
|
|
|
804 |
|
|
if (irq_nr < 16) { |
805 |
|
|
if (assrt) |
806 |
|
|
m->vr41xx_data->sysint1 |= (1 << irq_nr); |
807 |
|
|
else |
808 |
|
|
m->vr41xx_data->sysint1 &= ~(1 << irq_nr); |
809 |
|
|
} else if (irq_nr < 32) { |
810 |
|
|
irq_nr -= 16; |
811 |
|
|
if (assrt) |
812 |
|
|
m->vr41xx_data->sysint2 |= (1 << irq_nr); |
813 |
|
|
else |
814 |
|
|
m->vr41xx_data->sysint2 &= ~(1 << irq_nr); |
815 |
|
|
} |
816 |
|
|
|
817 |
|
|
/* TODO: Which hardware interrupt pin? */ |
818 |
|
|
|
819 |
|
|
/* debug(" sysint1=%04x mask=%04x, sysint2=%04x mask=%04x\n", |
820 |
|
|
m->vr41xx_data->sysint1, m->vr41xx_data->msysint1, |
821 |
|
|
m->vr41xx_data->sysint2, m->vr41xx_data->msysint2); */ |
822 |
|
|
|
823 |
|
|
if ((m->vr41xx_data->sysint1 & m->vr41xx_data->msysint1) | |
824 |
|
|
(m->vr41xx_data->sysint2 & m->vr41xx_data->msysint2)) |
825 |
|
|
cpu_interrupt(cpu, 2); |
826 |
|
|
else |
827 |
|
|
cpu_interrupt_ack(cpu, 2); |
828 |
|
|
} |
829 |
|
|
|
830 |
|
|
|
831 |
|
|
/* |
832 |
|
|
* Playstation 2 interrupt routine: |
833 |
|
|
*/ |
834 |
|
|
void ps2_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
835 |
|
|
{ |
836 |
|
|
irq_nr -= 8; |
837 |
|
|
debug("ps2_interrupt(): irq_nr=0x%x assrt=%i\n", irq_nr, assrt); |
838 |
|
|
|
839 |
|
|
if (assrt) { |
840 |
|
|
/* OR into the INTR: */ |
841 |
|
|
if (irq_nr < 0x10000) |
842 |
|
|
m->ps2_data->intr |= irq_nr; |
843 |
|
|
else |
844 |
|
|
m->ps2_data->dmac_reg[0x601] |= (irq_nr >> 16); |
845 |
|
|
|
846 |
|
|
/* Assert interrupt: TODO: masks */ |
847 |
|
|
if (irq_nr >= 0x10000) |
848 |
|
|
cpu_interrupt(cpu, 3); |
849 |
|
|
else |
850 |
|
|
cpu_interrupt(cpu, 2); |
851 |
|
|
} else { |
852 |
|
|
/* AND out of the INTR: */ |
853 |
|
|
if (irq_nr < 0x10000) |
854 |
|
|
m->ps2_data->intr &= ~irq_nr; |
855 |
|
|
else |
856 |
|
|
m->ps2_data->dmac_reg[0x601] &= ~(irq_nr >> 16); |
857 |
|
|
|
858 |
|
|
/* TODO: masks */ |
859 |
|
|
if ((m->ps2_data->intr & 0xffff) == 0) |
860 |
|
|
cpu_interrupt_ack(cpu, 2); |
861 |
|
|
if ((m->ps2_data->dmac_reg[0x601] & 0xffff) == 0) |
862 |
|
|
cpu_interrupt_ack(cpu, 3); |
863 |
|
|
} |
864 |
|
|
} |
865 |
|
|
|
866 |
|
|
|
867 |
|
|
/* |
868 |
|
|
* SGI "IP22" interrupt routine: |
869 |
|
|
*/ |
870 |
|
|
void sgi_ip22_interrupt(struct machine *m, struct cpu *cpu, |
871 |
|
|
int irq_nr, int assrt) |
872 |
|
|
{ |
873 |
|
|
/* |
874 |
|
|
* SGI-IP22 specific interrupt stuff: |
875 |
|
|
* |
876 |
|
|
* irq_nr should be 8 + x, where x = 0..31 for local0, |
877 |
|
|
* and 32..63 for local1 interrupts. |
878 |
|
|
* Add 64*y for "mappable" interrupts, where 1<<y is |
879 |
|
|
* the mappable interrupt bitmask. TODO: this misses 64*0 ! |
880 |
|
|
*/ |
881 |
|
|
|
882 |
|
|
uint32_t newmask; |
883 |
|
|
uint32_t stat, mask; |
884 |
|
|
|
885 |
|
|
irq_nr -= 8; |
886 |
|
|
newmask = 1 << (irq_nr & 31); |
887 |
|
|
|
888 |
|
|
if (irq_nr >= 64) { |
889 |
|
|
int ms = irq_nr / 64; |
890 |
|
|
uint32_t new = 1 << ms; |
891 |
|
|
if (assrt) |
892 |
|
|
m->sgi_ip22_data->reg[4] |= new; |
893 |
|
|
else |
894 |
|
|
m->sgi_ip22_data->reg[4] &= ~new; |
895 |
|
|
/* TODO: is this enough? */ |
896 |
|
|
irq_nr &= 63; |
897 |
|
|
} |
898 |
|
|
|
899 |
|
|
if (irq_nr < 32) { |
900 |
|
|
if (assrt) |
901 |
|
|
m->sgi_ip22_data->reg[0] |= newmask; |
902 |
|
|
else |
903 |
|
|
m->sgi_ip22_data->reg[0] &= ~newmask; |
904 |
|
|
} else { |
905 |
|
|
if (assrt) |
906 |
|
|
m->sgi_ip22_data->reg[2] |= newmask; |
907 |
|
|
else |
908 |
|
|
m->sgi_ip22_data->reg[2] &= ~newmask; |
909 |
|
|
} |
910 |
|
|
|
911 |
|
|
/* Read stat and mask for local0: */ |
912 |
|
|
stat = m->sgi_ip22_data->reg[0]; |
913 |
|
|
mask = m->sgi_ip22_data->reg[1]; |
914 |
|
|
if ((stat & mask) == 0) |
915 |
|
|
cpu_interrupt_ack(cpu, 2); |
916 |
|
|
else |
917 |
|
|
cpu_interrupt(cpu, 2); |
918 |
|
|
|
919 |
|
|
/* Read stat and mask for local1: */ |
920 |
|
|
stat = m->sgi_ip22_data->reg[2]; |
921 |
|
|
mask = m->sgi_ip22_data->reg[3]; |
922 |
|
|
if ((stat & mask) == 0) |
923 |
|
|
cpu_interrupt_ack(cpu, 3); |
924 |
|
|
else |
925 |
|
|
cpu_interrupt(cpu, 3); |
926 |
|
|
} |
927 |
|
|
|
928 |
|
|
|
929 |
|
|
/* |
930 |
|
|
* SGI "IP30" interrupt routine: |
931 |
|
|
* |
932 |
|
|
* irq_nr = 8 + 1 + nr, where nr is: |
933 |
|
|
* 0..49 HEART irqs hardware irq 2,3,4 |
934 |
|
|
* 50 HEART timer hardware irq 5 |
935 |
|
|
* 51..63 HEART errors hardware irq 6 |
936 |
|
|
* |
937 |
|
|
* according to Linux/IP30. |
938 |
|
|
*/ |
939 |
|
|
void sgi_ip30_interrupt(struct machine *m, struct cpu *cpu, |
940 |
|
|
int irq_nr, int assrt) |
941 |
|
|
{ |
942 |
|
|
uint64_t newmask; |
943 |
|
|
uint64_t stat, mask; |
944 |
|
|
|
945 |
|
|
irq_nr -= 8; |
946 |
|
|
if (irq_nr == 0) |
947 |
|
|
goto just_assert_and_such; |
948 |
|
|
irq_nr --; |
949 |
|
|
|
950 |
|
|
newmask = (int64_t)1 << irq_nr; |
951 |
|
|
|
952 |
|
|
if (assrt) |
953 |
|
|
m->sgi_ip30_data->isr |= newmask; |
954 |
|
|
else |
955 |
|
|
m->sgi_ip30_data->isr &= ~newmask; |
956 |
|
|
|
957 |
|
|
just_assert_and_such: |
958 |
|
|
|
959 |
|
|
cpu_interrupt_ack(cpu, 2); |
960 |
|
|
cpu_interrupt_ack(cpu, 3); |
961 |
|
|
cpu_interrupt_ack(cpu, 4); |
962 |
|
|
cpu_interrupt_ack(cpu, 5); |
963 |
|
|
cpu_interrupt_ack(cpu, 6); |
964 |
|
|
|
965 |
|
|
stat = m->sgi_ip30_data->isr; |
966 |
|
|
mask = m->sgi_ip30_data->imask0; |
967 |
|
|
|
968 |
|
|
if ((stat & mask) & 0x000000000000ffffULL) |
969 |
|
|
cpu_interrupt(cpu, 2); |
970 |
|
|
if ((stat & mask) & 0x00000000ffff0000ULL) |
971 |
|
|
cpu_interrupt(cpu, 3); |
972 |
|
|
if ((stat & mask) & 0x0003ffff00000000ULL) |
973 |
|
|
cpu_interrupt(cpu, 4); |
974 |
|
|
if ((stat & mask) & 0x0004000000000000ULL) |
975 |
|
|
cpu_interrupt(cpu, 5); |
976 |
|
|
if ((stat & mask) & 0xfff8000000000000ULL) |
977 |
|
|
cpu_interrupt(cpu, 6); |
978 |
|
|
} |
979 |
|
|
|
980 |
|
|
|
981 |
|
|
/* |
982 |
|
|
* SGI "IP32" interrupt routine: |
983 |
|
|
*/ |
984 |
|
|
void sgi_ip32_interrupt(struct machine *m, struct cpu *cpu, |
985 |
|
|
int irq_nr, int assrt) |
986 |
|
|
{ |
987 |
|
|
/* |
988 |
|
|
* The 64-bit word at crime offset 0x10 is CRIME_INTSTAT, |
989 |
|
|
* which contains the current interrupt bits. CRIME_INTMASK |
990 |
|
|
* contains a mask of which bits are actually in use. |
991 |
|
|
* |
992 |
|
|
* crime hardcoded at 0x14000000, for SGI-IP32. |
993 |
|
|
* If any of these bits are asserted, then physical MIPS |
994 |
|
|
* interrupt 2 should be asserted. |
995 |
|
|
* |
996 |
|
|
* TODO: how should all this be done nicely? |
997 |
|
|
* |
998 |
|
|
* TODO: mace interrupt mask |
999 |
|
|
*/ |
1000 |
|
|
|
1001 |
|
|
uint64_t crime_addr = CRIME_INTSTAT; |
1002 |
|
|
uint64_t mace_addr = 0x14; |
1003 |
|
|
uint64_t crime_interrupts, crime_interrupts_mask, mace_interrupts; |
1004 |
|
|
unsigned int i; |
1005 |
|
|
unsigned char x[8]; |
1006 |
|
|
|
1007 |
|
|
/* |
1008 |
|
|
* This mapping of both MACE and CRIME interrupts into the same |
1009 |
|
|
* 'int' is really ugly. |
1010 |
|
|
* |
1011 |
|
|
* If MACE_PERIPH_MISC or MACE_PERIPH_SERIAL is set, then mask |
1012 |
|
|
* that bit out and treat the rest of the word as the mace interrupt |
1013 |
|
|
* bitmask. |
1014 |
|
|
* |
1015 |
|
|
* TODO: fix. |
1016 |
|
|
*/ |
1017 |
|
|
if (irq_nr & MACE_PERIPH_SERIAL) { |
1018 |
|
|
/* Read current MACE interrupt bits: */ |
1019 |
|
|
memcpy(x, m->mace_data->reg + mace_addr, sizeof(uint32_t)); |
1020 |
|
|
mace_interrupts = 0; |
1021 |
|
|
for (i=0; i<sizeof(uint32_t); i++) { |
1022 |
|
|
/* SGI is big-endian... */ |
1023 |
|
|
mace_interrupts <<= 8; |
1024 |
|
|
mace_interrupts |= x[i]; |
1025 |
|
|
} |
1026 |
|
|
|
1027 |
|
|
if (assrt) |
1028 |
|
|
mace_interrupts |= (irq_nr & ~MACE_PERIPH_SERIAL); |
1029 |
|
|
else |
1030 |
|
|
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_SERIAL); |
1031 |
|
|
|
1032 |
|
|
/* Write back MACE interrupt bits: */ |
1033 |
|
|
for (i=0; i<4; i++) |
1034 |
|
|
x[3-i] = mace_interrupts >> (i*8); |
1035 |
|
|
memcpy(m->mace_data->reg + mace_addr, x, sizeof(uint32_t)); |
1036 |
|
|
|
1037 |
|
|
irq_nr = MACE_PERIPH_SERIAL; |
1038 |
|
|
if (mace_interrupts == 0) |
1039 |
|
|
assrt = 0; |
1040 |
|
|
else |
1041 |
|
|
assrt = 1; |
1042 |
|
|
} |
1043 |
|
|
|
1044 |
|
|
/* Hopefully _MISC and _SERIAL will not be both on at the same time. */ |
1045 |
|
|
if (irq_nr & MACE_PERIPH_MISC) { |
1046 |
|
|
/* Read current MACE interrupt bits: */ |
1047 |
|
|
memcpy(x, m->mace_data->reg + mace_addr, sizeof(uint32_t)); |
1048 |
|
|
mace_interrupts = 0; |
1049 |
|
|
for (i=0; i<sizeof(uint32_t); i++) { |
1050 |
|
|
/* SGI is big-endian... */ |
1051 |
|
|
mace_interrupts <<= 8; |
1052 |
|
|
mace_interrupts |= x[i]; |
1053 |
|
|
} |
1054 |
|
|
|
1055 |
|
|
if (assrt) |
1056 |
|
|
mace_interrupts |= (irq_nr & ~MACE_PERIPH_MISC); |
1057 |
|
|
else |
1058 |
|
|
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_MISC); |
1059 |
|
|
|
1060 |
|
|
/* Write back MACE interrupt bits: */ |
1061 |
|
|
for (i=0; i<4; i++) |
1062 |
|
|
x[3-i] = mace_interrupts >> (i*8); |
1063 |
|
|
memcpy(m->mace_data->reg + mace_addr, x, sizeof(uint32_t)); |
1064 |
|
|
|
1065 |
|
|
irq_nr = MACE_PERIPH_MISC; |
1066 |
|
|
if (mace_interrupts == 0) |
1067 |
|
|
assrt = 0; |
1068 |
|
|
else |
1069 |
|
|
assrt = 1; |
1070 |
|
|
} |
1071 |
|
|
|
1072 |
|
|
/* Read CRIME_INTSTAT: */ |
1073 |
|
|
memcpy(x, m->crime_data->reg + crime_addr, sizeof(uint64_t)); |
1074 |
|
|
crime_interrupts = 0; |
1075 |
|
|
for (i=0; i<8; i++) { |
1076 |
|
|
/* SGI is big-endian... */ |
1077 |
|
|
crime_interrupts <<= 8; |
1078 |
|
|
crime_interrupts |= x[i]; |
1079 |
|
|
} |
1080 |
|
|
|
1081 |
|
|
if (assrt) |
1082 |
|
|
crime_interrupts |= irq_nr; |
1083 |
|
|
else |
1084 |
|
|
crime_interrupts &= ~irq_nr; |
1085 |
|
|
|
1086 |
|
|
/* Write back CRIME_INTSTAT: */ |
1087 |
|
|
for (i=0; i<8; i++) |
1088 |
|
|
x[7-i] = crime_interrupts >> (i*8); |
1089 |
|
|
memcpy(m->crime_data->reg + crime_addr, x, sizeof(uint64_t)); |
1090 |
|
|
|
1091 |
|
|
/* Read CRIME_INTMASK: */ |
1092 |
|
|
memcpy(x, m->crime_data->reg + CRIME_INTMASK, sizeof(uint64_t)); |
1093 |
|
|
crime_interrupts_mask = 0; |
1094 |
|
|
for (i=0; i<8; i++) { |
1095 |
|
|
crime_interrupts_mask <<= 8; |
1096 |
|
|
crime_interrupts_mask |= x[i]; |
1097 |
|
|
} |
1098 |
|
|
|
1099 |
|
|
if ((crime_interrupts & crime_interrupts_mask) == 0) |
1100 |
|
|
cpu_interrupt_ack(cpu, 2); |
1101 |
|
|
else |
1102 |
|
|
cpu_interrupt(cpu, 2); |
1103 |
|
|
|
1104 |
|
|
/* printf("sgi_crime_machine_irq(%i,%i): new interrupts = 0x%08x\n", assrt, irq_nr, crime_interrupts); */ |
1105 |
|
|
} |
1106 |
|
|
|
1107 |
|
|
|
1108 |
|
|
/* |
1109 |
|
|
* Au1x00 interrupt routine: |
1110 |
|
|
* |
1111 |
|
|
* TODO: This is just bogus so far. For more info, read this: |
1112 |
|
|
* http://www.meshcube.org/cgi-bin/viewcvs.cgi/kernel/linux/arch/mips/au1000/common/ |
1113 |
|
|
* |
1114 |
|
|
* CPU int 2 = IC 0, request 0 |
1115 |
|
|
* CPU int 3 = IC 0, request 1 |
1116 |
|
|
* CPU int 4 = IC 1, request 0 |
1117 |
|
|
* CPU int 5 = IC 1, request 1 |
1118 |
|
|
* |
1119 |
|
|
* Interrupts 0..31 are on interrupt controller 0, interrupts 32..63 are |
1120 |
|
|
* on controller 1. |
1121 |
|
|
* |
1122 |
|
|
* Special case: if irq_nr == 64+8, then this just updates the CPU |
1123 |
|
|
* interrupt assertions. |
1124 |
|
|
*/ |
1125 |
|
|
void au1x00_interrupt(struct machine *m, struct cpu *cpu, |
1126 |
|
|
int irq_nr, int assrt) |
1127 |
|
|
{ |
1128 |
|
|
uint32_t ms; |
1129 |
|
|
|
1130 |
|
|
irq_nr -= 8; |
1131 |
|
|
debug("au1x00_interrupt(): irq_nr=%i assrt=%i\n", irq_nr, assrt); |
1132 |
|
|
|
1133 |
|
|
if (irq_nr < 64) { |
1134 |
|
|
ms = 1 << (irq_nr & 31); |
1135 |
|
|
|
1136 |
|
|
if (assrt) |
1137 |
|
|
m->au1x00_ic_data->request0_int |= ms; |
1138 |
|
|
else |
1139 |
|
|
m->au1x00_ic_data->request0_int &= ~ms; |
1140 |
|
|
|
1141 |
|
|
/* TODO: Controller 1 */ |
1142 |
|
|
} |
1143 |
|
|
|
1144 |
|
|
if ((m->au1x00_ic_data->request0_int & |
1145 |
|
|
m->au1x00_ic_data->mask) != 0) |
1146 |
|
|
cpu_interrupt(cpu, 2); |
1147 |
|
|
else |
1148 |
|
|
cpu_interrupt_ack(cpu, 2); |
1149 |
|
|
|
1150 |
|
|
/* TODO: What _is_ request1? */ |
1151 |
|
|
|
1152 |
|
|
/* TODO: Controller 1 */ |
1153 |
|
|
} |
1154 |
|
|
|
1155 |
|
|
|
1156 |
|
|
/**************************************************************************** |
1157 |
|
|
* * |
1158 |
|
|
* Machine dependant Initialization routines * |
1159 |
|
|
* * |
1160 |
|
|
****************************************************************************/ |
1161 |
|
|
|
1162 |
|
|
|
1163 |
|
|
/* |
1164 |
|
|
* machine_setup(): |
1165 |
|
|
* |
1166 |
|
|
* This (rather large) function initializes memory, registers, and/or devices |
1167 |
|
|
* required by specific machine emulations. |
1168 |
|
|
*/ |
1169 |
|
|
void machine_setup(struct machine *machine) |
1170 |
|
|
{ |
1171 |
|
|
uint64_t addr, addr2; |
1172 |
|
|
int i, j; |
1173 |
|
|
struct memory *mem; |
1174 |
|
|
char tmpstr[1000]; |
1175 |
|
|
|
1176 |
|
|
/* DECstation: */ |
1177 |
|
|
char *framebuffer_console_name, *serial_console_name; |
1178 |
|
|
int color_fb_flag; |
1179 |
|
|
int boot_scsi_boardnumber = 3, boot_net_boardnumber = 3; |
1180 |
|
|
char *turbochannel_default_gfx_card = "PMAG-BA"; |
1181 |
|
|
/* PMAG-AA, -BA, -CA/DA/EA/FA, -JA, -RO, PMAGB-BA */ |
1182 |
|
|
|
1183 |
|
|
/* HPCmips: */ |
1184 |
|
|
struct xx { |
1185 |
|
|
struct btinfo_magic a; |
1186 |
|
|
struct btinfo_bootpath b; |
1187 |
|
|
struct btinfo_symtab c; |
1188 |
|
|
} xx; |
1189 |
|
|
struct hpc_bootinfo hpc_bootinfo; |
1190 |
|
|
uint64_t hpcmips_fb_addr = 0; |
1191 |
|
|
int hpcmips_fb_bits = 0, hpcmips_fb_encoding = 0; |
1192 |
|
|
int hpcmips_fb_xsize = 0; |
1193 |
|
|
int hpcmips_fb_ysize = 0; |
1194 |
|
|
int hpcmips_fb_xsize_mem = 0; |
1195 |
|
|
int hpcmips_fb_ysize_mem = 0; |
1196 |
|
|
|
1197 |
|
|
/* ARCBIOS stuff: */ |
1198 |
|
|
struct arcbios_spb arcbios_spb; |
1199 |
|
|
struct arcbios_spb_64 arcbios_spb_64; |
1200 |
|
|
struct arcbios_sysid arcbios_sysid; |
1201 |
|
|
struct arcbios_dsp_stat arcbios_dsp_stat; |
1202 |
|
|
uint64_t mem_base, mem_count; |
1203 |
|
|
uint64_t system = 0; |
1204 |
|
|
uint64_t sgi_ram_offset = 0; |
1205 |
|
|
uint64_t arc_reserved; |
1206 |
|
|
int arc_wordlen = sizeof(uint32_t); |
1207 |
|
|
char *short_machine_name = NULL; |
1208 |
|
|
char *eaddr_string = "eaddr=10:20:30:40:50:60"; /* nonsense */ |
1209 |
|
|
unsigned char macaddr[6]; |
1210 |
|
|
|
1211 |
|
|
/* Generic bootstring stuff: */ |
1212 |
|
|
int bootdev_id = diskimage_bootdev(machine); |
1213 |
|
|
char *bootstr = NULL; |
1214 |
|
|
char *bootarg = NULL; |
1215 |
|
|
char *init_bootpath; |
1216 |
|
|
|
1217 |
|
|
/* PCI stuff: */ |
1218 |
|
|
struct pci_data *pci_data; |
1219 |
|
|
|
1220 |
|
|
/* Framebuffer stuff: */ |
1221 |
|
|
struct vfb_data *fb; |
1222 |
|
|
|
1223 |
|
|
/* Abreviation: :-) */ |
1224 |
|
|
struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; |
1225 |
|
|
|
1226 |
|
|
|
1227 |
|
|
mem = cpu->mem; |
1228 |
|
|
machine->machine_name = NULL; |
1229 |
|
|
|
1230 |
|
|
/* TODO: Move this somewhere else? */ |
1231 |
|
|
if (machine->boot_string_argument == NULL) { |
1232 |
|
|
switch (machine->machine_type) { |
1233 |
|
|
case MACHINE_ARC: |
1234 |
|
|
machine->boot_string_argument = "-aN"; |
1235 |
|
|
break; |
1236 |
|
|
case MACHINE_DEC: |
1237 |
|
|
machine->boot_string_argument = "-a"; |
1238 |
|
|
break; |
1239 |
|
|
default: |
1240 |
|
|
/* Important, because boot_string_argument should |
1241 |
|
|
not be set to NULL: */ |
1242 |
|
|
machine->boot_string_argument = ""; |
1243 |
|
|
} |
1244 |
|
|
} |
1245 |
|
|
|
1246 |
|
|
switch (machine->machine_type) { |
1247 |
|
|
|
1248 |
|
|
case MACHINE_NONE: |
1249 |
|
|
printf("\nNo emulation type specified.\n"); |
1250 |
|
|
exit(1); |
1251 |
|
|
|
1252 |
|
|
case MACHINE_BAREMIPS: |
1253 |
|
|
/* |
1254 |
|
|
* A "bare" MIPS test machine. |
1255 |
|
|
* |
1256 |
|
|
* NOTE: NO devices at all. |
1257 |
|
|
*/ |
1258 |
|
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
1259 |
|
|
machine->machine_name = "\"Bare\" MIPS machine"; |
1260 |
|
|
break; |
1261 |
|
|
|
1262 |
|
|
case MACHINE_TESTMIPS: |
1263 |
|
|
/* |
1264 |
|
|
* A MIPS test machine (which happens to work with my |
1265 |
|
|
* thesis work). |
1266 |
|
|
*/ |
1267 |
|
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
1268 |
|
|
machine->machine_name = "MIPS test machine"; |
1269 |
|
|
|
1270 |
|
|
machine->main_console_handle = dev_cons_init( |
1271 |
|
|
machine, mem, DEV_CONS_ADDRESS, "console", 2); |
1272 |
|
|
|
1273 |
|
|
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
1274 |
|
|
(long long)DEV_MP_ADDRESS); |
1275 |
|
|
device_add(machine, tmpstr); |
1276 |
|
|
|
1277 |
|
|
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
1278 |
|
|
640,480, 640,480, 24, "generic", 1); |
1279 |
|
|
break; |
1280 |
|
|
|
1281 |
|
|
case MACHINE_DEC: |
1282 |
|
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
1283 |
|
|
|
1284 |
|
|
/* An R2020 or R3220 memory thingy: */ |
1285 |
|
|
cpu->cd.mips.coproc[3] = mips_coproc_new(cpu, 3); |
1286 |
|
|
|
1287 |
|
|
/* There aren't really any good standard values... */ |
1288 |
|
|
framebuffer_console_name = "osconsole=0,3"; |
1289 |
|
|
serial_console_name = "osconsole=1"; |
1290 |
|
|
|
1291 |
|
|
switch (machine->machine_subtype) { |
1292 |
|
|
case MACHINE_DEC_PMAX_3100: /* type 1, KN01 */ |
1293 |
|
|
/* Supposed to have 12MHz or 16.67MHz R2000 CPU, R2010 FPC, R2020 Memory coprocessor */ |
1294 |
|
|
machine->machine_name = "DEC PMAX 3100 (KN01)"; |
1295 |
|
|
|
1296 |
|
|
/* 12 MHz for 2100, 16.67 MHz for 3100 */ |
1297 |
|
|
if (machine->emulated_hz == 0) |
1298 |
|
|
machine->emulated_hz = 16670000; |
1299 |
|
|
|
1300 |
|
|
if (machine->physical_ram_in_mb > 24) |
1301 |
|
|
fprintf(stderr, "WARNING! Real DECstation 3100 machines cannot have more than 24MB RAM. Continuing anyway.\n"); |
1302 |
|
|
|
1303 |
|
|
if ((machine->physical_ram_in_mb % 4) != 0) |
1304 |
|
|
fprintf(stderr, "WARNING! Real DECstation 3100 machines have an integer multiple of 4 MBs of RAM. Continuing anyway.\n"); |
1305 |
|
|
|
1306 |
|
|
color_fb_flag = 1; /* 1 for color, 0 for mono. TODO: command line option? */ |
1307 |
|
|
|
1308 |
|
|
/* |
1309 |
|
|
* According to NetBSD/pmax: |
1310 |
|
|
* |
1311 |
|
|
* pm0 at ibus0 addr 0xfc00000: 1024x864x1 (or x8 for color) |
1312 |
|
|
* dc0 at ibus0 addr 0x1c000000 |
1313 |
|
|
* le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00 |
1314 |
|
|
* sii0 at ibus0 addr 0x1a000000 |
1315 |
|
|
* mcclock0 at ibus0 addr 0x1d000000: mc146818 or compatible |
1316 |
|
|
* 0x1e000000 = system status and control register |
1317 |
|
|
*/ |
1318 |
|
|
fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START, |
1319 |
|
|
color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01, |
1320 |
|
|
0,0,0,0,0, color_fb_flag? "VFB02":"VFB01", 1); |
1321 |
|
|
dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START, &fb->color_plane_mask); |
1322 |
|
|
dev_vdac_init(mem, KN01_SYS_VDAC, fb->rgb_palette, color_fb_flag); |
1323 |
|
|
dev_le_init(machine, mem, KN01_SYS_LANCE, KN01_SYS_LANCE_B_START, KN01_SYS_LANCE_B_END, KN01_INT_LANCE, 4*1048576); |
1324 |
|
|
dev_sii_init(machine, mem, KN01_SYS_SII, KN01_SYS_SII_B_START, KN01_SYS_SII_B_END, KN01_INT_SII); |
1325 |
|
|
dev_dc7085_init(machine, mem, KN01_SYS_DZ, KN01_INT_DZ, machine->use_x11); |
1326 |
|
|
dev_mc146818_init(machine, mem, KN01_SYS_CLOCK, KN01_INT_CLOCK, MC146818_DEC, 1); |
1327 |
|
|
dev_kn01_csr_init(mem, KN01_SYS_CSR, color_fb_flag); |
1328 |
|
|
|
1329 |
|
|
framebuffer_console_name = "osconsole=0,3"; /* fb,keyb */ |
1330 |
|
|
serial_console_name = "osconsole=3"; /* 3 */ |
1331 |
|
|
break; |
1332 |
|
|
|
1333 |
|
|
case MACHINE_DEC_3MAX_5000: /* type 2, KN02 */ |
1334 |
|
|
/* Supposed to have 25MHz R3000 CPU, R3010 FPC, */ |
1335 |
|
|
/* and a R3220 Memory coprocessor */ |
1336 |
|
|
machine->machine_name = "DECstation 5000/200 (3MAX, KN02)"; |
1337 |
|
|
|
1338 |
|
|
if (machine->emulated_hz == 0) |
1339 |
|
|
machine->emulated_hz = 25000000; |
1340 |
|
|
|
1341 |
|
|
if (machine->physical_ram_in_mb < 8) |
1342 |
|
|
fprintf(stderr, "WARNING! Real KN02 machines do not have less than 8MB RAM. Continuing anyway.\n"); |
1343 |
|
|
if (machine->physical_ram_in_mb > 480) |
1344 |
|
|
fprintf(stderr, "WARNING! Real KN02 machines cannot have more than 480MB RAM. Continuing anyway.\n"); |
1345 |
|
|
|
1346 |
|
|
/* An R3220 memory thingy: */ |
1347 |
|
|
cpu->cd.mips.coproc[3] = mips_coproc_new(cpu, 3); |
1348 |
|
|
|
1349 |
|
|
/* |
1350 |
|
|
* According to NetBSD/pmax: |
1351 |
|
|
* asc0 at tc0 slot 5 offset 0x0 |
1352 |
|
|
* le0 at tc0 slot 6 offset 0x0 |
1353 |
|
|
* ibus0 at tc0 slot 7 offset 0x0 |
1354 |
|
|
* dc0 at ibus0 addr 0x1fe00000 |
1355 |
|
|
* mcclock0 at ibus0 addr 0x1fe80000: mc146818 |
1356 |
|
|
* |
1357 |
|
|
* kn02 shared irq numbers (IP) are offset by +8 |
1358 |
|
|
* in the emulator |
1359 |
|
|
*/ |
1360 |
|
|
|
1361 |
|
|
/* KN02 interrupts: */ |
1362 |
|
|
machine->md_interrupt = kn02_interrupt; |
1363 |
|
|
|
1364 |
|
|
/* |
1365 |
|
|
* TURBOchannel slots 0, 1, and 2 are free for |
1366 |
|
|
* option cards. Let's put in zero or more graphics |
1367 |
|
|
* boards: |
1368 |
|
|
* |
1369 |
|
|
* TODO: It's also possible to have larger graphics |
1370 |
|
|
* cards that occupy several slots. How to solve |
1371 |
|
|
* this nicely? |
1372 |
|
|
*/ |
1373 |
|
|
dev_turbochannel_init(machine, mem, 0, |
1374 |
|
|
KN02_PHYS_TC_0_START, KN02_PHYS_TC_0_END, |
1375 |
|
|
machine->n_gfx_cards >= 1? |
1376 |
|
|
turbochannel_default_gfx_card : "", |
1377 |
|
|
KN02_IP_SLOT0 +8); |
1378 |
|
|
|
1379 |
|
|
dev_turbochannel_init(machine, mem, 1, |
1380 |
|
|
KN02_PHYS_TC_1_START, KN02_PHYS_TC_1_END, |
1381 |
|
|
machine->n_gfx_cards >= 2? |
1382 |
|
|
turbochannel_default_gfx_card : "", |
1383 |
|
|
KN02_IP_SLOT1 +8); |
1384 |
|
|
|
1385 |
|
|
dev_turbochannel_init(machine, mem, 2, |
1386 |
|
|
KN02_PHYS_TC_2_START, KN02_PHYS_TC_2_END, |
1387 |
|
|
machine->n_gfx_cards >= 3? |
1388 |
|
|
turbochannel_default_gfx_card : "", |
1389 |
|
|
KN02_IP_SLOT2 +8); |
1390 |
|
|
|
1391 |
|
|
/* TURBOchannel slots 3 and 4 are reserved. */ |
1392 |
|
|
|
1393 |
|
|
/* TURBOchannel slot 5 is PMAZ-AA ("asc" SCSI). */ |
1394 |
|
|
dev_turbochannel_init(machine, mem, 5, |
1395 |
|
|
KN02_PHYS_TC_5_START, KN02_PHYS_TC_5_END, |
1396 |
|
|
"PMAZ-AA", KN02_IP_SCSI +8); |
1397 |
|
|
|
1398 |
|
|
/* TURBOchannel slot 6 is PMAD-AA ("le" ethernet). */ |
1399 |
|
|
dev_turbochannel_init(machine, mem, 6, |
1400 |
|
|
KN02_PHYS_TC_6_START, KN02_PHYS_TC_6_END, |
1401 |
|
|
"PMAD-AA", KN02_IP_LANCE +8); |
1402 |
|
|
|
1403 |
|
|
/* TURBOchannel slot 7 is system stuff. */ |
1404 |
|
|
machine->main_console_handle = |
1405 |
|
|
dev_dc7085_init(machine, mem, |
1406 |
|
|
KN02_SYS_DZ, KN02_IP_DZ +8, machine->use_x11); |
1407 |
|
|
dev_mc146818_init(machine, mem, |
1408 |
|
|
KN02_SYS_CLOCK, KN02_INT_CLOCK, MC146818_DEC, 1); |
1409 |
|
|
|
1410 |
|
|
machine->kn02_csr = |
1411 |
|
|
dev_kn02_init(cpu, mem, KN02_SYS_CSR); |
1412 |
|
|
|
1413 |
|
|
framebuffer_console_name = "osconsole=0,7"; |
1414 |
|
|
/* fb,keyb */ |
1415 |
|
|
serial_console_name = "osconsole=2"; |
1416 |
|
|
boot_scsi_boardnumber = 5; |
1417 |
|
|
boot_net_boardnumber = 6; /* TODO: 3? */ |
1418 |
|
|
break; |
1419 |
|
|
|
1420 |
|
|
case MACHINE_DEC_3MIN_5000: /* type 3, KN02BA */ |
1421 |
|
|
machine->machine_name = "DECstation 5000/112 or 145 (3MIN, KN02BA)"; |
1422 |
|
|
if (machine->emulated_hz == 0) |
1423 |
|
|
machine->emulated_hz = 33000000; |
1424 |
|
|
if (machine->physical_ram_in_mb > 128) |
1425 |
|
|
fprintf(stderr, "WARNING! Real 3MIN machines cannot have more than 128MB RAM. Continuing anyway.\n"); |
1426 |
|
|
|
1427 |
|
|
/* KMIN interrupts: */ |
1428 |
|
|
machine->md_interrupt = kmin_interrupt; |
1429 |
|
|
|
1430 |
|
|
/* |
1431 |
|
|
* tc0 at mainbus0: 12.5 MHz clock (0x10000000, slotsize = 64MB) |
1432 |
|
|
* tc slot 1: 0x14000000 |
1433 |
|
|
* tc slot 2: 0x18000000 |
1434 |
|
|
* ioasic0 at tc0 slot 3 offset 0x0 (0x1c000000) slot 0 |
1435 |
|
|
* asic regs (0x1c040000) slot 1 |
1436 |
|
|
* station's ether address (0x1c080000) slot 2 |
1437 |
|
|
* le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00 (0x1c0c0000) slot 3 |
1438 |
|
|
* scc0 at ioasic0 offset 0x100000 (0x1c100000) slot 4 |
1439 |
|
|
* scc1 at ioasic0 offset 0x180000: console (0x1c180000) slot 6 |
1440 |
|
|
* mcclock0 at ioasic0 offset 0x200000: mc146818 or compatible (0x1c200000) slot 8 |
1441 |
|
|
* asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7 (0x1c300000) slot 12 |
1442 |
|
|
* dma for asc0 (0x1c380000) slot 14 |
1443 |
|
|
*/ |
1444 |
|
|
machine->dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0); |
1445 |
|
|
dev_le_init(machine, mem, 0x1c0c0000, 0, 0, KMIN_INTR_LANCE +8, 4*65536); |
1446 |
|
|
dev_scc_init(machine, mem, 0x1c100000, KMIN_INTR_SCC_0 +8, machine->use_x11, 0, 1); |
1447 |
|
|
dev_scc_init(machine, mem, 0x1c180000, KMIN_INTR_SCC_1 +8, machine->use_x11, 1, 1); |
1448 |
|
|
dev_mc146818_init(machine, mem, 0x1c200000, KMIN_INTR_CLOCK +8, MC146818_DEC, 1); |
1449 |
|
|
dev_asc_init(machine, mem, 0x1c300000, KMIN_INTR_SCSI +8, |
1450 |
|
|
NULL, DEV_ASC_DEC, NULL, NULL); |
1451 |
|
|
|
1452 |
|
|
/* |
1453 |
|
|
* TURBOchannel slots 0, 1, and 2 are free for |
1454 |
|
|
* option cards. These are by default filled with |
1455 |
|
|
* zero or more graphics boards. |
1456 |
|
|
* |
1457 |
|
|
* TODO: irqs |
1458 |
|
|
*/ |
1459 |
|
|
dev_turbochannel_init(machine, mem, 0, |
1460 |
|
|
0x10000000, 0x103fffff, |
1461 |
|
|
machine->n_gfx_cards >= 1? |
1462 |
|
|
turbochannel_default_gfx_card : "", |
1463 |
|
|
KMIN_INT_TC0); |
1464 |
|
|
|
1465 |
|
|
dev_turbochannel_init(machine, mem, 1, |
1466 |
|
|
0x14000000, 0x143fffff, |
1467 |
|
|
machine->n_gfx_cards >= 2? |
1468 |
|
|
turbochannel_default_gfx_card : "", |
1469 |
|
|
KMIN_INT_TC1); |
1470 |
|
|
|
1471 |
|
|
dev_turbochannel_init(machine, mem, 2, |
1472 |
|
|
0x18000000, 0x183fffff, |
1473 |
|
|
machine->n_gfx_cards >= 3? |
1474 |
|
|
turbochannel_default_gfx_card : "", |
1475 |
|
|
KMIN_INT_TC2); |
1476 |
|
|
|
1477 |
|
|
/* (kmin shared irq numbers (IP) are offset by +8 in the emulator) */ |
1478 |
|
|
/* kmin_csr = dev_kmin_init(cpu, mem, KMIN_REG_INTR); */ |
1479 |
|
|
|
1480 |
|
|
framebuffer_console_name = "osconsole=0,3"; /* fb, keyb (?) */ |
1481 |
|
|
serial_console_name = "osconsole=3"; /* ? */ |
1482 |
|
|
break; |
1483 |
|
|
|
1484 |
|
|
case MACHINE_DEC_3MAXPLUS_5000: /* type 4, KN03 */ |
1485 |
|
|
machine->machine_name = "DECsystem 5900 or 5000 (3MAX+) (KN03)"; |
1486 |
|
|
|
1487 |
|
|
/* 5000/240 (KN03-GA, R3000): 40 MHz */ |
1488 |
|
|
/* 5000/260 (KN05-NB, R4000): 60 MHz */ |
1489 |
|
|
/* TODO: are both these type 4? */ |
1490 |
|
|
if (machine->emulated_hz == 0) |
1491 |
|
|
machine->emulated_hz = 40000000; |
1492 |
|
|
if (machine->physical_ram_in_mb > 480) |
1493 |
|
|
fprintf(stderr, "WARNING! Real KN03 machines cannot have more than 480MB RAM. Continuing anyway.\n"); |
1494 |
|
|
|
1495 |
|
|
/* KN03 interrupts: */ |
1496 |
|
|
machine->md_interrupt = kn03_interrupt; |
1497 |
|
|
|
1498 |
|
|
/* |
1499 |
|
|
* tc0 at mainbus0: 25 MHz clock (slot 0) (0x1e000000) |
1500 |
|
|
* tc0 slot 1 (0x1e800000) |
1501 |
|
|
* tc0 slot 2 (0x1f000000) |
1502 |
|
|
* ioasic0 at tc0 slot 3 offset 0x0 (0x1f800000) |
1503 |
|
|
* something that has to do with interrupts? (?) (0x1f840000 ?) |
1504 |
|
|
* le0 at ioasic0 offset 0xc0000 (0x1f8c0000) |
1505 |
|
|
* scc0 at ioasic0 offset 0x100000 (0x1f900000) |
1506 |
|
|
* scc1 at ioasic0 offset 0x180000: console (0x1f980000) |
1507 |
|
|
* mcclock0 at ioasic0 offset 0x200000: mc146818 or compatible (0x1fa00000) |
1508 |
|
|
* asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7 (0x1fb00000) |
1509 |
|
|
*/ |
1510 |
|
|
machine->dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1f800000, 0); |
1511 |
|
|
|
1512 |
|
|
dev_le_init(machine, mem, KN03_SYS_LANCE, 0, 0, KN03_INTR_LANCE +8, 4*65536); |
1513 |
|
|
|
1514 |
|
|
machine->dec_ioasic_data->dma_func[3] = dev_scc_dma_func; |
1515 |
|
|
machine->dec_ioasic_data->dma_func_extra[2] = dev_scc_init(machine, mem, KN03_SYS_SCC_0, KN03_INTR_SCC_0 +8, machine->use_x11, 0, 1); |
1516 |
|
|
machine->dec_ioasic_data->dma_func[2] = dev_scc_dma_func; |
1517 |
|
|
machine->dec_ioasic_data->dma_func_extra[3] = dev_scc_init(machine, mem, KN03_SYS_SCC_1, KN03_INTR_SCC_1 +8, machine->use_x11, 1, 1); |
1518 |
|
|
|
1519 |
|
|
dev_mc146818_init(machine, mem, KN03_SYS_CLOCK, KN03_INT_RTC, MC146818_DEC, 1); |
1520 |
|
|
dev_asc_init(machine, mem, KN03_SYS_SCSI, |
1521 |
|
|
KN03_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL); |
1522 |
|
|
|
1523 |
|
|
/* |
1524 |
|
|
* TURBOchannel slots 0, 1, and 2 are free for |
1525 |
|
|
* option cards. These are by default filled with |
1526 |
|
|
* zero or more graphics boards. |
1527 |
|
|
* |
1528 |
|
|
* TODO: irqs |
1529 |
|
|
*/ |
1530 |
|
|
dev_turbochannel_init(machine, mem, 0, |
1531 |
|
|
KN03_PHYS_TC_0_START, KN03_PHYS_TC_0_END, |
1532 |
|
|
machine->n_gfx_cards >= 1? |
1533 |
|
|
turbochannel_default_gfx_card : "", |
1534 |
|
|
KN03_INTR_TC_0 +8); |
1535 |
|
|
|
1536 |
|
|
dev_turbochannel_init(machine, mem, 1, |
1537 |
|
|
KN03_PHYS_TC_1_START, KN03_PHYS_TC_1_END, |
1538 |
|
|
machine->n_gfx_cards >= 2? |
1539 |
|
|
turbochannel_default_gfx_card : "", |
1540 |
|
|
KN03_INTR_TC_1 +8); |
1541 |
|
|
|
1542 |
|
|
dev_turbochannel_init(machine, mem, 2, |
1543 |
|
|
KN03_PHYS_TC_2_START, KN03_PHYS_TC_2_END, |
1544 |
|
|
machine->n_gfx_cards >= 3? |
1545 |
|
|
turbochannel_default_gfx_card : "", |
1546 |
|
|
KN03_INTR_TC_2 +8); |
1547 |
|
|
|
1548 |
|
|
/* TODO: interrupts */ |
1549 |
|
|
/* shared (turbochannel) interrupts are +8 */ |
1550 |
|
|
|
1551 |
|
|
framebuffer_console_name = "osconsole=0,3"; /* fb, keyb (?) */ |
1552 |
|
|
serial_console_name = "osconsole=3"; /* ? */ |
1553 |
|
|
break; |
1554 |
|
|
|
1555 |
|
|
case MACHINE_DEC_5800: /* type 5, KN5800 */ |
1556 |
|
|
machine->machine_name = "DECsystem 5800"; |
1557 |
|
|
|
1558 |
|
|
/* TODO: this is incorrect, banks multiply by 8 etc */ |
1559 |
|
|
if (machine->physical_ram_in_mb < 48) |
1560 |
|
|
fprintf(stderr, "WARNING! 5800 will probably not run with less than 48MB RAM. Continuing anyway.\n"); |
1561 |
|
|
|
1562 |
|
|
/* |
1563 |
|
|
* According to http://www2.no.netbsd.org/Ports/pmax/models.html, |
1564 |
|
|
* the 5800-series is based on VAX 6000/300. |
1565 |
|
|
*/ |
1566 |
|
|
|
1567 |
|
|
/* |
1568 |
|
|
* Ultrix might support SMP on this machine type. |
1569 |
|
|
* |
1570 |
|
|
* Something at 0x10000000. |
1571 |
|
|
* ssc serial console at 0x10140000, interrupt 2 (shared with XMI?). |
1572 |
|
|
* xmi 0 at address 0x11800000 (node x at offset x*0x80000) |
1573 |
|
|
* Clock uses interrupt 3 (shared with XMI?). |
1574 |
|
|
*/ |
1575 |
|
|
|
1576 |
|
|
machine->dec5800_csr = dev_dec5800_init(machine, mem, 0x10000000); |
1577 |
|
|
dev_decbi_init(mem, 0x10000000); |
1578 |
|
|
dev_ssc_init(machine, mem, 0x10140000, 2, machine->use_x11, &machine->dec5800_csr->csr); |
1579 |
|
|
dev_decxmi_init(mem, 0x11800000); |
1580 |
|
|
dev_deccca_init(mem, DEC_DECCCA_BASEADDR); |
1581 |
|
|
|
1582 |
|
|
break; |
1583 |
|
|
|
1584 |
|
|
case MACHINE_DEC_5400: /* type 6, KN210 */ |
1585 |
|
|
machine->machine_name = "DECsystem 5400 (KN210)"; |
1586 |
|
|
/* |
1587 |
|
|
* Misc. info from the KN210 manual: |
1588 |
|
|
* |
1589 |
|
|
* Interrupt lines: |
1590 |
|
|
* irq5 fpu |
1591 |
|
|
* irq4 halt |
1592 |
|
|
* irq3 pwrfl -> mer1 -> mer0 -> wear |
1593 |
|
|
* irq2 100 Hz -> birq7 |
1594 |
|
|
* irq1 dssi -> ni -> birq6 |
1595 |
|
|
* irq0 birq5 -> console -> timers -> birq4 |
1596 |
|
|
* |
1597 |
|
|
* Interrupt status register at 0x10048000. |
1598 |
|
|
* Main memory error status register at 0x1008140. |
1599 |
|
|
* Interval Timer Register (ITR) at 0x10084010. |
1600 |
|
|
* Q22 stuff at 0x10088000 - 0x1008ffff. |
1601 |
|
|
* TODR at 0x1014006c. |
1602 |
|
|
* TCR0 (timer control register 0) 0x10140100. |
1603 |
|
|
* TIR0 (timer interval register 0) 0x10140104. |
1604 |
|
|
* TCR1 (timer control register 1) 0x10140110. |
1605 |
|
|
* TIR1 (timer interval register 1) 0x10140114. |
1606 |
|
|
* VRR0 (Vector Read Register 0) at 0x16000050. |
1607 |
|
|
* VRR1 (Vector Read Register 1) at 0x16000054. |
1608 |
|
|
* VRR2 (Vector Read Register 2) at 0x16000058. |
1609 |
|
|
* VRR3 (Vector Read Register 3) at 0x1600005c. |
1610 |
|
|
*/ |
1611 |
|
|
/* ln (ethernet) at 0x10084x00 ? and 0x10120000 ? */ |
1612 |
|
|
/* error registers (?) at 0x17000000 and 0x10080000 */ |
1613 |
|
|
device_add(machine, "kn210 addr=0x10080000"); |
1614 |
|
|
dev_ssc_init(machine, mem, 0x10140000, 0, machine->use_x11, NULL); /* TODO: not irq 0 */ |
1615 |
|
|
break; |
1616 |
|
|
|
1617 |
|
|
case MACHINE_DEC_MAXINE_5000: /* type 7, KN02CA */ |
1618 |
|
|
machine->machine_name = "Personal DECstation 5000/xxx (MAXINE) (KN02CA)"; |
1619 |
|
|
if (machine->emulated_hz == 0) |
1620 |
|
|
machine->emulated_hz = 33000000; |
1621 |
|
|
|
1622 |
|
|
if (machine->physical_ram_in_mb < 8) |
1623 |
|
|
fprintf(stderr, "WARNING! Real KN02CA machines do not have less than 8MB RAM. Continuing anyway.\n"); |
1624 |
|
|
if (machine->physical_ram_in_mb > 40) |
1625 |
|
|
fprintf(stderr, "WARNING! Real KN02CA machines cannot have more than 40MB RAM. Continuing anyway.\n"); |
1626 |
|
|
|
1627 |
|
|
/* Maxine interrupts: */ |
1628 |
|
|
machine->md_interrupt = maxine_interrupt; |
1629 |
|
|
|
1630 |
|
|
/* |
1631 |
|
|
* Something at address 0xca00000. (?) |
1632 |
|
|
* Something at address 0xe000000. (?) |
1633 |
|
|
* tc0 slot 0 (0x10000000) |
1634 |
|
|
* tc0 slot 1 (0x14000000) |
1635 |
|
|
* (tc0 slot 2 used by the framebuffer) |
1636 |
|
|
* ioasic0 at tc0 slot 3 offset 0x0 (0x1c000000) |
1637 |
|
|
* le0 at ioasic0 offset 0xc0000: address 00:00:00:00:00:00 (0x1c0c0000) |
1638 |
|
|
* scc0 at ioasic0 offset 0x100000: console <-- serial (0x1c100000) |
1639 |
|
|
* mcclock0 at ioasic0 offset 0x200000: mc146818 (0x1c200000) |
1640 |
|
|
* isdn at ioasic0 offset 0x240000 not configured (0x1c240000) |
1641 |
|
|
* bba0 at ioasic0 offset 0x240000 (audio0 at bba0) <--- which one of isdn and bba0? |
1642 |
|
|
* dtop0 at ioasic0 offset 0x280000 (0x1c280000) |
1643 |
|
|
* fdc at ioasic0 offset 0x2c0000 not configured <-- floppy (0x1c2c0000) |
1644 |
|
|
* asc0 at ioasic0 offset 0x300000: NCR53C94, 25MHz, SCSI ID 7 (0x1c300000) |
1645 |
|
|
* xcfb0 at tc0 slot 2 offset 0x0: 1024x768x8 built-in framebuffer (0xa000000) |
1646 |
|
|
*/ |
1647 |
|
|
machine->dec_ioasic_data = dev_dec_ioasic_init(cpu, mem, 0x1c000000, 0); |
1648 |
|
|
|
1649 |
|
|
/* TURBOchannel slots (0 and 1): */ |
1650 |
|
|
dev_turbochannel_init(machine, mem, 0, |
1651 |
|
|
0x10000000, 0x103fffff, |
1652 |
|
|
machine->n_gfx_cards >= 2? |
1653 |
|
|
turbochannel_default_gfx_card : "", |
1654 |
|
|
XINE_INTR_TC_0 +8); |
1655 |
|
|
dev_turbochannel_init(machine, mem, 1, |
1656 |
|
|
0x14000000, 0x143fffff, |
1657 |
|
|
machine->n_gfx_cards >= 3? |
1658 |
|
|
turbochannel_default_gfx_card : "", |
1659 |
|
|
XINE_INTR_TC_1 +8); |
1660 |
|
|
|
1661 |
|
|
/* |
1662 |
|
|
* TURBOchannel slot 2 is hardwired to be used by |
1663 |
|
|
* the framebuffer: (NOTE: 0x8000000, not 0x18000000) |
1664 |
|
|
*/ |
1665 |
|
|
dev_turbochannel_init(machine, mem, 2, |
1666 |
|
|
0x8000000, 0xbffffff, "PMAG-DV", 0); |
1667 |
|
|
|
1668 |
|
|
/* |
1669 |
|
|
* TURBOchannel slot 3: fixed, ioasic |
1670 |
|
|
* (the system stuff), 0x1c000000 |
1671 |
|
|
*/ |
1672 |
|
|
dev_le_init(machine, mem, 0x1c0c0000, 0, 0, XINE_INTR_LANCE +8, 4*65536); |
1673 |
|
|
dev_scc_init(machine, mem, 0x1c100000, |
1674 |
|
|
XINE_INTR_SCC_0 +8, machine->use_x11, 0, 1); |
1675 |
|
|
dev_mc146818_init(machine, mem, 0x1c200000, |
1676 |
|
|
XINE_INT_TOY, MC146818_DEC, 1); |
1677 |
|
|
dev_asc_init(machine, mem, 0x1c300000, |
1678 |
|
|
XINE_INTR_SCSI +8, NULL, DEV_ASC_DEC, NULL, NULL); |
1679 |
|
|
|
1680 |
|
|
framebuffer_console_name = "osconsole=3,2"; /* keyb,fb ?? */ |
1681 |
|
|
serial_console_name = "osconsole=3"; |
1682 |
|
|
break; |
1683 |
|
|
|
1684 |
|
|
case MACHINE_DEC_5500: /* type 11, KN220 */ |
1685 |
|
|
machine->machine_name = "DECsystem 5500 (KN220)"; |
1686 |
|
|
|
1687 |
|
|
/* |
1688 |
|
|
* According to NetBSD's pmax ports page: |
1689 |
|
|
* KN220-AA is a "30 MHz R3000 CPU with R3010 FPU" |
1690 |
|
|
* with "512 kBytes of Prestoserve battery backed RAM." |
1691 |
|
|
*/ |
1692 |
|
|
if (machine->emulated_hz == 0) |
1693 |
|
|
machine->emulated_hz = 30000000; |
1694 |
|
|
|
1695 |
|
|
/* |
1696 |
|
|
* See KN220 docs for more info. |
1697 |
|
|
* |
1698 |
|
|
* something at 0x10000000 |
1699 |
|
|
* something at 0x10001000 |
1700 |
|
|
* something at 0x10040000 |
1701 |
|
|
* scc at 0x10140000 |
1702 |
|
|
* qbus at (or around) 0x10080000 |
1703 |
|
|
* dssi (disk controller) buffers at 0x10100000, registers at 0x10160000. |
1704 |
|
|
* sgec (ethernet) registers at 0x10008000, station addresss at 0x10120000. |
1705 |
|
|
* asc (scsi) at 0x17100000. |
1706 |
|
|
*/ |
1707 |
|
|
|
1708 |
|
|
dev_ssc_init(machine, mem, 0x10140000, 0, machine->use_x11, NULL); /* TODO: not irq 0 */ |
1709 |
|
|
|
1710 |
|
|
/* something at 0x17000000, ultrix says "cpu 0 panic: DS5500 I/O Board is missing" if this is not here */ |
1711 |
|
|
dev_dec5500_ioboard_init(cpu, mem, 0x17000000); |
1712 |
|
|
|
1713 |
|
|
dev_sgec_init(mem, 0x10008000, 0); /* irq? */ |
1714 |
|
|
|
1715 |
|
|
/* The asc controller might be TURBOchannel-ish? */ |
1716 |
|
|
#if 0 |
1717 |
|
|
dev_turbochannel_init(machine, mem, 0, 0x17100000, 0x171fffff, "PMAZ-AA", 0); /* irq? */ |
1718 |
|
|
#else |
1719 |
|
|
dev_asc_init(machine, mem, 0x17100000, 0, NULL, DEV_ASC_DEC, NULL, NULL); /* irq? */ |
1720 |
|
|
#endif |
1721 |
|
|
|
1722 |
|
|
framebuffer_console_name = "osconsole=0,0"; /* TODO (?) */ |
1723 |
|
|
serial_console_name = "osconsole=0"; |
1724 |
|
|
break; |
1725 |
|
|
|
1726 |
|
|
case MACHINE_DEC_MIPSMATE_5100: /* type 12 */ |
1727 |
|
|
machine->machine_name = "DEC MIPSMATE 5100 (KN230)"; |
1728 |
|
|
if (machine->emulated_hz == 0) |
1729 |
|
|
machine->emulated_hz = 20000000; |
1730 |
|
|
if (machine->physical_ram_in_mb > 128) |
1731 |
|
|
fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines cannot have more than 128MB RAM. Continuing anyway.\n"); |
1732 |
|
|
|
1733 |
|
|
if (machine->use_x11) |
1734 |
|
|
fprintf(stderr, "WARNING! Real MIPSMATE 5100 machines cannot have a graphical framebuffer. Continuing anyway.\n"); |
1735 |
|
|
|
1736 |
|
|
/* KN230 interrupts: */ |
1737 |
|
|
machine->md_interrupt = kn230_interrupt; |
1738 |
|
|
|
1739 |
|
|
/* |
1740 |
|
|
* According to NetBSD/pmax: |
1741 |
|
|
* dc0 at ibus0 addr 0x1c000000 |
1742 |
|
|
* le0 at ibus0 addr 0x18000000: address 00:00:00:00:00:00 |
1743 |
|
|
* sii0 at ibus0 addr 0x1a000000 |
1744 |
|
|
*/ |
1745 |
|
|
dev_mc146818_init(machine, mem, KN230_SYS_CLOCK, 4, MC146818_DEC, 1); |
1746 |
|
|
dev_dc7085_init(machine, mem, KN230_SYS_DZ0, KN230_CSR_INTR_DZ0, machine->use_x11); /* NOTE: CSR_INTR */ |
1747 |
|
|
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ1, KN230_CSR_INTR_OPT0, machine->use_x11); */ /* NOTE: CSR_INTR */ |
1748 |
|
|
/* dev_dc7085_init(machine, mem, KN230_SYS_DZ2, KN230_CSR_INTR_OPT1, machine->use_x11); */ /* NOTE: CSR_INTR */ |
1749 |
|
|
dev_le_init(machine, mem, KN230_SYS_LANCE, KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END, KN230_CSR_INTR_LANCE, 4*1048576); |
1750 |
|
|
dev_sii_init(machine, mem, KN230_SYS_SII, KN230_SYS_SII_B_START, KN230_SYS_SII_B_END, KN230_CSR_INTR_SII); |
1751 |
|
|
|
1752 |
|
|
snprintf(tmpstr, sizeof(tmpstr) - 1, |
1753 |
|
|
"kn230 addr=0x%llx", (long long)KN230_SYS_ICSR); |
1754 |
|
|
machine->kn230_csr = device_add(machine, tmpstr); |
1755 |
|
|
|
1756 |
|
|
serial_console_name = "osconsole=0"; |
1757 |
|
|
break; |
1758 |
|
|
|
1759 |
|
|
default: |
1760 |
|
|
; |
1761 |
|
|
} |
1762 |
|
|
|
1763 |
|
|
/* |
1764 |
|
|
* Most OSes on DECstation use physical addresses below |
1765 |
|
|
* 0x20000000, but OSF/1 seems to use 0xbe...... as if it was |
1766 |
|
|
* 0x1e......, so we need this hack: |
1767 |
|
|
*/ |
1768 |
|
|
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
1769 |
|
|
|
1770 |
|
|
/* DECstation PROM stuff: (TODO: endianness) */ |
1771 |
|
|
for (i=0; i<100; i++) |
1772 |
|
|
store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, |
1773 |
|
|
DEC_PROM_EMULATION + i*8); |
1774 |
|
|
|
1775 |
|
|
/* Fill PROM with dummy return instructions: (TODO: make this nicer) */ |
1776 |
|
|
for (i=0; i<100; i++) { |
1777 |
|
|
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, |
1778 |
|
|
0x03e00008); /* return */ |
1779 |
|
|
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, |
1780 |
|
|
0x00000000); /* nop */ |
1781 |
|
|
} |
1782 |
|
|
|
1783 |
|
|
/* |
1784 |
|
|
* According to dec_prom.h from NetBSD: |
1785 |
|
|
* |
1786 |
|
|
* "Programs loaded by the new PROMs pass the following arguments: |
1787 |
|
|
* a0 argc |
1788 |
|
|
* a1 argv |
1789 |
|
|
* a2 DEC_PROM_MAGIC |
1790 |
|
|
* a3 The callback vector defined below" |
1791 |
|
|
* |
1792 |
|
|
* So we try to emulate a PROM, even though no such thing has been |
1793 |
|
|
* loaded. |
1794 |
|
|
*/ |
1795 |
|
|
|
1796 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; |
1797 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; |
1798 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; |
1799 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; |
1800 |
|
|
|
1801 |
|
|
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, |
1802 |
|
|
BOOTINFO_MAGIC); |
1803 |
|
|
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, |
1804 |
|
|
BOOTINFO_ADDR); |
1805 |
|
|
|
1806 |
|
|
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, |
1807 |
|
|
(DEC_PROM_INITIAL_ARGV + 0x10)); |
1808 |
|
|
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, |
1809 |
|
|
(DEC_PROM_INITIAL_ARGV + 0x70)); |
1810 |
|
|
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, |
1811 |
|
|
(DEC_PROM_INITIAL_ARGV + 0xe0)); |
1812 |
|
|
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); |
1813 |
|
|
|
1814 |
|
|
/* |
1815 |
|
|
* NetBSD and Ultrix expect the boot args to be like this: |
1816 |
|
|
* |
1817 |
|
|
* "boot" "bootdev" [args?] |
1818 |
|
|
* |
1819 |
|
|
* where bootdev is supposed to be "rz(0,0,0)netbsd" for |
1820 |
|
|
* 3100/2100 (although that crashes Ultrix :-/), and |
1821 |
|
|
* "5/rz0a/netbsd" for all others. The number '5' is the |
1822 |
|
|
* slot number of the boot device. |
1823 |
|
|
* |
1824 |
|
|
* 'rz' for disks, 'tz' for tapes. |
1825 |
|
|
* |
1826 |
|
|
* TODO: Make this nicer. |
1827 |
|
|
*/ |
1828 |
|
|
{ |
1829 |
|
|
char bootpath[200]; |
1830 |
|
|
|
1831 |
|
|
#if 0 |
1832 |
|
|
if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) |
1833 |
|
|
strcpy(bootpath, "rz(0,0,0)"); |
1834 |
|
|
else |
1835 |
|
|
#endif |
1836 |
|
|
strcpy(bootpath, "5/rz1/"); |
1837 |
|
|
|
1838 |
|
|
if (bootdev_id < 0 || machine->force_netboot) { |
1839 |
|
|
/* tftp boot: */ |
1840 |
|
|
strcpy(bootpath, "5/tftp/"); |
1841 |
|
|
bootpath[0] = '0' + boot_net_boardnumber; |
1842 |
|
|
} else { |
1843 |
|
|
/* disk boot: */ |
1844 |
|
|
bootpath[0] = '0' + boot_scsi_boardnumber; |
1845 |
|
|
if (diskimage_is_a_tape(machine, bootdev_id)) |
1846 |
|
|
bootpath[2] = 't'; |
1847 |
|
|
bootpath[4] = '0' + bootdev_id; |
1848 |
|
|
} |
1849 |
|
|
|
1850 |
|
|
init_bootpath = bootpath; |
1851 |
|
|
} |
1852 |
|
|
|
1853 |
|
|
bootarg = malloc(strlen(init_bootpath) + |
1854 |
|
|
strlen(machine->boot_kernel_filename) + 1 + |
1855 |
|
|
strlen(machine->boot_string_argument) + 1); |
1856 |
|
|
strcpy(bootarg, init_bootpath); |
1857 |
|
|
strcat(bootarg, machine->boot_kernel_filename); |
1858 |
|
|
|
1859 |
|
|
bootstr = "boot"; |
1860 |
|
|
|
1861 |
|
|
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); |
1862 |
|
|
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); |
1863 |
|
|
store_string(cpu, DEC_PROM_INITIAL_ARGV+0xe0, |
1864 |
|
|
machine->boot_string_argument); |
1865 |
|
|
|
1866 |
|
|
/* Decrease the nr of args, if there are no args :-) */ |
1867 |
|
|
if (machine->boot_string_argument == NULL || |
1868 |
|
|
machine->boot_string_argument[0] == '\0') |
1869 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] --; |
1870 |
|
|
|
1871 |
|
|
if (machine->boot_string_argument[0] != '\0') { |
1872 |
|
|
strcat(bootarg, " "); |
1873 |
|
|
strcat(bootarg, machine->boot_string_argument); |
1874 |
|
|
} |
1875 |
|
|
|
1876 |
|
|
xx.a.common.next = (char *)&xx.b - (char *)&xx; |
1877 |
|
|
xx.a.common.type = BTINFO_MAGIC; |
1878 |
|
|
xx.a.magic = BOOTINFO_MAGIC; |
1879 |
|
|
|
1880 |
|
|
xx.b.common.next = (char *)&xx.c - (char *)&xx.b; |
1881 |
|
|
xx.b.common.type = BTINFO_BOOTPATH; |
1882 |
|
|
strcpy(xx.b.bootpath, bootstr); |
1883 |
|
|
|
1884 |
|
|
xx.c.common.next = 0; |
1885 |
|
|
xx.c.common.type = BTINFO_SYMTAB; |
1886 |
|
|
xx.c.nsym = 0; |
1887 |
|
|
xx.c.ssym = 0; |
1888 |
|
|
xx.c.esym = machine->file_loaded_end_addr; |
1889 |
|
|
|
1890 |
|
|
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
1891 |
|
|
|
1892 |
|
|
/* |
1893 |
|
|
* The system's memmap: (memmap is a global variable, in |
1894 |
|
|
* dec_prom.h) |
1895 |
|
|
*/ |
1896 |
|
|
store_32bit_word_in_host(cpu, |
1897 |
|
|
(unsigned char *)&memmap.pagesize, 4096); |
1898 |
|
|
{ |
1899 |
|
|
unsigned int i; |
1900 |
|
|
for (i=0; i<sizeof(memmap.bitmap); i++) |
1901 |
|
|
memmap.bitmap[i] = ((int)i * 4096*8 < |
1902 |
|
|
1048576*machine->physical_ram_in_mb)? |
1903 |
|
|
0xff : 0x00; |
1904 |
|
|
} |
1905 |
|
|
store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap)); |
1906 |
|
|
|
1907 |
|
|
/* Environment variables: */ |
1908 |
|
|
addr = DEC_PROM_STRINGS; |
1909 |
|
|
|
1910 |
|
|
if (machine->use_x11 && machine->n_gfx_cards > 0) |
1911 |
|
|
/* (0,3) Keyboard and Framebuffer */ |
1912 |
|
|
add_environment_string(cpu, framebuffer_console_name, &addr); |
1913 |
|
|
else |
1914 |
|
|
/* Serial console */ |
1915 |
|
|
add_environment_string(cpu, serial_console_name, &addr); |
1916 |
|
|
|
1917 |
|
|
/* |
1918 |
|
|
* The KN5800 (SMP system) uses a CCA (console communications |
1919 |
|
|
* area): (See VAX 6000 documentation for details.) |
1920 |
|
|
*/ |
1921 |
|
|
{ |
1922 |
|
|
char tmps[300]; |
1923 |
|
|
sprintf(tmps, "cca=%x", |
1924 |
|
|
(int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); |
1925 |
|
|
add_environment_string(cpu, tmps, &addr); |
1926 |
|
|
} |
1927 |
|
|
|
1928 |
|
|
/* These are needed for Sprite to boot: */ |
1929 |
|
|
{ |
1930 |
|
|
char tmps[300]; |
1931 |
|
|
|
1932 |
|
|
sprintf(tmps, "boot=%s", bootarg); |
1933 |
|
|
add_environment_string(cpu, tmps, &addr); |
1934 |
|
|
|
1935 |
|
|
sprintf(tmps, "bitmap=0x%x", (uint32_t)(( |
1936 |
|
|
DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) |
1937 |
|
|
& 0xffffffffULL)); |
1938 |
|
|
add_environment_string(cpu, tmps, &addr); |
1939 |
|
|
|
1940 |
|
|
sprintf(tmps, "bitmaplen=0x%x", |
1941 |
|
|
machine->physical_ram_in_mb * 1048576 / 4096 / 8); |
1942 |
|
|
add_environment_string(cpu, tmps, &addr); |
1943 |
|
|
} |
1944 |
|
|
|
1945 |
|
|
add_environment_string(cpu, "scsiid0=7", &addr); |
1946 |
|
|
add_environment_string(cpu, "bootmode=a", &addr); |
1947 |
|
|
add_environment_string(cpu, "testaction=q", &addr); |
1948 |
|
|
add_environment_string(cpu, "haltaction=h", &addr); |
1949 |
|
|
add_environment_string(cpu, "more=24", &addr); |
1950 |
|
|
|
1951 |
|
|
/* Used in at least Ultrix on the 5100: */ |
1952 |
|
|
add_environment_string(cpu, "scsiid=7", &addr); |
1953 |
|
|
add_environment_string(cpu, "baud0=9600", &addr); |
1954 |
|
|
add_environment_string(cpu, "baud1=9600", &addr); |
1955 |
|
|
add_environment_string(cpu, "baud2=9600", &addr); |
1956 |
|
|
add_environment_string(cpu, "baud3=9600", &addr); |
1957 |
|
|
add_environment_string(cpu, "iooption=0x1", &addr); |
1958 |
|
|
|
1959 |
|
|
/* The end: */ |
1960 |
|
|
add_environment_string(cpu, "", &addr); |
1961 |
|
|
|
1962 |
|
|
break; |
1963 |
|
|
|
1964 |
|
|
case MACHINE_COBALT: |
1965 |
|
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
1966 |
|
|
machine->machine_name = "Cobalt"; |
1967 |
|
|
|
1968 |
|
|
/* |
1969 |
|
|
* Interrupts seem to be the following: |
1970 |
|
|
* (according to http://www.funet.fi/pub/Linux/PEOPLE/Linus/v2.4/patch-html/patch-2.4.19/linux-2.4.19_arch_mips_cobalt_irq.c.html) |
1971 |
|
|
* |
1972 |
|
|
* 2 Galileo chip (timer) |
1973 |
|
|
* 3 Tulip 0 + NCR SCSI |
1974 |
|
|
* 4 Tulip 1 |
1975 |
|
|
* 5 16550 UART (serial console) |
1976 |
|
|
* 6 VIA southbridge PIC |
1977 |
|
|
* 7 PCI |
1978 |
|
|
*/ |
1979 |
|
|
/* dev_XXX_init(cpu, mem, 0x10000000, machine->emulated_hz); */ |
1980 |
|
|
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
1981 |
|
|
machine->main_console_handle = dev_ns16550_init(machine, mem, |
1982 |
|
|
0x1c800000, 5, 1, 1, "serial console"); |
1983 |
|
|
|
1984 |
|
|
/* |
1985 |
|
|
* According to NetBSD/cobalt: |
1986 |
|
|
* |
1987 |
|
|
* pchb0 at pci0 dev 0 function 0: Galileo GT-64111 System Controller, rev 1 (NOTE: added by dev_gt_init()) |
1988 |
|
|
* tlp0 at pci0 dev 7 function 0: DECchip 21143 Ethernet, pass 4.1 |
1989 |
|
|
* Symbios Logic 53c860 (SCSI mass storage, revision 0x02) at pci0 dev 8 |
1990 |
|
|
* pcib0 at pci0 dev 9 function 0, VIA Technologies VT82C586 (Apollo VP) PCI-ISA Bridge, rev 37 |
1991 |
|
|
* pciide0 at pci0 dev 9 function 1: VIA Technologies VT82C586 (Apollo VP) ATA33 cr |
1992 |
|
|
* tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1 |
1993 |
|
|
*/ |
1994 |
|
|
pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 6); /* 7 for PCI, not 6? */ |
1995 |
|
|
/* bus_pci_add(machine, pci_data, mem, 0, 7, 0, pci_dec21143_init, pci_dec21143_rr); */ |
1996 |
|
|
bus_pci_add(machine, pci_data, mem, 0, 8, 0, NULL, NULL); /* PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */ |
1997 |
|
|
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
1998 |
|
|
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
1999 |
|
|
/* bus_pci_add(machine, pci_data, mem, 0, 12, 0, pci_dec21143_init, pci_dec21143_rr); */ |
2000 |
|
|
|
2001 |
|
|
/* |
2002 |
|
|
* NetBSD/cobalt expects memsize in a0, but it seems that what |
2003 |
|
|
* it really wants is the end of memory + 0x80000000. |
2004 |
|
|
* |
2005 |
|
|
* The bootstring should be stored starting 512 bytes before end |
2006 |
|
|
* of physical ram. |
2007 |
|
|
*/ |
2008 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = machine->physical_ram_in_mb * 1048576 + 0x80000000; |
2009 |
|
|
bootstr = "root=/dev/hda1 ro"; |
2010 |
|
|
/* bootstr = "nfsroot=/usr/cobalt/"; */ |
2011 |
|
|
store_string(cpu, 0xffffffff80000000ULL + |
2012 |
|
|
machine->physical_ram_in_mb * 1048576 - 512, bootstr); |
2013 |
|
|
break; |
2014 |
|
|
|
2015 |
|
|
case MACHINE_HPCMIPS: |
2016 |
|
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2017 |
|
|
memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo)); |
2018 |
|
|
/* TODO: set platid from netbsd/usr/src/sys/arch/hpc/include/platid* */ |
2019 |
|
|
/* |
2020 |
|
|
#define PLATID_FLAGS_SHIFT 0 |
2021 |
|
|
#define PLATID_CPU_SUBMODEL_SHIFT 8 |
2022 |
|
|
#define PLATID_CPU_MODEL_SHIFT 14 |
2023 |
|
|
#define PLATID_CPU_SERIES_SHIFT 20 |
2024 |
|
|
#define PLATID_CPU_ARCH_SHIFT 26 |
2025 |
|
|
|
2026 |
|
|
#define PLATID_SUBMODEL_SHIFT 0 |
2027 |
|
|
#define PLATID_MODEL_SHIFT 8 |
2028 |
|
|
#define PLATID_SERIES_SHIFT 16 |
2029 |
|
|
#define PLATID_VENDOR_SHIFT 22 |
2030 |
|
|
*/ |
2031 |
|
|
|
2032 |
|
|
/* |
2033 |
|
|
NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&forum=23 |
2034 |
|
|
for info on framebuffer addresses. |
2035 |
|
|
*/ |
2036 |
|
|
|
2037 |
|
|
switch (machine->machine_subtype) { |
2038 |
|
|
case MACHINE_HPCMIPS_CASIO_BE300: |
2039 |
|
|
/* 166MHz VR4131 */ |
2040 |
|
|
machine->machine_name = "Casio Cassiopeia BE-300"; |
2041 |
|
|
hpcmips_fb_addr = 0x0a200000; |
2042 |
|
|
hpcmips_fb_xsize = 240; |
2043 |
|
|
hpcmips_fb_ysize = 320; |
2044 |
|
|
hpcmips_fb_xsize_mem = 256; |
2045 |
|
|
hpcmips_fb_ysize_mem = 320; |
2046 |
|
|
hpcmips_fb_bits = 15; |
2047 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2048 |
|
|
|
2049 |
|
|
machine->main_console_handle = dev_ns16550_init( |
2050 |
|
|
machine, mem, 0xa008680, 0, 4, |
2051 |
|
|
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
2052 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4131); |
2053 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2054 |
|
|
|
2055 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2056 |
|
|
(1 << 26) /* 1 = MIPS */ |
2057 |
|
|
+ (1 << 20) /* 1 = VR */ |
2058 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2059 |
|
|
+ (6 << 8) /* 6 = VR4131 */ |
2060 |
|
|
); |
2061 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2062 |
|
|
(3 << 22) /* 22: vendor 3=casio */ |
2063 |
|
|
+ (1 << 16) /* 16: series 1=CASSIOPEIAE*/ |
2064 |
|
|
+ (2 << 8) /* 8: model 2=EXXX*/ |
2065 |
|
|
+ (3) /* 0: submodel 3=E500 */ |
2066 |
|
|
); |
2067 |
|
|
/* TODO: Don't use model number for E500, it's a BE300! */ |
2068 |
|
|
break; |
2069 |
|
|
case MACHINE_HPCMIPS_CASIO_E105: |
2070 |
|
|
/* 131MHz VR4121 */ |
2071 |
|
|
machine->machine_name = "Casio Cassiopeia E-105"; |
2072 |
|
|
hpcmips_fb_addr = 0x0a200000; /* TODO? */ |
2073 |
|
|
hpcmips_fb_xsize = 240; |
2074 |
|
|
hpcmips_fb_ysize = 320; |
2075 |
|
|
hpcmips_fb_xsize_mem = 256; |
2076 |
|
|
hpcmips_fb_ysize_mem = 320; |
2077 |
|
|
hpcmips_fb_bits = 16; |
2078 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2079 |
|
|
|
2080 |
|
|
machine->main_console_handle = dev_ns16550_init( |
2081 |
|
|
machine, mem, 0xa008680, 0, 4, |
2082 |
|
|
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
2083 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2084 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2085 |
|
|
|
2086 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2087 |
|
|
(1 << 26) /* 1 = MIPS */ |
2088 |
|
|
+ (1 << 20) /* 1 = VR */ |
2089 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2090 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2091 |
|
|
); |
2092 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2093 |
|
|
(3 << 22) /* 22: vendor 3=casio */ |
2094 |
|
|
+ (1 << 16) /* 16: series 1=CASSIOPEIAE*/ |
2095 |
|
|
+ (2 << 8) /* 8: model 2=EXXX*/ |
2096 |
|
|
+ (2) /* 0: submodel 2=E105 */ |
2097 |
|
|
); |
2098 |
|
|
break; |
2099 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_770: |
2100 |
|
|
/* 131 MHz VR4121 */ |
2101 |
|
|
machine->machine_name = "NEC MobilePro 770"; |
2102 |
|
|
/* TODO: */ |
2103 |
|
|
hpcmips_fb_addr = 0xa000000; |
2104 |
|
|
hpcmips_fb_xsize = 640; |
2105 |
|
|
hpcmips_fb_ysize = 240; |
2106 |
|
|
hpcmips_fb_xsize_mem = 800; |
2107 |
|
|
hpcmips_fb_ysize_mem = 240; |
2108 |
|
|
hpcmips_fb_bits = 16; |
2109 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2110 |
|
|
|
2111 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2112 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2113 |
|
|
|
2114 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2115 |
|
|
(1 << 26) /* 1 = MIPS */ |
2116 |
|
|
+ (1 << 20) /* 1 = VR */ |
2117 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2118 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2119 |
|
|
); |
2120 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2121 |
|
|
(1 << 22) /* 22: vendor 1=NEC */ |
2122 |
|
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
2123 |
|
|
+ (2 << 8) /* 8: model 2="MCR 5XX" */ |
2124 |
|
|
+ (4) /* 0: submodel 4="MCR 520A" */ |
2125 |
|
|
); |
2126 |
|
|
break; |
2127 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_780: |
2128 |
|
|
/* 166 (or 168) MHz VR4121 */ |
2129 |
|
|
machine->machine_name = "NEC MobilePro 780"; |
2130 |
|
|
/* TODO: */ |
2131 |
|
|
hpcmips_fb_addr = 0xa180100; |
2132 |
|
|
hpcmips_fb_xsize = 640; |
2133 |
|
|
hpcmips_fb_ysize = 240; |
2134 |
|
|
hpcmips_fb_xsize_mem = 640; |
2135 |
|
|
hpcmips_fb_ysize_mem = 240; |
2136 |
|
|
hpcmips_fb_bits = 16; |
2137 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2138 |
|
|
|
2139 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2140 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2141 |
|
|
|
2142 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2143 |
|
|
(1 << 26) /* 1 = MIPS */ |
2144 |
|
|
+ (1 << 20) /* 1 = VR */ |
2145 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2146 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2147 |
|
|
); |
2148 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2149 |
|
|
(1 << 22) /* 22: vendor 1=NEC */ |
2150 |
|
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
2151 |
|
|
+ (2 << 8) /* 8: model 2="MCR 5XX" */ |
2152 |
|
|
+ (8) /* 0: submodel 8="MCR 530A" */ |
2153 |
|
|
); |
2154 |
|
|
break; |
2155 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_800: |
2156 |
|
|
/* 131 MHz VR4121 */ |
2157 |
|
|
machine->machine_name = "NEC MobilePro 800"; |
2158 |
|
|
/* TODO: */ |
2159 |
|
|
hpcmips_fb_addr = 0xa000000; |
2160 |
|
|
hpcmips_fb_xsize = 800; |
2161 |
|
|
hpcmips_fb_ysize = 600; |
2162 |
|
|
hpcmips_fb_xsize_mem = 800; |
2163 |
|
|
hpcmips_fb_ysize_mem = 600; |
2164 |
|
|
hpcmips_fb_bits = 16; |
2165 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2166 |
|
|
|
2167 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2168 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2169 |
|
|
|
2170 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2171 |
|
|
(1 << 26) /* 1 = MIPS */ |
2172 |
|
|
+ (1 << 20) /* 1 = VR */ |
2173 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2174 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2175 |
|
|
); |
2176 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2177 |
|
|
(1 << 22) /* 22: vendor 1=NEC */ |
2178 |
|
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
2179 |
|
|
+ (3 << 8) /* 8: model 3="MCR 7XX" */ |
2180 |
|
|
+ (2) /* 0: submodel 2="MCR 700A" */ |
2181 |
|
|
); |
2182 |
|
|
break; |
2183 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_880: |
2184 |
|
|
/* 168 MHz VR4121 */ |
2185 |
|
|
machine->machine_name = "NEC MobilePro 880"; |
2186 |
|
|
/* TODO: */ |
2187 |
|
|
hpcmips_fb_addr = 0xa0ea600; |
2188 |
|
|
hpcmips_fb_xsize = 800; |
2189 |
|
|
hpcmips_fb_ysize = 600; |
2190 |
|
|
hpcmips_fb_xsize_mem = 800; |
2191 |
|
|
hpcmips_fb_ysize_mem = 600; |
2192 |
|
|
hpcmips_fb_bits = 16; |
2193 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2194 |
|
|
|
2195 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2196 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2197 |
|
|
|
2198 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2199 |
|
|
(1 << 26) /* 1 = MIPS */ |
2200 |
|
|
+ (1 << 20) /* 1 = VR */ |
2201 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2202 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2203 |
|
|
); |
2204 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2205 |
|
|
(1 << 22) /* 22: vendor 1=NEC */ |
2206 |
|
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
2207 |
|
|
+ (3 << 8) /* 8: model 3="MCR 7XX" */ |
2208 |
|
|
+ (4) /* 0: submodel 4="MCR 730A" */ |
2209 |
|
|
); |
2210 |
|
|
break; |
2211 |
|
|
case MACHINE_HPCMIPS_AGENDA_VR3: |
2212 |
|
|
/* 66 MHz VR4181 */ |
2213 |
|
|
machine->machine_name = "Agenda VR3"; |
2214 |
|
|
/* TODO: */ |
2215 |
|
|
hpcmips_fb_addr = 0x1000; |
2216 |
|
|
hpcmips_fb_xsize = 160; |
2217 |
|
|
hpcmips_fb_ysize = 240; |
2218 |
|
|
hpcmips_fb_xsize_mem = 160; |
2219 |
|
|
hpcmips_fb_ysize_mem = 240; |
2220 |
|
|
hpcmips_fb_bits = 4; |
2221 |
|
|
hpcmips_fb_encoding = BIFB_D4_M2L_F; |
2222 |
|
|
|
2223 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4181); |
2224 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2225 |
|
|
|
2226 |
|
|
/* TODO: Hm... irq 17 according to linux, but |
2227 |
|
|
VRIP_INTR_SIU (=9) here? */ |
2228 |
|
|
{ |
2229 |
|
|
int x; |
2230 |
|
|
x = dev_ns16550_init(machine, mem, 0x0c000010, |
2231 |
|
|
8 + VRIP_INTR_SIU, 1, 1, "serial 0"); |
2232 |
|
|
|
2233 |
|
|
if (!machine->use_x11) |
2234 |
|
|
machine->main_console_handle = x; |
2235 |
|
|
} |
2236 |
|
|
|
2237 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2238 |
|
|
(1 << 26) /* 1 = MIPS */ |
2239 |
|
|
+ (1 << 20) /* 1 = VR */ |
2240 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2241 |
|
|
+ (4 << 8) /* 4 = VR4181 */ |
2242 |
|
|
); |
2243 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2244 |
|
|
(15 << 22) /* 22: vendor 15=Agenda */ |
2245 |
|
|
+ (1 << 16) /* 16: series 2=VR */ |
2246 |
|
|
+ (1 << 8) /* 8: model 1=VR3 */ |
2247 |
|
|
+ (0) /* 0: submodel 0="VR3" */ |
2248 |
|
|
); |
2249 |
|
|
|
2250 |
|
|
dev_ram_init(mem, 0x0f000000, 0x01000000, DEV_RAM_MIRROR, 0x0); |
2251 |
|
|
break; |
2252 |
|
|
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
2253 |
|
|
/* 131 MHz VR4121 */ |
2254 |
|
|
machine->machine_name = "Agenda VR3"; |
2255 |
|
|
/* TODO: */ |
2256 |
|
|
hpcmips_fb_addr = 0xa000000; |
2257 |
|
|
hpcmips_fb_xsize = 640; |
2258 |
|
|
hpcmips_fb_ysize = 480; |
2259 |
|
|
hpcmips_fb_xsize_mem = 640; |
2260 |
|
|
hpcmips_fb_ysize_mem = 480; |
2261 |
|
|
hpcmips_fb_bits = 16; |
2262 |
|
|
hpcmips_fb_encoding = BIFB_D16_0000; |
2263 |
|
|
|
2264 |
|
|
machine->vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2265 |
|
|
machine->md_interrupt = vr41xx_interrupt; |
2266 |
|
|
|
2267 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2268 |
|
|
(1 << 26) /* 1 = MIPS */ |
2269 |
|
|
+ (1 << 20) /* 1 = VR */ |
2270 |
|
|
+ (1 << 14) /* 1 = VR41XX */ |
2271 |
|
|
+ (3 << 8) /* 3 = VR4121 */ |
2272 |
|
|
); |
2273 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2274 |
|
|
(9 << 22) /* 22: vendor 9=IBM */ |
2275 |
|
|
+ (1 << 16) /* 16: series 1=WorkPad */ |
2276 |
|
|
+ (1 << 8) /* 8: model 1=Z50 */ |
2277 |
|
|
+ (0) /* 0: submodel 0 */ |
2278 |
|
|
); |
2279 |
|
|
break; |
2280 |
|
|
default: |
2281 |
|
|
printf("Unimplemented hpcmips machine number.\n"); |
2282 |
|
|
exit(1); |
2283 |
|
|
} |
2284 |
|
|
|
2285 |
|
|
if (machine->use_x11) |
2286 |
|
|
machine->main_console_handle = |
2287 |
|
|
machine->vr41xx_data->kiu_console_handle; |
2288 |
|
|
|
2289 |
|
|
/* NetBSD/hpcmips and possibly others expects the following: */ |
2290 |
|
|
|
2291 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ |
2292 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 |
2293 |
|
|
+ 0xffffffff80000000ULL - 512; /* argv */ |
2294 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 |
2295 |
|
|
+ 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ |
2296 |
|
|
|
2297 |
|
|
bootstr = machine->boot_kernel_filename; |
2298 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16); |
2299 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
2300 |
|
|
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
2301 |
|
|
|
2302 |
|
|
/* Special case for the Agenda VR3: */ |
2303 |
|
|
if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { |
2304 |
|
|
const int tmplen = 1000; |
2305 |
|
|
char *tmp = malloc(tmplen); |
2306 |
|
|
|
2307 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ |
2308 |
|
|
|
2309 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2310 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
2311 |
|
|
|
2312 |
|
|
snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," |
2313 |
|
|
"gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); |
2314 |
|
|
tmp[tmplen-1] = '\0'; |
2315 |
|
|
|
2316 |
|
|
if (!machine->use_x11) |
2317 |
|
|
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); |
2318 |
|
|
tmp[tmplen-1] = '\0'; |
2319 |
|
|
|
2320 |
|
|
if (machine->boot_string_argument[0]) |
2321 |
|
|
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); |
2322 |
|
|
tmp[tmplen-1] = '\0'; |
2323 |
|
|
|
2324 |
|
|
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, tmp); |
2325 |
|
|
|
2326 |
|
|
bootarg = tmp; |
2327 |
|
|
} else if (machine->boot_string_argument[0]) { |
2328 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ |
2329 |
|
|
|
2330 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2331 |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
2332 |
|
|
|
2333 |
|
|
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, |
2334 |
|
|
machine->boot_string_argument); |
2335 |
|
|
|
2336 |
|
|
bootarg = machine->boot_string_argument; |
2337 |
|
|
} |
2338 |
|
|
|
2339 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
2340 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
2341 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); |
2342 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8); |
2343 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize); |
2344 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize); |
2345 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding); |
2346 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ |
2347 |
|
|
|
2348 |
|
|
/* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); |
2349 |
|
|
printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ |
2350 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
2351 |
|
|
store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
2352 |
|
|
|
2353 |
|
|
if (hpcmips_fb_addr != 0) { |
2354 |
|
|
dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS, |
2355 |
|
|
hpcmips_fb_xsize, hpcmips_fb_ysize, |
2356 |
|
|
hpcmips_fb_xsize_mem, hpcmips_fb_ysize_mem, |
2357 |
|
|
hpcmips_fb_bits, "HPCmips", 0); |
2358 |
|
|
|
2359 |
|
|
/* NetBSD/hpcmips uses framebuffer at physical |
2360 |
|
|
address 0x8.......: */ |
2361 |
|
|
dev_ram_init(mem, 0x80000000, 0x20000000, |
2362 |
|
|
DEV_RAM_MIRROR, 0x0); |
2363 |
|
|
} |
2364 |
|
|
|
2365 |
|
|
break; |
2366 |
|
|
|
2367 |
|
|
case MACHINE_PS2: |
2368 |
|
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2369 |
|
|
machine->machine_name = "Playstation 2"; |
2370 |
|
|
|
2371 |
|
|
if (machine->physical_ram_in_mb != 32) |
2372 |
|
|
fprintf(stderr, "WARNING! Playstation 2 machines are supposed to have exactly 32 MB RAM. Continuing anyway.\n"); |
2373 |
|
|
if (!machine->use_x11) |
2374 |
|
|
fprintf(stderr, "WARNING! Playstation 2 without -X is pretty meaningless. Continuing anyway.\n"); |
2375 |
|
|
|
2376 |
|
|
/* |
2377 |
|
|
* According to NetBSD: |
2378 |
|
|
* Hardware irq 0 is timer/interrupt controller |
2379 |
|
|
* Hardware irq 1 is dma controller |
2380 |
|
|
* |
2381 |
|
|
* Some things are not yet emulated (at all), and hence are detected incorrectly: |
2382 |
|
|
* sbus0 at mainbus0: controller type 2 |
2383 |
|
|
* ohci0 at sbus0 (at 0x1f801600, according to linux) |
2384 |
|
|
* ohci0: OHCI version 1.0 |
2385 |
|
|
*/ |
2386 |
|
|
|
2387 |
|
|
device_add(machine, "ps2_gs addr=0x12000000"); |
2388 |
|
|
machine->ps2_data = dev_ps2_stuff_init(machine, mem, 0x10000000); |
2389 |
|
|
dev_ps2_ohci_init(cpu, mem, 0x1f801600); |
2390 |
|
|
dev_ram_init(mem, 0x1c000000, 4 * 1048576, DEV_RAM_RAM, 0); /* TODO: how much? */ |
2391 |
|
|
|
2392 |
|
|
machine->md_interrupt = ps2_interrupt; |
2393 |
|
|
|
2394 |
|
|
add_symbol_name(&machine->symbol_context, |
2395 |
|
|
PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0); |
2396 |
|
|
store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); |
2397 |
|
|
store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); |
2398 |
|
|
|
2399 |
|
|
#if 0 |
2400 |
|
|
/* Harddisk controller present flag: */ |
2401 |
|
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); |
2402 |
|
|
dev_ps2_spd_init(machine, mem, 0x14000000); |
2403 |
|
|
#endif |
2404 |
|
|
|
2405 |
|
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); |
2406 |
|
|
bootstr = "root=/dev/hda1 crtmode=vesa0,60"; |
2407 |
|
|
store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); |
2408 |
|
|
|
2409 |
|
|
/* TODO: netbsd's bootinfo.h, for symbolic names */ |
2410 |
|
|
{ |
2411 |
|
|
time_t timet; |
2412 |
|
|
struct tm *tmp; |
2413 |
|
|
|
2414 |
|
|
/* RTC data given by the BIOS: */ |
2415 |
|
|
timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ |
2416 |
|
|
tmp = gmtime(&timet); |
2417 |
|
|
/* TODO: are these 0- or 1-based? */ |
2418 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 1, int_to_bcd(tmp->tm_sec)); |
2419 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 2, int_to_bcd(tmp->tm_min)); |
2420 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 3, int_to_bcd(tmp->tm_hour)); |
2421 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 5, int_to_bcd(tmp->tm_mday)); |
2422 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 6, int_to_bcd(tmp->tm_mon + 1)); |
2423 |
|
|
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 7, int_to_bcd(tmp->tm_year - 100)); |
2424 |
|
|
} |
2425 |
|
|
|
2426 |
|
|
/* "BOOTINFO_PCMCIA_TYPE" in NetBSD's bootinfo.h. This contains the sbus controller type. */ |
2427 |
|
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x1c, 3); |
2428 |
|
|
|
2429 |
|
|
/* TODO: Is this necessary? */ |
2430 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_SP] = 0x80007f00; |
2431 |
|
|
|
2432 |
|
|
break; |
2433 |
|
|
|
2434 |
|
|
case MACHINE_SGI: |
2435 |
|
|
case MACHINE_ARC: |
2436 |
|
|
/* |
2437 |
|
|
* SGI and ARC emulation share a lot of code. (SGI is a special case of |
2438 |
|
|
* "almost ARC".) |
2439 |
|
|
* |
2440 |
|
|
* http://obsolete.majix.org/computers/sgi/iptable.shtml contains a pretty |
2441 |
|
|
* detailed list of IP ("Inhouse Processor") model numbers. |
2442 |
|
|
* (Or http://hardware.majix.org/computers/sgi/iptable.shtml) |
2443 |
|
|
*/ |
2444 |
|
|
machine->machine_name = malloc(500); |
2445 |
|
|
if (machine->machine_name == NULL) { |
2446 |
|
|
fprintf(stderr, "out of memory\n"); |
2447 |
|
|
exit(1); |
2448 |
|
|
} |
2449 |
|
|
short_machine_name = malloc(500); |
2450 |
|
|
if (short_machine_name == NULL) { |
2451 |
|
|
fprintf(stderr, "out of memory\n"); |
2452 |
|
|
exit(1); |
2453 |
|
|
} |
2454 |
|
|
|
2455 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
2456 |
|
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
2457 |
|
|
sprintf(short_machine_name, "SGI-IP%i", machine->machine_subtype); |
2458 |
|
|
sprintf(machine->machine_name, "SGI-IP%i", machine->machine_subtype); |
2459 |
|
|
|
2460 |
|
|
/* Super-special case for IP24: */ |
2461 |
|
|
if (machine->machine_subtype == 24) |
2462 |
|
|
sprintf(short_machine_name, "SGI-IP22"); |
2463 |
|
|
|
2464 |
|
|
sgi_ram_offset = 1048576 * machine->memory_offset_in_mb; |
2465 |
|
|
|
2466 |
|
|
/* Special cases for IP20,22,24,26 memory offset: */ |
2467 |
|
|
if (machine->machine_subtype == 20 || machine->machine_subtype == 22 || |
2468 |
|
|
machine->machine_subtype == 24 || machine->machine_subtype == 26) { |
2469 |
|
|
dev_ram_init(mem, 0x00000000, 0x10000, DEV_RAM_MIRROR, sgi_ram_offset); |
2470 |
|
|
dev_ram_init(mem, 0x00050000, sgi_ram_offset-0x50000, DEV_RAM_MIRROR, sgi_ram_offset + 0x50000); |
2471 |
|
|
} |
2472 |
|
|
|
2473 |
|
|
/* Special cases for IP28,30 memory offset: */ |
2474 |
|
|
if (machine->machine_subtype == 28 || machine->machine_subtype == 30) { |
2475 |
|
|
/* TODO: length below should maybe not be 128MB? */ |
2476 |
|
|
dev_ram_init(mem, 0x00000000, 128*1048576, DEV_RAM_MIRROR, sgi_ram_offset); |
2477 |
|
|
} |
2478 |
|
|
} else { |
2479 |
|
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2480 |
|
|
sprintf(short_machine_name, "ARC"); |
2481 |
|
|
sprintf(machine->machine_name, "ARC"); |
2482 |
|
|
} |
2483 |
|
|
|
2484 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
2485 |
|
|
/* TODO: Other SGI machine types? */ |
2486 |
|
|
switch (machine->machine_subtype) { |
2487 |
|
|
case 12: |
2488 |
|
|
strcat(machine->machine_name, " (Iris Indigo IP12)"); |
2489 |
|
|
|
2490 |
|
|
/* TODO */ |
2491 |
|
|
/* 33 MHz R3000, according to http://www.irisindigo.com/ */ |
2492 |
|
|
/* "capable of addressing up to 96MB of memory." */ |
2493 |
|
|
|
2494 |
|
|
break; |
2495 |
|
|
case 19: |
2496 |
|
|
strcat(machine->machine_name, " (Everest IP19)"); |
2497 |
|
|
machine->main_console_handle = |
2498 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "serial zs"); /* serial? netbsd? */ |
2499 |
|
|
dev_scc_init(machine, mem, 0x10086000, 0, machine->use_x11, 0, 8); /* serial? irix? */ |
2500 |
|
|
|
2501 |
|
|
device_add(machine, "sgi_ip19 addr=0x18000000"); |
2502 |
|
|
|
2503 |
|
|
/* Irix' <everest_du_init+0x130> reads this device: */ |
2504 |
|
|
device_add(machine, "random addr=0x10006000 len=16"); |
2505 |
|
|
|
2506 |
|
|
/* Irix' get_mpconf() looks for this: (TODO) */ |
2507 |
|
|
store_32bit_word(cpu, 0xa0000000 + 0x3000, |
2508 |
|
|
0xbaddeed2); |
2509 |
|
|
|
2510 |
|
|
/* Memory size, not 4096 byte pages, but 256 bytes? (16 is size of kernel... approx) */ |
2511 |
|
|
store_32bit_word(cpu, 0xa0000000 + 0x26d0, |
2512 |
|
|
30000); /* (machine->physical_ram_in_mb - 16) * (1048576 / 256)); */ |
2513 |
|
|
|
2514 |
|
|
break; |
2515 |
|
|
case 20: |
2516 |
|
|
strcat(machine->machine_name, " (Indigo)"); |
2517 |
|
|
|
2518 |
|
|
/* |
2519 |
|
|
* Guesses based on NetBSD 2.0 beta, 20040606. |
2520 |
|
|
* |
2521 |
|
|
* int0 at mainbus0 addr 0x1fb801c0: bus 1MHz, CPU 2MHz |
2522 |
|
|
* imc0 at mainbus0 addr 0x1fa00000: revision 0 |
2523 |
|
|
* gio0 at imc0 |
2524 |
|
|
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 0 addr 0x1f400000 not configured |
2525 |
|
|
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 1 addr 0x1f600000 not configured |
2526 |
|
|
* unknown GIO card (product 0x00 revision 0x00) at gio0 slot 2 addr 0x1f000000 not configured |
2527 |
|
|
* hpc0 at gio0 addr 0x1fb80000: SGI HPC1 |
2528 |
|
|
* zsc0 at hpc0 offset 0xd10 (channels 0 and 1, channel 1 for console) |
2529 |
|
|
* zsc1 at hpc0 offset 0xd00 (2 channels) |
2530 |
|
|
* sq0 at hpc0 offset 0x100: SGI Seeq 80c03 |
2531 |
|
|
* wdsc0 at hpc0 offset 0x11f |
2532 |
|
|
* dpclock0 at hpc0 offset 0xe00 |
2533 |
|
|
*/ |
2534 |
|
|
|
2535 |
|
|
/* int0 at mainbus0 addr 0x1fb801c0 */ |
2536 |
|
|
machine->sgi_ip20_data = dev_sgi_ip20_init(cpu, mem, DEV_SGI_IP20_BASE); |
2537 |
|
|
|
2538 |
|
|
/* imc0 at mainbus0 addr 0x1fa00000: revision 0: TODO (or in dev_sgi_ip20?) */ |
2539 |
|
|
|
2540 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
2541 |
|
|
|
2542 |
|
|
/* This is the zsc0 reported by NetBSD: TODO: irqs */ |
2543 |
|
|
machine->main_console_handle = dev_zs_init(machine, mem, 0x1fb80d10, 0, 1, "zsc0"); /* zsc0 */ |
2544 |
|
|
dev_zs_init(machine, mem, 0x1fb80d00, 0, 1, "zsc1"); /* zsc1 */ |
2545 |
|
|
|
2546 |
|
|
/* WDSC SCSI controller: */ |
2547 |
|
|
dev_wdsc_init(machine, mem, 0x1fb8011f, 0, 0); |
2548 |
|
|
|
2549 |
|
|
/* Return memory read errors so that hpc1 |
2550 |
|
|
and hpc2 are not detected: */ |
2551 |
|
|
device_add(machine, "unreadable addr=0x1fb00000 len=0x10000"); |
2552 |
|
|
device_add(machine, "unreadable addr=0x1f980000 len=0x10000"); |
2553 |
|
|
|
2554 |
|
|
/* Return nothing for gio slots 0, 1, and 2: */ |
2555 |
|
|
device_add(machine, "unreadable addr=0x1f400000 len=0x1000"); /* gio0 slot 0 */ |
2556 |
|
|
device_add(machine, "unreadable addr=0x1f600000 len=0x1000"); /* gio0 slot 1 */ |
2557 |
|
|
device_add(machine, "unreadable addr=0x1f000000 len=0x1000"); /* gio0 slot 2 */ |
2558 |
|
|
|
2559 |
|
|
break; |
2560 |
|
|
case 21: |
2561 |
|
|
strcat(machine->machine_name, " (uknown SGI-IP21 ?)"); /* TODO */ |
2562 |
|
|
/* NOTE: Special case for arc_wordlen: */ |
2563 |
|
|
arc_wordlen = sizeof(uint64_t); |
2564 |
|
|
|
2565 |
|
|
device_add(machine, "random addr=0x418000200, len=0x20000"); |
2566 |
|
|
|
2567 |
|
|
break; |
2568 |
|
|
case 22: |
2569 |
|
|
case 24: |
2570 |
|
|
if (machine->machine_subtype == 22) { |
2571 |
|
|
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Full-house)"); |
2572 |
|
|
machine->sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
2573 |
|
|
} else { |
2574 |
|
|
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Guiness)"); |
2575 |
|
|
machine->sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
2576 |
|
|
} |
2577 |
|
|
|
2578 |
|
|
/* |
2579 |
|
|
Why is this here? TODO |
2580 |
|
|
dev_ram_init(mem, 0x88000000ULL, |
2581 |
|
|
128 * 1048576, DEV_RAM_MIRROR, 0x08000000); |
2582 |
|
|
*/ |
2583 |
|
|
machine->md_interrupt = sgi_ip22_interrupt; |
2584 |
|
|
|
2585 |
|
|
/* |
2586 |
|
|
* According to NetBSD 1.6.2: |
2587 |
|
|
* |
2588 |
|
|
* imc0 at mainbus0 addr 0x1fa00000, Revision 0 |
2589 |
|
|
* gio0 at imc0 |
2590 |
|
|
* hpc0 at gio0 addr 0x1fb80000: SGI HPC3 |
2591 |
|
|
* zsc0 at hpc0 offset 0x59830 |
2592 |
|
|
* zstty0 at zsc0 channel 1 (console i/o) |
2593 |
|
|
* zstty1 at zsc0 channel 0 |
2594 |
|
|
* sq0 at hpc0 offset 0x54000: SGI Seeq 80c03 (Ethernet) |
2595 |
|
|
* wdsc0 at hpc0 offset 0x44000: WD33C93 SCSI, rev=0, target 7 |
2596 |
|
|
* scsibus2 at wdsc0: 8 targets, 8 luns per target |
2597 |
|
|
* dsclock0 at hpc0 offset 0x60000 |
2598 |
|
|
* |
2599 |
|
|
* According to Linux/IP22: |
2600 |
|
|
* tty00 at 0xbfbd9830 (irq = 45) is a Zilog8530 |
2601 |
|
|
* tty01 at 0xbfbd9838 (irq = 45) is a Zilog8530 |
2602 |
|
|
* |
2603 |
|
|
* and according to NetBSD 2.0_BETA (20040606): |
2604 |
|
|
* |
2605 |
|
|
* haltwo0 at hpc0 offset 0x58000: HAL2 revision 0.0.0 |
2606 |
|
|
* audio0 at haltwo0: half duplex |
2607 |
|
|
* |
2608 |
|
|
* IRQ numbers are of the form 8 + x, where x = 0..31 for local0 |
2609 |
|
|
* interrupts, and 32..63 for local1. + y*65 for "mappable". |
2610 |
|
|
*/ |
2611 |
|
|
|
2612 |
|
|
/* zsc0 serial console. */ |
2613 |
|
|
i = dev_zs_init(machine, mem, 0x1fbd9830, |
2614 |
|
|
8 + 32 + 3 + 64*5, 1, "zsc0"); |
2615 |
|
|
|
2616 |
|
|
/* Not supported by NetBSD 1.6.2, but by 2.0_BETA: */ |
2617 |
|
|
j = dev_pckbc_init(machine, mem, 0x1fbd9840, PCKBC_8242, |
2618 |
|
|
0, 0, machine->use_x11); /* TODO: irq numbers */ |
2619 |
|
|
|
2620 |
|
|
if (machine->use_x11) |
2621 |
|
|
machine->main_console_handle = j; |
2622 |
|
|
|
2623 |
|
|
/* sq0: Ethernet. TODO: This should have irq_nr = 8 + 3 */ |
2624 |
|
|
/* dev_sq_init... */ |
2625 |
|
|
|
2626 |
|
|
/* wdsc0: SCSI */ |
2627 |
|
|
dev_wdsc_init(machine, mem, 0x1fbc4000, 0, 8 + 1); |
2628 |
|
|
|
2629 |
|
|
/* wdsc1: SCSI TODO: irq nr */ |
2630 |
|
|
dev_wdsc_init(machine, mem, 0x1fbcc000, 1, 8 + 1); |
2631 |
|
|
|
2632 |
|
|
/* dsclock0: TODO: possibly irq 8 + 33 */ |
2633 |
|
|
|
2634 |
|
|
/* Return memory read errors so that hpc1 and hpc2 are not detected: */ |
2635 |
|
|
device_add(machine, "unreadable addr=0x1fb00000, len=0x10000"); |
2636 |
|
|
device_add(machine, "unreadable addr=0x1f980000, len=0x10000"); |
2637 |
|
|
|
2638 |
|
|
/* Similarly for gio slots 0, 1, and 2: */ |
2639 |
|
|
device_add(machine, "unreadable addr=0x1f400000, len=0x1000"); /* gio0 slot 0 */ |
2640 |
|
|
device_add(machine, "unreadable addr=0x1f600000, len=0x1000"); /* gio0 slot 1 */ |
2641 |
|
|
device_add(machine, "unreadable addr=0x1f000000, len=0x1000"); /* gio0 slot 2 */ |
2642 |
|
|
|
2643 |
|
|
break; |
2644 |
|
|
case 25: |
2645 |
|
|
/* NOTE: Special case for arc_wordlen: */ |
2646 |
|
|
arc_wordlen = sizeof(uint64_t); |
2647 |
|
|
strcat(machine->machine_name, " (Everest IP25)"); |
2648 |
|
|
|
2649 |
|
|
/* serial? irix? */ |
2650 |
|
|
dev_scc_init(machine, mem, |
2651 |
|
|
0x400086000ULL, 0, machine->use_x11, 0, 8); |
2652 |
|
|
|
2653 |
|
|
/* NOTE: ip19! (perhaps not really the same */ |
2654 |
|
|
device_add(machine, "sgi_ip19 addr=0x18000000"); |
2655 |
|
|
|
2656 |
|
|
/* |
2657 |
|
|
* Memory size, not 4096 byte pages, but 256 |
2658 |
|
|
* bytes? (16 is size of kernel... approx) |
2659 |
|
|
*/ |
2660 |
|
|
store_32bit_word(cpu, 0xa0000000ULL + 0x26d0, |
2661 |
|
|
30000); /* (machine->physical_ram_in_mb - 16) |
2662 |
|
|
* (1048576 / 256)); */ |
2663 |
|
|
|
2664 |
|
|
break; |
2665 |
|
|
case 26: |
2666 |
|
|
/* NOTE: Special case for arc_wordlen: */ |
2667 |
|
|
arc_wordlen = sizeof(uint64_t); |
2668 |
|
|
strcat(machine->machine_name, |
2669 |
|
|
" (uknown SGI-IP26 ?)"); /* TODO */ |
2670 |
|
|
machine->main_console_handle = |
2671 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, |
2672 |
|
|
0, 1, "zs console"); |
2673 |
|
|
break; |
2674 |
|
|
case 27: |
2675 |
|
|
strcat(machine->machine_name, |
2676 |
|
|
" (Origin 200/2000, Onyx2)"); |
2677 |
|
|
arc_wordlen = sizeof(uint64_t); |
2678 |
|
|
/* 2 cpus per node */ |
2679 |
|
|
|
2680 |
|
|
machine->main_console_handle = |
2681 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, |
2682 |
|
|
0, 1, "zs console"); |
2683 |
|
|
break; |
2684 |
|
|
case 28: |
2685 |
|
|
/* NOTE: Special case for arc_wordlen: */ |
2686 |
|
|
arc_wordlen = sizeof(uint64_t); |
2687 |
|
|
strcat(machine->machine_name, " (Impact Indigo2 ?)"); |
2688 |
|
|
|
2689 |
|
|
device_add(machine, "random addr=0x1fbe0000, len=1"); |
2690 |
|
|
|
2691 |
|
|
/* Something at paddr 0x1880fb0000. */ |
2692 |
|
|
|
2693 |
|
|
break; |
2694 |
|
|
case 30: |
2695 |
|
|
/* NOTE: Special case for arc_wordlen: */ |
2696 |
|
|
arc_wordlen = sizeof(uint64_t); |
2697 |
|
|
strcat(machine->machine_name, " (Octane)"); |
2698 |
|
|
|
2699 |
|
|
machine->sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
2700 |
|
|
machine->md_interrupt = sgi_ip30_interrupt; |
2701 |
|
|
|
2702 |
|
|
dev_ram_init(mem, 0xa0000000ULL, |
2703 |
|
|
128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
2704 |
|
|
|
2705 |
|
|
dev_ram_init(mem, 0x80000000ULL, |
2706 |
|
|
32 * 1048576, DEV_RAM_RAM, 0x00000000); |
2707 |
|
|
|
2708 |
|
|
/* |
2709 |
|
|
* Something at paddr=1f022004: TODO |
2710 |
|
|
* Something at paddr=813f0510 - paddr=813f0570 ? |
2711 |
|
|
* Something at paddr=813f04b8 |
2712 |
|
|
* Something at paddr=f8000003c used by Linux/Octane |
2713 |
|
|
* |
2714 |
|
|
* 16550 serial port at paddr=1f620178, addr mul 1 |
2715 |
|
|
* (Error messages are printed to this serial port by the PROM.) |
2716 |
|
|
* |
2717 |
|
|
* There seems to also be a serial port at 1f620170. The "symmon" |
2718 |
|
|
* program dumps something there, but it doesn't look like |
2719 |
|
|
* readable text. (TODO) |
2720 |
|
|
*/ |
2721 |
|
|
machine->main_console_handle = dev_ns16550_init(machine, mem, 0x1f620170, 0, 1, |
2722 |
|
|
machine->use_x11? 0 : 1, "serial 0"); /* TODO: irq? */ |
2723 |
|
|
dev_ns16550_init(machine, mem, 0x1f620178, 0, 1, |
2724 |
|
|
0, "serial 1"); /* TODO: irq? */ |
2725 |
|
|
|
2726 |
|
|
/* MardiGras graphics: */ |
2727 |
|
|
device_add(machine, "sgi_mardigras addr=0x1c000000"); |
2728 |
|
|
|
2729 |
|
|
break; |
2730 |
|
|
case 32: |
2731 |
|
|
strcat(machine->machine_name, " (O2)"); |
2732 |
|
|
|
2733 |
|
|
/* TODO: Find out where the physical ram is actually located. */ |
2734 |
|
|
dev_ram_init(mem, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
2735 |
|
|
dev_ram_init(mem, 0x10000000ULL, 256, DEV_RAM_MIRROR, 0x00000000); |
2736 |
|
|
dev_ram_init(mem, 0x11ffff00ULL, 256, DEV_RAM_MIRROR, 0x01ffff00); |
2737 |
|
|
dev_ram_init(mem, 0x12000000ULL, 256, DEV_RAM_MIRROR, 0x02000000); |
2738 |
|
|
dev_ram_init(mem, 0x17ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
2739 |
|
|
dev_ram_init(mem, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
2740 |
|
|
dev_ram_init(mem, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000); |
2741 |
|
|
|
2742 |
|
|
machine->crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11); /* crime0 */ |
2743 |
|
|
dev_sgi_mte_init(mem, 0x15000000); /* mte ??? memory thing */ |
2744 |
|
|
dev_sgi_gbe_init(machine, mem, 0x16000000); /* gbe? framebuffer? */ |
2745 |
|
|
|
2746 |
|
|
/* |
2747 |
|
|
* A combination of NetBSD and Linux info: |
2748 |
|
|
* |
2749 |
|
|
* 17000000 vice (Video Image Compression Engine) |
2750 |
|
|
* 1f000000 mace |
2751 |
|
|
* 1f080000 macepci |
2752 |
|
|
* 1f100000 vin1 |
2753 |
|
|
* 1f180000 vin2 |
2754 |
|
|
* 1f200000 vout |
2755 |
|
|
* 1f280000 enet (mec0, MAC-110 Ethernet) |
2756 |
|
|
* 1f300000 perif: |
2757 |
|
|
* 1f300000 audio |
2758 |
|
|
* 1f310000 isa |
2759 |
|
|
* 1f318000 (accessed by Irix' pciio_pio_write64) |
2760 |
|
|
* 1f320000 kbdms |
2761 |
|
|
* 1f330000 i2c |
2762 |
|
|
* 1f340000 ust |
2763 |
|
|
* 1f380000 isa ext |
2764 |
|
|
* 1f390000 com0 (serial) |
2765 |
|
|
* 1f398000 com1 (serial) |
2766 |
|
|
* 1f3a0000 mcclock0 |
2767 |
|
|
*/ |
2768 |
|
|
|
2769 |
|
|
machine->mace_data = dev_mace_init(mem, 0x1f310000, 2); |
2770 |
|
|
machine->md_interrupt = sgi_ip32_interrupt; |
2771 |
|
|
|
2772 |
|
|
/* |
2773 |
|
|
* IRQ mapping is really ugly. TODO: fix |
2774 |
|
|
* |
2775 |
|
|
* com0 at mace0 offset 0x390000 intr 4 intrmask 0x3f00000: ns16550a, working fifo |
2776 |
|
|
* com1 at mace0 offset 0x398000 intr 4 intrmask 0xfc000000: ns16550a, working fifo |
2777 |
|
|
* pckbc0 at mace0 offset 0x320000 intr 5 intrmask 0x0 |
2778 |
|
|
* mcclock0 at mace0 offset 0x3a0000 intrmask 0x0 |
2779 |
|
|
* macepci0 at mace0 offset 0x80000 intr 7 intrmask 0x0: rev 1 |
2780 |
|
|
* |
2781 |
|
|
* intr 4 = MACE_PERIPH_SERIAL |
2782 |
|
|
* intr 5 = MACE_PERIPH_MISC |
2783 |
|
|
* intr 7 = MACE_PCI_BRIDGE |
2784 |
|
|
*/ |
2785 |
|
|
|
2786 |
|
|
i = dev_pckbc_init(machine, mem, 0x1f320000, |
2787 |
|
|
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
2788 |
|
|
0x800 + MACE_PERIPH_MISC, machine->use_x11); |
2789 |
|
|
/* keyb+mouse (mace irq numbers) */ |
2790 |
|
|
|
2791 |
|
|
net_generate_unique_mac(machine, macaddr); |
2792 |
|
|
eaddr_string = malloc(30); |
2793 |
|
|
if (eaddr_string == NULL) { |
2794 |
|
|
fprintf(stderr, "out of memory\n"); |
2795 |
|
|
exit(1); |
2796 |
|
|
} |
2797 |
|
|
sprintf(eaddr_string, "eaddr=%02x:%02x:" |
2798 |
|
|
"%02x:%02x:%02x:%02x", |
2799 |
|
|
macaddr[0], macaddr[1], macaddr[2], |
2800 |
|
|
macaddr[3], macaddr[4], macaddr[5]); |
2801 |
|
|
dev_sgi_mec_init(machine, mem, 0x1f280000, MACE_ETHERNET, macaddr); |
2802 |
|
|
|
2803 |
|
|
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
2804 |
|
|
|
2805 |
|
|
j = dev_ns16550_init(machine, mem, 0x1f390000, |
2806 |
|
|
(1<<20) + MACE_PERIPH_SERIAL, 0x100, |
2807 |
|
|
machine->use_x11? 0 : 1, "serial 0"); /* com0 */ |
2808 |
|
|
dev_ns16550_init(machine, mem, 0x1f398000, |
2809 |
|
|
(1<<26) + MACE_PERIPH_SERIAL, 0x100, |
2810 |
|
|
0, "serial 1"); /* com1 */ |
2811 |
|
|
|
2812 |
|
|
if (machine->use_x11) |
2813 |
|
|
machine->main_console_handle = i; |
2814 |
|
|
else |
2815 |
|
|
machine->main_console_handle = j; |
2816 |
|
|
|
2817 |
|
|
dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ |
2818 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
2819 |
|
|
|
2820 |
|
|
/* |
2821 |
|
|
* PCI devices: (according to NetBSD's GENERIC config file for sgimips) |
2822 |
|
|
* |
2823 |
|
|
* ne* at pci? dev ? function ? |
2824 |
|
|
* ahc0 at pci0 dev 1 function ? |
2825 |
|
|
* ahc1 at pci0 dev 2 function ? |
2826 |
|
|
*/ |
2827 |
|
|
|
2828 |
|
|
pci_data = dev_macepci_init(mem, 0x1f080000, MACE_PCI_BRIDGE); /* macepci0 */ |
2829 |
|
|
/* bus_pci_add(machine, pci_data, mem, 0, 0, 0, pci_ne2000_init, pci_ne2000_rr); TODO */ |
2830 |
|
|
#if 1 |
2831 |
|
|
bus_pci_add(machine, pci_data, mem, 0, 1, 0, pci_ahc_init, pci_ahc_rr); |
2832 |
|
|
#endif |
2833 |
|
|
/* bus_pci_add(machine, pci_data, mem, 0, 2, 0, pci_ahc_init, pci_ahc_rr); */ |
2834 |
|
|
|
2835 |
|
|
break; |
2836 |
|
|
case 35: |
2837 |
|
|
strcat(machine->machine_name, " (Origin 3000)"); |
2838 |
|
|
/* 4 cpus per node */ |
2839 |
|
|
|
2840 |
|
|
machine->main_console_handle = |
2841 |
|
|
dev_zs_init(machine, mem, 0x1fbd9830, |
2842 |
|
|
0, 1, "zs console"); |
2843 |
|
|
break; |
2844 |
|
|
case 53: |
2845 |
|
|
strcat(machine->machine_name, " (Origin 350)"); |
2846 |
|
|
/* |
2847 |
|
|
* According to http://kumba.drachentekh.net/xml/myguide.html |
2848 |
|
|
* Origin 350, Tezro IP53 R16000 |
2849 |
|
|
*/ |
2850 |
|
|
break; |
2851 |
|
|
default: |
2852 |
|
|
fatal("unimplemented SGI machine type IP%i\n", |
2853 |
|
|
machine->machine_subtype); |
2854 |
|
|
exit(1); |
2855 |
|
|
} |
2856 |
|
|
} else { |
2857 |
|
|
switch (machine->machine_subtype) { |
2858 |
|
|
|
2859 |
|
|
case MACHINE_ARC_NEC_RD94: |
2860 |
|
|
case MACHINE_ARC_NEC_R94: |
2861 |
|
|
case MACHINE_ARC_NEC_R96: |
2862 |
|
|
/* |
2863 |
|
|
* "NEC-RD94" (NEC RISCstation 2250) |
2864 |
|
|
* "NEC-R94" (NEC RISCstation 2200) |
2865 |
|
|
* "NEC-R96" (NEC Express RISCserver) |
2866 |
|
|
* |
2867 |
|
|
* http://mirror.aarnet.edu.au/pub/NetBSD/misc/chs/arcdiag.out (NEC-R96) |
2868 |
|
|
*/ |
2869 |
|
|
|
2870 |
|
|
switch (machine->machine_subtype) { |
2871 |
|
|
case MACHINE_ARC_NEC_RD94: |
2872 |
|
|
strcat(machine->machine_name, " (NEC-RD94, NEC RISCstation 2250)"); |
2873 |
|
|
break; |
2874 |
|
|
case MACHINE_ARC_NEC_R94: |
2875 |
|
|
strcat(machine->machine_name, " (NEC-R94; NEC RISCstation 2200)"); |
2876 |
|
|
break; |
2877 |
|
|
case MACHINE_ARC_NEC_R96: |
2878 |
|
|
strcat(machine->machine_name, " (NEC-R96; NEC Express RISCserver)"); |
2879 |
|
|
break; |
2880 |
|
|
} |
2881 |
|
|
|
2882 |
|
|
/* TODO: interrupt controller! */ |
2883 |
|
|
|
2884 |
|
|
pci_data = device_add(machine, |
2885 |
|
|
"rd94 addr=0x80000000, irq=0"); |
2886 |
|
|
|
2887 |
|
|
device_add(machine, "sn addr=0x80001000 irq=0"); |
2888 |
|
|
dev_mc146818_init(machine, mem, 0x80004000ULL, 0, MC146818_ARC_NEC, 1); |
2889 |
|
|
i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042, 0, 0, machine->use_x11); |
2890 |
|
|
j = dev_ns16550_init(machine, mem, 0x80006000ULL, |
2891 |
|
|
3, 1, machine->use_x11? 0 : 1, "serial 0"); /* com0 */ |
2892 |
|
|
dev_ns16550_init(machine, mem, 0x80007000ULL, |
2893 |
|
|
0, 1, 0, "serial 1"); /* com1 */ |
2894 |
|
|
|
2895 |
|
|
if (machine->use_x11) |
2896 |
|
|
machine->main_console_handle = i; |
2897 |
|
|
else |
2898 |
|
|
machine->main_console_handle = j; |
2899 |
|
|
|
2900 |
|
|
/* lpt at 0x80008000 */ |
2901 |
|
|
|
2902 |
|
|
device_add(machine, "fdc addr=0x8000c000, irq=0"); |
2903 |
|
|
|
2904 |
|
|
switch (machine->machine_subtype) { |
2905 |
|
|
case MACHINE_ARC_NEC_RD94: |
2906 |
|
|
case MACHINE_ARC_NEC_R94: |
2907 |
|
|
/* PCI devices: (NOTE: bus must be 0, device must be 3, 4, or 5, for NetBSD to accept interrupts) */ |
2908 |
|
|
bus_pci_add(machine, pci_data, mem, 0, 3, 0, pci_dec21030_init, pci_dec21030_rr); /* tga graphics */ |
2909 |
|
|
break; |
2910 |
|
|
case MACHINE_ARC_NEC_R96: |
2911 |
|
|
dev_fb_init(machine, mem, 0x100e00000ULL, |
2912 |
|
|
VFB_GENERIC, 640,480, 1024,480, |
2913 |
|
|
8, "necvdfrb", 1); |
2914 |
|
|
break; |
2915 |
|
|
} |
2916 |
|
|
break; |
2917 |
|
|
|
2918 |
|
|
case MACHINE_ARC_NEC_R98: |
2919 |
|
|
/* |
2920 |
|
|
* "NEC-R98" (NEC RISCserver 4200) |
2921 |
|
|
* |
2922 |
|
|
* According to http://mail-index.netbsd.org/port-arc/2004/02/01/0001.html: |
2923 |
|
|
* |
2924 |
|
|
* Network adapter at "start: 0x 0 18600000, length: 0x1000, level: 4, vector: 9" |
2925 |
|
|
* Disk at "start: 0x 0 18c103f0, length: 0x1000, level: 5, vector: 6" |
2926 |
|
|
* Keyboard at "start: 0x 0 18c20060, length: 0x1000, level: 5, vector: 3" |
2927 |
|
|
* Serial at "start: 0x 0 18c103f8, length: 0x1000, level: 5, vector: 4" |
2928 |
|
|
* Serial at "start: 0x 0 18c102f8, length: 0x1000, level: 5, vector: 4" |
2929 |
|
|
* Parallel at "start: 0x 0 18c10278, length: 0x1000, level: 5, vector: 5" |
2930 |
|
|
*/ |
2931 |
|
|
|
2932 |
|
|
strcat(machine->machine_name, " (NEC-R98; NEC RISCserver 4200)"); |
2933 |
|
|
|
2934 |
|
|
/* |
2935 |
|
|
* Windows NT access stuff at these addresses: |
2936 |
|
|
* |
2937 |
|
|
* 19980308, 18000210, 18c0a008, |
2938 |
|
|
* 19022018, 19026010, andso on. |
2939 |
|
|
*/ |
2940 |
|
|
break; |
2941 |
|
|
|
2942 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
2943 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
2944 |
|
|
/* |
2945 |
|
|
* "PICA-61" |
2946 |
|
|
* |
2947 |
|
|
* According to NetBSD 1.6.2: |
2948 |
|
|
* |
2949 |
|
|
* jazzio0 at mainbus0 |
2950 |
|
|
* timer0 at jazzio0 addr 0xe0000228 |
2951 |
|
|
* mcclock0 at jazzio0 addr 0xe0004000: mc146818 or compatible |
2952 |
|
|
* lpt at jazzio0 addr 0xe0008000 intr 0 not configured |
2953 |
|
|
* fdc at jazzio0 addr 0xe0003000 intr 1 not configured |
2954 |
|
|
* MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured |
2955 |
|
|
* ALI_S3 at jazzio0 addr 0xe0800000 intr 3 not configured |
2956 |
|
|
* sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet |
2957 |
|
|
* sn0: Ethernet address 69:6a:6b:6c:00:00 |
2958 |
|
|
* asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, target 0 |
2959 |
|
|
* pckbd at jazzio0 addr 0xe0005000 intr 6 not configured |
2960 |
|
|
* pms at jazzio0 addr 0xe0005000 intr 7 not configured |
2961 |
|
|
* com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo |
2962 |
|
|
* com at jazzio0 addr 0xe0007000 intr 9 not configured |
2963 |
|
|
* jazzisabr0 at mainbus0 |
2964 |
|
|
* isa0 at jazzisabr0 isa_io_base 0xe2000000 isa_mem_base 0xe3000000 |
2965 |
|
|
* |
2966 |
|
|
* "Microsoft-Jazz", "MIPS Magnum" |
2967 |
|
|
* |
2968 |
|
|
* timer0 at jazzio0 addr 0xe0000228 |
2969 |
|
|
* mcclock0 at jazzio0 addr 0xe0004000: mc146818 or compatible |
2970 |
|
|
* lpt at jazzio0 addr 0xe0008000 intr 0 not configured |
2971 |
|
|
* fdc at jazzio0 addr 0xe0003000 intr 1 not configured |
2972 |
|
|
* MAGNUM at jazzio0 addr 0xe000c000 intr 2 not configured |
2973 |
|
|
* VXL at jazzio0 addr 0xe0800000 intr 3 not configured |
2974 |
|
|
* sn0 at jazzio0 addr 0xe0001000 intr 4: SONIC Ethernet |
2975 |
|
|
* sn0: Ethernet address 69:6a:6b:6c:00:00 |
2976 |
|
|
* asc0 at jazzio0 addr 0xe0002000 intr 5: NCR53C94, target 0 |
2977 |
|
|
* scsibus0 at asc0: 8 targets, 8 luns per target |
2978 |
|
|
* pckbd at jazzio0 addr 0xe0005000 intr 6 not configured |
2979 |
|
|
* pms at jazzio0 addr 0xe0005000 intr 7 not configured |
2980 |
|
|
* com0 at jazzio0 addr 0xe0006000 intr 8: ns16550a, working fifo |
2981 |
|
|
* com at jazzio0 addr 0xe0007000 intr 9 not configured |
2982 |
|
|
* jazzisabr0 at mainbus0 |
2983 |
|
|
* isa0 at jazzisabr0 isa_io_base 0xe2000000 isa_mem_base 0xe3000000 |
2984 |
|
|
*/ |
2985 |
|
|
|
2986 |
|
|
switch (machine->machine_subtype) { |
2987 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
2988 |
|
|
strcat(machine->machine_name, " (Microsoft Jazz, Acer PICA-61)"); |
2989 |
|
|
break; |
2990 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
2991 |
|
|
strcat(machine->machine_name, " (Microsoft Jazz, MIPS Magnum)"); |
2992 |
|
|
break; |
2993 |
|
|
default: |
2994 |
|
|
fatal("error in machine.c. jazz\n"); |
2995 |
|
|
exit(1); |
2996 |
|
|
} |
2997 |
|
|
|
2998 |
|
|
machine->jazz_data = device_add(machine, |
2999 |
|
|
"jazz addr=0x80000000"); |
3000 |
|
|
machine->md_interrupt = jazz_interrupt; |
3001 |
|
|
|
3002 |
|
|
switch (machine->machine_subtype) { |
3003 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
3004 |
|
|
dev_vga_init(machine, mem, |
3005 |
|
|
0x400b8000ULL, 0x600003c0ULL, |
3006 |
|
|
ARC_CONSOLE_MAX_X, ARC_CONSOLE_MAX_Y, machine->machine_name); |
3007 |
|
|
arcbios_console_init(cpu, 0x400b8000ULL, |
3008 |
|
|
0x600003c0ULL, ARC_CONSOLE_MAX_X, |
3009 |
|
|
ARC_CONSOLE_MAX_Y); |
3010 |
|
|
break; |
3011 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
3012 |
|
|
/* PROM mirror? */ |
3013 |
|
|
dev_ram_init(mem, 0xfff00000, 0x100000, |
3014 |
|
|
DEV_RAM_MIRROR, 0x1fc00000); |
3015 |
|
|
|
3016 |
|
|
/* VXL. TODO */ |
3017 |
|
|
/* control at 0x60100000? */ |
3018 |
|
|
dev_fb_init(machine, mem, 0x60200000ULL, |
3019 |
|
|
VFB_GENERIC, 1024,768, 1024,768, |
3020 |
|
|
8, "VXL", 1); |
3021 |
|
|
break; |
3022 |
|
|
} |
3023 |
|
|
|
3024 |
|
|
/* irq 8 + 4 */ |
3025 |
|
|
device_add(machine, "sn addr=0x80001000 irq=12"); |
3026 |
|
|
|
3027 |
|
|
dev_asc_init(machine, mem, |
3028 |
|
|
0x80002000ULL, 8 + 5, NULL, DEV_ASC_PICA, |
3029 |
|
|
dev_jazz_dma_controller, machine->jazz_data); |
3030 |
|
|
|
3031 |
|
|
device_add(machine, "fdc addr=0x80003000, irq=0"); |
3032 |
|
|
|
3033 |
|
|
dev_mc146818_init(machine, mem, |
3034 |
|
|
0x80004000ULL, 2, MC146818_ARC_JAZZ, 1); |
3035 |
|
|
|
3036 |
|
|
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3037 |
|
|
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11); |
3038 |
|
|
|
3039 |
|
|
j = dev_ns16550_init(machine, mem, |
3040 |
|
|
0x80006000ULL, 8 + 8, 1, |
3041 |
|
|
machine->use_x11? 0 : 1, "serial 0"); |
3042 |
|
|
dev_ns16550_init(machine, mem, |
3043 |
|
|
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
3044 |
|
|
|
3045 |
|
|
if (machine->use_x11) |
3046 |
|
|
machine->main_console_handle = i; |
3047 |
|
|
else |
3048 |
|
|
machine->main_console_handle = j; |
3049 |
|
|
|
3050 |
|
|
#if 0 |
3051 |
|
|
Not yet. |
3052 |
|
|
dev_wdc_init(machine, mem, 0x900001f0ULL, 8+16 + 14, 0); |
3053 |
|
|
#endif |
3054 |
|
|
|
3055 |
|
|
break; |
3056 |
|
|
|
3057 |
|
|
case MACHINE_ARC_JAZZ_M700: |
3058 |
|
|
/* |
3059 |
|
|
* "Microsoft-Jazz", "Olivetti M700" |
3060 |
|
|
* |
3061 |
|
|
* Different enough from Pica and Magnum to be |
3062 |
|
|
* separate here. |
3063 |
|
|
* |
3064 |
|
|
* See http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html. |
3065 |
|
|
*/ |
3066 |
|
|
|
3067 |
|
|
strcat(machine->machine_name, " (Microsoft Jazz, Olivetti M700)"); |
3068 |
|
|
|
3069 |
|
|
machine->jazz_data = device_add(machine, |
3070 |
|
|
"jazz addr=0x80000000"); |
3071 |
|
|
machine->md_interrupt = jazz_interrupt; |
3072 |
|
|
|
3073 |
|
|
dev_mc146818_init(machine, mem, |
3074 |
|
|
0x80004000ULL, 2, MC146818_ARC_JAZZ, 1); |
3075 |
|
|
|
3076 |
|
|
i = 0; /* TODO: Yuck! */ |
3077 |
|
|
#if 0 |
3078 |
|
|
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3079 |
|
|
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11); |
3080 |
|
|
#endif |
3081 |
|
|
j = dev_ns16550_init(machine, mem, |
3082 |
|
|
0x80006000ULL, 8 + 8, 1, |
3083 |
|
|
machine->use_x11? 0 : 1, "serial 0"); |
3084 |
|
|
dev_ns16550_init(machine, mem, |
3085 |
|
|
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
3086 |
|
|
|
3087 |
|
|
if (machine->use_x11) |
3088 |
|
|
machine->main_console_handle = i; |
3089 |
|
|
else |
3090 |
|
|
machine->main_console_handle = j; |
3091 |
|
|
|
3092 |
|
|
dev_m700_fb_init(machine, mem, |
3093 |
|
|
0x180080000ULL, 0x100000000ULL); |
3094 |
|
|
|
3095 |
|
|
break; |
3096 |
|
|
|
3097 |
|
|
case MACHINE_ARC_DESKTECH_TYNE: |
3098 |
|
|
/* |
3099 |
|
|
* "Deskstation Tyne" (?) |
3100 |
|
|
* |
3101 |
|
|
* TODO |
3102 |
|
|
* http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html |
3103 |
|
|
*/ |
3104 |
|
|
|
3105 |
|
|
strcat(machine->machine_name, " (Deskstation Tyne)"); |
3106 |
|
|
|
3107 |
|
|
dev_vga_init(machine, mem, 0x1000b8000ULL, 0x9000003c0ULL, |
3108 |
|
|
ARC_CONSOLE_MAX_X, ARC_CONSOLE_MAX_Y, machine->machine_name); |
3109 |
|
|
|
3110 |
|
|
arcbios_console_init(cpu, 0x1000b8000ULL, |
3111 |
|
|
0x9000003c0ULL, ARC_CONSOLE_MAX_X, |
3112 |
|
|
ARC_CONSOLE_MAX_Y); |
3113 |
|
|
|
3114 |
|
|
i = dev_ns16550_init(machine, mem, 0x9000003f8ULL, 0, 1, machine->use_x11? 0 : 1, "serial 0"); |
3115 |
|
|
dev_ns16550_init(machine, mem, 0x9000002f8ULL, 0, 1, 0, "serial 1"); |
3116 |
|
|
dev_ns16550_init(machine, mem, 0x9000003e8ULL, 0, 1, 0, "serial 2"); |
3117 |
|
|
dev_ns16550_init(machine, mem, 0x9000002e8ULL, 0, 1, 0, "serial 3"); |
3118 |
|
|
|
3119 |
|
|
dev_mc146818_init(machine, mem, |
3120 |
|
|
0x900000070ULL, 2, MC146818_PC_CMOS, 1); |
3121 |
|
|
|
3122 |
|
|
#if 0 |
3123 |
|
|
dev_wdc_init(machine, mem, 0x9000001f0ULL, 0, 0); |
3124 |
|
|
dev_wdc_init(machine, mem, 0x900000170ULL, 0, 2); |
3125 |
|
|
#endif |
3126 |
|
|
/* PC kbd */ |
3127 |
|
|
j = dev_pckbc_init(machine, mem, 0x900000060ULL, |
3128 |
|
|
PCKBC_8042, 0, 0, machine->use_x11); |
3129 |
|
|
|
3130 |
|
|
if (machine->use_x11) |
3131 |
|
|
machine->main_console_handle = j; |
3132 |
|
|
else |
3133 |
|
|
machine->main_console_handle = i; |
3134 |
|
|
|
3135 |
|
|
break; |
3136 |
|
|
|
3137 |
|
|
default: |
3138 |
|
|
fatal("Unimplemented ARC machine type %i\n", |
3139 |
|
|
machine->machine_subtype); |
3140 |
|
|
exit(1); |
3141 |
|
|
} |
3142 |
|
|
} |
3143 |
|
|
|
3144 |
|
|
|
3145 |
|
|
if (!machine->prom_emulation) |
3146 |
|
|
goto no_arc_prom_emulation; /* TODO: ugly */ |
3147 |
|
|
|
3148 |
|
|
|
3149 |
|
|
/* |
3150 |
|
|
* This is important: :-) |
3151 |
|
|
* |
3152 |
|
|
* TODO: There should not be any use of |
3153 |
|
|
* ARCBIOS before this statement. |
3154 |
|
|
*/ |
3155 |
|
|
if (arc_wordlen == sizeof(uint64_t)) |
3156 |
|
|
arcbios_set_64bit_mode(1); |
3157 |
|
|
|
3158 |
|
|
if (machine->physical_ram_in_mb < 16) |
3159 |
|
|
fprintf(stderr, "WARNING! The ARC platform specification doesn't allow less than 16 MB of RAM. Continuing anyway.\n"); |
3160 |
|
|
|
3161 |
|
|
arcbios_set_default_exception_handler(cpu); |
3162 |
|
|
|
3163 |
|
|
memset(&arcbios_sysid, 0, sizeof(arcbios_sysid)); |
3164 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
3165 |
|
|
/* Vendor ID, max 8 chars: */ |
3166 |
|
|
strncpy(arcbios_sysid.VendorId, "SGI", 3); |
3167 |
|
|
switch (machine->machine_subtype) { |
3168 |
|
|
case 22: |
3169 |
|
|
strncpy(arcbios_sysid.ProductId, |
3170 |
|
|
"87654321", 8); /* some kind of ID? */ |
3171 |
|
|
break; |
3172 |
|
|
case 32: |
3173 |
|
|
strncpy(arcbios_sysid.ProductId, "8", 1); |
3174 |
|
|
/* 6 or 8 (?) */ |
3175 |
|
|
break; |
3176 |
|
|
default: |
3177 |
|
|
snprintf(arcbios_sysid.ProductId, 8, "IP%i", |
3178 |
|
|
machine->machine_subtype); |
3179 |
|
|
} |
3180 |
|
|
} else { |
3181 |
|
|
switch (machine->machine_subtype) { |
3182 |
|
|
case MACHINE_ARC_NEC_RD94: |
3183 |
|
|
strncpy(arcbios_sysid.VendorId, "NEC W&S", 8); /* NOTE: max 8 chars */ |
3184 |
|
|
strncpy(arcbios_sysid.ProductId, "RD94", 4); /* NOTE: max 8 chars */ |
3185 |
|
|
break; |
3186 |
|
|
case MACHINE_ARC_NEC_R94: |
3187 |
|
|
strncpy(arcbios_sysid.VendorId, "NEC W&S", 8); /* NOTE: max 8 chars */ |
3188 |
|
|
strncpy(arcbios_sysid.ProductId, "ijkl", 4); /* NOTE: max 8 chars */ |
3189 |
|
|
break; |
3190 |
|
|
case MACHINE_ARC_NEC_R96: |
3191 |
|
|
strncpy(arcbios_sysid.VendorId, "MIPS DUO", 8); /* NOTE: max 8 chars */ |
3192 |
|
|
strncpy(arcbios_sysid.ProductId, "blahblah", 8); /* NOTE: max 8 chars */ |
3193 |
|
|
break; |
3194 |
|
|
case MACHINE_ARC_NEC_R98: |
3195 |
|
|
strncpy(arcbios_sysid.VendorId, "NEC W&S", 8); /* NOTE: max 8 chars */ |
3196 |
|
|
strncpy(arcbios_sysid.ProductId, "R98", 4); /* NOTE: max 8 chars */ |
3197 |
|
|
break; |
3198 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
3199 |
|
|
strncpy(arcbios_sysid.VendorId, "MIPS MAG", 8);/* NOTE: max 8 chars */ |
3200 |
|
|
strncpy(arcbios_sysid.ProductId, "ijkl", 4); /* NOTE: max 8 chars */ |
3201 |
|
|
break; |
3202 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
3203 |
|
|
strncpy(arcbios_sysid.VendorId, "MIPS MAG", 8);/* NOTE: max 8 chars */ |
3204 |
|
|
strncpy(arcbios_sysid.ProductId, "ijkl", 4); /* NOTE: max 8 chars */ |
3205 |
|
|
break; |
3206 |
|
|
case MACHINE_ARC_JAZZ_M700: |
3207 |
|
|
strncpy(arcbios_sysid.VendorId, "OLI00000", 8);/* NOTE: max 8 chars */ |
3208 |
|
|
strncpy(arcbios_sysid.ProductId, "ijkl", 4); /* NOTE: max 8 chars */ |
3209 |
|
|
break; |
3210 |
|
|
case MACHINE_ARC_DESKTECH_TYNE: |
3211 |
|
|
strncpy(arcbios_sysid.VendorId, "DESKTECH", 8);/* NOTE: max 8 chars */ |
3212 |
|
|
strncpy(arcbios_sysid.ProductId, "ijkl", 4); /* NOTE: max 8 chars */ |
3213 |
|
|
break; |
3214 |
|
|
default: |
3215 |
|
|
fatal("error in machine.c sysid\n"); |
3216 |
|
|
exit(1); |
3217 |
|
|
} |
3218 |
|
|
} |
3219 |
|
|
store_buf(cpu, SGI_SYSID_ADDR, (char *)&arcbios_sysid, sizeof(arcbios_sysid)); |
3220 |
|
|
|
3221 |
|
|
arcbios_get_dsp_stat(cpu, &arcbios_dsp_stat); |
3222 |
|
|
store_buf(cpu, ARC_DSPSTAT_ADDR, (char *)&arcbios_dsp_stat, sizeof(arcbios_dsp_stat)); |
3223 |
|
|
|
3224 |
|
|
/* |
3225 |
|
|
* The first 12 MBs of RAM are simply reserved... this simplifies things a lot. |
3226 |
|
|
* If there's more than 512MB of RAM, it has to be split in two, according to |
3227 |
|
|
* the ARC spec. This code creates a number of chunks of at most 512MB each. |
3228 |
|
|
* |
3229 |
|
|
* NOTE: The region of physical address space between 0x10000000 and 0x1fffffff |
3230 |
|
|
* (256 - 512 MB) is usually occupied by memory mapped devices, so that portion is "lost". |
3231 |
|
|
*/ |
3232 |
|
|
|
3233 |
|
|
arc_reserved = 0x2000; |
3234 |
|
|
if (machine->machine_type == MACHINE_SGI) |
3235 |
|
|
arc_reserved = 0x4000; |
3236 |
|
|
|
3237 |
|
|
arcbios_add_memory_descriptor(cpu, 0, arc_reserved, ARCBIOS_MEM_FirmwarePermanent); |
3238 |
|
|
arcbios_add_memory_descriptor(cpu, sgi_ram_offset + arc_reserved, 0x60000-arc_reserved, ARCBIOS_MEM_FirmwareTemporary); |
3239 |
|
|
|
3240 |
|
|
mem_base = 12; |
3241 |
|
|
mem_base += sgi_ram_offset / 1048576; |
3242 |
|
|
|
3243 |
|
|
while (mem_base < machine->physical_ram_in_mb + sgi_ram_offset/1048576) { |
3244 |
|
|
mem_count = machine->physical_ram_in_mb + sgi_ram_offset/1048576 |
3245 |
|
|
- mem_base; |
3246 |
|
|
|
3247 |
|
|
/* Skip the 256-512MB region (for devices) */ |
3248 |
|
|
if (mem_base < 256 && mem_base + mem_count > 256) { |
3249 |
|
|
mem_count = 256-mem_base; |
3250 |
|
|
} |
3251 |
|
|
|
3252 |
|
|
/* At most 512MB per descriptor (at least the first 512MB |
3253 |
|
|
must be separated this way, according to the ARC spec) */ |
3254 |
|
|
if (mem_count > 512) |
3255 |
|
|
mem_count = 512; |
3256 |
|
|
|
3257 |
|
|
arcbios_add_memory_descriptor(cpu, mem_base * 1048576, |
3258 |
|
|
mem_count * 1048576, ARCBIOS_MEM_FreeMemory); |
3259 |
|
|
|
3260 |
|
|
mem_base += mem_count; |
3261 |
|
|
|
3262 |
|
|
/* Skip the devices: */ |
3263 |
|
|
if (mem_base == 256) |
3264 |
|
|
mem_base = 512; |
3265 |
|
|
} |
3266 |
|
|
|
3267 |
|
|
|
3268 |
|
|
/* |
3269 |
|
|
* Components: (this is an example of what a system could look like) |
3270 |
|
|
* |
3271 |
|
|
* [System] |
3272 |
|
|
* [CPU] (one for each cpu) |
3273 |
|
|
* [FPU] (one for each cpu) |
3274 |
|
|
* [CPU Caches] |
3275 |
|
|
* [Memory] |
3276 |
|
|
* [Ethernet] |
3277 |
|
|
* [Serial] |
3278 |
|
|
* [SCSI] |
3279 |
|
|
* [Disk] |
3280 |
|
|
* |
3281 |
|
|
* Here's a good list of what hardware is in different IP-models: |
3282 |
|
|
* http://www.linux-mips.org/archives/linux-mips/2001-03/msg00101.html |
3283 |
|
|
*/ |
3284 |
|
|
|
3285 |
|
|
if (machine->machine_name == NULL) |
3286 |
|
|
fatal("ERROR: machine_name == NULL\n"); |
3287 |
|
|
if (short_machine_name == NULL) |
3288 |
|
|
fatal("ERROR: short_machine_name == NULL\n"); |
3289 |
|
|
|
3290 |
|
|
switch (machine->machine_type) { |
3291 |
|
|
case MACHINE_SGI: |
3292 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3293 |
|
|
0, 1, 2, 0, 0xffffffff, short_machine_name, 0 /* ROOT */ , NULL, 0); |
3294 |
|
|
break; |
3295 |
|
|
default: |
3296 |
|
|
/* ARC: */ |
3297 |
|
|
switch (machine->machine_subtype) { |
3298 |
|
|
case MACHINE_ARC_NEC_RD94: |
3299 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3300 |
|
|
0, 1, 2, 0, 0xffffffff, "NEC-RD94", 0 /* ROOT */ , NULL, 0); |
3301 |
|
|
break; |
3302 |
|
|
case MACHINE_ARC_NEC_R94: |
3303 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3304 |
|
|
0, 1, 2, 0, 0xffffffff, "NEC-R94", 0 /* ROOT */ , NULL, 0); |
3305 |
|
|
break; |
3306 |
|
|
case MACHINE_ARC_NEC_R96: |
3307 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3308 |
|
|
0, 1, 2, 0, 0xffffffff, "NEC-R96", 0 /* ROOT */ , NULL, 0); |
3309 |
|
|
break; |
3310 |
|
|
case MACHINE_ARC_NEC_R98: |
3311 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3312 |
|
|
0, 1, 2, 0, 0xffffffff, "NEC-R98", 0 /* ROOT */ , NULL, 0); |
3313 |
|
|
break; |
3314 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
3315 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3316 |
|
|
0, 1, 2, 0, 0xffffffff, "PICA-61", 0 /* ROOT */ , NULL, 0); |
3317 |
|
|
break; |
3318 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
3319 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3320 |
|
|
0, 1, 2, 0, 0xffffffff, "Microsoft-Jazz", 0 /* ROOT */ , NULL, 0); |
3321 |
|
|
break; |
3322 |
|
|
case MACHINE_ARC_JAZZ_M700: |
3323 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3324 |
|
|
0, 1, 2, 0, 0xffffffff, "Microsoft-Jazz", 0 /* ROOT */ , NULL, 0); |
3325 |
|
|
break; |
3326 |
|
|
case MACHINE_ARC_DESKTECH_TYNE: |
3327 |
|
|
system = arcbios_addchild_manual(cpu, COMPONENT_CLASS_SystemClass, COMPONENT_TYPE_ARC, |
3328 |
|
|
0, 1, 2, 0, 0xffffffff, "DESKTECH-TYNE", 0 /* ROOT */ , NULL, 0); |
3329 |
|
|
break; |
3330 |
|
|
default: |
3331 |
|
|
fatal("Unimplemented ARC machine type %i\n", |
3332 |
|
|
machine->machine_subtype); |
3333 |
|
|
exit(1); |
3334 |
|
|
} |
3335 |
|
|
} |
3336 |
|
|
|
3337 |
|
|
|
3338 |
|
|
/* |
3339 |
|
|
* Common stuff for both SGI and ARC: |
3340 |
|
|
*/ |
3341 |
|
|
debug("ARC system @ 0x%llx\n", (long long)system); |
3342 |
|
|
|
3343 |
|
|
for (i=0; i<machine->ncpus; i++) { |
3344 |
|
|
uint64_t cpuaddr, fpu=0, picache, pdcache, sdcache=0; |
3345 |
|
|
int cache_size, cache_line_size; |
3346 |
|
|
unsigned int jj; |
3347 |
|
|
char arc_cpu_name[100]; |
3348 |
|
|
char arc_fpc_name[105]; |
3349 |
|
|
|
3350 |
|
|
snprintf(arc_cpu_name, sizeof(arc_cpu_name), |
3351 |
|
|
"MIPS-%s", machine->cpu_name); |
3352 |
|
|
|
3353 |
|
|
if (machine->machine_type == MACHINE_ARC && |
3354 |
|
|
machine->machine_subtype == MACHINE_ARC_NEC_R96) |
3355 |
|
|
snprintf(arc_cpu_name, sizeof(arc_cpu_name), |
3356 |
|
|
"MIPS-%s - Pr 4/5.0, Fp 5/0", |
3357 |
|
|
machine->cpu_name); |
3358 |
|
|
|
3359 |
|
|
arc_cpu_name[sizeof(arc_cpu_name)-1] = 0; |
3360 |
|
|
for (jj=0; jj<strlen(arc_cpu_name); jj++) |
3361 |
|
|
if (arc_cpu_name[jj] >= 'a' && arc_cpu_name[jj] <= 'z') |
3362 |
|
|
arc_cpu_name[jj] += ('A' - 'a'); |
3363 |
|
|
|
3364 |
|
|
strcpy(arc_fpc_name, arc_cpu_name); |
3365 |
|
|
strcat(arc_fpc_name, "FPC"); |
3366 |
|
|
|
3367 |
|
|
cpuaddr = arcbios_addchild_manual(cpu, COMPONENT_CLASS_ProcessorClass, COMPONENT_TYPE_CPU, |
3368 |
|
|
0, 1, 2, i, 0xffffffff, arc_cpu_name, system, NULL, 0); |
3369 |
|
|
|
3370 |
|
|
/* |
3371 |
|
|
* TODO: This was in the ARC specs, but it isn't |
3372 |
|
|
* really used by ARC implementations? |
3373 |
|
|
* At least SGI-IP32 uses it. |
3374 |
|
|
*/ |
3375 |
|
|
if (machine->machine_type == MACHINE_SGI) |
3376 |
|
|
fpu = arcbios_addchild_manual(cpu, COMPONENT_CLASS_ProcessorClass, COMPONENT_TYPE_FPU, |
3377 |
|
|
0, 1, 2, 0, 0xffffffff, arc_fpc_name, cpuaddr, NULL, 0); |
3378 |
|
|
|
3379 |
|
|
cache_size = DEFAULT_PCACHE_SIZE - 12; |
3380 |
|
|
if (machine->cache_picache) |
3381 |
|
|
cache_size = machine->cache_picache - 12; |
3382 |
|
|
if (cache_size < 0) |
3383 |
|
|
cache_size = 0; |
3384 |
|
|
|
3385 |
|
|
cache_line_size = DEFAULT_PCACHE_LINESIZE; |
3386 |
|
|
if (machine->cache_picache_linesize) |
3387 |
|
|
cache_line_size = machine->cache_picache_linesize; |
3388 |
|
|
if (cache_line_size < 0) |
3389 |
|
|
cache_line_size = 0; |
3390 |
|
|
|
3391 |
|
|
picache = arcbios_addchild_manual(cpu, COMPONENT_CLASS_CacheClass, |
3392 |
|
|
COMPONENT_TYPE_PrimaryICache, 0, 1, 2, |
3393 |
|
|
/* |
3394 |
|
|
* Key bits: 0xXXYYZZZZ |
3395 |
|
|
* XX is refill-size. |
3396 |
|
|
* Cache line size is 1 << YY, |
3397 |
|
|
* Cache size is 4KB << ZZZZ. |
3398 |
|
|
*/ |
3399 |
|
|
0x01000000 + (cache_line_size << 16) + cache_size, |
3400 |
|
|
/* 32 bytes per line, default = 32 KB total */ |
3401 |
|
|
0xffffffff, NULL, cpuaddr, NULL, 0); |
3402 |
|
|
|
3403 |
|
|
cache_size = DEFAULT_PCACHE_SIZE - 12; |
3404 |
|
|
if (machine->cache_pdcache) |
3405 |
|
|
cache_size = machine->cache_pdcache - 12; |
3406 |
|
|
if (cache_size < 0) |
3407 |
|
|
cache_size = 0; |
3408 |
|
|
|
3409 |
|
|
cache_line_size = DEFAULT_PCACHE_LINESIZE; |
3410 |
|
|
if (machine->cache_pdcache_linesize) |
3411 |
|
|
cache_line_size = machine->cache_pdcache_linesize; |
3412 |
|
|
if (cache_line_size < 0) |
3413 |
|
|
cache_line_size = 0; |
3414 |
|
|
|
3415 |
|
|
pdcache = arcbios_addchild_manual(cpu, COMPONENT_CLASS_CacheClass, |
3416 |
|
|
COMPONENT_TYPE_PrimaryDCache, 0, 1, 2, |
3417 |
|
|
/* |
3418 |
|
|
* Key bits: 0xYYZZZZ |
3419 |
|
|
* Cache line size is 1 << YY, |
3420 |
|
|
* Cache size is 4KB << ZZZZ. |
3421 |
|
|
*/ |
3422 |
|
|
0x01000000 + (cache_line_size << 16) + cache_size, |
3423 |
|
|
/* 32 bytes per line, default = 32 KB total */ |
3424 |
|
|
0xffffffff, NULL, cpuaddr, NULL, 0); |
3425 |
|
|
|
3426 |
|
|
if (machine->cache_secondary >= 12) { |
3427 |
|
|
cache_size = machine->cache_secondary - 12; |
3428 |
|
|
|
3429 |
|
|
cache_line_size = 6; /* 64 bytes default */ |
3430 |
|
|
if (machine->cache_secondary_linesize) |
3431 |
|
|
cache_line_size = machine->cache_secondary_linesize; |
3432 |
|
|
if (cache_line_size < 0) |
3433 |
|
|
cache_line_size = 0; |
3434 |
|
|
|
3435 |
|
|
sdcache = arcbios_addchild_manual(cpu, COMPONENT_CLASS_CacheClass, |
3436 |
|
|
COMPONENT_TYPE_SecondaryDCache, 0, 1, 2, |
3437 |
|
|
/* |
3438 |
|
|
* Key bits: 0xYYZZZZ |
3439 |
|
|
* Cache line size is 1 << YY, |
3440 |
|
|
* Cache size is 4KB << ZZZZ. |
3441 |
|
|
*/ |
3442 |
|
|
0x01000000 + (cache_line_size << 16) + cache_size, |
3443 |
|
|
/* 64 bytes per line, default = 1 MB total */ |
3444 |
|
|
0xffffffff, NULL, cpuaddr, NULL, 0); |
3445 |
|
|
} |
3446 |
|
|
|
3447 |
|
|
debug("ARC cpu%i @ 0x%llx", i, (long long)cpuaddr); |
3448 |
|
|
|
3449 |
|
|
if (fpu != 0) |
3450 |
|
|
debug(" (fpu @ 0x%llx)\n", (long long)fpu); |
3451 |
|
|
else |
3452 |
|
|
debug("\n"); |
3453 |
|
|
|
3454 |
|
|
debug(" picache @ 0x%llx, pdcache @ 0x%llx\n", |
3455 |
|
|
(long long)picache, (long long)pdcache); |
3456 |
|
|
|
3457 |
|
|
if (machine->cache_secondary >= 12) |
3458 |
|
|
debug(" sdcache @ 0x%llx\n", |
3459 |
|
|
(long long)sdcache); |
3460 |
|
|
|
3461 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
3462 |
|
|
/* TODO: Memory amount (and base address?)! */ |
3463 |
|
|
uint64_t memory = arcbios_addchild_manual(cpu, COMPONENT_CLASS_MemoryClass, |
3464 |
|
|
COMPONENT_TYPE_MemoryUnit, |
3465 |
|
|
0, 1, 2, 0, 0xffffffff, "memory", cpuaddr, NULL, 0); |
3466 |
|
|
debug(" memory @ 0x%llx\n", (long long)memory); |
3467 |
|
|
} |
3468 |
|
|
} |
3469 |
|
|
|
3470 |
|
|
|
3471 |
|
|
/* |
3472 |
|
|
* Other components, and default TLB entries: |
3473 |
|
|
* |
3474 |
|
|
* TODO: How to build the component tree intermixed with |
3475 |
|
|
* the rest of device initialization? |
3476 |
|
|
*/ |
3477 |
|
|
|
3478 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
3479 |
|
|
/* TODO: On which models is this required? */ |
3480 |
|
|
mips_coproc_tlb_set_entry(cpu, 0, 1048576*16, |
3481 |
|
|
0xc000000000000000ULL, |
3482 |
|
|
0x0, 1048576*16, |
3483 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3484 |
|
|
} |
3485 |
|
|
|
3486 |
|
|
if (machine->machine_type == MACHINE_ARC && |
3487 |
|
|
( machine->machine_subtype == MACHINE_ARC_NEC_RD94 || |
3488 |
|
|
machine->machine_subtype == MACHINE_ARC_NEC_R94 || |
3489 |
|
|
machine->machine_subtype == MACHINE_ARC_NEC_R96 )) { |
3490 |
|
|
uint64_t jazzbus, eisa, other; |
3491 |
|
|
|
3492 |
|
|
jazzbus = arcbios_addchild_manual(cpu, |
3493 |
|
|
COMPONENT_CLASS_AdapterClass, |
3494 |
|
|
COMPONENT_TYPE_MultiFunctionAdapter, |
3495 |
|
|
0, 1, 2, 0, 0xffffffff, "Jazz-Internal Bus", |
3496 |
|
|
system, NULL, 0); |
3497 |
|
|
|
3498 |
|
|
switch (machine->machine_subtype) { |
3499 |
|
|
case MACHINE_ARC_NEC_RD94: |
3500 |
|
|
case MACHINE_ARC_NEC_R94: |
3501 |
|
|
if (machine->use_x11) |
3502 |
|
|
arcbios_addchild_manual(cpu, |
3503 |
|
|
COMPONENT_CLASS_ControllerClass, |
3504 |
|
|
COMPONENT_TYPE_DisplayController, |
3505 |
|
|
0, 1, 2, 0, 0x0, "10110004", |
3506 |
|
|
system, NULL, 0); |
3507 |
|
|
break; |
3508 |
|
|
case MACHINE_ARC_NEC_R96: |
3509 |
|
|
if (machine->use_x11) { |
3510 |
|
|
uint64_t x; |
3511 |
|
|
x = arcbios_addchild_manual(cpu, |
3512 |
|
|
COMPONENT_CLASS_ControllerClass, |
3513 |
|
|
COMPONENT_TYPE_DisplayController, |
3514 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3515 |
|
|
COMPONENT_FLAG_Output, |
3516 |
|
|
1, 2, 0, 0x0, "necvdfrb", |
3517 |
|
|
jazzbus, NULL, 0); |
3518 |
|
|
arcbios_addchild_manual(cpu, |
3519 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3520 |
|
|
COMPONENT_TYPE_MonitorPeripheral, |
3521 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3522 |
|
|
COMPONENT_FLAG_Output, |
3523 |
|
|
1, 2, 0, 0xffffffff, "640x480", |
3524 |
|
|
x, NULL, 0); |
3525 |
|
|
} |
3526 |
|
|
|
3527 |
|
|
/* TODO: R[D]94 too? */ |
3528 |
|
|
eisa = arcbios_addchild_manual(cpu, |
3529 |
|
|
COMPONENT_CLASS_AdapterClass, |
3530 |
|
|
COMPONENT_TYPE_EISAAdapter, |
3531 |
|
|
0, 1, 2, 0, 0xffffffff, "EISA", |
3532 |
|
|
system, NULL, 0); |
3533 |
|
|
|
3534 |
|
|
other = arcbios_addchild_manual(cpu, |
3535 |
|
|
COMPONENT_CLASS_ControllerClass, |
3536 |
|
|
COMPONENT_TYPE_OtherController, |
3537 |
|
|
0, 1, 2, 0, 0xffffffff, "NEC1C01", |
3538 |
|
|
eisa, NULL, 0); |
3539 |
|
|
|
3540 |
|
|
break; |
3541 |
|
|
} |
3542 |
|
|
} |
3543 |
|
|
|
3544 |
|
|
if (machine->machine_type == MACHINE_ARC && |
3545 |
|
|
(machine->machine_subtype == MACHINE_ARC_JAZZ_PICA |
3546 |
|
|
|| machine->machine_subtype == MACHINE_ARC_JAZZ_MAGNUM)) { |
3547 |
|
|
uint64_t jazzbus, ali_s3, vxl; |
3548 |
|
|
uint64_t diskcontroller, floppy, kbdctl, kbd; |
3549 |
|
|
uint64_t ptrctl, ptr, paral, audio; |
3550 |
|
|
uint64_t eisa, scsi; |
3551 |
|
|
/* uint64_t serial1, serial2; */ |
3552 |
|
|
|
3553 |
|
|
jazzbus = arcbios_addchild_manual(cpu, |
3554 |
|
|
COMPONENT_CLASS_AdapterClass, |
3555 |
|
|
COMPONENT_TYPE_MultiFunctionAdapter, |
3556 |
|
|
0, 1, 2, 0, 0xffffffff, "Jazz-Internal Bus", |
3557 |
|
|
system, NULL, 0); |
3558 |
|
|
|
3559 |
|
|
/* |
3560 |
|
|
* DisplayController, needed by NetBSD: |
3561 |
|
|
* TODO: NetBSD still doesn't use it :( |
3562 |
|
|
*/ |
3563 |
|
|
switch (machine->machine_subtype) { |
3564 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
3565 |
|
|
/* Default TLB entries on PICA-61: */ |
3566 |
|
|
|
3567 |
|
|
/* 7: 256K, asid: 0x0, v: 0xe1000000, |
3568 |
|
|
p0: 0xfff00000(2.VG), p1: 0x0(0..G) */ |
3569 |
|
|
mips_coproc_tlb_set_entry(cpu, 7, 262144, |
3570 |
|
|
0xffffffffe1000000ULL, |
3571 |
|
|
0x0fff00000ULL, 0, |
3572 |
|
|
1, 0, 0, 0, 1, 0, 2, 0); |
3573 |
|
|
|
3574 |
|
|
/* 8: 64K, asid: 0x0, v: 0xe0000000, |
3575 |
|
|
p0: 0x80000000(2DVG), p1: 0x0(0..G) */ |
3576 |
|
|
mips_coproc_tlb_set_entry(cpu, 8, 65536, |
3577 |
|
|
0xffffffffe0000000ULL, |
3578 |
|
|
0x080000000ULL, 0, |
3579 |
|
|
1, 0, 1, 0, 1, 0, 2, 0); |
3580 |
|
|
|
3581 |
|
|
/* 9: 64K, asid: 0x0, v: 0xe00e0000, |
3582 |
|
|
p0: 0x800e0000(2DVG), p1: 0x800f0000(2DVG) */ |
3583 |
|
|
mips_coproc_tlb_set_entry(cpu, 9, 65536, |
3584 |
|
|
(uint64_t)0xffffffffe00e0000ULL, |
3585 |
|
|
(uint64_t)0x0800e0000ULL, |
3586 |
|
|
(uint64_t)0x0800f0000ULL, |
3587 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3588 |
|
|
|
3589 |
|
|
/* 10: 4K, asid: 0x0, v: 0xe0100000, |
3590 |
|
|
p0: 0xf0000000(2DVG), p1: 0x0(0..G) */ |
3591 |
|
|
mips_coproc_tlb_set_entry(cpu, 10, 4096, |
3592 |
|
|
(uint64_t)0xffffffffe0100000ULL, |
3593 |
|
|
(uint64_t)0x0f0000000ULL, 0, |
3594 |
|
|
1, 0, 1, 0, 1, 0, 2, 0); |
3595 |
|
|
|
3596 |
|
|
/* 11: 1M, asid: 0x0, v: 0xe0200000, |
3597 |
|
|
p0: 0x60000000(2DVG), p1: 0x60100000(2DVG) */ |
3598 |
|
|
mips_coproc_tlb_set_entry(cpu, 11, 1048576, |
3599 |
|
|
0xffffffffe0200000ULL, |
3600 |
|
|
0x060000000ULL, 0x060100000ULL, |
3601 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3602 |
|
|
|
3603 |
|
|
/* 12: 1M, asid: 0x0, v: 0xe0400000, |
3604 |
|
|
p0: 0x60200000(2DVG), p1: 0x60300000(2DVG) */ |
3605 |
|
|
mips_coproc_tlb_set_entry(cpu, 12, 1048576, |
3606 |
|
|
0xffffffffe0400000ULL, |
3607 |
|
|
0x060200000ULL, 0x060300000ULL, |
3608 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3609 |
|
|
|
3610 |
|
|
/* 13: 4M, asid: 0x0, v: 0xe0800000, |
3611 |
|
|
p0: 0x40000000(2DVG), p1: 0x40400000(2DVG) */ |
3612 |
|
|
mips_coproc_tlb_set_entry(cpu, 13, 1048576*4, |
3613 |
|
|
0xffffffffe0800000ULL, |
3614 |
|
|
0x040000000ULL, 0x040400000ULL, |
3615 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3616 |
|
|
|
3617 |
|
|
/* 14: 16M, asid: 0x0, v: 0xe2000000, |
3618 |
|
|
p0: 0x90000000(2DVG), p1: 0x91000000(2DVG) */ |
3619 |
|
|
mips_coproc_tlb_set_entry(cpu, 14, 1048576*16, |
3620 |
|
|
0xffffffffe2000000ULL, |
3621 |
|
|
0x090000000ULL, 0x091000000ULL, |
3622 |
|
|
1, 1, 1, 1, 1, 0, 2, 2); |
3623 |
|
|
|
3624 |
|
|
if (machine->use_x11) { |
3625 |
|
|
ali_s3 = arcbios_addchild_manual(cpu, |
3626 |
|
|
COMPONENT_CLASS_ControllerClass, |
3627 |
|
|
COMPONENT_TYPE_DisplayController, |
3628 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3629 |
|
|
COMPONENT_FLAG_Output, |
3630 |
|
|
1, 2, 0, 0xffffffff, "ALI_S3", |
3631 |
|
|
jazzbus, NULL, 0); |
3632 |
|
|
|
3633 |
|
|
arcbios_addchild_manual(cpu, |
3634 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3635 |
|
|
COMPONENT_TYPE_MonitorPeripheral, |
3636 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3637 |
|
|
COMPONENT_FLAG_Output, |
3638 |
|
|
1, 2, 0, 0xffffffff, "1024x768", |
3639 |
|
|
ali_s3, NULL, 0); |
3640 |
|
|
} |
3641 |
|
|
break; |
3642 |
|
|
case MACHINE_ARC_JAZZ_MAGNUM: |
3643 |
|
|
if (machine->use_x11) { |
3644 |
|
|
vxl = arcbios_addchild_manual(cpu, |
3645 |
|
|
COMPONENT_CLASS_ControllerClass, |
3646 |
|
|
COMPONENT_TYPE_DisplayController, |
3647 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3648 |
|
|
COMPONENT_FLAG_Output, |
3649 |
|
|
1, 2, 0, 0xffffffff, "VXL", |
3650 |
|
|
jazzbus, NULL, 0); |
3651 |
|
|
|
3652 |
|
|
arcbios_addchild_manual(cpu, |
3653 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3654 |
|
|
COMPONENT_TYPE_MonitorPeripheral, |
3655 |
|
|
COMPONENT_FLAG_ConsoleOut | |
3656 |
|
|
COMPONENT_FLAG_Output, |
3657 |
|
|
1, 2, 0, 0xffffffff, "1024x768", |
3658 |
|
|
vxl, NULL, 0); |
3659 |
|
|
} |
3660 |
|
|
break; |
3661 |
|
|
} |
3662 |
|
|
|
3663 |
|
|
diskcontroller = arcbios_addchild_manual(cpu, |
3664 |
|
|
COMPONENT_CLASS_ControllerClass, |
3665 |
|
|
COMPONENT_TYPE_DiskController, |
3666 |
|
|
COMPONENT_FLAG_Input | |
3667 |
|
|
COMPONENT_FLAG_Output, |
3668 |
|
|
1, 2, 0, 0xffffffff, "I82077", |
3669 |
|
|
jazzbus, NULL, 0); |
3670 |
|
|
|
3671 |
|
|
floppy = arcbios_addchild_manual(cpu, |
3672 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3673 |
|
|
COMPONENT_TYPE_FloppyDiskPeripheral, |
3674 |
|
|
COMPONENT_FLAG_Removable | |
3675 |
|
|
COMPONENT_FLAG_Input | |
3676 |
|
|
COMPONENT_FLAG_Output, |
3677 |
|
|
1, 2, 0, 0xffffffff, NULL, |
3678 |
|
|
diskcontroller, NULL, 0); |
3679 |
|
|
|
3680 |
|
|
kbdctl = arcbios_addchild_manual(cpu, |
3681 |
|
|
COMPONENT_CLASS_ControllerClass, |
3682 |
|
|
COMPONENT_TYPE_KeyboardController, |
3683 |
|
|
COMPONENT_FLAG_ConsoleIn | |
3684 |
|
|
COMPONENT_FLAG_Input, |
3685 |
|
|
1, 2, 0, 0xffffffff, "I8742", |
3686 |
|
|
jazzbus, NULL, 0); |
3687 |
|
|
|
3688 |
|
|
kbd = arcbios_addchild_manual(cpu, |
3689 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3690 |
|
|
COMPONENT_TYPE_KeyboardPeripheral, |
3691 |
|
|
COMPONENT_FLAG_ConsoleIn | |
3692 |
|
|
COMPONENT_FLAG_Input, |
3693 |
|
|
1, 2, 0, 0xffffffff, "PCAT_ENHANCED", |
3694 |
|
|
kbdctl, NULL, 0); |
3695 |
|
|
|
3696 |
|
|
ptrctl = arcbios_addchild_manual(cpu, |
3697 |
|
|
COMPONENT_CLASS_ControllerClass, |
3698 |
|
|
COMPONENT_TYPE_PointerController, |
3699 |
|
|
COMPONENT_FLAG_Input, |
3700 |
|
|
1, 2, 0, 0xffffffff, "I8742", |
3701 |
|
|
jazzbus, NULL, 0); |
3702 |
|
|
|
3703 |
|
|
ptr = arcbios_addchild_manual(cpu, |
3704 |
|
|
COMPONENT_CLASS_PeripheralClass, |
3705 |
|
|
COMPONENT_TYPE_PointerPeripheral, |
3706 |
|
|
COMPONENT_FLAG_Input, |
3707 |
|
|
1, 2, 0, 0xffffffff, "PS2 MOUSE", |
3708 |
|
|
ptrctl, NULL, 0); |
3709 |
|
|
|
3710 |
|
|
/* These cause Windows NT to bug out. */ |
3711 |
|
|
#if 0 |
3712 |
|
|
serial1 = arcbios_addchild_manual(cpu, |
3713 |
|
|
COMPONENT_CLASS_ControllerClass, |
3714 |
|
|
COMPONENT_TYPE_SerialController, |
3715 |
|
|
COMPONENT_FLAG_Input | |
3716 |
|
|
COMPONENT_FLAG_Output, |
3717 |
|
|
1, 2, 0, 0xffffffff, "COM1", |
3718 |
|
|
jazzbus, NULL, 0); |
3719 |
|
|
|
3720 |
|
|
serial2 = arcbios_addchild_manual(cpu, |
3721 |
|
|
COMPONENT_CLASS_ControllerClass, |
3722 |
|
|
COMPONENT_TYPE_SerialController, |
3723 |
|
|
COMPONENT_FLAG_Input | |
3724 |
|
|
COMPONENT_FLAG_Output, |
3725 |
|
|
1, 2, 0, 0xffffffff, "COM1", |
3726 |
|
|
jazzbus, NULL, 0); |
3727 |
|
|
#endif |
3728 |
|
|
|
3729 |
|
|
paral = arcbios_addchild_manual(cpu, |
3730 |
|
|
COMPONENT_CLASS_ControllerClass, |
3731 |
|
|
COMPONENT_TYPE_ParallelController, |
3732 |
|
|
COMPONENT_FLAG_Input | |
3733 |
|
|
COMPONENT_FLAG_Output, |
3734 |
|
|
1, 2, 0, 0xffffffff, "LPT1", |
3735 |
|
|
jazzbus, NULL, 0); |
3736 |
|
|
|
3737 |
|
|
audio = arcbios_addchild_manual(cpu, |
3738 |
|
|
COMPONENT_CLASS_ControllerClass, |
3739 |
|
|
COMPONENT_TYPE_AudioController, |
3740 |
|
|
COMPONENT_FLAG_Input | |
3741 |
|
|
COMPONENT_FLAG_Output, |
3742 |
|
|
1, 2, 0, 0xffffffff, "MAGNUM", |
3743 |
|
|
jazzbus, NULL, 0); |
3744 |
|
|
|
3745 |
|
|
eisa = arcbios_addchild_manual(cpu, |
3746 |
|
|
COMPONENT_CLASS_AdapterClass, |
3747 |
|
|
COMPONENT_TYPE_EISAAdapter, |
3748 |
|
|
0, 1, 2, 0, 0xffffffff, "EISA", |
3749 |
|
|
system, NULL, 0); |
3750 |
|
|
|
3751 |
|
|
{ |
3752 |
|
|
unsigned char config[78]; |
3753 |
|
|
memset(config, 0, sizeof(config)); |
3754 |
|
|
|
3755 |
|
|
/* config data version: 1, revision: 2, count: 4 */ |
3756 |
|
|
config[0] = 0x01; config[1] = 0x00; |
3757 |
|
|
config[2] = 0x02; config[3] = 0x00; |
3758 |
|
|
config[4] = 0x04; config[5] = 0x00; config[6] = 0x00; config[7] = 0x00; |
3759 |
|
|
|
3760 |
|
|
/* |
3761 |
|
|
type: Interrupt |
3762 |
|
|
share_disposition: DeviceExclusive, flags: LevelSensitive |
3763 |
|
|
level: 4, vector: 22, reserved1: 0 |
3764 |
|
|
*/ |
3765 |
|
|
config[8] = arc_CmResourceTypeInterrupt; |
3766 |
|
|
config[9] = arc_CmResourceShareDeviceExclusive; |
3767 |
|
|
config[10] = arc_CmResourceInterruptLevelSensitive; |
3768 |
|
|
config[12] = 4; |
3769 |
|
|
config[16] = 22; |
3770 |
|
|
config[20] = 0; |
3771 |
|
|
|
3772 |
|
|
/* |
3773 |
|
|
type: Memory |
3774 |
|
|
share_disposition: DeviceExclusive, flags: ReadWrite |
3775 |
|
|
start: 0x 0 80002000, length: 0x1000 |
3776 |
|
|
*/ |
3777 |
|
|
config[24] = arc_CmResourceTypeMemory; |
3778 |
|
|
config[25] = arc_CmResourceShareDeviceExclusive; |
3779 |
|
|
config[26] = arc_CmResourceMemoryReadWrite; |
3780 |
|
|
config[28] = 0x00; config[29] = 0x20; config[30] = 0x00; config[31] = 0x80; |
3781 |
|
|
config[32] = 0x00; config[33] = 0x00; config[34] = 0x00; config[35] = 0x00; |
3782 |
|
|
config[36] = 0x00; config[37] = 0x10; config[38] = 0x00; config[39] = 0x00; |
3783 |
|
|
|
3784 |
|
|
/* |
3785 |
|
|
type: DMA |
3786 |
|
|
share_disposition: DeviceExclusive, flags: 0x0 |
3787 |
|
|
channel: 0, port: 0, reserved1: 0 |
3788 |
|
|
*/ |
3789 |
|
|
config[40] = arc_CmResourceTypeDMA; |
3790 |
|
|
config[41] = arc_CmResourceShareDeviceExclusive; |
3791 |
|
|
/* 42..43 = flags, 44,45,46,47 = channel, 48,49,50,51 = port, 52,53,54,55 = reserved */ |
3792 |
|
|
|
3793 |
|
|
/* type: DeviceSpecific |
3794 |
|
|
share_disposition: DeviceExclusive, flags: 0x0 |
3795 |
|
|
datasize: 6, reserved1: 0, reserved2: 0 |
3796 |
|
|
data: [0x1:0x0:0x2:0x0:0x7:0x30] |
3797 |
|
|
*/ |
3798 |
|
|
config[56] = arc_CmResourceTypeDeviceSpecific; |
3799 |
|
|
config[57] = arc_CmResourceShareDeviceExclusive; |
3800 |
|
|
/* 58,59 = flags 60,61,62,63 = data size, 64..71 = reserved */ |
3801 |
|
|
config[60] = 6; |
3802 |
|
|
/* 72..77 = the data */ |
3803 |
|
|
config[72] = 0x01; |
3804 |
|
|
config[73] = 0x00; |
3805 |
|
|
config[74] = 0x02; |
3806 |
|
|
config[75] = 0x00; |
3807 |
|
|
config[76] = 0x07; |
3808 |
|
|
config[77] = 0x30; |
3809 |
|
|
scsi = arcbios_addchild_manual(cpu, |
3810 |
|
|
COMPONENT_CLASS_AdapterClass, |
3811 |
|
|
COMPONENT_TYPE_SCSIAdapter, |
3812 |
|
|
0, 1, 2, 0, 0xffffffff, "ESP216", |
3813 |
|
|
system, config, sizeof(config)); |
3814 |
|
|
|
3815 |
|
|
arcbios_register_scsicontroller(scsi); |
3816 |
|
|
} |
3817 |
|
|
|
3818 |
|
|
} |
3819 |
|
|
|
3820 |
|
|
|
3821 |
|
|
add_symbol_name(&machine->symbol_context, |
3822 |
|
|
ARC_FIRMWARE_ENTRIES, 0x10000, "[ARCBIOS entry]", 0); |
3823 |
|
|
|
3824 |
|
|
switch (arc_wordlen) { |
3825 |
|
|
case sizeof(uint64_t): |
3826 |
|
|
for (i=0; i<100; i++) |
3827 |
|
|
store_64bit_word(cpu, ARC_FIRMWARE_VECTORS + i*8, |
3828 |
|
|
ARC_FIRMWARE_ENTRIES + i*8); |
3829 |
|
|
for (i=0; i<100; i++) |
3830 |
|
|
store_64bit_word(cpu, ARC_PRIVATE_VECTORS + i*8, |
3831 |
|
|
ARC_PRIVATE_ENTRIES + i*8); |
3832 |
|
|
break; |
3833 |
|
|
default: |
3834 |
|
|
for (i=0; i<100; i++) |
3835 |
|
|
store_32bit_word(cpu, ARC_FIRMWARE_VECTORS + i*4, |
3836 |
|
|
ARC_FIRMWARE_ENTRIES + i*4); |
3837 |
|
|
for (i=0; i<100; i++) |
3838 |
|
|
store_32bit_word(cpu, ARC_PRIVATE_VECTORS + i*4, |
3839 |
|
|
ARC_PRIVATE_ENTRIES + i*4); |
3840 |
|
|
} |
3841 |
|
|
|
3842 |
|
|
switch (arc_wordlen) { |
3843 |
|
|
case sizeof(uint64_t): |
3844 |
|
|
/* |
3845 |
|
|
* ARCS64 SPD (TODO: This is just a guess) |
3846 |
|
|
*/ |
3847 |
|
|
memset(&arcbios_spb_64, 0, sizeof(arcbios_spb_64)); |
3848 |
|
|
store_64bit_word_in_host(cpu, (unsigned char *)&arcbios_spb_64.SPBSignature, ARCBIOS_SPB_SIGNATURE); |
3849 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&arcbios_spb_64.Version, 64); |
3850 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&arcbios_spb_64.Revision, 0); |
3851 |
|
|
store_64bit_word_in_host(cpu, (unsigned char *)&arcbios_spb_64.FirmwareVector, ARC_FIRMWARE_VECTORS); |
3852 |
|
|
store_buf(cpu, SGI_SPB_ADDR, (char *)&arcbios_spb_64, sizeof(arcbios_spb_64)); |
3853 |
|
|
break; |
3854 |
|
|
default: /* 32-bit */ |
3855 |
|
|
/* |
3856 |
|
|
* ARCBIOS SPB: (For ARC and 32-bit SGI modes) |
3857 |
|
|
*/ |
3858 |
|
|
memset(&arcbios_spb, 0, sizeof(arcbios_spb)); |
3859 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.SPBSignature, ARCBIOS_SPB_SIGNATURE); |
3860 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.SPBLength, sizeof(arcbios_spb)); |
3861 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.Version, 1); |
3862 |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.Revision, machine->machine_type == MACHINE_SGI? 10 : 2); |
3863 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.FirmwareVector, ARC_FIRMWARE_VECTORS); |
3864 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.FirmwareVectorLength, 100 * 4); /* ? */ |
3865 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.PrivateVector, ARC_PRIVATE_VECTORS); |
3866 |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&arcbios_spb.PrivateVectorLength, 100 * 4); /* ? */ |
3867 |
|
|
store_buf(cpu, SGI_SPB_ADDR, (char *)&arcbios_spb, sizeof(arcbios_spb)); |
3868 |
|
|
} |
3869 |
|
|
|
3870 |
|
|
/* |
3871 |
|
|
* Boot string in ARC format: |
3872 |
|
|
* |
3873 |
|
|
* TODO: How about floppies? multi()disk()fdisk() |
3874 |
|
|
* Is tftp() good for netbooting? |
3875 |
|
|
*/ |
3876 |
|
|
init_bootpath = malloc(500); |
3877 |
|
|
if (init_bootpath == NULL) { |
3878 |
|
|
fprintf(stderr, "out of mem, bootpath\n"); |
3879 |
|
|
exit(1); |
3880 |
|
|
} |
3881 |
|
|
init_bootpath[0] = '\0'; |
3882 |
|
|
|
3883 |
|
|
if (bootdev_id < 0 || machine->force_netboot) { |
3884 |
|
|
snprintf(init_bootpath, 400, "tftp()"); |
3885 |
|
|
} else { |
3886 |
|
|
/* TODO: Make this nicer. */ |
3887 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
3888 |
|
|
if (machine->machine_subtype == 30) |
3889 |
|
|
strcat(init_bootpath, "xio(0)pci(15)"); |
3890 |
|
|
if (machine->machine_subtype == 32) |
3891 |
|
|
strcat(init_bootpath, "pci(0)"); |
3892 |
|
|
} |
3893 |
|
|
|
3894 |
|
|
if (diskimage_is_a_cdrom(machine, bootdev_id)) |
3895 |
|
|
snprintf(init_bootpath + strlen(init_bootpath), 400, |
3896 |
|
|
"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); |
3897 |
|
|
else |
3898 |
|
|
snprintf(init_bootpath + strlen(init_bootpath), 400, |
3899 |
|
|
"scsi(0)disk(%i)rdisk(0)partition(1)", bootdev_id); |
3900 |
|
|
} |
3901 |
|
|
|
3902 |
|
|
if (machine->machine_type == MACHINE_ARC) |
3903 |
|
|
strcat(init_bootpath, "\\"); |
3904 |
|
|
|
3905 |
|
|
bootstr = malloc(strlen(init_bootpath) + |
3906 |
|
|
strlen(machine->boot_kernel_filename) + 1); |
3907 |
|
|
strcpy(bootstr, init_bootpath); |
3908 |
|
|
strcat(bootstr, machine->boot_kernel_filename); |
3909 |
|
|
|
3910 |
|
|
/* Boot args., eg "-a" */ |
3911 |
|
|
bootarg = machine->boot_string_argument; |
3912 |
|
|
|
3913 |
|
|
/* argc, argv, envp in a0, a1, a2: */ |
3914 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ |
3915 |
|
|
|
3916 |
|
|
/* TODO: not needed? */ |
3917 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_SP] = machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080; |
3918 |
|
|
|
3919 |
|
|
/* Set up argc/argv: */ |
3920 |
|
|
addr = ARC_ENV_STRINGS; |
3921 |
|
|
addr2 = ARC_ARGV_START; |
3922 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; |
3923 |
|
|
|
3924 |
|
|
/* bootstr: */ |
3925 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3926 |
|
|
add_environment_string(cpu, bootstr, &addr); |
3927 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
3928 |
|
|
|
3929 |
|
|
/* bootarg: */ |
3930 |
|
|
if (bootarg[0] != '\0') { |
3931 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3932 |
|
|
add_environment_string(cpu, bootarg, &addr); |
3933 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
3934 |
|
|
} |
3935 |
|
|
|
3936 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; |
3937 |
|
|
|
3938 |
|
|
/* |
3939 |
|
|
* Add environment variables. For each variable, add it |
3940 |
|
|
* as a string using add_environment_string(), and add a |
3941 |
|
|
* pointer to it to the ARC_ENV_POINTERS array. |
3942 |
|
|
*/ |
3943 |
|
|
if (machine->use_x11) { |
3944 |
|
|
if (machine->machine_type == MACHINE_ARC) { |
3945 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3946 |
|
|
add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); |
3947 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3948 |
|
|
add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); |
3949 |
|
|
} else { |
3950 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3951 |
|
|
add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); |
3952 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3953 |
|
|
add_environment_string(cpu, "ConsoleOut=video()", &addr); |
3954 |
|
|
|
3955 |
|
|
/* g for graphical mode. G for graphical mode |
3956 |
|
|
with SGI logo visible on Irix? */ |
3957 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3958 |
|
|
add_environment_string(cpu, "console=g", &addr); |
3959 |
|
|
} |
3960 |
|
|
} else { |
3961 |
|
|
if (machine->machine_type == MACHINE_ARC) { |
3962 |
|
|
/* TODO: serial console for ARC? */ |
3963 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3964 |
|
|
add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); |
3965 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3966 |
|
|
add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); |
3967 |
|
|
} else { |
3968 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3969 |
|
|
add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); |
3970 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3971 |
|
|
add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); |
3972 |
|
|
|
3973 |
|
|
/* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ |
3974 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3975 |
|
|
add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ |
3976 |
|
|
} |
3977 |
|
|
} |
3978 |
|
|
|
3979 |
|
|
if (machine->machine_type == MACHINE_SGI) { |
3980 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3981 |
|
|
add_environment_string(cpu, "AutoLoad=No", &addr); |
3982 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3983 |
|
|
add_environment_string(cpu, "diskless=0", &addr); |
3984 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3985 |
|
|
add_environment_string(cpu, "volume=80", &addr); |
3986 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3987 |
|
|
add_environment_string(cpu, "sgilogo=y", &addr); |
3988 |
|
|
|
3989 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3990 |
|
|
add_environment_string(cpu, "monitor=h", &addr); |
3991 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3992 |
|
|
add_environment_string(cpu, "TimeZone=GMT", &addr); |
3993 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3994 |
|
|
add_environment_string(cpu, "nogfxkbd=1", &addr); |
3995 |
|
|
|
3996 |
|
|
/* TODO: 'xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(0)' on IP30 at least */ |
3997 |
|
|
|
3998 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3999 |
|
|
add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &addr); |
4000 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4001 |
|
|
add_environment_string(cpu, "OSLoadPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(0)", &addr); |
4002 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4003 |
|
|
add_environment_string(cpu, "OSLoadFilename=/unix", &addr); |
4004 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4005 |
|
|
add_environment_string(cpu, "OSLoader=sash", &addr); |
4006 |
|
|
|
4007 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4008 |
|
|
add_environment_string(cpu, "rbaud=9600", &addr); |
4009 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4010 |
|
|
add_environment_string(cpu, "rebound=y", &addr); |
4011 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4012 |
|
|
add_environment_string(cpu, "crt_option=1", &addr); |
4013 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4014 |
|
|
add_environment_string(cpu, "netaddr=10.0.0.1", &addr); |
4015 |
|
|
|
4016 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4017 |
|
|
add_environment_string(cpu, "keybd=US", &addr); |
4018 |
|
|
|
4019 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4020 |
|
|
add_environment_string(cpu, "cpufreq=3", &addr); |
4021 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4022 |
|
|
add_environment_string(cpu, "dbaud=9600", &addr); |
4023 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4024 |
|
|
add_environment_string(cpu, eaddr_string, &addr); |
4025 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4026 |
|
|
add_environment_string(cpu, "verbose=istrue", &addr); |
4027 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4028 |
|
|
add_environment_string(cpu, "showconfig=istrue", &addr); |
4029 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4030 |
|
|
add_environment_string(cpu, "diagmode=v", &addr); |
4031 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4032 |
|
|
add_environment_string(cpu, "kernname=unix", &addr); |
4033 |
|
|
} else { |
4034 |
|
|
char *tmp; |
4035 |
|
|
tmp = malloc(strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2); |
4036 |
|
|
sprintf(tmp, "OSLOADOPTIONS=%s", bootarg); |
4037 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4038 |
|
|
add_environment_string(cpu, tmp, &addr); |
4039 |
|
|
|
4040 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4041 |
|
|
add_environment_string(cpu, "OSLOADPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
4042 |
|
|
|
4043 |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
4044 |
|
|
add_environment_string(cpu, "SYSTEMPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
4045 |
|
|
} |
4046 |
|
|
|
4047 |
|
|
/* End the environment strings with an empty zero-terminated |
4048 |
|
|
string, and the envp array with a NULL pointer. */ |
4049 |
|
|
add_environment_string(cpu, "", &addr); /* the end */ |
4050 |
|
|
store_pointer_and_advance(cpu, &addr2, |
4051 |
|
|
0, arc_wordlen==sizeof(uint64_t)); |
4052 |
|
|
|
4053 |
|
|
no_arc_prom_emulation: /* TODO: ugly, get rid of the goto */ |
4054 |
|
|
|
4055 |
|
|
/* Return address: (0x20 = ReturnFromMain()) */ |
4056 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_RA] = ARC_FIRMWARE_ENTRIES + 0x20; |
4057 |
|
|
|
4058 |
|
|
break; |
4059 |
|
|
|
4060 |
|
|
case MACHINE_MESHCUBE: |
4061 |
|
|
machine->machine_name = "MeshCube"; |
4062 |
|
|
|
4063 |
|
|
if (machine->physical_ram_in_mb != 64) |
4064 |
|
|
fprintf(stderr, "WARNING! MeshCubes are supposed to have exactly 64 MB RAM. Continuing anyway.\n"); |
4065 |
|
|
if (machine->use_x11) |
4066 |
|
|
fprintf(stderr, "WARNING! MeshCube with -X is meaningless. Continuing anyway.\n"); |
4067 |
|
|
|
4068 |
|
|
/* First of all, the MeshCube has an Au1500 in it: */ |
4069 |
|
|
machine->md_interrupt = au1x00_interrupt; |
4070 |
|
|
machine->au1x00_ic_data = dev_au1x00_init(machine, mem); |
4071 |
|
|
|
4072 |
|
|
/* |
4073 |
|
|
* TODO: Which non-Au1500 devices, and at what addresses? |
4074 |
|
|
* |
4075 |
|
|
* "4G Systems MTX-1 Board" at ? |
4076 |
|
|
* 1017fffc, 14005004, 11700000, 11700008, 11900014, |
4077 |
|
|
* 1190002c, 11900100, 11900108, 1190010c, |
4078 |
|
|
* 10400040 - 10400074, |
4079 |
|
|
* 14001000 (possibly LCD?) |
4080 |
|
|
* 11100028 (possibly ttySx?) |
4081 |
|
|
* |
4082 |
|
|
* "usb_ohci=base:0x10100000,len:0x100000,irq:26" |
4083 |
|
|
*/ |
4084 |
|
|
|
4085 |
|
|
device_add(machine, "random addr=0x1017fffc len=4"); |
4086 |
|
|
|
4087 |
|
|
/* |
4088 |
|
|
* TODO: A Linux kernel wants "memsize" from somewhere... I |
4089 |
|
|
* haven't found any docs on how it is used though. |
4090 |
|
|
*/ |
4091 |
|
|
|
4092 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; |
4093 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; |
4094 |
|
|
store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], |
4095 |
|
|
0xa0002000ULL); |
4096 |
|
|
store_string(cpu, 0xa0002000ULL, "something=somethingelse"); |
4097 |
|
|
|
4098 |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; |
4099 |
|
|
store_string(cpu, 0xa0002000ULL, "hello=world\n"); |
4100 |
|
|
|
4101 |
|
|
break; |
4102 |
|
|
|
4103 |
|
|
case MACHINE_NETGEAR: |
4104 |
|
|
machine->machine_name = "NetGear WG602"; |
4105 |
|
|
|
4106 |
|
|
if (machine->use_x11) |
4107 |
|
|
fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); |
4108 |
|
|
if (machine->physical_ram_in_mb != 16) |
4109 |
|
|
fprintf(stderr, "WARNING! Real NetGear WG602 boxes have exactly 16 MB RAM. Continuing anyway.\n"); |
4110 |
|
|
|
4111 |
|
|
/* |
4112 |
|
|
* Lots of info about the IDT 79RC 32334 |
4113 |
|
|
* http://www.idt.com/products/pages/Integrated_Processors-79RC32334.html |
4114 |
|
|
*/ |
4115 |
|
|
device_add(machine, "8250 addr=0x18000800 addr_mult=4 irq=0"); |
4116 |
|
|
break; |
4117 |
|
|
|
4118 |
|
|
case MACHINE_WRT54G: |
4119 |
|
|
machine->machine_name = "Linksys WRT54G"; |
4120 |
|
|
|
4121 |
|
|
if (machine->use_x11) |
4122 |
|
|
fprintf(stderr, "WARNING! Linksys WRT54G with -X is meaningless. Continuing anyway.\n"); |
4123 |
|
|
|
4124 |
|
|
/* 200 MHz default */ |
4125 |
|
|
if (machine->emulated_hz == 0) |
4126 |
|
|
machine->emulated_hz = 200000000; |
4127 |
|
|
|
4128 |
|
|
/* |
4129 |
|
|
* Linux should be loaded at 0x80001000. |
4130 |
|
|
* RAM: 16 or 32 MB, Flash RAM: 4 or 8 MB. |
4131 |
|
|
* http://www.bumpclub.ee/~jaanus/wrt54g/vana/minicom.cap: |
4132 |
|
|
* |
4133 |
|
|
* Starting program at 0x80001000 |
4134 |
|
|
* CPU revision is: 00029007 |
4135 |
|
|
* Primary instruction cache 8kb, linesize 16 bytes (2 ways) |
4136 |
|
|
* Primary data cache 4kb, linesize 16 bytes (2 ways) |
4137 |
|
|
* memory: 01000000 @ 00000000 (usable) |
4138 |
|
|
* Kernel command line: root=/dev/mtdblock2 rootfstype=squashfs init=/etc/preinit noinitrd console=ttyS0,115200 |
4139 |
|
|
* CPU: BCM4712 rev 1 at 200 MHz |
4140 |
|
|
* Calibrating delay loop... 199.47 BogoMIPS |
4141 |
|
|
* ttyS00 at 0xb8000300 (irq = 3) is a 16550A |
4142 |
|
|
* ttyS01 at 0xb8000400 (irq = 0) is a 16550A |
4143 |
|
|
* Flash device: 0x400000 at 0x1c000000 |
4144 |
|
|
* .. |
4145 |
|
|
*/ |
4146 |
|
|
|
4147 |
|
|
/* TODO: What should the initial register contents be? */ |
4148 |
|
|
#if 1 |
4149 |
|
|
{ |
4150 |
|
|
int i; |
4151 |
|
|
for (i=0; i<32; i++) |
4152 |
|
|
cpu->cd.mips.gpr[i] = 0x01230000 + (i << 8) + 0x55; |
4153 |
|
|
} |
4154 |
|
|
#endif |
4155 |
|
|
|
4156 |
|
|
break; |
4157 |
|
|
|
4158 |
|
|
case MACHINE_SONYNEWS: |
4159 |
|
|
/* |
4160 |
|
|
* There are several models, according to |
4161 |
|
|
* http://www.netbsd.org/Ports/newsmips/: |
4162 |
|
|
* |
4163 |
|
|
* "R3000 and hyper-bus based models" |
4164 |
|
|
* NWS-3470D, -3410, -3460, -3710, -3720 |
4165 |
|
|
* |
4166 |
|
|
* "R4000/4400 and apbus based models" |
4167 |
|
|
* NWS-5000 |
4168 |
|
|
* |
4169 |
|
|
* For example: (found using google) |
4170 |
|
|
* |
4171 |
|
|
* cpu_model = news3700 |
4172 |
|
|
* SONY NET WORK STATION, Model NWS-3710, Machine ID #30145 |
4173 |
|
|
* cpu0: MIPS R3000 (0x220) Rev. 2.0 with MIPS R3010 Rev.2.0 |
4174 |
|
|
* 64KB/4B direct-mapped I, 64KB/4B direct-mapped w-thr. D |
4175 |
|
|
* |
4176 |
|
|
* See http://katsu.watanabe.name/doc/sonynews/model.html |
4177 |
|
|
* for more details. |
4178 |
|
|
*/ |
4179 |
|
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
4180 |
|
|
machine->machine_name = "Sony NeWS (NET WORK STATION)"; |
4181 |
|
|
|
4182 |
|
|
/* This is just a test. TODO */ |
4183 |
|
|
{ |
4184 |
|
|
int i; |
4185 |
|
|
for (i=0; i<32; i++) |
4186 |
|
|
cpu->cd.mips.gpr[i] = |
4187 |
|
|
0x01230000 + (i << 8) + 0x55; |
4188 |
|
|
} |
4189 |
|
|
|
4190 |
|
|
machine->main_console_handle = |
4191 |
|
|
dev_zs_init(machine, mem, 0x1e950000, 0, 1, "zs console"); |
4192 |
|
|
|
4193 |
|
|
break; |
4194 |
|
|
|
4195 |
|
|
case MACHINE_BAREPPC: |
4196 |
|
|
/* |
4197 |
|
|
* A "bare" PPC machine. |
4198 |
|
|
* |
4199 |
|
|
* NOTE: NO devices at all. |
4200 |
|
|
*/ |
4201 |
|
|
machine->machine_name = "\"Bare\" PPC machine"; |
4202 |
|
|
break; |
4203 |
|
|
|
4204 |
|
|
case MACHINE_TESTPPC: |
4205 |
|
|
/* |
4206 |
|
|
* A PPC test machine, similar to the test machine for MIPS. |
4207 |
|
|
*/ |
4208 |
|
|
machine->machine_name = "PPC test machine"; |
4209 |
|
|
|
4210 |
|
|
/* TODO: interrupt for PPC? */ |
4211 |
|
|
machine->main_console_handle = dev_cons_init( |
4212 |
|
|
machine, mem, DEV_CONS_ADDRESS, "console", 0); |
4213 |
|
|
|
4214 |
|
|
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
4215 |
|
|
(long long)DEV_MP_ADDRESS); |
4216 |
|
|
device_add(machine, tmpstr); |
4217 |
|
|
|
4218 |
|
|
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
4219 |
|
|
640,480, 640,480, 24, "generic", 1); |
4220 |
|
|
break; |
4221 |
|
|
|
4222 |
|
|
case MACHINE_WALNUT: |
4223 |
|
|
/* |
4224 |
|
|
* NetBSD/evbppc (http://www.netbsd.org/Ports/evbppc/) |
4225 |
|
|
*/ |
4226 |
|
|
machine->machine_name = "Walnut evaluation board"; |
4227 |
|
|
|
4228 |
|
|
break; |
4229 |
|
|
|
4230 |
|
|
case MACHINE_PMPPC: |
4231 |
|
|
/* |
4232 |
|
|
* NetBSD/pmppc (http://www.netbsd.org/Ports/pmppc/) |
4233 |
|
|
*/ |
4234 |
|
|
machine->machine_name = "Artesyn's PM/PPC board"; |
4235 |
|
|
|
4236 |
|
|
dev_pmppc_init(mem); |
4237 |
|
|
|
4238 |
|
|
/* com0 = 0xff600300, com1 = 0xff600400 */ |
4239 |
|
|
machine->main_console_handle = dev_ns16550_init(machine, mem, |
4240 |
|
|
0xff600300, 0, 1, 1, "serial 0"); |
4241 |
|
|
dev_ns16550_init(machine, mem, |
4242 |
|
|
0xff600400, 0, 1, 0, "serial 1"); |
4243 |
|
|
|
4244 |
|
|
break; |
4245 |
|
|
|
4246 |
|
|
case MACHINE_SANDPOINT: |
4247 |
|
|
/* |
4248 |
|
|
* NetBSD/sandpoint (http://www.netbsd.org/Ports/sandpoint/) |
4249 |
|
|
*/ |
4250 |
|
|
machine->machine_name = "Motorola Sandpoint"; |
4251 |
|
|
|
4252 |
|
|
{ |
4253 |
|
|
int i; |
4254 |
|
|
for (i=0; i<32; i++) |
4255 |
|
|
cpu->cd.ppc.gpr[i] = |
4256 |
|
|
0x12340000 + (i << 8) + 0x55; |
4257 |
|
|
} |
4258 |
|
|
|
4259 |
|
|
break; |
4260 |
|
|
|
4261 |
|
|
case MACHINE_BEBOX: |
4262 |
|
|
/* |
4263 |
|
|
* NetBSD/bebox (http://www.netbsd.org/Ports/bebox/) |
4264 |
|
|
*/ |
4265 |
|
|
machine->machine_name = "BeBox"; |
4266 |
|
|
|
4267 |
|
|
device_add(machine, "bebox"); |
4268 |
|
|
|
4269 |
|
|
/* Serial, used by NetBSD: */ |
4270 |
|
|
machine->main_console_handle = dev_ns16550_init(machine, mem, |
4271 |
|
|
0x800003f8, 0, 1, 1, "serial 0"); |
4272 |
|
|
|
4273 |
|
|
/* Serial, used by Linux: */ |
4274 |
|
|
dev_ns16550_init(machine, mem, 0x800002f8, 0, 1, 0, "serial 1"); |
4275 |
|
|
|
4276 |
|
|
/* This is used by Linux too: */ |
4277 |
|
|
dev_vga_init(machine, mem, 0xc00b8000ULL, 0x800003c0ULL, 80, 25, |
4278 |
|
|
machine->machine_name); |
4279 |
|
|
|
4280 |
|
|
store_32bit_word(cpu, 0x3010, |
4281 |
|
|
machine->physical_ram_in_mb * 1048576); |
4282 |
|
|
|
4283 |
|
|
/* TODO: List of stuff, see http://www.beatjapan.org/ |
4284 |
|
|
mirror/www.be.com/aboutbe/benewsletter/ |
4285 |
|
|
Issue27.html#Cookbook for the details. */ |
4286 |
|
|
store_32bit_word(cpu, 0x301c, 0); |
4287 |
|
|
|
4288 |
|
|
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
4289 |
|
|
r5 = args, r6 = ptr to bootinfo? */ |
4290 |
|
|
cpu->cd.ppc.gpr[3] = 0x3100; |
4291 |
|
|
cpu->cd.ppc.gpr[4] = 0x200000; |
4292 |
|
|
cpu->cd.ppc.gpr[5] = 0x2000; |
4293 |
|
|
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
4294 |
|
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 |
4295 |
|
|
- 0x100; |
4296 |
|
|
|
4297 |
|
|
/* See NetBSD's bebox/include/bootinfo.h for details */ |
4298 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 0, 12); /* next */ |
4299 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 4, 0); /* mem */ |
4300 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 8, |
4301 |
|
|
machine->physical_ram_in_mb * 1048576); |
4302 |
|
|
|
4303 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 12, 20); /* next */ |
4304 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 16, 1); /* console */ |
4305 |
|
|
store_buf(cpu, cpu->cd.ppc.gpr[6] + 20, "com", 4); |
4306 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 24, 0x3f8);/* addr */ |
4307 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 28, 9600);/* speed */ |
4308 |
|
|
|
4309 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 32, 0); /* next */ |
4310 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 36, 2); /* clock */ |
4311 |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 40, 100); |
4312 |
|
|
|
4313 |
|
|
break; |
4314 |
|
|
|
4315 |
|
|
case MACHINE_PREP: |
4316 |
|
|
/* |
4317 |
|
|
* NetBSD/prep (http://www.netbsd.org/Ports/prep/) |
4318 |
|
|
*/ |
4319 |
|
|
machine->machine_name = "PowerPC Reference Platform"; |
4320 |
|
|
|
4321 |
|
|
{ |
4322 |
|
|
int i; |
4323 |
|
|
for (i=0; i<32; i++) |
4324 |
|
|
cpu->cd.ppc.gpr[i] = |
4325 |
|
|
0x12340000 + (i << 8) + 0x55; |
4326 |
|
|
} |
4327 |
|
|
|
4328 |
|
|
/* Linux on PReP has 0xdeadc0de at address 0? (See |
4329 |
|
|
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
4330 |
|
|
store_32bit_word(cpu, 0, 0xdeadc0de); |
4331 |
|
|
|
4332 |
|
|
/* r6 should point to "residual data"? */ |
4333 |
|
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 |
4334 |
|
|
- 0x1000; |
4335 |
|
|
|
4336 |
|
|
break; |
4337 |
|
|
|
4338 |
|
|
case MACHINE_MACPPC: |
4339 |
|
|
/* |
4340 |
|
|
* NetBSD/macppc (http://www.netbsd.org/Ports/macppc/) |
4341 |
|
|
* OpenBSD/macppc (http://www.openbsd.org/macppc.html) |
4342 |
|
|
*/ |
4343 |
|
|
machine->machine_name = "Macintosh (PPC)"; |
4344 |
|
|
|
4345 |
|
|
/* r5 = OpenFirmware entry point */ |
4346 |
|
|
cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; |
4347 |
|
|
|
4348 |
|
|
break; |
4349 |
|
|
|
4350 |
|
|
case MACHINE_DB64360: |
4351 |
|
|
/* For playing with PMON2000 for PPC: */ |
4352 |
|
|
machine->machine_name = "DB64360"; |
4353 |
|
|
|
4354 |
|
|
machine->main_console_handle = dev_ns16550_init(machine, mem, |
4355 |
|
|
0x1d000020, 0, 4, 1, "serial console"); |
4356 |
|
|
|
4357 |
|
|
{ |
4358 |
|
|
int i; |
4359 |
|
|
for (i=0; i<32; i++) |
4360 |
|
|
cpu->cd.ppc.gpr[i] = |
4361 |
|
|
0x12340000 + (i << 8) + 0x55; |
4362 |
|
|
} |
4363 |
|
|
|
4364 |
|
|
break; |
4365 |
|
|
|
4366 |
|
|
case MACHINE_BARESPARC: |
4367 |
|
|
/* A bare SPARC machine, with no devices. */ |
4368 |
|
|
machine->machine_name = "\"Bare\" SPARC machine"; |
4369 |
|
|
break; |
4370 |
|
|
|
4371 |
|
|
case MACHINE_ULTRA1: |
4372 |
|
|
/* |
4373 |
|
|
* NetBSD/sparc64 (http://www.netbsd.org/Ports/sparc64/) |
4374 |
|
|
* OpenBSD/sparc64 (http://www.openbsd.org/sparc64.html) |
4375 |
|
|
*/ |
4376 |
|
|
machine->machine_name = "Sun Ultra1"; |
4377 |
|
|
break; |
4378 |
|
|
|
4379 |
|
|
case MACHINE_BAREURISC: |
4380 |
|
|
machine->machine_name = "\"Bare\" URISC machine"; |
4381 |
|
|
break; |
4382 |
|
|
|
4383 |
|
|
case MACHINE_TESTURISC: |
4384 |
|
|
machine->machine_name = "URISC test machine"; |
4385 |
|
|
|
4386 |
|
|
/* TODO */ |
4387 |
|
|
/* A special "device" for accessing normal devices |
4388 |
|
|
using urisc accesses? */ |
4389 |
|
|
|
4390 |
|
|
device_add(machine, "urisc addr=0x12341234"); |
4391 |
|
|
|
4392 |
|
|
break; |
4393 |
|
|
|
4394 |
|
|
case MACHINE_BAREHPPA: |
4395 |
|
|
machine->machine_name = "\"Bare\" HPPA machine"; |
4396 |
|
|
break; |
4397 |
|
|
|
4398 |
|
|
case MACHINE_TESTHPPA: |
4399 |
|
|
machine->machine_name = "HPPA test machine"; |
4400 |
|
|
|
4401 |
|
|
/* TODO */ |
4402 |
|
|
break; |
4403 |
|
|
|
4404 |
|
|
case MACHINE_BAREALPHA: |
4405 |
|
|
machine->machine_name = "\"Bare\" Alpha machine"; |
4406 |
|
|
break; |
4407 |
|
|
|
4408 |
|
|
case MACHINE_TESTALPHA: |
4409 |
|
|
machine->machine_name = "Alpha test machine"; |
4410 |
|
|
|
4411 |
|
|
/* TODO */ |
4412 |
|
|
break; |
4413 |
|
|
|
4414 |
|
|
default: |
4415 |
|
|
fatal("Unknown emulation type %i\n", machine->machine_type); |
4416 |
|
|
exit(1); |
4417 |
|
|
} |
4418 |
|
|
|
4419 |
|
|
if (machine->machine_name != NULL) |
4420 |
|
|
debug("machine: %s", machine->machine_name); |
4421 |
|
|
|
4422 |
|
|
if (machine->emulated_hz > 0) |
4423 |
|
|
debug(" (%.2f MHz)", (float)machine->emulated_hz / 1000000); |
4424 |
|
|
debug("\n"); |
4425 |
|
|
|
4426 |
|
|
if (machine->emulated_hz < 1) |
4427 |
|
|
machine->emulated_hz = 1000000; |
4428 |
|
|
|
4429 |
|
|
if (bootstr != NULL) { |
4430 |
|
|
debug("bootstring%s: %s", (bootarg!=NULL && |
4431 |
|
|
strlen(bootarg) >= 1)? "(+bootarg)" : "", bootstr); |
4432 |
|
|
if (bootarg != NULL && strlen(bootarg) >= 1) |
4433 |
|
|
debug(" %s", bootarg); |
4434 |
|
|
debug("\n"); |
4435 |
|
|
} |
4436 |
|
|
} |
4437 |
|
|
|
4438 |
|
|
|
4439 |
|
|
/* |
4440 |
|
|
* machine_memsize_fix(): |
4441 |
|
|
* |
4442 |
|
|
* Sets physical_ram_in_mb (if not already set), and memory_offset_in_mb, |
4443 |
|
|
* depending on machine type. |
4444 |
|
|
*/ |
4445 |
|
|
void machine_memsize_fix(struct machine *m) |
4446 |
|
|
{ |
4447 |
|
|
if (m == NULL) { |
4448 |
|
|
fatal("machine_defaultmemsize(): m == NULL?\n"); |
4449 |
|
|
exit(1); |
4450 |
|
|
} |
4451 |
|
|
|
4452 |
|
|
if (m->physical_ram_in_mb == 0) { |
4453 |
|
|
switch (m->machine_type) { |
4454 |
|
|
case MACHINE_PS2: |
4455 |
|
|
m->physical_ram_in_mb = 32; |
4456 |
|
|
break; |
4457 |
|
|
case MACHINE_SGI: |
4458 |
|
|
m->physical_ram_in_mb = 64; |
4459 |
|
|
break; |
4460 |
|
|
case MACHINE_HPCMIPS: |
4461 |
|
|
/* Most have 32 MB by default. */ |
4462 |
|
|
m->physical_ram_in_mb = 32; |
4463 |
|
|
switch (m->machine_subtype) { |
4464 |
|
|
case MACHINE_HPCMIPS_CASIO_BE300: |
4465 |
|
|
m->physical_ram_in_mb = 16; |
4466 |
|
|
break; |
4467 |
|
|
case MACHINE_HPCMIPS_CASIO_E105: |
4468 |
|
|
m->physical_ram_in_mb = 32; |
4469 |
|
|
break; |
4470 |
|
|
case MACHINE_HPCMIPS_AGENDA_VR3: |
4471 |
|
|
m->physical_ram_in_mb = 16; |
4472 |
|
|
break; |
4473 |
|
|
} |
4474 |
|
|
break; |
4475 |
|
|
case MACHINE_MESHCUBE: |
4476 |
|
|
m->physical_ram_in_mb = 64; |
4477 |
|
|
break; |
4478 |
|
|
case MACHINE_NETGEAR: |
4479 |
|
|
m->physical_ram_in_mb = 16; |
4480 |
|
|
break; |
4481 |
|
|
case MACHINE_WRT54G: |
4482 |
|
|
m->physical_ram_in_mb = 32; |
4483 |
|
|
break; |
4484 |
|
|
case MACHINE_ARC: |
4485 |
|
|
switch (m->machine_subtype) { |
4486 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
4487 |
|
|
m->physical_ram_in_mb = 64; |
4488 |
|
|
break; |
4489 |
|
|
case MACHINE_ARC_JAZZ_M700: |
4490 |
|
|
m->physical_ram_in_mb = 64; |
4491 |
|
|
break; |
4492 |
|
|
default: |
4493 |
|
|
m->physical_ram_in_mb = 32; |
4494 |
|
|
} |
4495 |
|
|
break; |
4496 |
|
|
case MACHINE_DEC: |
4497 |
|
|
switch (m->machine_subtype) { |
4498 |
|
|
case MACHINE_DEC_PMAX_3100: |
4499 |
|
|
m->physical_ram_in_mb = 24; |
4500 |
|
|
break; |
4501 |
|
|
default: |
4502 |
|
|
m->physical_ram_in_mb = 32; |
4503 |
|
|
} |
4504 |
|
|
break; |
4505 |
|
|
case MACHINE_BEBOX: |
4506 |
|
|
m->physical_ram_in_mb = 64; |
4507 |
|
|
break; |
4508 |
|
|
case MACHINE_BAREURISC: |
4509 |
|
|
case MACHINE_TESTURISC: |
4510 |
|
|
m->physical_ram_in_mb = 2; |
4511 |
|
|
break; |
4512 |
|
|
} |
4513 |
|
|
} |
4514 |
|
|
|
4515 |
|
|
/* Special hack for WRT54G and hpcmips machines: */ |
4516 |
|
|
if (m->machine_type == MACHINE_WRT54G || |
4517 |
|
|
m->machine_type == MACHINE_HPCMIPS) { |
4518 |
|
|
m->dbe_on_nonexistant_memaccess = 0; |
4519 |
|
|
} |
4520 |
|
|
|
4521 |
|
|
/* Special SGI memory offsets: */ |
4522 |
|
|
if (m->machine_type == MACHINE_SGI) { |
4523 |
|
|
switch (m->machine_subtype) { |
4524 |
|
|
case 20: |
4525 |
|
|
case 22: |
4526 |
|
|
case 24: |
4527 |
|
|
case 26: |
4528 |
|
|
m->memory_offset_in_mb = 128; |
4529 |
|
|
break; |
4530 |
|
|
case 28: |
4531 |
|
|
case 30: |
4532 |
|
|
m->memory_offset_in_mb = 512; |
4533 |
|
|
break; |
4534 |
|
|
} |
4535 |
|
|
} |
4536 |
|
|
|
4537 |
|
|
if (m->physical_ram_in_mb == 0) |
4538 |
|
|
m->physical_ram_in_mb = DEFAULT_RAM_IN_MB; |
4539 |
|
|
} |
4540 |
|
|
|
4541 |
|
|
|
4542 |
|
|
/* |
4543 |
|
|
* machine_default_cputype(): |
4544 |
|
|
* |
4545 |
|
|
* Sets m->cpu_name, if it isn't already set, depending on the machine |
4546 |
|
|
* type. |
4547 |
|
|
*/ |
4548 |
|
|
void machine_default_cputype(struct machine *m) |
4549 |
|
|
{ |
4550 |
|
|
if (m == NULL) { |
4551 |
|
|
fatal("machine_default_cputype(): m == NULL?\n"); |
4552 |
|
|
exit(1); |
4553 |
|
|
} |
4554 |
|
|
|
4555 |
|
|
if (m->cpu_name != NULL) |
4556 |
|
|
return; |
4557 |
|
|
|
4558 |
|
|
switch (m->machine_type) { |
4559 |
|
|
case MACHINE_BAREMIPS: |
4560 |
|
|
case MACHINE_TESTMIPS: |
4561 |
|
|
m->cpu_name = strdup("R4000"); |
4562 |
|
|
break; |
4563 |
|
|
case MACHINE_PS2: |
4564 |
|
|
m->cpu_name = strdup("R5900"); |
4565 |
|
|
break; |
4566 |
|
|
case MACHINE_DEC: |
4567 |
|
|
if (m->machine_subtype > 2) |
4568 |
|
|
m->cpu_name = strdup("R3000A"); |
4569 |
|
|
if (m->machine_subtype > 1 && m->cpu_name == NULL) |
4570 |
|
|
m->cpu_name = strdup("R3000"); |
4571 |
|
|
if (m->cpu_name == NULL) |
4572 |
|
|
m->cpu_name = strdup("R2000"); |
4573 |
|
|
break; |
4574 |
|
|
case MACHINE_SONYNEWS: |
4575 |
|
|
m->cpu_name = strdup("R3000"); |
4576 |
|
|
break; |
4577 |
|
|
case MACHINE_HPCMIPS: |
4578 |
|
|
switch (m->machine_subtype) { |
4579 |
|
|
case MACHINE_HPCMIPS_CASIO_BE300: |
4580 |
|
|
m->cpu_name = strdup("VR4131"); |
4581 |
|
|
break; |
4582 |
|
|
case MACHINE_HPCMIPS_CASIO_E105: |
4583 |
|
|
m->cpu_name = strdup("VR4121"); |
4584 |
|
|
break; |
4585 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_770: |
4586 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_780: |
4587 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_800: |
4588 |
|
|
case MACHINE_HPCMIPS_NEC_MOBILEPRO_880: |
4589 |
|
|
m->cpu_name = strdup("VR4121"); |
4590 |
|
|
break; |
4591 |
|
|
case MACHINE_HPCMIPS_AGENDA_VR3: |
4592 |
|
|
m->cpu_name = strdup("VR4181"); |
4593 |
|
|
break; |
4594 |
|
|
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
4595 |
|
|
m->cpu_name = strdup("VR4121"); |
4596 |
|
|
break; |
4597 |
|
|
default: |
4598 |
|
|
printf("Unimplemented HPCMIPS model?\n"); |
4599 |
|
|
exit(1); |
4600 |
|
|
} |
4601 |
|
|
break; |
4602 |
|
|
case MACHINE_COBALT: |
4603 |
|
|
m->cpu_name = strdup("RM5200"); |
4604 |
|
|
break; |
4605 |
|
|
case MACHINE_MESHCUBE: |
4606 |
|
|
m->cpu_name = strdup("R4400"); |
4607 |
|
|
/* TODO: Should be AU1500, but Linux doesn't like |
4608 |
|
|
the absence of caches in the emulator */ |
4609 |
|
|
break; |
4610 |
|
|
case MACHINE_NETGEAR: |
4611 |
|
|
m->cpu_name = strdup("RC32334"); |
4612 |
|
|
break; |
4613 |
|
|
case MACHINE_WRT54G: |
4614 |
|
|
m->cpu_name = strdup("BCM4712"); |
4615 |
|
|
break; |
4616 |
|
|
case MACHINE_ARC: |
4617 |
|
|
switch (m->machine_subtype) { |
4618 |
|
|
case MACHINE_ARC_JAZZ_PICA: |
4619 |
|
|
m->cpu_name = strdup("R4000"); |
4620 |
|
|
break; |
4621 |
|
|
default: |
4622 |
|
|
m->cpu_name = strdup("R4400"); |
4623 |
|
|
} |
4624 |
|
|
break; |
4625 |
|
|
case MACHINE_SGI: |
4626 |
|
|
if (m->machine_subtype <= 12) |
4627 |
|
|
m->cpu_name = strdup("R3000"); |
4628 |
|
|
if (m->cpu_name == NULL && m->machine_subtype == 35) |
4629 |
|
|
m->cpu_name = strdup("R12000"); |
4630 |
|
|
if (m->cpu_name == NULL && (m->machine_subtype == 25 || |
4631 |
|
|
m->machine_subtype == 27 || |
4632 |
|
|
m->machine_subtype == 28 || |
4633 |
|
|
m->machine_subtype == 30 || |
4634 |
|
|
m->machine_subtype == 32)) |
4635 |
|
|
m->cpu_name = strdup("R10000"); |
4636 |
|
|
if (m->cpu_name == NULL && (m->machine_subtype == 21 || |
4637 |
|
|
m->machine_subtype == 26)) |
4638 |
|
|
m->cpu_name = strdup("R8000"); |
4639 |
|
|
if (m->cpu_name == NULL && m->machine_subtype == 24) |
4640 |
|
|
m->cpu_name = strdup("R5000"); |
4641 |
|
|
|
4642 |
|
|
/* Other SGIs should probably work with |
4643 |
|
|
R4000, R4400 or R5000 or similar: */ |
4644 |
|
|
if (m->cpu_name == NULL) |
4645 |
|
|
m->cpu_name = strdup("R4400"); |
4646 |
|
|
break; |
4647 |
|
|
|
4648 |
|
|
/* PowerPC: */ |
4649 |
|
|
case MACHINE_BAREPPC: |
4650 |
|
|
case MACHINE_TESTPPC: |
4651 |
|
|
m->cpu_name = strdup("PPC970"); |
4652 |
|
|
break; |
4653 |
|
|
case MACHINE_WALNUT: |
4654 |
|
|
/* For NetBSD/evbppc. */ |
4655 |
|
|
m->cpu_name = strdup("PPC405GP"); |
4656 |
|
|
break; |
4657 |
|
|
case MACHINE_PMPPC: |
4658 |
|
|
/* For NetBSD/pmppc. */ |
4659 |
|
|
m->cpu_name = strdup("PPC750"); |
4660 |
|
|
break; |
4661 |
|
|
case MACHINE_SANDPOINT: |
4662 |
|
|
/* |
4663 |
|
|
* For NetBSD/sandpoint. According to NetBSD's page: |
4664 |
|
|
* |
4665 |
|
|
* "Unity" module has an MPC8240. |
4666 |
|
|
* "Altimus" module has an MPC7400 (G4) or an MPC107. |
4667 |
|
|
*/ |
4668 |
|
|
m->cpu_name = strdup("MPC7400"); |
4669 |
|
|
break; |
4670 |
|
|
case MACHINE_BEBOX: |
4671 |
|
|
/* For NetBSD/bebox. Dual 133 MHz 603e CPUs, for example. */ |
4672 |
|
|
m->cpu_name = strdup("PPC603e"); |
4673 |
|
|
break; |
4674 |
|
|
case MACHINE_PREP: |
4675 |
|
|
/* For NetBSD/prep. TODO */ |
4676 |
|
|
m->cpu_name = strdup("PPC603e"); |
4677 |
|
|
break; |
4678 |
|
|
case MACHINE_MACPPC: |
4679 |
|
|
switch (m->machine_subtype) { |
4680 |
|
|
case MACHINE_MACPPC_G4: |
4681 |
|
|
m->cpu_name = strdup("G4e"); |
4682 |
|
|
break; |
4683 |
|
|
case MACHINE_MACPPC_G5: |
4684 |
|
|
m->cpu_name = strdup("PPC970"); |
4685 |
|
|
break; |
4686 |
|
|
} |
4687 |
|
|
break; |
4688 |
|
|
case MACHINE_DB64360: |
4689 |
|
|
m->cpu_name = strdup("PPC750"); |
4690 |
|
|
break; |
4691 |
|
|
|
4692 |
|
|
/* SPARC: */ |
4693 |
|
|
case MACHINE_BARESPARC: |
4694 |
|
|
m->cpu_name = strdup("SPARCV9"); |
4695 |
|
|
break; |
4696 |
|
|
case MACHINE_ULTRA1: |
4697 |
|
|
m->cpu_name = strdup("SPARCV9"); |
4698 |
|
|
break; |
4699 |
|
|
|
4700 |
|
|
/* URISC: */ |
4701 |
|
|
case MACHINE_BAREURISC: |
4702 |
|
|
case MACHINE_TESTURISC: |
4703 |
|
|
m->cpu_name = strdup("URISC"); |
4704 |
|
|
break; |
4705 |
|
|
|
4706 |
|
|
/* HPPA: */ |
4707 |
|
|
case MACHINE_BAREHPPA: |
4708 |
|
|
case MACHINE_TESTHPPA: |
4709 |
|
|
m->cpu_name = strdup("HPPA2.0"); |
4710 |
|
|
break; |
4711 |
|
|
|
4712 |
|
|
/* Alpha: */ |
4713 |
|
|
case MACHINE_BAREALPHA: |
4714 |
|
|
case MACHINE_TESTALPHA: |
4715 |
|
|
m->cpu_name = strdup("EV4"); |
4716 |
|
|
break; |
4717 |
|
|
} |
4718 |
|
|
|
4719 |
|
|
if (m->cpu_name == NULL) { |
4720 |
|
|
fprintf(stderr, "machine_default_cputype(): no default" |
4721 |
|
|
" cpu for machine type %i subtype %i\n", |
4722 |
|
|
m->machine_type, m->machine_subtype); |
4723 |
|
|
exit(1); |
4724 |
|
|
} |
4725 |
|
|
} |
4726 |
|
|
|
4727 |
|
|
|
4728 |
|
|
/* |
4729 |
|
|
* machine_dumpinfo(): |
4730 |
|
|
* |
4731 |
|
|
* Dumps info about a machine in some kind of readable format. (Used by |
4732 |
|
|
* the 'machine' debugger command.) |
4733 |
|
|
*/ |
4734 |
|
|
void machine_dumpinfo(struct machine *m) |
4735 |
|
|
{ |
4736 |
|
|
int i; |
4737 |
|
|
|
4738 |
|
|
debug("serial nr: %i", m->serial_nr); |
4739 |
|
|
if (m->nr_of_nics > 0) |
4740 |
|
|
debug(" (nr of nics: %i)", m->nr_of_nics); |
4741 |
|
|
debug("\n"); |
4742 |
|
|
|
4743 |
|
|
debug("memory: %i MB", m->physical_ram_in_mb); |
4744 |
|
|
if (m->memory_offset_in_mb != 0) |
4745 |
|
|
debug(" (offset by %i MB)", m->memory_offset_in_mb); |
4746 |
|
|
if (m->random_mem_contents) |
4747 |
|
|
debug(", randomized contents"); |
4748 |
|
|
if (m->dbe_on_nonexistant_memaccess) |
4749 |
|
|
debug(", dbe_on_nonexistant_memaccess"); |
4750 |
|
|
debug("\n"); |
4751 |
|
|
|
4752 |
|
|
if (m->single_step_on_bad_addr) |
4753 |
|
|
debug("single-step on bad addresses\n"); |
4754 |
|
|
|
4755 |
|
|
if (m->bintrans_enable) |
4756 |
|
|
debug("bintrans enabled (%i MB cache)\n", |
4757 |
|
|
(int) (m->bintrans_size / 1048576)); |
4758 |
|
|
else |
4759 |
|
|
debug("bintrans disabled, other speedtricks %s\n", |
4760 |
|
|
m->speed_tricks? "enabled" : "disabled"); |
4761 |
|
|
|
4762 |
|
|
debug("clock: "); |
4763 |
|
|
if (m->automatic_clock_adjustment) |
4764 |
|
|
debug("adjusted automatically"); |
4765 |
|
|
else |
4766 |
|
|
debug("fixed at %i Hz", m->emulated_hz); |
4767 |
|
|
debug("\n"); |
4768 |
|
|
|
4769 |
|
|
if (!m->prom_emulation) |
4770 |
|
|
debug("PROM emulation disabled\n"); |
4771 |
|
|
|
4772 |
|
|
for (i=0; i<m->ncpus; i++) |
4773 |
|
|
cpu_dumpinfo(m, m->cpus[i]); |
4774 |
|
|
|
4775 |
|
|
if (m->ncpus > 1) |
4776 |
|
|
debug("Bootstrap cpu is nr %i\n", m->bootstrap_cpu); |
4777 |
|
|
|
4778 |
|
|
if (m->slow_serial_interrupts_hack_for_linux) |
4779 |
|
|
debug("Using slow_serial_interrupts_hack_for_linux\n"); |
4780 |
|
|
|
4781 |
|
|
if (m->use_x11) { |
4782 |
|
|
debug("Using X11"); |
4783 |
|
|
if (m->x11_scaledown > 1) |
4784 |
|
|
debug(", scaledown %i", m->x11_scaledown); |
4785 |
|
|
if (m->x11_n_display_names > 0) { |
4786 |
|
|
for (i=0; i<m->x11_n_display_names; i++) { |
4787 |
|
|
debug(i? ", " : " ("); |
4788 |
|
|
debug("\"%s\"", m->x11_display_names[i]); |
4789 |
|
|
} |
4790 |
|
|
debug(")"); |
4791 |
|
|
} |
4792 |
|
|
debug("\n"); |
4793 |
|
|
} |
4794 |
|
|
|
4795 |
|
|
diskimage_dump_info(m); |
4796 |
|
|
|
4797 |
|
|
if (m->force_netboot) |
4798 |
|
|
debug("Forced netboot\n"); |
4799 |
|
|
} |
4800 |
|
|
|
4801 |
|
|
|
4802 |
|
|
/* |
4803 |
|
|
* machine_entry_new(): |
4804 |
|
|
* |
4805 |
|
|
* This function creates a new machine_entry struct, and fills it with some |
4806 |
|
|
* valid data; it is up to the caller to add additional data that weren't |
4807 |
|
|
* passed as arguments to this function. |
4808 |
|
|
* |
4809 |
|
|
* For internal use. |
4810 |
|
|
*/ |
4811 |
|
|
static struct machine_entry *machine_entry_new(const char *name, |
4812 |
|
|
int arch, int oldstyle_type, int n_aliases, int n_subtypes) |
4813 |
|
|
{ |
4814 |
|
|
struct machine_entry *me; |
4815 |
|
|
|
4816 |
|
|
me = malloc(sizeof(struct machine_entry)); |
4817 |
|
|
if (me == NULL) { |
4818 |
|
|
fprintf(stderr, "machine_entry_new(): out of memory (1)\n"); |
4819 |
|
|
exit(1); |
4820 |
|
|
} |
4821 |
|
|
|
4822 |
|
|
memset(me, 0, sizeof(struct machine_entry)); |
4823 |
|
|
|
4824 |
|
|
me->name = name; |
4825 |
|
|
me->arch = arch; |
4826 |
|
|
me->machine_type = oldstyle_type; |
4827 |
|
|
me->n_aliases = n_aliases; |
4828 |
|
|
me->aliases = malloc(sizeof(char *) * n_aliases); |
4829 |
|
|
if (me->aliases == NULL) { |
4830 |
|
|
fprintf(stderr, "machine_entry_new(): out of memory (2)\n"); |
4831 |
|
|
exit(1); |
4832 |
|
|
} |
4833 |
|
|
me->n_subtypes = n_subtypes; |
4834 |
|
|
|
4835 |
|
|
if (n_subtypes > 0) { |
4836 |
|
|
me->subtype = malloc(sizeof(struct machine_entry_subtype *) * |
4837 |
|
|
n_subtypes); |
4838 |
|
|
if (me->subtype == NULL) { |
4839 |
|
|
fprintf(stderr, "machine_entry_new(): out of " |
4840 |
|
|
"memory (3)\n"); |
4841 |
|
|
exit(1); |
4842 |
|
|
} |
4843 |
|
|
} |
4844 |
|
|
|
4845 |
|
|
return me; |
4846 |
|
|
} |
4847 |
|
|
|
4848 |
|
|
|
4849 |
|
|
/* |
4850 |
|
|
* machine_entry_subtype_new(): |
4851 |
|
|
* |
4852 |
|
|
* This function creates a new machine_entry_subtype struct, and fills it with |
4853 |
|
|
* some valid data; it is up to the caller to add additional data that weren't |
4854 |
|
|
* passed as arguments to this function. |
4855 |
|
|
* |
4856 |
|
|
* For internal use. |
4857 |
|
|
*/ |
4858 |
|
|
static struct machine_entry_subtype *machine_entry_subtype_new( |
4859 |
|
|
const char *name, int oldstyle_type, int n_aliases) |
4860 |
|
|
{ |
4861 |
|
|
struct machine_entry_subtype *mes; |
4862 |
|
|
|
4863 |
|
|
mes = malloc(sizeof(struct machine_entry_subtype)); |
4864 |
|
|
if (mes == NULL) { |
4865 |
|
|
fprintf(stderr, "machine_entry_subtype_new(): out " |
4866 |
|
|
"of memory (1)\n"); |
4867 |
|
|
exit(1); |
4868 |
|
|
} |
4869 |
|
|
|
4870 |
|
|
memset(mes, 0, sizeof(struct machine_entry_subtype)); |
4871 |
|
|
mes->name = name; |
4872 |
|
|
mes->machine_subtype = oldstyle_type; |
4873 |
|
|
mes->n_aliases = n_aliases; |
4874 |
|
|
mes->aliases = malloc(sizeof(char *) * n_aliases); |
4875 |
|
|
if (mes->aliases == NULL) { |
4876 |
|
|
fprintf(stderr, "machine_entry_subtype_new(): " |
4877 |
|
|
"out of memory (2)\n"); |
4878 |
|
|
exit(1); |
4879 |
|
|
} |
4880 |
|
|
|
4881 |
|
|
return mes; |
4882 |
|
|
} |
4883 |
|
|
|
4884 |
|
|
|
4885 |
|
|
/* |
4886 |
|
|
* machine_list_available_types_and_cpus(): |
4887 |
|
|
* |
4888 |
|
|
* List all available machine types (for example when running the emulator |
4889 |
|
|
* with just -H as command line argument). |
4890 |
|
|
*/ |
4891 |
|
|
void machine_list_available_types_and_cpus(void) |
4892 |
|
|
{ |
4893 |
|
|
struct machine_entry *me; |
4894 |
|
|
int iadd = 8; |
4895 |
|
|
|
4896 |
|
|
debug("Available CPU types:\n\n"); |
4897 |
|
|
|
4898 |
|
|
debug_indentation(iadd); |
4899 |
|
|
cpu_list_available_types(); |
4900 |
|
|
debug_indentation(-iadd); |
4901 |
|
|
|
4902 |
|
|
debug("\nMost of the CPU types are bogus, and not really implemented." |
4903 |
|
|
" The main effect of\nselecting a specific CPU type is to choose " |
4904 |
|
|
"what kind of 'id' it will have.\n\nAvailable machine types (with " |
4905 |
|
|
"aliases) and their subtypes:\n\n"); |
4906 |
|
|
|
4907 |
|
|
debug_indentation(iadd); |
4908 |
|
|
me = first_machine_entry; |
4909 |
|
|
|
4910 |
|
|
if (me == NULL) |
4911 |
|
|
fatal("No machines defined!\n"); |
4912 |
|
|
|
4913 |
|
|
while (me != NULL) { |
4914 |
|
|
int i, j, iadd = 4; |
4915 |
|
|
|
4916 |
|
|
debug("%s", me->name); |
4917 |
|
|
debug(" ("); |
4918 |
|
|
for (i=0; i<me->n_aliases; i++) |
4919 |
|
|
debug("%s\"%s\"", i? ", " : "", me->aliases[i]); |
4920 |
|
|
debug(")\n"); |
4921 |
|
|
|
4922 |
|
|
debug_indentation(iadd); |
4923 |
|
|
for (i=0; i<me->n_subtypes; i++) { |
4924 |
|
|
struct machine_entry_subtype *mes; |
4925 |
|
|
mes = me->subtype[i]; |
4926 |
|
|
debug("- %s", mes->name); |
4927 |
|
|
debug(" ("); |
4928 |
|
|
for (j=0; j<mes->n_aliases; j++) |
4929 |
|
|
debug("%s\"%s\"", j? ", " : "", |
4930 |
|
|
mes->aliases[j]); |
4931 |
|
|
debug(")\n"); |
4932 |
|
|
} |
4933 |
|
|
debug_indentation(-iadd); |
4934 |
|
|
|
4935 |
|
|
me = me->next; |
4936 |
|
|
} |
4937 |
|
|
debug_indentation(-iadd); |
4938 |
|
|
|
4939 |
|
|
debug("\nMost of the machine types are bogus too. Please read the " |
4940 |
|
|
"GXemul\ndocumentation for information about which machine" |
4941 |
|
|
" types that actually\nwork. Use the alias when selecting a " |
4942 |
|
|
"machine type or subtype, not the\nreal name.\n"); |
4943 |
|
|
|
4944 |
|
|
debug("\n"); |
4945 |
|
|
|
4946 |
|
|
useremul_list_emuls(); |
4947 |
|
|
} |
4948 |
|
|
|
4949 |
|
|
|
4950 |
|
|
/* |
4951 |
|
|
* machine_init(): |
4952 |
|
|
* |
4953 |
|
|
* This function should be called before any other machine_*() function |
4954 |
|
|
* is used. |
4955 |
|
|
*/ |
4956 |
|
|
void machine_init(void) |
4957 |
|
|
{ |
4958 |
|
|
struct machine_entry *me; |
4959 |
|
|
|
4960 |
|
|
/* |
4961 |
|
|
* NOTE: This list is in reverse order, so that the |
4962 |
|
|
* entries will appear in normal order when listed. :-) |
4963 |
|
|
*/ |
4964 |
|
|
|
4965 |
|
|
/* Walnut: (NetBSD/evbppc) */ |
4966 |
|
|
me = machine_entry_new("Walnut evaluation board", ARCH_PPC, |
4967 |
|
|
MACHINE_WALNUT, 2, 0); |
4968 |
|
|
me->aliases[0] = "walnut"; |
4969 |
|
|
me->aliases[1] = "evbppc"; |
4970 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
4971 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
4972 |
|
|
} |
4973 |
|
|
|
4974 |
|
|
/* Test-machine for URISC: */ |
4975 |
|
|
me = machine_entry_new("Test-machine for URISC", ARCH_URISC, |
4976 |
|
|
MACHINE_TESTURISC, 1, 0); |
4977 |
|
|
me->aliases[0] = "testurisc"; |
4978 |
|
|
if (cpu_family_ptr_by_number(ARCH_URISC) != NULL) { |
4979 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
4980 |
|
|
} |
4981 |
|
|
|
4982 |
|
|
/* Test-machine for PPC: */ |
4983 |
|
|
me = machine_entry_new("Test-machine for PPC", ARCH_PPC, |
4984 |
|
|
MACHINE_TESTPPC, 1, 0); |
4985 |
|
|
me->aliases[0] = "testppc"; |
4986 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
4987 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
4988 |
|
|
} |
4989 |
|
|
|
4990 |
|
|
/* Test-machine for MIPS: */ |
4991 |
|
|
me = machine_entry_new("Test-machine for MIPS", ARCH_MIPS, |
4992 |
|
|
MACHINE_TESTMIPS, 1, 0); |
4993 |
|
|
me->aliases[0] = "testmips"; |
4994 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
4995 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
4996 |
|
|
} |
4997 |
|
|
|
4998 |
|
|
/* Test-machine for HPPA: */ |
4999 |
|
|
me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, |
5000 |
|
|
MACHINE_TESTHPPA, 1, 0); |
5001 |
|
|
me->aliases[0] = "testhppa"; |
5002 |
|
|
if (cpu_family_ptr_by_number(ARCH_HPPA) != NULL) { |
5003 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5004 |
|
|
} |
5005 |
|
|
|
5006 |
|
|
/* Test-machine for Alpha: */ |
5007 |
|
|
me = machine_entry_new("Test-machine for Alpha", ARCH_ALPHA, |
5008 |
|
|
MACHINE_TESTALPHA, 1, 0); |
5009 |
|
|
me->aliases[0] = "testalpha"; |
5010 |
|
|
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
5011 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5012 |
|
|
} |
5013 |
|
|
|
5014 |
|
|
/* Sun Ultra1: */ |
5015 |
|
|
me = machine_entry_new("Sun Ultra1", ARCH_SPARC, MACHINE_ULTRA1, 1, 0); |
5016 |
|
|
me->aliases[0] = "ultra1"; |
5017 |
|
|
if (cpu_family_ptr_by_number(ARCH_SPARC) != NULL) { |
5018 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5019 |
|
|
} |
5020 |
|
|
|
5021 |
|
|
/* Sony Playstation 2: */ |
5022 |
|
|
me = machine_entry_new("Sony Playstation 2", ARCH_MIPS, |
5023 |
|
|
MACHINE_PS2, 2, 0); |
5024 |
|
|
me->aliases[0] = "playstation2"; |
5025 |
|
|
me->aliases[1] = "ps2"; |
5026 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5027 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5028 |
|
|
} |
5029 |
|
|
|
5030 |
|
|
/* Sony NeWS: */ |
5031 |
|
|
me = machine_entry_new("Sony NeWS", ARCH_MIPS, |
5032 |
|
|
MACHINE_SONYNEWS, 2, 0); |
5033 |
|
|
me->aliases[0] = "sonynews"; |
5034 |
|
|
me->aliases[1] = "news"; |
5035 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5036 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5037 |
|
|
} |
5038 |
|
|
|
5039 |
|
|
/* SGI: */ |
5040 |
|
|
me = machine_entry_new("SGI", ARCH_MIPS, MACHINE_SGI, 2, 9); |
5041 |
|
|
me->aliases[0] = "silicon graphics"; |
5042 |
|
|
me->aliases[1] = "sgi"; |
5043 |
|
|
me->subtype[0] = machine_entry_subtype_new("IP19", 19, 1); |
5044 |
|
|
me->subtype[0]->aliases[0] = "ip19"; |
5045 |
|
|
me->subtype[1] = machine_entry_subtype_new("IP20", 20, 1); |
5046 |
|
|
me->subtype[1]->aliases[0] = "ip20"; |
5047 |
|
|
me->subtype[2] = machine_entry_subtype_new("IP22", 22, 2); |
5048 |
|
|
me->subtype[2]->aliases[0] = "ip22"; |
5049 |
|
|
me->subtype[2]->aliases[1] = "indy"; |
5050 |
|
|
me->subtype[3] = machine_entry_subtype_new("IP24", 24, 1); |
5051 |
|
|
me->subtype[3]->aliases[0] = "ip24"; |
5052 |
|
|
me->subtype[4] = machine_entry_subtype_new("IP27", 27, 3); |
5053 |
|
|
me->subtype[4]->aliases[0] = "ip27"; |
5054 |
|
|
me->subtype[4]->aliases[1] = "origin 200"; |
5055 |
|
|
me->subtype[4]->aliases[2] = "origin 2000"; |
5056 |
|
|
me->subtype[5] = machine_entry_subtype_new("IP28", 28, 1); |
5057 |
|
|
me->subtype[5]->aliases[0] = "ip28"; |
5058 |
|
|
me->subtype[6] = machine_entry_subtype_new("IP30", 30, 2); |
5059 |
|
|
me->subtype[6]->aliases[0] = "ip30"; |
5060 |
|
|
me->subtype[6]->aliases[1] = "octane"; |
5061 |
|
|
me->subtype[7] = machine_entry_subtype_new("IP32", 32, 2); |
5062 |
|
|
me->subtype[7]->aliases[0] = "ip32"; |
5063 |
|
|
me->subtype[7]->aliases[1] = "o2"; |
5064 |
|
|
me->subtype[8] = machine_entry_subtype_new("IP35", 35, 1); |
5065 |
|
|
me->subtype[8]->aliases[0] = "ip35"; |
5066 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5067 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5068 |
|
|
} |
5069 |
|
|
|
5070 |
|
|
/* PReP: (NetBSD/prep etc.) */ |
5071 |
|
|
me = machine_entry_new("PowerPC Reference Platform", ARCH_PPC, |
5072 |
|
|
MACHINE_PREP, 1, 0); |
5073 |
|
|
me->aliases[0] = "prep"; |
5074 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5075 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5076 |
|
|
} |
5077 |
|
|
|
5078 |
|
|
/* NetGear: */ |
5079 |
|
|
me = machine_entry_new("NetGear WG602", ARCH_MIPS, |
5080 |
|
|
MACHINE_NETGEAR, 2, 0); |
5081 |
|
|
me->aliases[0] = "netgear"; |
5082 |
|
|
me->aliases[1] = "wg602"; |
5083 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5084 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5085 |
|
|
} |
5086 |
|
|
|
5087 |
|
|
/* Motorola Sandpoint: (NetBSD/sandpoint) */ |
5088 |
|
|
me = machine_entry_new("Motorola Sandpoint", |
5089 |
|
|
ARCH_PPC, MACHINE_SANDPOINT, 1, 0); |
5090 |
|
|
me->aliases[0] = "sandpoint"; |
5091 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5092 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5093 |
|
|
} |
5094 |
|
|
|
5095 |
|
|
/* Meshcube: */ |
5096 |
|
|
me = machine_entry_new("Meshcube", ARCH_MIPS, MACHINE_MESHCUBE, 1, 0); |
5097 |
|
|
me->aliases[0] = "meshcube"; |
5098 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5099 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5100 |
|
|
} |
5101 |
|
|
|
5102 |
|
|
/* Macintosh (PPC): */ |
5103 |
|
|
me = machine_entry_new("Macintosh (PPC)", ARCH_PPC, |
5104 |
|
|
MACHINE_MACPPC, 1, 2); |
5105 |
|
|
me->aliases[0] = "macppc"; |
5106 |
|
|
me->subtype[0] = machine_entry_subtype_new("MacPPC G4", |
5107 |
|
|
MACHINE_MACPPC_G4, 1); |
5108 |
|
|
me->subtype[0]->aliases[0] = "g4"; |
5109 |
|
|
me->subtype[1] = machine_entry_subtype_new("MacPPC G5", |
5110 |
|
|
MACHINE_MACPPC_G5, 1); |
5111 |
|
|
me->subtype[1]->aliases[0] = "g5"; |
5112 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5113 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5114 |
|
|
} |
5115 |
|
|
|
5116 |
|
|
/* Linksys: */ |
5117 |
|
|
me = machine_entry_new("Linksys WRT54G", ARCH_MIPS, |
5118 |
|
|
MACHINE_WRT54G, 2, 0); |
5119 |
|
|
me->aliases[0] = "linksys"; |
5120 |
|
|
me->aliases[1] = "wrt54g"; |
5121 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5122 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5123 |
|
|
} |
5124 |
|
|
|
5125 |
|
|
/* HPCmips: */ |
5126 |
|
|
me = machine_entry_new("Handheld MIPS (HPC)", |
5127 |
|
|
ARCH_MIPS, MACHINE_HPCMIPS, 2, 8); |
5128 |
|
|
me->aliases[0] = "hpcmips"; |
5129 |
|
|
me->aliases[1] = "hpc"; |
5130 |
|
|
me->subtype[0] = machine_entry_subtype_new( |
5131 |
|
|
"Casio Cassiopeia BE-300", MACHINE_HPCMIPS_CASIO_BE300, 2); |
5132 |
|
|
me->subtype[0]->aliases[0] = "be-300"; |
5133 |
|
|
me->subtype[0]->aliases[1] = "be300"; |
5134 |
|
|
me->subtype[1] = machine_entry_subtype_new( |
5135 |
|
|
"Casio Cassiopeia E-105", MACHINE_HPCMIPS_CASIO_E105, 2); |
5136 |
|
|
me->subtype[1]->aliases[0] = "e-105"; |
5137 |
|
|
me->subtype[1]->aliases[1] = "e105"; |
5138 |
|
|
me->subtype[2] = machine_entry_subtype_new( |
5139 |
|
|
"Agenda VR3", MACHINE_HPCMIPS_AGENDA_VR3, 2); |
5140 |
|
|
me->subtype[2]->aliases[0] = "agenda"; |
5141 |
|
|
me->subtype[2]->aliases[1] = "vr3"; |
5142 |
|
|
me->subtype[3] = machine_entry_subtype_new( |
5143 |
|
|
"IBM WorkPad Z50", MACHINE_HPCMIPS_IBM_WORKPAD_Z50, 2); |
5144 |
|
|
me->subtype[3]->aliases[0] = "workpad"; |
5145 |
|
|
me->subtype[3]->aliases[1] = "z50"; |
5146 |
|
|
me->subtype[4] = machine_entry_subtype_new( |
5147 |
|
|
"NEC MobilePro 770", MACHINE_HPCMIPS_NEC_MOBILEPRO_770, 1); |
5148 |
|
|
me->subtype[4]->aliases[0] = "mobilepro770"; |
5149 |
|
|
me->subtype[5] = machine_entry_subtype_new( |
5150 |
|
|
"NEC MobilePro 780", MACHINE_HPCMIPS_NEC_MOBILEPRO_780, 1); |
5151 |
|
|
me->subtype[5]->aliases[0] = "mobilepro780"; |
5152 |
|
|
me->subtype[6] = machine_entry_subtype_new( |
5153 |
|
|
"NEC MobilePro 800", MACHINE_HPCMIPS_NEC_MOBILEPRO_800, 1); |
5154 |
|
|
me->subtype[6]->aliases[0] = "mobilepro800"; |
5155 |
|
|
me->subtype[7] = machine_entry_subtype_new( |
5156 |
|
|
"NEC MobilePro 880", MACHINE_HPCMIPS_NEC_MOBILEPRO_880, 1); |
5157 |
|
|
me->subtype[7]->aliases[0] = "mobilepro880"; |
5158 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5159 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5160 |
|
|
} |
5161 |
|
|
|
5162 |
|
|
/* Generic "bare" URISC machine: */ |
5163 |
|
|
me = machine_entry_new("Generic \"bare\" URISC machine", ARCH_URISC, |
5164 |
|
|
MACHINE_BAREURISC, 1, 0); |
5165 |
|
|
me->aliases[0] = "bareurisc"; |
5166 |
|
|
if (cpu_family_ptr_by_number(ARCH_URISC) != NULL) { |
5167 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5168 |
|
|
} |
5169 |
|
|
|
5170 |
|
|
/* Generic "bare" SPARC machine: */ |
5171 |
|
|
me = machine_entry_new("Generic \"bare\" SPARC machine", ARCH_SPARC, |
5172 |
|
|
MACHINE_BARESPARC, 1, 0); |
5173 |
|
|
me->aliases[0] = "baresparc"; |
5174 |
|
|
if (cpu_family_ptr_by_number(ARCH_SPARC) != NULL) { |
5175 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5176 |
|
|
} |
5177 |
|
|
|
5178 |
|
|
/* Generic "bare" PPC machine: */ |
5179 |
|
|
me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, |
5180 |
|
|
MACHINE_BAREPPC, 1, 0); |
5181 |
|
|
me->aliases[0] = "bareppc"; |
5182 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5183 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5184 |
|
|
} |
5185 |
|
|
|
5186 |
|
|
/* Generic "bare" MIPS machine: */ |
5187 |
|
|
me = machine_entry_new("Generic \"bare\" MIPS machine", ARCH_MIPS, |
5188 |
|
|
MACHINE_BAREMIPS, 1, 0); |
5189 |
|
|
me->aliases[0] = "baremips"; |
5190 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5191 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5192 |
|
|
} |
5193 |
|
|
|
5194 |
|
|
/* Generic "bare" HPPA machine: */ |
5195 |
|
|
me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, |
5196 |
|
|
MACHINE_BAREHPPA, 1, 0); |
5197 |
|
|
me->aliases[0] = "barehppa"; |
5198 |
|
|
if (cpu_family_ptr_by_number(ARCH_HPPA) != NULL) { |
5199 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5200 |
|
|
} |
5201 |
|
|
|
5202 |
|
|
/* Generic "bare" Alpha machine: */ |
5203 |
|
|
me = machine_entry_new("Generic \"bare\" Alpha machine", ARCH_ALPHA, |
5204 |
|
|
MACHINE_BAREALPHA, 1, 0); |
5205 |
|
|
me->aliases[0] = "barealpha"; |
5206 |
|
|
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
5207 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5208 |
|
|
} |
5209 |
|
|
|
5210 |
|
|
/* DECstation: */ |
5211 |
|
|
me = machine_entry_new("DECstation/DECsystem", |
5212 |
|
|
ARCH_MIPS, MACHINE_DEC, 3, 9); |
5213 |
|
|
me->aliases[0] = "decstation"; |
5214 |
|
|
me->aliases[1] = "decsystem"; |
5215 |
|
|
me->aliases[2] = "dec"; |
5216 |
|
|
me->subtype[0] = machine_entry_subtype_new( |
5217 |
|
|
"DECstation 3100 (PMAX)", MACHINE_DEC_PMAX_3100, 3); |
5218 |
|
|
me->subtype[0]->aliases[0] = "pmax"; |
5219 |
|
|
me->subtype[0]->aliases[1] = "3100"; |
5220 |
|
|
me->subtype[0]->aliases[2] = "2100"; |
5221 |
|
|
|
5222 |
|
|
me->subtype[1] = machine_entry_subtype_new( |
5223 |
|
|
"DECstation 5000/200 (3MAX)", MACHINE_DEC_3MAX_5000, 2); |
5224 |
|
|
me->subtype[1]->aliases[0] = "3max"; |
5225 |
|
|
me->subtype[1]->aliases[1] = "5000/200"; |
5226 |
|
|
|
5227 |
|
|
me->subtype[2] = machine_entry_subtype_new( |
5228 |
|
|
"DECstation 5000/1xx (3MIN)", MACHINE_DEC_3MIN_5000, 2); |
5229 |
|
|
me->subtype[2]->aliases[0] = "3min"; |
5230 |
|
|
me->subtype[2]->aliases[1] = "5000/1xx"; |
5231 |
|
|
|
5232 |
|
|
me->subtype[3] = machine_entry_subtype_new( |
5233 |
|
|
"DECstation 5000 (3MAXPLUS)", MACHINE_DEC_3MAXPLUS_5000, 2); |
5234 |
|
|
me->subtype[3]->aliases[0] = "3maxplus"; |
5235 |
|
|
me->subtype[3]->aliases[1] = "3max+"; |
5236 |
|
|
|
5237 |
|
|
me->subtype[4] = machine_entry_subtype_new( |
5238 |
|
|
"DECsystem 58x0", MACHINE_DEC_5800, 2); |
5239 |
|
|
me->subtype[4]->aliases[0] = "5800"; |
5240 |
|
|
me->subtype[4]->aliases[1] = "58x0"; |
5241 |
|
|
|
5242 |
|
|
me->subtype[5] = machine_entry_subtype_new( |
5243 |
|
|
"DECsystem 5400", MACHINE_DEC_5400, 1); |
5244 |
|
|
me->subtype[5]->aliases[0] = "5400"; |
5245 |
|
|
|
5246 |
|
|
me->subtype[6] = machine_entry_subtype_new( |
5247 |
|
|
"DECstation Maxine (5000)", MACHINE_DEC_MAXINE_5000, 1); |
5248 |
|
|
me->subtype[6]->aliases[0] = "maxine"; |
5249 |
|
|
|
5250 |
|
|
me->subtype[7] = machine_entry_subtype_new( |
5251 |
|
|
"DECsystem 5500", MACHINE_DEC_5500, 1); |
5252 |
|
|
me->subtype[7]->aliases[0] = "5500"; |
5253 |
|
|
|
5254 |
|
|
me->subtype[8] = machine_entry_subtype_new( |
5255 |
|
|
"DECstation MipsMate (5100)", MACHINE_DEC_MIPSMATE_5100, 2); |
5256 |
|
|
me->subtype[8]->aliases[0] = "5100"; |
5257 |
|
|
me->subtype[8]->aliases[1] = "mipsmate"; |
5258 |
|
|
|
5259 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5260 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5261 |
|
|
} |
5262 |
|
|
|
5263 |
|
|
/* DB64360: (for playing with PMON for PPC) */ |
5264 |
|
|
me = machine_entry_new("DB64360", ARCH_PPC, MACHINE_DB64360, 1, 0); |
5265 |
|
|
me->aliases[0] = "db64360"; |
5266 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5267 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5268 |
|
|
} |
5269 |
|
|
|
5270 |
|
|
/* Cobalt: */ |
5271 |
|
|
me = machine_entry_new("Cobalt", ARCH_MIPS, MACHINE_COBALT, 1, 0); |
5272 |
|
|
me->aliases[0] = "cobalt"; |
5273 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5274 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5275 |
|
|
} |
5276 |
|
|
|
5277 |
|
|
/* BeBox: (NetBSD/bebox) */ |
5278 |
|
|
me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); |
5279 |
|
|
me->aliases[0] = "bebox"; |
5280 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5281 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5282 |
|
|
} |
5283 |
|
|
|
5284 |
|
|
/* Artesyn's PM/PPC board: (NetBSD/pmppc) */ |
5285 |
|
|
me = machine_entry_new("Artesyn's PM/PPC board", ARCH_PPC, |
5286 |
|
|
MACHINE_PMPPC, 1, 0); |
5287 |
|
|
me->aliases[0] = "pmppc"; |
5288 |
|
|
if (cpu_family_ptr_by_number(ARCH_PPC) != NULL) { |
5289 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5290 |
|
|
} |
5291 |
|
|
|
5292 |
|
|
/* ARC: */ |
5293 |
|
|
me = machine_entry_new("ARC", ARCH_MIPS, MACHINE_ARC, 1, 8); |
5294 |
|
|
me->aliases[0] = "arc"; |
5295 |
|
|
|
5296 |
|
|
me->subtype[0] = machine_entry_subtype_new( |
5297 |
|
|
"Acer PICA-61", MACHINE_ARC_JAZZ_PICA, 3); |
5298 |
|
|
me->subtype[0]->aliases[0] = "pica-61"; |
5299 |
|
|
me->subtype[0]->aliases[1] = "acer pica"; |
5300 |
|
|
me->subtype[0]->aliases[2] = "pica"; |
5301 |
|
|
|
5302 |
|
|
me->subtype[1] = machine_entry_subtype_new( |
5303 |
|
|
"Deskstation Tyne", MACHINE_ARC_DESKTECH_TYNE, 3); |
5304 |
|
|
me->subtype[1]->aliases[0] = "deskstation tyne"; |
5305 |
|
|
me->subtype[1]->aliases[1] = "desktech"; |
5306 |
|
|
me->subtype[1]->aliases[2] = "tyne"; |
5307 |
|
|
|
5308 |
|
|
me->subtype[2] = machine_entry_subtype_new( |
5309 |
|
|
"Jazz Magnum", MACHINE_ARC_JAZZ_MAGNUM, 2); |
5310 |
|
|
me->subtype[2]->aliases[0] = "magnum"; |
5311 |
|
|
me->subtype[2]->aliases[1] = "jazz magnum"; |
5312 |
|
|
|
5313 |
|
|
me->subtype[3] = machine_entry_subtype_new( |
5314 |
|
|
"NEC-R94", MACHINE_ARC_NEC_R94, 2); |
5315 |
|
|
me->subtype[3]->aliases[0] = "nec-r94"; |
5316 |
|
|
me->subtype[3]->aliases[1] = "r94"; |
5317 |
|
|
|
5318 |
|
|
me->subtype[4] = machine_entry_subtype_new( |
5319 |
|
|
"NEC-RD94", MACHINE_ARC_NEC_RD94, 2); |
5320 |
|
|
me->subtype[4]->aliases[0] = "nec-rd94"; |
5321 |
|
|
me->subtype[4]->aliases[1] = "rd94"; |
5322 |
|
|
|
5323 |
|
|
me->subtype[5] = machine_entry_subtype_new( |
5324 |
|
|
"NEC-R96", MACHINE_ARC_NEC_R96, 2); |
5325 |
|
|
me->subtype[5]->aliases[0] = "nec-r96"; |
5326 |
|
|
me->subtype[5]->aliases[1] = "r96"; |
5327 |
|
|
|
5328 |
|
|
me->subtype[6] = machine_entry_subtype_new( |
5329 |
|
|
"NEC-R98", MACHINE_ARC_NEC_R98, 2); |
5330 |
|
|
me->subtype[6]->aliases[0] = "nec-r98"; |
5331 |
|
|
me->subtype[6]->aliases[1] = "r98"; |
5332 |
|
|
|
5333 |
|
|
me->subtype[7] = machine_entry_subtype_new( |
5334 |
|
|
"Olivetti M700", MACHINE_ARC_JAZZ_M700, 2); |
5335 |
|
|
me->subtype[7]->aliases[0] = "olivetti"; |
5336 |
|
|
me->subtype[7]->aliases[1] = "m700"; |
5337 |
|
|
|
5338 |
|
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5339 |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
5340 |
|
|
} |
5341 |
|
|
} |
5342 |
|
|
|