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