25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine.c,v 1.452 2005/06/02 17:11:34 debug Exp $ |
* $Id: machine.c,v 1.569 2005/10/11 03:31:27 debug Exp $ |
29 |
* |
* |
30 |
* Emulation of specific machines. |
* Emulation of specific machines. |
31 |
* |
* |
53 |
#include "arcbios.h" |
#include "arcbios.h" |
54 |
#include "bus_pci.h" |
#include "bus_pci.h" |
55 |
#include "cpu.h" |
#include "cpu.h" |
|
#include "cpu_mips.h" |
|
56 |
#include "device.h" |
#include "device.h" |
57 |
#include "devices.h" |
#include "devices.h" |
58 |
#include "diskimage.h" |
#include "diskimage.h" |
64 |
#include "net.h" |
#include "net.h" |
65 |
#include "symbol.h" |
#include "symbol.h" |
66 |
|
|
67 |
|
/* For Alpha emulation: */ |
68 |
|
#include "alpha_rpb.h" |
69 |
|
|
70 |
|
/* For CATS emulation: */ |
71 |
|
#include "cyclone_boot.h" |
72 |
|
|
73 |
/* For SGI and ARC emulation: */ |
/* For SGI and ARC emulation: */ |
74 |
#include "sgi_arcbios.h" |
#include "sgi_arcbios.h" |
75 |
#include "crimereg.h" |
#include "crimereg.h" |
76 |
|
|
77 |
|
/* For evbmips emulation: */ |
78 |
|
#include "maltareg.h" |
79 |
|
|
80 |
/* For DECstation emulation: */ |
/* For DECstation emulation: */ |
81 |
#include "dec_prom.h" |
#include "dec_prom.h" |
82 |
#include "dec_bootinfo.h" |
#include "dec_bootinfo.h" |
91 |
#include "hpc_bootinfo.h" |
#include "hpc_bootinfo.h" |
92 |
#include "vripreg.h" |
#include "vripreg.h" |
93 |
|
|
94 |
|
#define BOOTSTR_BUFLEN 1000 |
95 |
|
#define BOOTARG_BUFLEN 2000 |
96 |
|
#define ETHERNET_STRING_MAXLEN 40 |
97 |
|
|
98 |
struct machine_entry_subtype { |
struct machine_entry_subtype { |
99 |
int machine_subtype;/* Old-style subtype */ |
int machine_subtype;/* Old-style subtype */ |
148 |
m->name = strdup(name); |
m->name = strdup(name); |
149 |
|
|
150 |
/* Sane default values: */ |
/* Sane default values: */ |
151 |
m->serial_nr = 0; |
m->serial_nr = 1; |
152 |
m->machine_type = MACHINE_NONE; |
m->machine_type = MACHINE_NONE; |
153 |
m->machine_subtype = MACHINE_NONE; |
m->machine_subtype = MACHINE_NONE; |
154 |
|
#ifdef BINTRANS |
155 |
m->bintrans_enable = 1; |
m->bintrans_enable = 1; |
156 |
|
m->old_bintrans_enable = 1; |
157 |
|
#endif |
158 |
|
m->arch_pagesize = 4096; /* Should be overriden in |
159 |
|
emul.c for other pagesizes. */ |
160 |
|
m->dyntrans_alignment_check = 1; |
161 |
m->prom_emulation = 1; |
m->prom_emulation = 1; |
162 |
m->speed_tricks = 1; |
m->speed_tricks = 1; |
163 |
m->byte_order_override = NO_BYTE_ORDER_OVERRIDE; |
m->byte_order_override = NO_BYTE_ORDER_OVERRIDE; |
188 |
int *type, int *subtype, int *arch) |
int *type, int *subtype, int *arch) |
189 |
{ |
{ |
190 |
struct machine_entry *me; |
struct machine_entry *me; |
191 |
int i, j, k; |
int i, j, k, nmatches = 0; |
192 |
|
|
193 |
*type = MACHINE_NONE; |
*type = MACHINE_NONE; |
194 |
*subtype = 0; |
*subtype = 0; |
195 |
|
|
196 |
|
/* Check stype, and optionally ssubtype: */ |
197 |
me = first_machine_entry; |
me = first_machine_entry; |
198 |
while (me != NULL) { |
while (me != NULL) { |
199 |
for (i=0; i<me->n_aliases; i++) |
for (i=0; i<me->n_aliases; i++) |
228 |
me = me->next; |
me = me->next; |
229 |
} |
} |
230 |
|
|
231 |
fatal("\nSorry, emulation \"%s\"", stype); |
/* Not found? Then just check ssubtype: */ |
232 |
if (ssubtype != NULL && ssubtype[0] != '\0') |
me = first_machine_entry; |
233 |
fatal(" (subtype \"%s\")", ssubtype); |
while (me != NULL) { |
234 |
fatal(" is unknown.\n"); |
if (me->n_subtypes == 0) { |
235 |
fatal("Use the -H command line option to get a list of available" |
me = me->next; |
236 |
" types and subtypes.\n\n"); |
continue; |
237 |
|
} |
238 |
|
|
239 |
|
/* Check for subtype: */ |
240 |
|
for (j=0; j<me->n_subtypes; j++) |
241 |
|
for (k=0; k<me->subtype[j]->n_aliases; k++) |
242 |
|
if (strcasecmp(ssubtype, me->subtype[j]-> |
243 |
|
aliases[k]) == 0) { |
244 |
|
*type = me->machine_type; |
245 |
|
*arch = me->arch; |
246 |
|
*subtype = me->subtype[j]-> |
247 |
|
machine_subtype; |
248 |
|
nmatches ++; |
249 |
|
} |
250 |
|
|
251 |
|
me = me->next; |
252 |
|
} |
253 |
|
|
254 |
|
switch (nmatches) { |
255 |
|
case 0: fatal("\nSorry, emulation \"%s\"", stype); |
256 |
|
if (ssubtype != NULL && ssubtype[0] != '\0') |
257 |
|
fatal(" (subtype \"%s\")", ssubtype); |
258 |
|
fatal(" is unknown.\n"); |
259 |
|
break; |
260 |
|
case 1: return 1; |
261 |
|
default:fatal("\nSorry, multiple matches for \"%s\"", stype); |
262 |
|
if (ssubtype != NULL && ssubtype[0] != '\0') |
263 |
|
fatal(" (subtype \"%s\")", ssubtype); |
264 |
|
fatal(".\n"); |
265 |
|
} |
266 |
|
|
267 |
|
*type = MACHINE_NONE; |
268 |
|
*subtype = 0; |
269 |
|
|
270 |
|
fatal("Use the -H command line option to get a list of " |
271 |
|
"available types and subtypes.\n\n"); |
272 |
|
|
273 |
return 0; |
return 0; |
274 |
} |
} |
275 |
|
|
391 |
|
|
392 |
|
|
393 |
/* |
/* |
394 |
|
* add_environment_string_dual(): |
395 |
|
* |
396 |
|
* Add "dual" environment strings, one for the variable name and one for the |
397 |
|
* value, and update pointers afterwards. |
398 |
|
*/ |
399 |
|
void add_environment_string_dual(struct cpu *cpu, |
400 |
|
uint64_t *ptrp, uint64_t *addrp, char *s1, char *s2) |
401 |
|
{ |
402 |
|
uint64_t ptr = *ptrp, addr = *addrp; |
403 |
|
|
404 |
|
store_32bit_word(cpu, ptr, addr); |
405 |
|
ptr += sizeof(uint32_t); |
406 |
|
if (addr != 0) { |
407 |
|
store_string(cpu, addr, s1); |
408 |
|
addr += strlen(s1) + 1; |
409 |
|
} |
410 |
|
store_32bit_word(cpu, ptr, addr); |
411 |
|
ptr += sizeof(uint32_t); |
412 |
|
if (addr != 0) { |
413 |
|
store_string(cpu, addr, s2); |
414 |
|
addr += strlen(s2) + 1; |
415 |
|
} |
416 |
|
|
417 |
|
*ptrp = ptr; |
418 |
|
*addrp = addr; |
419 |
|
} |
420 |
|
|
421 |
|
|
422 |
|
/* |
423 |
* store_64bit_word(): |
* store_64bit_word(): |
424 |
* |
* |
425 |
* Stores a 64-bit word in emulated RAM. Byte order is taken into account. |
* Stores a 64-bit word in emulated RAM. Byte order is taken into account. |
459 |
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32) |
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32) |
460 |
{ |
{ |
461 |
unsigned char data[4]; |
unsigned char data[4]; |
462 |
if ((addr >> 32) == 0) |
if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) |
463 |
addr = (int64_t)(int32_t)addr; |
addr = (int64_t)(int32_t)addr; |
464 |
data[0] = (data32 >> 24) & 255; |
data[0] = (data32 >> 24) & 255; |
465 |
data[1] = (data32 >> 16) & 255; |
data[1] = (data32 >> 16) & 255; |
484 |
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16) |
int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16) |
485 |
{ |
{ |
486 |
unsigned char data[2]; |
unsigned char data[2]; |
487 |
if ((addr >> 32) == 0) |
if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) |
488 |
addr = (int64_t)(int32_t)addr; |
addr = (int64_t)(int32_t)addr; |
489 |
data[0] = (data16 >> 8) & 255; |
data[0] = (data16 >> 8) & 255; |
490 |
data[1] = (data16) & 255; |
data[1] = (data16) & 255; |
505 |
{ |
{ |
506 |
int psize = 1024; /* 1024 256 64 16 4 1 */ |
int psize = 1024; /* 1024 256 64 16 4 1 */ |
507 |
|
|
508 |
if ((addr >> 32) == 0) |
if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) |
509 |
addr = (int64_t)(int32_t)addr; |
addr = (int64_t)(int32_t)addr; |
510 |
|
|
511 |
while (len != 0) { |
while (len != 0) { |
558 |
{ |
{ |
559 |
unsigned char data[4]; |
unsigned char data[4]; |
560 |
|
|
561 |
if ((addr >> 32) == 0) |
if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) |
562 |
addr = (int64_t)(int32_t)addr; |
addr = (int64_t)(int32_t)addr; |
563 |
cpu->memory_rw(cpu, cpu->mem, |
cpu->memory_rw(cpu, cpu->mem, |
564 |
addr, data, sizeof(data), MEM_READ, CACHE_DATA); |
addr, data, sizeof(data), MEM_READ, CACHE_DATA); |
582 |
{ |
{ |
583 |
unsigned char data[2]; |
unsigned char data[2]; |
584 |
|
|
585 |
if ((addr >> 32) == 0) |
if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) |
586 |
addr = (int64_t)(int32_t)addr; |
addr = (int64_t)(int32_t)addr; |
587 |
cpu->memory_rw(cpu, cpu->mem, |
cpu->memory_rw(cpu, cpu->mem, |
588 |
addr, data, sizeof(data), MEM_READ, CACHE_DATA); |
addr, data, sizeof(data), MEM_READ, CACHE_DATA); |
1136 |
* interrupt 2 should be asserted. |
* interrupt 2 should be asserted. |
1137 |
* |
* |
1138 |
* TODO: how should all this be done nicely? |
* TODO: how should all this be done nicely? |
|
* |
|
|
* TODO: mace interrupt mask |
|
1139 |
*/ |
*/ |
1140 |
|
|
1141 |
uint64_t crime_addr = CRIME_INTSTAT; |
uint64_t crime_addr = CRIME_INTSTAT; |
1142 |
uint64_t mace_addr = 0x14; |
uint64_t mace_addr = 0x10; |
1143 |
uint64_t crime_interrupts, crime_interrupts_mask, mace_interrupts; |
uint64_t crime_interrupts, crime_interrupts_mask; |
1144 |
|
uint64_t mace_interrupts, mace_interrupt_mask; |
1145 |
unsigned int i; |
unsigned int i; |
1146 |
unsigned char x[8]; |
unsigned char x[8]; |
1147 |
|
|
1148 |
|
/* Read current MACE interrupt assertions: */ |
1149 |
|
memcpy(x, m->md_int.ip32.mace_data->reg + mace_addr, |
1150 |
|
sizeof(uint64_t)); |
1151 |
|
mace_interrupts = 0; |
1152 |
|
for (i=0; i<sizeof(uint64_t); i++) { |
1153 |
|
mace_interrupts <<= 8; |
1154 |
|
mace_interrupts |= x[i]; |
1155 |
|
} |
1156 |
|
|
1157 |
|
/* Read current MACE interrupt mask: */ |
1158 |
|
memcpy(x, m->md_int.ip32.mace_data->reg + mace_addr + 8, |
1159 |
|
sizeof(uint64_t)); |
1160 |
|
mace_interrupt_mask = 0; |
1161 |
|
for (i=0; i<sizeof(uint64_t); i++) { |
1162 |
|
mace_interrupt_mask <<= 8; |
1163 |
|
mace_interrupt_mask |= x[i]; |
1164 |
|
} |
1165 |
|
|
1166 |
/* |
/* |
1167 |
* This mapping of both MACE and CRIME interrupts into the same |
* This mapping of both MACE and CRIME interrupts into the same |
1168 |
* 'int' is really ugly. |
* 'int' is really ugly. |
1174 |
* TODO: fix. |
* TODO: fix. |
1175 |
*/ |
*/ |
1176 |
if (irq_nr & MACE_PERIPH_SERIAL) { |
if (irq_nr & MACE_PERIPH_SERIAL) { |
|
/* Read current MACE interrupt bits: */ |
|
|
memcpy(x, m->md_int.ip32.mace_data->reg + mace_addr, sizeof(uint32_t)); |
|
|
mace_interrupts = 0; |
|
|
for (i=0; i<sizeof(uint32_t); i++) { |
|
|
/* SGI is big-endian... */ |
|
|
mace_interrupts <<= 8; |
|
|
mace_interrupts |= x[i]; |
|
|
} |
|
|
|
|
1177 |
if (assrt) |
if (assrt) |
1178 |
mace_interrupts |= (irq_nr & ~MACE_PERIPH_SERIAL); |
mace_interrupts |= (irq_nr & ~MACE_PERIPH_SERIAL); |
1179 |
else |
else |
1180 |
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_SERIAL); |
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_SERIAL); |
1181 |
|
|
|
/* Write back MACE interrupt bits: */ |
|
|
for (i=0; i<4; i++) |
|
|
x[3-i] = mace_interrupts >> (i*8); |
|
|
memcpy(m->md_int.ip32.mace_data->reg + mace_addr, x, sizeof(uint32_t)); |
|
|
|
|
1182 |
irq_nr = MACE_PERIPH_SERIAL; |
irq_nr = MACE_PERIPH_SERIAL; |
1183 |
if (mace_interrupts == 0) |
if ((mace_interrupts & mace_interrupt_mask) == 0) |
1184 |
assrt = 0; |
assrt = 0; |
1185 |
else |
else |
1186 |
assrt = 1; |
assrt = 1; |
1188 |
|
|
1189 |
/* Hopefully _MISC and _SERIAL will not be both on at the same time. */ |
/* Hopefully _MISC and _SERIAL will not be both on at the same time. */ |
1190 |
if (irq_nr & MACE_PERIPH_MISC) { |
if (irq_nr & MACE_PERIPH_MISC) { |
|
/* Read current MACE interrupt bits: */ |
|
|
memcpy(x, m->md_int.ip32.mace_data->reg + mace_addr, sizeof(uint32_t)); |
|
|
mace_interrupts = 0; |
|
|
for (i=0; i<sizeof(uint32_t); i++) { |
|
|
/* SGI is big-endian... */ |
|
|
mace_interrupts <<= 8; |
|
|
mace_interrupts |= x[i]; |
|
|
} |
|
|
|
|
1191 |
if (assrt) |
if (assrt) |
1192 |
mace_interrupts |= (irq_nr & ~MACE_PERIPH_MISC); |
mace_interrupts |= (irq_nr & ~MACE_PERIPH_MISC); |
1193 |
else |
else |
1194 |
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_MISC); |
mace_interrupts &= ~(irq_nr & ~MACE_PERIPH_MISC); |
1195 |
|
|
|
/* Write back MACE interrupt bits: */ |
|
|
for (i=0; i<4; i++) |
|
|
x[3-i] = mace_interrupts >> (i*8); |
|
|
memcpy(m->md_int.ip32.mace_data->reg + mace_addr, x, sizeof(uint32_t)); |
|
|
|
|
1196 |
irq_nr = MACE_PERIPH_MISC; |
irq_nr = MACE_PERIPH_MISC; |
1197 |
if (mace_interrupts == 0) |
if ((mace_interrupts & mace_interrupt_mask) == 0) |
1198 |
assrt = 0; |
assrt = 0; |
1199 |
else |
else |
1200 |
assrt = 1; |
assrt = 1; |
1201 |
} |
} |
1202 |
|
|
1203 |
|
/* Write back MACE interrupt assertions: */ |
1204 |
|
for (i=0; i<sizeof(uint64_t); i++) |
1205 |
|
x[7-i] = mace_interrupts >> (i*8); |
1206 |
|
memcpy(m->md_int.ip32.mace_data->reg + mace_addr, x, sizeof(uint64_t)); |
1207 |
|
|
1208 |
/* Read CRIME_INTSTAT: */ |
/* Read CRIME_INTSTAT: */ |
1209 |
memcpy(x, m->md_int.ip32.crime_data->reg + crime_addr, sizeof(uint64_t)); |
memcpy(x, m->md_int.ip32.crime_data->reg + crime_addr, |
1210 |
|
sizeof(uint64_t)); |
1211 |
crime_interrupts = 0; |
crime_interrupts = 0; |
1212 |
for (i=0; i<8; i++) { |
for (i=0; i<sizeof(uint64_t); i++) { |
|
/* SGI is big-endian... */ |
|
1213 |
crime_interrupts <<= 8; |
crime_interrupts <<= 8; |
1214 |
crime_interrupts |= x[i]; |
crime_interrupts |= x[i]; |
1215 |
} |
} |
1220 |
crime_interrupts &= ~irq_nr; |
crime_interrupts &= ~irq_nr; |
1221 |
|
|
1222 |
/* Write back CRIME_INTSTAT: */ |
/* Write back CRIME_INTSTAT: */ |
1223 |
for (i=0; i<8; i++) |
for (i=0; i<sizeof(uint64_t); i++) |
1224 |
x[7-i] = crime_interrupts >> (i*8); |
x[7-i] = crime_interrupts >> (i*8); |
1225 |
memcpy(m->md_int.ip32.crime_data->reg + crime_addr, x, sizeof(uint64_t)); |
memcpy(m->md_int.ip32.crime_data->reg + crime_addr, x, |
1226 |
|
sizeof(uint64_t)); |
1227 |
|
|
1228 |
/* Read CRIME_INTMASK: */ |
/* Read CRIME_INTMASK: */ |
1229 |
memcpy(x, m->md_int.ip32.crime_data->reg + CRIME_INTMASK, sizeof(uint64_t)); |
memcpy(x, m->md_int.ip32.crime_data->reg + CRIME_INTMASK, |
1230 |
|
sizeof(uint64_t)); |
1231 |
crime_interrupts_mask = 0; |
crime_interrupts_mask = 0; |
1232 |
for (i=0; i<8; i++) { |
for (i=0; i<sizeof(uint64_t); i++) { |
1233 |
crime_interrupts_mask <<= 8; |
crime_interrupts_mask <<= 8; |
1234 |
crime_interrupts_mask |= x[i]; |
crime_interrupts_mask |= x[i]; |
1235 |
} |
} |
1239 |
else |
else |
1240 |
cpu_interrupt(cpu, 2); |
cpu_interrupt(cpu, 2); |
1241 |
|
|
1242 |
/* printf("sgi_crime_machine_irq(%i,%i): new interrupts = 0x%08x\n", assrt, irq_nr, crime_interrupts); */ |
/* printf("sgi_crime_machine_irq(%i,%i): new interrupts = 0x%08x\n", |
1243 |
|
assrt, irq_nr, crime_interrupts); */ |
1244 |
} |
} |
1245 |
|
|
1246 |
|
|
1293 |
|
|
1294 |
|
|
1295 |
/* |
/* |
1296 |
|
* Malta (evbmips) interrupts: |
1297 |
|
* |
1298 |
|
* ISA interrupts. |
1299 |
|
* (irq_nr = 16+8 can be used to just reassert/deassert interrupts.) |
1300 |
|
*/ |
1301 |
|
void malta_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, |
1302 |
|
int assrt) |
1303 |
|
{ |
1304 |
|
int mask; |
1305 |
|
|
1306 |
|
irq_nr -= 8; |
1307 |
|
mask = 1 << (irq_nr & 7); |
1308 |
|
|
1309 |
|
if (irq_nr < 8) { |
1310 |
|
if (assrt) |
1311 |
|
m->isa_pic_data.pic1->irr |= mask; |
1312 |
|
else |
1313 |
|
m->isa_pic_data.pic1->irr &= ~mask; |
1314 |
|
} else if (irq_nr < 16) { |
1315 |
|
if (assrt) |
1316 |
|
m->isa_pic_data.pic2->irr |= mask; |
1317 |
|
else |
1318 |
|
m->isa_pic_data.pic2->irr &= ~mask; |
1319 |
|
} |
1320 |
|
|
1321 |
|
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
1322 |
|
/* (TODO: don't hardcode this here) */ |
1323 |
|
if (m->isa_pic_data.pic2->irr & |
1324 |
|
~m->isa_pic_data.pic2->ier) |
1325 |
|
m->isa_pic_data.pic1->irr |= 0x04; |
1326 |
|
else |
1327 |
|
m->isa_pic_data.pic1->irr &= ~0x04; |
1328 |
|
|
1329 |
|
/* Now, PIC1: */ |
1330 |
|
if (m->isa_pic_data.pic1->irr & |
1331 |
|
~m->isa_pic_data.pic1->ier) |
1332 |
|
cpu_interrupt(cpu, 2); |
1333 |
|
else |
1334 |
|
cpu_interrupt_ack(cpu, 2); |
1335 |
|
|
1336 |
|
/* printf("MALTA: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " |
1337 |
|
"ier=0x%02x\n", m->isa_pic_data.pic1->irr, |
1338 |
|
m->isa_pic_data.pic1->ier, |
1339 |
|
m->isa_pic_data.pic2->irr, |
1340 |
|
m->isa_pic_data.pic2->ier); */ |
1341 |
|
} |
1342 |
|
|
1343 |
|
|
1344 |
|
/* |
1345 |
|
* Cobalt interrupts: |
1346 |
|
* |
1347 |
|
* (irq_nr = 8 + 16 can be used to just reassert/deassert interrupts.) |
1348 |
|
*/ |
1349 |
|
void cobalt_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
1350 |
|
{ |
1351 |
|
int mask; |
1352 |
|
|
1353 |
|
irq_nr -= 8; |
1354 |
|
mask = 1 << (irq_nr & 7); |
1355 |
|
|
1356 |
|
if (irq_nr < 8) { |
1357 |
|
if (assrt) |
1358 |
|
m->isa_pic_data.pic1->irr |= mask; |
1359 |
|
else |
1360 |
|
m->isa_pic_data.pic1->irr &= ~mask; |
1361 |
|
} else if (irq_nr < 16) { |
1362 |
|
if (assrt) |
1363 |
|
m->isa_pic_data.pic2->irr |= mask; |
1364 |
|
else |
1365 |
|
m->isa_pic_data.pic2->irr &= ~mask; |
1366 |
|
} |
1367 |
|
|
1368 |
|
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
1369 |
|
/* (TODO: don't hardcode this here) */ |
1370 |
|
if (m->isa_pic_data.pic2->irr & |
1371 |
|
~m->isa_pic_data.pic2->ier) |
1372 |
|
m->isa_pic_data.pic1->irr |= 0x04; |
1373 |
|
else |
1374 |
|
m->isa_pic_data.pic1->irr &= ~0x04; |
1375 |
|
|
1376 |
|
/* Now, PIC1: */ |
1377 |
|
if (m->isa_pic_data.pic1->irr & |
1378 |
|
~m->isa_pic_data.pic1->ier) |
1379 |
|
cpu_interrupt(cpu, 6); |
1380 |
|
else |
1381 |
|
cpu_interrupt_ack(cpu, 6); |
1382 |
|
|
1383 |
|
/* printf("COBALT: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " |
1384 |
|
"ier=0x%02x\n", m->isa_pic_data.pic1->irr, |
1385 |
|
m->isa_pic_data.pic1->ier, |
1386 |
|
m->isa_pic_data.pic2->irr, |
1387 |
|
m->isa_pic_data.pic2->ier); */ |
1388 |
|
} |
1389 |
|
|
1390 |
|
|
1391 |
|
/* |
1392 |
* x86 (PC) interrupts: |
* x86 (PC) interrupts: |
1393 |
* |
* |
1394 |
* (irq_nr = 16 can be used to just reassert/deassert interrupts.) |
* (irq_nr = 16 can be used to just reassert/deassert interrupts.) |
1399 |
|
|
1400 |
if (irq_nr < 8) { |
if (irq_nr < 8) { |
1401 |
if (assrt) |
if (assrt) |
1402 |
m->md.pc.pic1->irr |= mask; |
m->isa_pic_data.pic1->irr |= mask; |
1403 |
else |
else |
1404 |
m->md.pc.pic1->irr &= ~mask; |
m->isa_pic_data.pic1->irr &= ~mask; |
1405 |
} else if (irq_nr < 16) { |
} else if (irq_nr < 16) { |
1406 |
if (m->md.pc.pic2 == NULL) { |
if (m->isa_pic_data.pic2 == NULL) { |
1407 |
fatal("x86_pc_interrupt(): pic2 used (irq_nr = %i), " |
fatal("x86_pc_interrupt(): pic2 used (irq_nr = %i), " |
1408 |
"but we are emulating an XT?\n", irq_nr); |
"but we are emulating an XT?\n", irq_nr); |
1409 |
return; |
return; |
1410 |
} |
} |
1411 |
if (assrt) |
if (assrt) |
1412 |
m->md.pc.pic2->irr |= mask; |
m->isa_pic_data.pic2->irr |= mask; |
1413 |
else |
else |
1414 |
m->md.pc.pic2->irr &= ~mask; |
m->isa_pic_data.pic2->irr &= ~mask; |
1415 |
} |
} |
1416 |
|
|
1417 |
if (m->md.pc.pic2 != NULL) { |
if (m->isa_pic_data.pic2 != NULL) { |
1418 |
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
1419 |
/* (TODO: don't hardcode this here) */ |
/* (TODO: don't hardcode this here) */ |
1420 |
if (m->md.pc.pic2->irr & ~m->md.pc.pic2->ier) |
if (m->isa_pic_data.pic2->irr & ~m->isa_pic_data.pic2->ier) |
1421 |
m->md.pc.pic1->irr |= 0x04; |
m->isa_pic_data.pic1->irr |= 0x04; |
1422 |
else |
else |
1423 |
m->md.pc.pic1->irr &= ~0x04; |
m->isa_pic_data.pic1->irr &= ~0x04; |
1424 |
} |
} |
1425 |
|
|
1426 |
/* Now, PIC1: */ |
/* Now, PIC1: */ |
1427 |
if (m->md.pc.pic1->irr & ~m->md.pc.pic1->ier) |
if (m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier) |
1428 |
cpu->cd.x86.interrupt_asserted = 1; |
cpu->cd.x86.interrupt_asserted = 1; |
1429 |
else |
else |
1430 |
cpu->cd.x86.interrupt_asserted = 0; |
cpu->cd.x86.interrupt_asserted = 0; |
1431 |
} |
} |
1432 |
|
|
1433 |
|
|
1434 |
|
/* |
1435 |
|
* Footbridge interrupts: |
1436 |
|
* |
1437 |
|
* 0..31 = footbridge interrupt |
1438 |
|
* 32..47 = ISA (connected to IRQ_IN_L2 on CATS, L3 on NetWinder) |
1439 |
|
* 64 = reassert |
1440 |
|
*/ |
1441 |
|
void footbridge_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, |
1442 |
|
int assrt) |
1443 |
|
{ |
1444 |
|
uint32_t mask = 1 << (irq_nr & 31); |
1445 |
|
int old_isa_assert, new_isa_assert; |
1446 |
|
int isa_int = m->machine_type == MACHINE_CATS? 10 : 11; |
1447 |
|
|
1448 |
|
old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1449 |
|
|
1450 |
|
if (irq_nr >= 32 && irq_nr < 32 + 8) { |
1451 |
|
int mm = 1 << (irq_nr & 7); |
1452 |
|
if (assrt) |
1453 |
|
m->isa_pic_data.pic1->irr |= mm; |
1454 |
|
else |
1455 |
|
m->isa_pic_data.pic1->irr &= ~mm; |
1456 |
|
} else if (irq_nr >= 32+8 && irq_nr < 32+16) { |
1457 |
|
int mm = 1 << (irq_nr & 7); |
1458 |
|
if (assrt) |
1459 |
|
m->isa_pic_data.pic2->irr |= mm; |
1460 |
|
else |
1461 |
|
m->isa_pic_data.pic2->irr &= ~mm; |
1462 |
|
} |
1463 |
|
|
1464 |
|
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
1465 |
|
/* (TODO: don't hardcode this here) */ |
1466 |
|
if (m->isa_pic_data.pic2->irr & ~m->isa_pic_data.pic2->ier) |
1467 |
|
m->isa_pic_data.pic1->irr |= 0x04; |
1468 |
|
else |
1469 |
|
m->isa_pic_data.pic1->irr &= ~0x04; |
1470 |
|
|
1471 |
|
/* Now, PIC1: */ |
1472 |
|
new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1473 |
|
if (old_isa_assert != new_isa_assert) { |
1474 |
|
if (new_isa_assert) |
1475 |
|
cpu_interrupt(cpu, isa_int); |
1476 |
|
else |
1477 |
|
cpu_interrupt_ack(cpu, isa_int); |
1478 |
|
return; |
1479 |
|
} |
1480 |
|
|
1481 |
|
if (irq_nr < 32) { |
1482 |
|
if (assrt) |
1483 |
|
m->md_int.footbridge_data->irq_status |= mask; |
1484 |
|
else |
1485 |
|
m->md_int.footbridge_data->irq_status &= ~mask; |
1486 |
|
} |
1487 |
|
|
1488 |
|
if (m->md_int.footbridge_data->irq_status & |
1489 |
|
m->md_int.footbridge_data->irq_enable) |
1490 |
|
cpu_interrupt(cpu, 65); |
1491 |
|
else |
1492 |
|
cpu_interrupt_ack(cpu, 65); |
1493 |
|
} |
1494 |
|
|
1495 |
|
|
1496 |
/**************************************************************************** |
/**************************************************************************** |
1497 |
* * |
* * |
1498 |
* Machine dependant Initialization routines * |
* Machine dependant Initialization routines * |
1512 |
int i, j; |
int i, j; |
1513 |
struct memory *mem; |
struct memory *mem; |
1514 |
char tmpstr[1000]; |
char tmpstr[1000]; |
1515 |
|
struct cons_data *cons_data; |
1516 |
|
|
1517 |
/* DECstation: */ |
/* DECstation: */ |
1518 |
char *framebuffer_console_name, *serial_console_name; |
char *framebuffer_console_name, *serial_console_name; |
1549 |
char *init_bootpath; |
char *init_bootpath; |
1550 |
|
|
1551 |
/* PCI stuff: */ |
/* PCI stuff: */ |
1552 |
struct pci_data *pci_data; |
struct pci_data *pci_data = NULL; |
1553 |
|
|
1554 |
/* Framebuffer stuff: */ |
/* Framebuffer stuff: */ |
1555 |
struct vfb_data *fb; |
struct vfb_data *fb = NULL; |
1556 |
|
|
1557 |
/* Abreviation: :-) */ |
/* Abreviation: :-) */ |
1558 |
struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; |
struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; |
1569 |
case MACHINE_ARC: |
case MACHINE_ARC: |
1570 |
machine->boot_string_argument = "-aN"; |
machine->boot_string_argument = "-aN"; |
1571 |
break; |
break; |
1572 |
|
case MACHINE_CATS: |
1573 |
|
machine->boot_string_argument = "-A"; |
1574 |
|
break; |
1575 |
case MACHINE_DEC: |
case MACHINE_DEC: |
1576 |
machine->boot_string_argument = "-a"; |
machine->boot_string_argument = "-a"; |
1577 |
break; |
break; |
1588 |
printf("\nNo emulation type specified.\n"); |
printf("\nNo emulation type specified.\n"); |
1589 |
exit(1); |
exit(1); |
1590 |
|
|
1591 |
|
#ifdef ENABLE_MIPS |
1592 |
case MACHINE_BAREMIPS: |
case MACHINE_BAREMIPS: |
1593 |
/* |
/* |
1594 |
* A "bare" MIPS test machine. |
* A "bare" MIPS test machine. |
1601 |
|
|
1602 |
case MACHINE_TESTMIPS: |
case MACHINE_TESTMIPS: |
1603 |
/* |
/* |
1604 |
* A MIPS test machine (which happens to work with my |
* A MIPS test machine (which happens to work with the |
1605 |
* thesis work). |
* code in my master's thesis). :-) |
1606 |
|
* |
1607 |
|
* IRQ map: |
1608 |
|
* 7 CPU counter |
1609 |
|
* 6 SMP IPIs |
1610 |
|
* 5 not used yet |
1611 |
|
* 4 not used yet |
1612 |
|
* 3 ethernet |
1613 |
|
* 2 serial console |
1614 |
*/ |
*/ |
1615 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
1616 |
machine->machine_name = "MIPS test machine"; |
machine->machine_name = "MIPS test machine"; |
1617 |
|
|
1618 |
machine->main_console_handle = dev_cons_init( |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=2", |
1619 |
machine, mem, DEV_CONS_ADDRESS, "console", 2); |
(long long)DEV_CONS_ADDRESS); |
1620 |
|
cons_data = device_add(machine, tmpstr); |
1621 |
|
machine->main_console_handle = cons_data->console_handle; |
1622 |
|
|
1623 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
1624 |
(long long)DEV_MP_ADDRESS); |
(long long)DEV_MP_ADDRESS); |
1625 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
1626 |
|
|
1627 |
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
1628 |
640,480, 640,480, 24, "generic", 1); |
640,480, 640,480, 24, "testmips generic"); |
1629 |
|
|
1630 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
1631 |
|
(long long)DEV_DISK_ADDRESS); |
1632 |
|
device_add(machine, tmpstr); |
1633 |
|
|
1634 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=3", |
1635 |
|
(long long)DEV_ETHER_ADDRESS); |
1636 |
|
device_add(machine, tmpstr); |
1637 |
|
|
1638 |
break; |
break; |
1639 |
|
|
1640 |
case MACHINE_DEC: |
case MACHINE_DEC: |
1676 |
*/ |
*/ |
1677 |
fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START, |
fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START, |
1678 |
color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01, |
color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01, |
1679 |
0,0,0,0,0, color_fb_flag? "VFB02":"VFB01", 1); |
0,0,0,0,0, color_fb_flag? "VFB02":"VFB01"); |
1680 |
dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START, &fb->color_plane_mask); |
dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START, &fb->color_plane_mask); |
1681 |
dev_vdac_init(mem, KN01_SYS_VDAC, fb->rgb_palette, color_fb_flag); |
dev_vdac_init(mem, KN01_SYS_VDAC, fb->rgb_palette, color_fb_flag); |
1682 |
dev_le_init(machine, mem, KN01_SYS_LANCE, KN01_SYS_LANCE_B_START, KN01_SYS_LANCE_B_END, KN01_INT_LANCE, 4*1048576); |
dev_le_init(machine, mem, KN01_SYS_LANCE, KN01_SYS_LANCE_B_START, KN01_SYS_LANCE_B_END, KN01_INT_LANCE, 4*1048576); |
2108 |
dev_le_init(machine, mem, KN230_SYS_LANCE, KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END, KN230_CSR_INTR_LANCE, 4*1048576); |
dev_le_init(machine, mem, KN230_SYS_LANCE, KN230_SYS_LANCE_B_START, KN230_SYS_LANCE_B_END, KN230_CSR_INTR_LANCE, 4*1048576); |
2109 |
dev_sii_init(machine, mem, KN230_SYS_SII, KN230_SYS_SII_B_START, KN230_SYS_SII_B_END, KN230_CSR_INTR_SII); |
dev_sii_init(machine, mem, KN230_SYS_SII, KN230_SYS_SII_B_START, KN230_SYS_SII_B_END, KN230_CSR_INTR_SII); |
2110 |
|
|
2111 |
snprintf(tmpstr, sizeof(tmpstr) - 1, |
snprintf(tmpstr, sizeof(tmpstr), |
2112 |
"kn230 addr=0x%llx", (long long)KN230_SYS_ICSR); |
"kn230 addr=0x%llx", (long long)KN230_SYS_ICSR); |
2113 |
machine->md_int.kn230_csr = device_add(machine, tmpstr); |
machine->md_int.kn230_csr = device_add(machine, tmpstr); |
2114 |
|
|
2126 |
*/ |
*/ |
2127 |
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
2128 |
|
|
2129 |
/* DECstation PROM stuff: (TODO: endianness) */ |
if (machine->prom_emulation) { |
2130 |
for (i=0; i<100; i++) |
/* DECstation PROM stuff: (TODO: endianness) */ |
2131 |
store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, |
for (i=0; i<100; i++) |
2132 |
DEC_PROM_EMULATION + i*8); |
store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, |
2133 |
|
DEC_PROM_EMULATION + i*8); |
2134 |
/* Fill PROM with dummy return instructions: (TODO: make this nicer) */ |
|
2135 |
for (i=0; i<100; i++) { |
/* Fill PROM with dummy return instructions: (TODO: make this nicer) */ |
2136 |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, |
for (i=0; i<100; i++) { |
2137 |
0x03e00008); /* return */ |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, |
2138 |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, |
0x03e00008); /* return */ |
2139 |
0x00000000); /* nop */ |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, |
2140 |
} |
0x00000000); /* nop */ |
2141 |
|
} |
2142 |
|
|
2143 |
/* |
/* |
2144 |
* According to dec_prom.h from NetBSD: |
* According to dec_prom.h from NetBSD: |
2145 |
* |
* |
2146 |
* "Programs loaded by the new PROMs pass the following arguments: |
* "Programs loaded by the new PROMs pass the following arguments: |
2147 |
* a0 argc |
* a0 argc |
2148 |
* a1 argv |
* a1 argv |
2149 |
* a2 DEC_PROM_MAGIC |
* a2 DEC_PROM_MAGIC |
2150 |
* a3 The callback vector defined below" |
* a3 The callback vector defined below" |
2151 |
* |
* |
2152 |
* So we try to emulate a PROM, even though no such thing has been |
* So we try to emulate a PROM, even though no such thing has been |
2153 |
* loaded. |
* loaded. |
2154 |
*/ |
*/ |
2155 |
|
|
2156 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; |
2157 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; |
cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; |
2158 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; |
cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; |
2159 |
cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; |
cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; |
2160 |
|
|
2161 |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, |
2162 |
BOOTINFO_MAGIC); |
BOOTINFO_MAGIC); |
2163 |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, |
2164 |
BOOTINFO_ADDR); |
BOOTINFO_ADDR); |
2165 |
|
|
2166 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, |
2167 |
(DEC_PROM_INITIAL_ARGV + 0x10)); |
(DEC_PROM_INITIAL_ARGV + 0x10)); |
2168 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, |
2169 |
(DEC_PROM_INITIAL_ARGV + 0x70)); |
(DEC_PROM_INITIAL_ARGV + 0x70)); |
2170 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, |
2171 |
(DEC_PROM_INITIAL_ARGV + 0xe0)); |
(DEC_PROM_INITIAL_ARGV + 0xe0)); |
2172 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); |
2173 |
|
|
2174 |
/* |
/* |
2175 |
* NetBSD and Ultrix expect the boot args to be like this: |
* NetBSD and Ultrix expect the boot args to be like this: |
2176 |
* |
* |
2177 |
* "boot" "bootdev" [args?] |
* "boot" "bootdev" [args?] |
2178 |
* |
* |
2179 |
* where bootdev is supposed to be "rz(0,0,0)netbsd" for |
* where bootdev is supposed to be "rz(0,0,0)netbsd" for |
2180 |
* 3100/2100 (although that crashes Ultrix :-/), and |
* 3100/2100 (although that crashes Ultrix :-/), and |
2181 |
* "5/rz0a/netbsd" for all others. The number '5' is the |
* "5/rz0a/netbsd" for all others. The number '5' is the |
2182 |
* slot number of the boot device. |
* slot number of the boot device. |
2183 |
* |
* |
2184 |
* 'rz' for disks, 'tz' for tapes. |
* 'rz' for disks, 'tz' for tapes. |
2185 |
* |
* |
2186 |
* TODO: Make this nicer. |
* TODO: Make this nicer. |
2187 |
*/ |
*/ |
2188 |
{ |
{ |
2189 |
char bootpath[200]; |
char bootpath[200]; |
|
|
|
2190 |
#if 0 |
#if 0 |
2191 |
if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) |
if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) |
2192 |
strcpy(bootpath, "rz(0,0,0)"); |
strlcpy(bootpath, "rz(0,0,0)", sizeof(bootpath)); |
2193 |
else |
else |
2194 |
#endif |
#endif |
2195 |
strcpy(bootpath, "5/rz1/"); |
strlcpy(bootpath, "5/rz1/", sizeof(bootpath)); |
2196 |
|
|
2197 |
if (bootdev_id < 0 || machine->force_netboot) { |
if (bootdev_id < 0 || machine->force_netboot) { |
2198 |
/* tftp boot: */ |
/* tftp boot: */ |
2199 |
strcpy(bootpath, "5/tftp/"); |
strlcpy(bootpath, "5/tftp/", sizeof(bootpath)); |
2200 |
bootpath[0] = '0' + boot_net_boardnumber; |
bootpath[0] = '0' + boot_net_boardnumber; |
2201 |
} else { |
} else { |
2202 |
/* disk boot: */ |
/* disk boot: */ |
2208 |
} |
} |
2209 |
|
|
2210 |
init_bootpath = bootpath; |
init_bootpath = bootpath; |
2211 |
} |
} |
2212 |
|
|
2213 |
bootarg = malloc(strlen(init_bootpath) + |
bootarg = malloc(BOOTARG_BUFLEN); |
2214 |
strlen(machine->boot_kernel_filename) + 1 + |
if (bootarg == NULL) { |
2215 |
strlen(machine->boot_string_argument) + 1); |
fprintf(stderr, "out of memory\n"); |
2216 |
strcpy(bootarg, init_bootpath); |
exit(1); |
2217 |
strcat(bootarg, machine->boot_kernel_filename); |
} |
2218 |
|
strlcpy(bootarg, init_bootpath, BOOTARG_BUFLEN); |
2219 |
bootstr = "boot"; |
if (strlcat(bootarg, machine->boot_kernel_filename, |
2220 |
|
BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { |
2221 |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); |
fprintf(stderr, "bootarg truncated?\n"); |
2222 |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); |
exit(1); |
2223 |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0xe0, |
} |
|
machine->boot_string_argument); |
|
|
|
|
|
/* Decrease the nr of args, if there are no args :-) */ |
|
|
if (machine->boot_string_argument == NULL || |
|
|
machine->boot_string_argument[0] == '\0') |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] --; |
|
|
|
|
|
if (machine->boot_string_argument[0] != '\0') { |
|
|
strcat(bootarg, " "); |
|
|
strcat(bootarg, machine->boot_string_argument); |
|
|
} |
|
|
|
|
|
xx.a.common.next = (char *)&xx.b - (char *)&xx; |
|
|
xx.a.common.type = BTINFO_MAGIC; |
|
|
xx.a.magic = BOOTINFO_MAGIC; |
|
|
|
|
|
xx.b.common.next = (char *)&xx.c - (char *)&xx.b; |
|
|
xx.b.common.type = BTINFO_BOOTPATH; |
|
|
strcpy(xx.b.bootpath, bootstr); |
|
|
|
|
|
xx.c.common.next = 0; |
|
|
xx.c.common.type = BTINFO_SYMTAB; |
|
|
xx.c.nsym = 0; |
|
|
xx.c.ssym = 0; |
|
|
xx.c.esym = machine->file_loaded_end_addr; |
|
2224 |
|
|
2225 |
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
bootstr = "boot"; |
2226 |
|
|
2227 |
/* |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); |
2228 |
* The system's memmap: (memmap is a global variable, in |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); |
2229 |
* dec_prom.h) |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0xe0, |
2230 |
*/ |
machine->boot_string_argument); |
|
store_32bit_word_in_host(cpu, |
|
|
(unsigned char *)&memmap.pagesize, 4096); |
|
|
{ |
|
|
unsigned int i; |
|
|
for (i=0; i<sizeof(memmap.bitmap); i++) |
|
|
memmap.bitmap[i] = ((int)i * 4096*8 < |
|
|
1048576*machine->physical_ram_in_mb)? |
|
|
0xff : 0x00; |
|
|
} |
|
|
store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap)); |
|
|
|
|
|
/* Environment variables: */ |
|
|
addr = DEC_PROM_STRINGS; |
|
|
|
|
|
if (machine->use_x11 && machine->n_gfx_cards > 0) |
|
|
/* (0,3) Keyboard and Framebuffer */ |
|
|
add_environment_string(cpu, framebuffer_console_name, &addr); |
|
|
else |
|
|
/* Serial console */ |
|
|
add_environment_string(cpu, serial_console_name, &addr); |
|
2231 |
|
|
2232 |
/* |
/* Decrease the nr of args, if there are no args :-) */ |
2233 |
* The KN5800 (SMP system) uses a CCA (console communications |
if (machine->boot_string_argument == NULL || |
2234 |
* area): (See VAX 6000 documentation for details.) |
machine->boot_string_argument[0] == '\0') |
2235 |
*/ |
cpu->cd.mips.gpr[MIPS_GPR_A0] --; |
2236 |
{ |
|
2237 |
char tmps[300]; |
if (machine->boot_string_argument[0] != '\0') { |
2238 |
sprintf(tmps, "cca=%x", |
strlcat(bootarg, " ", BOOTARG_BUFLEN); |
2239 |
(int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); |
if (strlcat(bootarg, machine->boot_string_argument, |
2240 |
add_environment_string(cpu, tmps, &addr); |
BOOTARG_BUFLEN) >= BOOTARG_BUFLEN) { |
2241 |
} |
fprintf(stderr, "bootstr truncated?\n"); |
2242 |
|
exit(1); |
2243 |
|
} |
2244 |
|
} |
2245 |
|
|
2246 |
/* These are needed for Sprite to boot: */ |
xx.a.common.next = (char *)&xx.b - (char *)&xx; |
2247 |
{ |
xx.a.common.type = BTINFO_MAGIC; |
2248 |
char tmps[300]; |
xx.a.magic = BOOTINFO_MAGIC; |
2249 |
|
|
2250 |
|
xx.b.common.next = (char *)&xx.c - (char *)&xx.b; |
2251 |
|
xx.b.common.type = BTINFO_BOOTPATH; |
2252 |
|
strlcpy(xx.b.bootpath, bootstr, sizeof(xx.b.bootpath)); |
2253 |
|
|
2254 |
|
xx.c.common.next = 0; |
2255 |
|
xx.c.common.type = BTINFO_SYMTAB; |
2256 |
|
xx.c.nsym = 0; |
2257 |
|
xx.c.ssym = 0; |
2258 |
|
xx.c.esym = machine->file_loaded_end_addr; |
2259 |
|
|
2260 |
sprintf(tmps, "boot=%s", bootarg); |
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
|
add_environment_string(cpu, tmps, &addr); |
|
2261 |
|
|
2262 |
sprintf(tmps, "bitmap=0x%x", (uint32_t)(( |
/* |
2263 |
DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) |
* The system's memmap: (memmap is a global variable, in |
2264 |
& 0xffffffffULL)); |
* dec_prom.h) |
2265 |
add_environment_string(cpu, tmps, &addr); |
*/ |
2266 |
|
store_32bit_word_in_host(cpu, |
2267 |
sprintf(tmps, "bitmaplen=0x%x", |
(unsigned char *)&memmap.pagesize, 4096); |
2268 |
machine->physical_ram_in_mb * 1048576 / 4096 / 8); |
{ |
2269 |
add_environment_string(cpu, tmps, &addr); |
unsigned int i; |
2270 |
} |
for (i=0; i<sizeof(memmap.bitmap); i++) |
2271 |
|
memmap.bitmap[i] = ((int)i * 4096*8 < |
2272 |
add_environment_string(cpu, "scsiid0=7", &addr); |
1048576*machine->physical_ram_in_mb)? |
2273 |
add_environment_string(cpu, "bootmode=a", &addr); |
0xff : 0x00; |
2274 |
add_environment_string(cpu, "testaction=q", &addr); |
} |
2275 |
add_environment_string(cpu, "haltaction=h", &addr); |
store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap)); |
2276 |
add_environment_string(cpu, "more=24", &addr); |
|
2277 |
|
/* Environment variables: */ |
2278 |
/* Used in at least Ultrix on the 5100: */ |
addr = DEC_PROM_STRINGS; |
|
add_environment_string(cpu, "scsiid=7", &addr); |
|
|
add_environment_string(cpu, "baud0=9600", &addr); |
|
|
add_environment_string(cpu, "baud1=9600", &addr); |
|
|
add_environment_string(cpu, "baud2=9600", &addr); |
|
|
add_environment_string(cpu, "baud3=9600", &addr); |
|
|
add_environment_string(cpu, "iooption=0x1", &addr); |
|
2279 |
|
|
2280 |
/* The end: */ |
if (machine->use_x11 && machine->n_gfx_cards > 0) |
2281 |
add_environment_string(cpu, "", &addr); |
/* (0,3) Keyboard and Framebuffer */ |
2282 |
|
add_environment_string(cpu, framebuffer_console_name, &addr); |
2283 |
|
else |
2284 |
|
/* Serial console */ |
2285 |
|
add_environment_string(cpu, serial_console_name, &addr); |
2286 |
|
|
2287 |
|
/* |
2288 |
|
* The KN5800 (SMP system) uses a CCA (console communications |
2289 |
|
* area): (See VAX 6000 documentation for details.) |
2290 |
|
*/ |
2291 |
|
{ |
2292 |
|
char tmps[300]; |
2293 |
|
snprintf(tmps, sizeof(tmps), "cca=%x", |
2294 |
|
(int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); |
2295 |
|
add_environment_string(cpu, tmps, &addr); |
2296 |
|
} |
2297 |
|
|
2298 |
|
/* These are needed for Sprite to boot: */ |
2299 |
|
{ |
2300 |
|
char tmps[500]; |
2301 |
|
|
2302 |
|
snprintf(tmps, sizeof(tmps), "boot=%s", bootarg); |
2303 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2304 |
|
add_environment_string(cpu, tmps, &addr); |
2305 |
|
|
2306 |
|
snprintf(tmps, sizeof(tmps), "bitmap=0x%x", (uint32_t)(( |
2307 |
|
DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) |
2308 |
|
& 0xffffffffULL)); |
2309 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2310 |
|
add_environment_string(cpu, tmps, &addr); |
2311 |
|
|
2312 |
|
snprintf(tmps, sizeof(tmps), "bitmaplen=0x%x", |
2313 |
|
machine->physical_ram_in_mb * 1048576 / 4096 / 8); |
2314 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2315 |
|
add_environment_string(cpu, tmps, &addr); |
2316 |
|
} |
2317 |
|
|
2318 |
|
add_environment_string(cpu, "scsiid0=7", &addr); |
2319 |
|
add_environment_string(cpu, "bootmode=a", &addr); |
2320 |
|
add_environment_string(cpu, "testaction=q", &addr); |
2321 |
|
add_environment_string(cpu, "haltaction=h", &addr); |
2322 |
|
add_environment_string(cpu, "more=24", &addr); |
2323 |
|
|
2324 |
|
/* Used in at least Ultrix on the 5100: */ |
2325 |
|
add_environment_string(cpu, "scsiid=7", &addr); |
2326 |
|
add_environment_string(cpu, "baud0=9600", &addr); |
2327 |
|
add_environment_string(cpu, "baud1=9600", &addr); |
2328 |
|
add_environment_string(cpu, "baud2=9600", &addr); |
2329 |
|
add_environment_string(cpu, "baud3=9600", &addr); |
2330 |
|
add_environment_string(cpu, "iooption=0x1", &addr); |
2331 |
|
|
2332 |
|
/* The end: */ |
2333 |
|
add_environment_string(cpu, "", &addr); |
2334 |
|
} |
2335 |
|
|
2336 |
break; |
break; |
2337 |
|
|
2348 |
* 4 Tulip 1 |
* 4 Tulip 1 |
2349 |
* 5 16550 UART (serial console) |
* 5 16550 UART (serial console) |
2350 |
* 6 VIA southbridge PIC |
* 6 VIA southbridge PIC |
2351 |
* 7 PCI |
* 7 PCI (Note: Not used. The PCI controller |
2352 |
|
* interrupts at ISA interrupt 9.) |
2353 |
*/ |
*/ |
2354 |
/* dev_XXX_init(cpu, mem, 0x10000000, machine->emulated_hz); */ |
|
2355 |
|
/* ISA interrupt controllers: */ |
2356 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x10000020"); |
2357 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
2358 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0"); |
2359 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
2360 |
|
machine->md_interrupt = cobalt_interrupt; |
2361 |
|
|
2362 |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
2363 |
|
|
2364 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
machine->main_console_handle = (size_t) |
2365 |
0x1c800000, 5, 1, 1, "serial console"); |
device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1"); |
2366 |
|
|
2367 |
#if 0 |
#if 0 |
2368 |
dev_ns16550_init(machine, mem, 0x1f000010, 0, 1, 1, |
device_add(machine, "ns16550 irq=0 addr=0x1f000010 name2=tty1 in_use=0"); |
|
"other serial console"); |
|
2369 |
#endif |
#endif |
2370 |
|
|
2371 |
/* |
/* |
2377 |
* pcib0 at pci0 dev 9 function 0, VIA Technologies VT82C586 (Apollo VP) PCI-ISA Bridge, rev 37 |
* pcib0 at pci0 dev 9 function 0, VIA Technologies VT82C586 (Apollo VP) PCI-ISA Bridge, rev 37 |
2378 |
* pciide0 at pci0 dev 9 function 1: VIA Technologies VT82C586 (Apollo VP) ATA33 cr |
* pciide0 at pci0 dev 9 function 1: VIA Technologies VT82C586 (Apollo VP) ATA33 cr |
2379 |
* tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1 |
* tlp1 at pci0 dev 12 function 0: DECchip 21143 Ethernet, pass 4.1 |
2380 |
|
* |
2381 |
|
* The PCI controller interrupts at ISA interrupt 9. |
2382 |
*/ |
*/ |
2383 |
pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 6); /* 7 for PCI, not 6? */ |
pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 8 + 9, 11); |
2384 |
/* bus_pci_add(machine, pci_data, mem, 0, 7, 0, pci_dec21143_init, pci_dec21143_rr); */ |
/* bus_pci_add(machine, pci_data, mem, 0, 7, 0, pci_dec21143_init, pci_dec21143_rr); */ |
2385 |
bus_pci_add(machine, pci_data, mem, 0, 8, 0, NULL, NULL); /* PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */ |
bus_pci_add(machine, pci_data, mem, 0, 8, 0, NULL, NULL); /* PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */ |
2386 |
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
2387 |
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
2388 |
/* bus_pci_add(machine, pci_data, mem, 0, 12, 0, pci_dec21143_init, pci_dec21143_rr); */ |
/* bus_pci_add(machine, pci_data, mem, 0, 12, 0, pci_dec21143_init, pci_dec21143_rr); */ |
2389 |
|
|
2390 |
/* |
if (machine->prom_emulation) { |
2391 |
* NetBSD/cobalt expects memsize in a0, but it seems that what |
/* |
2392 |
* it really wants is the end of memory + 0x80000000. |
* NetBSD/cobalt expects memsize in a0, but it seems that what |
2393 |
* |
* it really wants is the end of memory + 0x80000000. |
2394 |
* The bootstring should be stored starting 512 bytes before end |
* |
2395 |
* of physical ram. |
* The bootstring is stored 512 bytes before the end of |
2396 |
*/ |
* physical ram. |
2397 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = machine->physical_ram_in_mb * 1048576 + 0x80000000; |
*/ |
2398 |
bootstr = "root=/dev/hda1 ro"; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = |
2399 |
/* bootstr = "nfsroot=/usr/cobalt/"; */ |
machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL; |
2400 |
store_string(cpu, 0xffffffff80000000ULL + |
bootstr = "root=/dev/hda1 ro"; |
2401 |
machine->physical_ram_in_mb * 1048576 - 512, bootstr); |
/* bootstr = "nfsroot=/usr/cobalt/"; */ |
2402 |
|
/* TODO: bootarg, and/or automagic boot device detection */ |
2403 |
|
store_string(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0] - 512, bootstr); |
2404 |
|
} |
2405 |
break; |
break; |
2406 |
|
|
2407 |
case MACHINE_HPCMIPS: |
case MACHINE_HPCMIPS: |
2438 |
hpcmips_fb_bits = 15; |
hpcmips_fb_bits = 15; |
2439 |
hpcmips_fb_encoding = BIFB_D16_0000; |
hpcmips_fb_encoding = BIFB_D16_0000; |
2440 |
|
|
2441 |
machine->main_console_handle = dev_ns16550_init( |
/* TODO: irq? */ |
2442 |
machine, mem, 0xa008680, 0, 4, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1); |
2443 |
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
2444 |
|
|
2445 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131); |
2446 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2447 |
|
|
2470 |
hpcmips_fb_bits = 16; |
hpcmips_fb_bits = 16; |
2471 |
hpcmips_fb_encoding = BIFB_D16_0000; |
hpcmips_fb_encoding = BIFB_D16_0000; |
2472 |
|
|
2473 |
machine->main_console_handle = dev_ns16550_init( |
/* TODO: irq? */ |
2474 |
machine, mem, 0xa008680, 0, 4, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x0a008680 addr_mult=4 in_use=%i", machine->use_x11? 0 : 1); |
2475 |
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
2476 |
|
|
2477 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2478 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2479 |
|
|
2621 |
VRIP_INTR_SIU (=9) here? */ |
VRIP_INTR_SIU (=9) here? */ |
2622 |
{ |
{ |
2623 |
int x; |
int x; |
2624 |
x = dev_ns16550_init(machine, mem, 0x0c000010, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x0c000010", 8 + VRIP_INTR_SIU); |
2625 |
8 + VRIP_INTR_SIU, 1, 1, "serial 0"); |
x = (size_t)device_add(machine, tmpstr); |
2626 |
|
|
2627 |
if (!machine->use_x11) |
if (!machine->use_x11) |
2628 |
machine->main_console_handle = x; |
machine->main_console_handle = x; |
2645 |
break; |
break; |
2646 |
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
2647 |
/* 131 MHz VR4121 */ |
/* 131 MHz VR4121 */ |
2648 |
machine->machine_name = "Agenda VR3"; |
machine->machine_name = "IBM Workpad Z50"; |
2649 |
/* TODO: */ |
/* TODO: */ |
2650 |
hpcmips_fb_addr = 0xa000000; |
hpcmips_fb_addr = 0xa000000; |
2651 |
hpcmips_fb_xsize = 640; |
hpcmips_fb_xsize = 640; |
2680 |
machine->main_console_handle = |
machine->main_console_handle = |
2681 |
machine->md_int.vr41xx_data->kiu_console_handle; |
machine->md_int.vr41xx_data->kiu_console_handle; |
2682 |
|
|
2683 |
/* NetBSD/hpcmips and possibly others expects the following: */ |
if (machine->prom_emulation) { |
2684 |
|
/* NetBSD/hpcmips and possibly others expects the following: */ |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 |
|
|
+ 0xffffffff80000000ULL - 512; /* argv */ |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 |
|
|
+ 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ |
|
|
|
|
|
bootstr = machine->boot_kernel_filename; |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16); |
|
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
|
|
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
|
|
|
|
|
/* Special case for the Agenda VR3: */ |
|
|
if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { |
|
|
const int tmplen = 1000; |
|
|
char *tmp = malloc(tmplen); |
|
|
|
|
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ |
|
2685 |
|
|
2686 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ |
2687 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 |
2688 |
|
+ 0xffffffff80000000ULL - 512; /* argv */ |
2689 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 |
2690 |
|
+ 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ |
2691 |
|
|
2692 |
|
bootstr = machine->boot_kernel_filename; |
2693 |
|
store_32bit_word(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512, |
2694 |
|
0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16); |
2695 |
|
store_32bit_word(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
2696 |
|
store_string(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
2697 |
|
|
2698 |
|
/* Special case for the Agenda VR3: */ |
2699 |
|
if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { |
2700 |
|
const int tmplen = 1000; |
2701 |
|
char *tmp = malloc(tmplen); |
2702 |
|
|
2703 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ |
2704 |
|
|
2705 |
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2706 |
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
2707 |
|
|
2708 |
|
snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," |
2709 |
|
"gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); |
2710 |
|
tmp[tmplen-1] = '\0'; |
2711 |
|
|
2712 |
snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," |
if (!machine->use_x11) |
2713 |
"gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); |
2714 |
tmp[tmplen-1] = '\0'; |
tmp[tmplen-1] = '\0'; |
2715 |
|
|
2716 |
if (!machine->use_x11) |
if (machine->boot_string_argument[0]) |
2717 |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); |
2718 |
tmp[tmplen-1] = '\0'; |
tmp[tmplen-1] = '\0'; |
2719 |
|
|
2720 |
if (machine->boot_string_argument[0]) |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, tmp); |
|
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); |
|
|
tmp[tmplen-1] = '\0'; |
|
2721 |
|
|
2722 |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, tmp); |
bootarg = tmp; |
2723 |
|
} else if (machine->boot_string_argument[0]) { |
2724 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ |
2725 |
|
|
2726 |
bootarg = tmp; |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2727 |
} else if (machine->boot_string_argument[0]) { |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ |
|
2728 |
|
|
2729 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, |
2730 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
machine->boot_string_argument); |
2731 |
|
|
2732 |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, |
bootarg = machine->boot_string_argument; |
2733 |
machine->boot_string_argument); |
} |
2734 |
|
|
2735 |
bootarg = machine->boot_string_argument; |
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
2736 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
2737 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); |
2738 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8); |
2739 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize); |
2740 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize); |
2741 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding); |
2742 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ |
2743 |
|
|
2744 |
|
/* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); |
2745 |
|
printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ |
2746 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
2747 |
|
store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
2748 |
} |
} |
2749 |
|
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8); |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize); |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize); |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding); |
|
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ |
|
|
|
|
|
/* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); |
|
|
printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ |
|
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
|
|
store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
|
|
|
|
2750 |
if (hpcmips_fb_addr != 0) { |
if (hpcmips_fb_addr != 0) { |
2751 |
dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS, |
dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS, |
2752 |
hpcmips_fb_xsize, hpcmips_fb_ysize, |
hpcmips_fb_xsize, hpcmips_fb_ysize, |
2753 |
hpcmips_fb_xsize_mem, hpcmips_fb_ysize_mem, |
hpcmips_fb_xsize_mem, hpcmips_fb_ysize_mem, |
2754 |
hpcmips_fb_bits, "HPCmips", 0); |
hpcmips_fb_bits, "HPCmips"); |
2755 |
|
|
2756 |
/* NetBSD/hpcmips uses framebuffer at physical |
/* NetBSD/hpcmips uses framebuffer at physical |
2757 |
address 0x8.......: */ |
address 0x8.......: */ |
2790 |
|
|
2791 |
machine->md_interrupt = ps2_interrupt; |
machine->md_interrupt = ps2_interrupt; |
2792 |
|
|
|
add_symbol_name(&machine->symbol_context, |
|
|
PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0); |
|
|
store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); |
|
|
store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); |
|
|
|
|
2793 |
/* Set the Harddisk controller present flag, if either |
/* Set the Harddisk controller present flag, if either |
2794 |
disk 0 or 1 is present: */ |
disk 0 or 1 is present: */ |
2795 |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
2796 |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
2797 |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); |
if (machine->prom_emulation) |
2798 |
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); |
2799 |
dev_ps2_spd_init(machine, mem, 0x14000000); |
dev_ps2_spd_init(machine, mem, 0x14000000); |
2800 |
} |
} |
2801 |
|
|
2802 |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); |
if (machine->prom_emulation) { |
|
{ |
|
2803 |
int tmplen = 1000; |
int tmplen = 1000; |
2804 |
char *tmp = malloc(tmplen); |
char *tmp = malloc(tmplen); |
2805 |
|
time_t timet; |
2806 |
|
struct tm *tm_ptr; |
2807 |
|
|
2808 |
|
add_symbol_name(&machine->symbol_context, |
2809 |
|
PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0, 0); |
2810 |
|
store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); |
2811 |
|
store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); |
2812 |
|
|
2813 |
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); |
2814 |
if (tmp == NULL) { |
if (tmp == NULL) { |
2815 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
2816 |
exit(1); |
exit(1); |
2817 |
} |
} |
2818 |
|
|
2819 |
strcpy(tmp, "root=/dev/hda1 crtmode=vesa0,60"); |
strlcpy(tmp, "root=/dev/hda1 crtmode=vesa0,60", tmplen); |
2820 |
|
|
2821 |
if (machine->boot_string_argument[0]) |
if (machine->boot_string_argument[0]) |
2822 |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), |
2825 |
|
|
2826 |
bootstr = tmp; |
bootstr = tmp; |
2827 |
store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); |
store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); |
|
} |
|
2828 |
|
|
2829 |
/* TODO: netbsd's bootinfo.h, for symbolic names */ |
/* TODO: netbsd's bootinfo.h, for symbolic names */ |
|
{ |
|
|
time_t timet; |
|
|
struct tm *tmp; |
|
2830 |
|
|
2831 |
/* RTC data given by the BIOS: */ |
/* RTC data given by the BIOS: */ |
2832 |
timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ |
timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ |
2833 |
tmp = gmtime(&timet); |
tm_ptr = gmtime(&timet); |
2834 |
/* TODO: are these 0- or 1-based? */ |
/* TODO: are these 0- or 1-based? */ |
2835 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 1, int_to_bcd(tmp->tm_sec)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 1, int_to_bcd(tm_ptr->tm_sec)); |
2836 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 2, int_to_bcd(tmp->tm_min)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 2, int_to_bcd(tm_ptr->tm_min)); |
2837 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 3, int_to_bcd(tmp->tm_hour)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 3, int_to_bcd(tm_ptr->tm_hour)); |
2838 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 5, int_to_bcd(tmp->tm_mday)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 5, int_to_bcd(tm_ptr->tm_mday)); |
2839 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 6, int_to_bcd(tmp->tm_mon + 1)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 6, int_to_bcd(tm_ptr->tm_mon + 1)); |
2840 |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 7, int_to_bcd(tmp->tm_year - 100)); |
store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 7, int_to_bcd(tm_ptr->tm_year - 100)); |
|
} |
|
2841 |
|
|
2842 |
/* "BOOTINFO_PCMCIA_TYPE" in NetBSD's bootinfo.h. This contains the sbus controller type. */ |
/* "BOOTINFO_PCMCIA_TYPE" in NetBSD's bootinfo.h. This contains the sbus controller type. */ |
2843 |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x1c, 2); |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x1c, 2); |
2844 |
|
} |
2845 |
|
|
2846 |
break; |
break; |
2847 |
|
|
2855 |
* detailed list of IP ("Inhouse Processor") model numbers. |
* detailed list of IP ("Inhouse Processor") model numbers. |
2856 |
* (Or http://hardware.majix.org/computers/sgi/iptable.shtml) |
* (Or http://hardware.majix.org/computers/sgi/iptable.shtml) |
2857 |
*/ |
*/ |
2858 |
machine->machine_name = malloc(500); |
machine->machine_name = malloc(MACHINE_NAME_MAXBUF); |
2859 |
if (machine->machine_name == NULL) { |
if (machine->machine_name == NULL) { |
2860 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
2861 |
exit(1); |
exit(1); |
2863 |
|
|
2864 |
if (machine->machine_type == MACHINE_SGI) { |
if (machine->machine_type == MACHINE_SGI) { |
2865 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
2866 |
sprintf(machine->machine_name, "SGI-IP%i", machine->machine_subtype); |
snprintf(machine->machine_name, MACHINE_NAME_MAXBUF, |
2867 |
|
"SGI-IP%i", machine->machine_subtype); |
2868 |
|
|
2869 |
sgi_ram_offset = 1048576 * machine->memory_offset_in_mb; |
sgi_ram_offset = 1048576 * machine->memory_offset_in_mb; |
2870 |
|
|
2882 |
} |
} |
2883 |
} else { |
} else { |
2884 |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2885 |
sprintf(machine->machine_name, "ARC"); |
snprintf(machine->machine_name, |
2886 |
|
MACHINE_NAME_MAXBUF, "ARC"); |
2887 |
} |
} |
2888 |
|
|
2889 |
if (machine->machine_type == MACHINE_SGI) { |
if (machine->machine_type == MACHINE_SGI) { |
2890 |
/* TODO: Other SGI machine types? */ |
/* TODO: Other SGI machine types? */ |
2891 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
2892 |
case 12: |
case 12: |
2893 |
strcat(machine->machine_name, " (Iris Indigo IP12)"); |
strlcat(machine->machine_name, |
2894 |
|
" (Iris Indigo IP12)", MACHINE_NAME_MAXBUF); |
2895 |
|
|
2896 |
/* TODO */ |
/* TODO */ |
2897 |
/* 33 MHz R3000, according to http://www.irisindigo.com/ */ |
/* 33 MHz R3000, according to http://www.irisindigo.com/ */ |
2899 |
|
|
2900 |
break; |
break; |
2901 |
case 19: |
case 19: |
2902 |
strcat(machine->machine_name, " (Everest IP19)"); |
strlcat(machine->machine_name, |
2903 |
|
" (Everest IP19)", MACHINE_NAME_MAXBUF); |
2904 |
machine->main_console_handle = |
machine->main_console_handle = |
2905 |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "serial zs"); /* serial? netbsd? */ |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "serial zs"); /* serial? netbsd? */ |
2906 |
dev_scc_init(machine, mem, 0x10086000, 0, machine->use_x11, 0, 8); /* serial? irix? */ |
dev_scc_init(machine, mem, 0x10086000, 0, machine->use_x11, 0, 8); /* serial? irix? */ |
2920 |
|
|
2921 |
break; |
break; |
2922 |
case 20: |
case 20: |
2923 |
strcat(machine->machine_name, " (Indigo)"); |
strlcat(machine->machine_name, |
2924 |
|
" (Indigo)", MACHINE_NAME_MAXBUF); |
2925 |
|
|
2926 |
/* |
/* |
2927 |
* Guesses based on NetBSD 2.0 beta, 20040606. |
* Guesses based on NetBSD 2.0 beta, 20040606. |
2966 |
|
|
2967 |
break; |
break; |
2968 |
case 21: |
case 21: |
2969 |
strcat(machine->machine_name, " (uknown SGI-IP21 ?)"); /* TODO */ |
strlcat(machine->machine_name, /* TODO */ |
2970 |
|
" (uknown SGI-IP21 ?)", MACHINE_NAME_MAXBUF); |
2971 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
2972 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
2973 |
|
|
2977 |
case 22: |
case 22: |
2978 |
case 24: |
case 24: |
2979 |
if (machine->machine_subtype == 22) { |
if (machine->machine_subtype == 22) { |
2980 |
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Full-house)"); |
strlcat(machine->machine_name, |
2981 |
|
" (Indy, Indigo2, Challenge S; Full-house)", |
2982 |
|
MACHINE_NAME_MAXBUF); |
2983 |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9000, 0); |
2984 |
} else { |
} else { |
2985 |
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Guiness)"); |
strlcat(machine->machine_name, |
2986 |
|
" (Indy, Indigo2, Challenge S; Guiness)", |
2987 |
|
MACHINE_NAME_MAXBUF); |
2988 |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
machine->md_int.sgi_ip22_data = dev_sgi_ip22_init(machine, mem, 0x1fbd9880, 1); |
2989 |
} |
} |
2990 |
|
|
3057 |
case 25: |
case 25: |
3058 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3059 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3060 |
strcat(machine->machine_name, " (Everest IP25)"); |
strlcat(machine->machine_name, |
3061 |
|
" (Everest IP25)", MACHINE_NAME_MAXBUF); |
3062 |
|
|
3063 |
/* serial? irix? */ |
/* serial? irix? */ |
3064 |
dev_scc_init(machine, mem, |
dev_scc_init(machine, mem, |
3079 |
case 26: |
case 26: |
3080 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3081 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3082 |
strcat(machine->machine_name, |
strlcat(machine->machine_name, |
3083 |
" (uknown SGI-IP26 ?)"); /* TODO */ |
" (uknown SGI-IP26 ?)", |
3084 |
|
MACHINE_NAME_MAXBUF); /* TODO */ |
3085 |
machine->main_console_handle = |
machine->main_console_handle = |
3086 |
dev_zs_init(machine, mem, 0x1fbd9830, |
dev_zs_init(machine, mem, 0x1fbd9830, |
3087 |
0, 1, "zs console"); |
0, 1, "zs console"); |
3088 |
break; |
break; |
3089 |
case 27: |
case 27: |
3090 |
strcat(machine->machine_name, |
strlcat(machine->machine_name, |
3091 |
" (Origin 200/2000, Onyx2)"); |
" (Origin 200/2000, Onyx2)", |
3092 |
|
MACHINE_NAME_MAXBUF); |
3093 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3094 |
/* 2 cpus per node */ |
/* 2 cpus per node */ |
3095 |
|
|
3100 |
case 28: |
case 28: |
3101 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3102 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3103 |
strcat(machine->machine_name, " (Impact Indigo2 ?)"); |
strlcat(machine->machine_name, |
3104 |
|
" (Impact Indigo2 ?)", MACHINE_NAME_MAXBUF); |
3105 |
|
|
3106 |
device_add(machine, "random addr=0x1fbe0000, len=1"); |
device_add(machine, "random addr=0x1fbe0000, len=1"); |
3107 |
|
|
3111 |
case 30: |
case 30: |
3112 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3113 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3114 |
strcat(machine->machine_name, " (Octane)"); |
strlcat(machine->machine_name, |
3115 |
|
" (Octane)", MACHINE_NAME_MAXBUF); |
3116 |
|
|
3117 |
machine->md_int.sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
machine->md_int.sgi_ip30_data = dev_sgi_ip30_init(machine, mem, 0x0ff00000); |
3118 |
machine->md_interrupt = sgi_ip30_interrupt; |
machine->md_interrupt = sgi_ip30_interrupt; |
3136 |
* program dumps something there, but it doesn't look like |
* program dumps something there, but it doesn't look like |
3137 |
* readable text. (TODO) |
* readable text. (TODO) |
3138 |
*/ |
*/ |
3139 |
machine->main_console_handle = dev_ns16550_init(machine, mem, 0x1f620170, 0, 1, |
|
3140 |
machine->use_x11? 0 : 1, "serial 0"); /* TODO: irq? */ |
/* TODO: irq! */ |
3141 |
dev_ns16550_init(machine, mem, 0x1f620178, 0, 1, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x1f620170 name2=tty0 in_use=%i", machine->use_x11? 0 : 1); |
3142 |
0, "serial 1"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
3143 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x1f620178 name2=tty1 in_use=0"); |
3144 |
|
device_add(machine, tmpstr); |
3145 |
|
|
3146 |
/* MardiGras graphics: */ |
/* MardiGras graphics: */ |
3147 |
device_add(machine, "sgi_mardigras addr=0x1c000000"); |
device_add(machine, "sgi_mardigras addr=0x1c000000"); |
3148 |
|
|
3149 |
break; |
break; |
3150 |
case 32: |
case 32: |
3151 |
strcat(machine->machine_name, " (O2)"); |
strlcat(machine->machine_name, |
3152 |
|
" (O2)", MACHINE_NAME_MAXBUF); |
3153 |
|
|
3154 |
/* TODO: Find out where the physical ram is actually located. */ |
/* TODO: Find out where the physical ram is actually located. */ |
3155 |
dev_ram_init(mem, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
dev_ram_init(mem, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
3204 |
* intr 7 = MACE_PCI_BRIDGE |
* intr 7 = MACE_PCI_BRIDGE |
3205 |
*/ |
*/ |
3206 |
|
|
|
i = dev_pckbc_init(machine, mem, 0x1f320000, |
|
|
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
|
|
0x800 + MACE_PERIPH_MISC, machine->use_x11, 0); |
|
|
/* keyb+mouse (mace irq numbers) */ |
|
|
|
|
3207 |
net_generate_unique_mac(machine, macaddr); |
net_generate_unique_mac(machine, macaddr); |
3208 |
eaddr_string = malloc(30); |
eaddr_string = malloc(ETHERNET_STRING_MAXLEN); |
3209 |
if (eaddr_string == NULL) { |
if (eaddr_string == NULL) { |
3210 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
3211 |
exit(1); |
exit(1); |
3212 |
} |
} |
3213 |
sprintf(eaddr_string, "eaddr=%02x:%02x:" |
snprintf(eaddr_string, ETHERNET_STRING_MAXLEN, |
3214 |
"%02x:%02x:%02x:%02x", |
"eaddr=%02x:%02x:%02x:%02x:%02x:%02x", |
3215 |
macaddr[0], macaddr[1], macaddr[2], |
macaddr[0], macaddr[1], macaddr[2], |
3216 |
macaddr[3], macaddr[4], macaddr[5]); |
macaddr[3], macaddr[4], macaddr[5]); |
3217 |
dev_sgi_mec_init(machine, mem, 0x1f280000, MACE_ETHERNET, macaddr); |
dev_sgi_mec_init(machine, mem, 0x1f280000, |
3218 |
|
MACE_ETHERNET, macaddr); |
3219 |
|
|
3220 |
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
3221 |
|
|
3222 |
j = dev_ns16550_init(machine, mem, 0x1f390000, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f390000 addr_mult=0x100 in_use=%i name2=tty0", |
3223 |
(1<<20) + MACE_PERIPH_SERIAL, 0x100, |
(1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1); |
3224 |
machine->use_x11? 0 : 1, "serial 0"); /* com0 */ |
j = (size_t)device_add(machine, tmpstr); |
3225 |
dev_ns16550_init(machine, mem, 0x1f398000, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f398000 addr_mult=0x100 in_use=%i name2=tty1", |
3226 |
(1<<26) + MACE_PERIPH_SERIAL, 0x100, |
(1<<26) + MACE_PERIPH_SERIAL, 0); |
3227 |
0, "serial 1"); /* com1 */ |
device_add(machine, tmpstr); |
3228 |
|
|
3229 |
if (machine->use_x11) |
machine->main_console_handle = j; |
3230 |
|
|
3231 |
|
/* TODO: Once this works, it should be enabled |
3232 |
|
always, not just when using X! */ |
3233 |
|
if (machine->use_x11) { |
3234 |
|
i = dev_pckbc_init(machine, mem, 0x1f320000, |
3235 |
|
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
3236 |
|
0x800 + MACE_PERIPH_MISC, machine->use_x11, 0); |
3237 |
|
/* keyb+mouse (mace irq numbers) */ |
3238 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3239 |
else |
} |
|
machine->main_console_handle = j; |
|
3240 |
|
|
3241 |
dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ |
dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ |
3242 |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
3268 |
|
|
3269 |
break; |
break; |
3270 |
case 35: |
case 35: |
3271 |
strcat(machine->machine_name, " (Origin 3000)"); |
strlcat(machine->machine_name, |
3272 |
|
" (Origin 3000)", MACHINE_NAME_MAXBUF); |
3273 |
/* 4 cpus per node */ |
/* 4 cpus per node */ |
3274 |
|
|
3275 |
machine->main_console_handle = |
machine->main_console_handle = |
3277 |
0, 1, "zs console"); |
0, 1, "zs console"); |
3278 |
break; |
break; |
3279 |
case 53: |
case 53: |
3280 |
strcat(machine->machine_name, " (Origin 350)"); |
strlcat(machine->machine_name, |
3281 |
|
" (Origin 350)", MACHINE_NAME_MAXBUF); |
3282 |
/* |
/* |
3283 |
* According to http://kumba.drachentekh.net/xml/myguide.html |
* According to http://kumba.drachentekh.net/xml/myguide.html |
3284 |
* Origin 350, Tezro IP53 R16000 |
* Origin 350, Tezro IP53 R16000 |
3305 |
|
|
3306 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
3307 |
case MACHINE_ARC_NEC_RD94: |
case MACHINE_ARC_NEC_RD94: |
3308 |
strcat(machine->machine_name, " (NEC-RD94, NEC RISCstation 2250)"); |
strlcat(machine->machine_name, |
3309 |
|
" (NEC-RD94, NEC RISCstation 2250)", |
3310 |
|
MACHINE_NAME_MAXBUF); |
3311 |
break; |
break; |
3312 |
case MACHINE_ARC_NEC_R94: |
case MACHINE_ARC_NEC_R94: |
3313 |
strcat(machine->machine_name, " (NEC-R94; NEC RISCstation 2200)"); |
strlcat(machine->machine_name, " (NEC-R94; NEC RISCstation 2200)", |
3314 |
|
MACHINE_NAME_MAXBUF); |
3315 |
break; |
break; |
3316 |
case MACHINE_ARC_NEC_R96: |
case MACHINE_ARC_NEC_R96: |
3317 |
strcat(machine->machine_name, " (NEC-R96; NEC Express RISCserver)"); |
strlcat(machine->machine_name, " (NEC-R96; NEC Express RISCserver)", |
3318 |
|
MACHINE_NAME_MAXBUF); |
3319 |
break; |
break; |
3320 |
} |
} |
3321 |
|
|
3327 |
device_add(machine, "sn addr=0x80001000 irq=0"); |
device_add(machine, "sn addr=0x80001000 irq=0"); |
3328 |
dev_mc146818_init(machine, mem, 0x80004000ULL, 0, MC146818_ARC_NEC, 1); |
dev_mc146818_init(machine, mem, 0x80004000ULL, 0, MC146818_ARC_NEC, 1); |
3329 |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042, 0, 0, machine->use_x11, 0); |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, PCKBC_8042, 0, 0, machine->use_x11, 0); |
3330 |
j = dev_ns16550_init(machine, mem, 0x80006000ULL, |
|
3331 |
3, 1, machine->use_x11? 0 : 1, "serial 0"); /* com0 */ |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=3 addr=0x80006000 in_use=%i name2=tty0", machine->use_x11? 0 : 1); |
3332 |
dev_ns16550_init(machine, mem, 0x80007000ULL, |
j = (size_t)device_add(machine, tmpstr); |
3333 |
0, 1, 0, "serial 1"); /* com1 */ |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x80007000 in_use=%i name2=tty1", 0); |
3334 |
|
device_add(machine, tmpstr); |
3335 |
|
|
3336 |
if (machine->use_x11) |
if (machine->use_x11) |
3337 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3351 |
case MACHINE_ARC_NEC_R96: |
case MACHINE_ARC_NEC_R96: |
3352 |
dev_fb_init(machine, mem, 0x100e00000ULL, |
dev_fb_init(machine, mem, 0x100e00000ULL, |
3353 |
VFB_GENERIC, 640,480, 1024,480, |
VFB_GENERIC, 640,480, 1024,480, |
3354 |
8, "necvdfrb", 1); |
8, "necvdfrb"); |
3355 |
break; |
break; |
3356 |
} |
} |
3357 |
break; |
break; |
3370 |
* Parallel at "start: 0x 0 18c10278, length: 0x1000, level: 5, vector: 5" |
* Parallel at "start: 0x 0 18c10278, length: 0x1000, level: 5, vector: 5" |
3371 |
*/ |
*/ |
3372 |
|
|
3373 |
strcat(machine->machine_name, " (NEC-R98; NEC RISCserver 4200)"); |
strlcat(machine->machine_name, |
3374 |
|
" (NEC-R98; NEC RISCserver 4200)", |
3375 |
|
MACHINE_NAME_MAXBUF); |
3376 |
|
|
3377 |
/* |
/* |
3378 |
* Windows NT access stuff at these addresses: |
* Windows NT access stuff at these addresses: |
3428 |
|
|
3429 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
3430 |
case MACHINE_ARC_JAZZ_PICA: |
case MACHINE_ARC_JAZZ_PICA: |
3431 |
strcat(machine->machine_name, " (Microsoft Jazz, Acer PICA-61)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, Acer PICA-61)", |
3432 |
|
MACHINE_NAME_MAXBUF); |
3433 |
break; |
break; |
3434 |
case MACHINE_ARC_JAZZ_MAGNUM: |
case MACHINE_ARC_JAZZ_MAGNUM: |
3435 |
strcat(machine->machine_name, " (Microsoft Jazz, MIPS Magnum)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, MIPS Magnum)", |
3436 |
|
MACHINE_NAME_MAXBUF); |
3437 |
break; |
break; |
3438 |
default: |
default: |
3439 |
fatal("error in machine.c. jazz\n"); |
fatal("error in machine.c. jazz\n"); |
3447 |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3448 |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
3449 |
|
|
3450 |
j = dev_ns16550_init(machine, mem, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=16 addr=0x80006000 in_use=%i name2=tty0", machine->use_x11? 0 : 1); |
3451 |
0x80006000ULL, 8 + 8, 1, |
j = (size_t)device_add(machine, tmpstr); |
3452 |
machine->use_x11? 0 : 1, "serial 0"); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=17 addr=0x80007000 in_use=%i name2=tty1", 0); |
3453 |
dev_ns16550_init(machine, mem, |
device_add(machine, tmpstr); |
|
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
|
3454 |
|
|
3455 |
if (machine->use_x11) |
if (machine->use_x11) |
3456 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3476 |
/* control at 0x60100000? */ |
/* control at 0x60100000? */ |
3477 |
dev_fb_init(machine, mem, 0x60200000ULL, |
dev_fb_init(machine, mem, 0x60200000ULL, |
3478 |
VFB_GENERIC, 1024,768, 1024,768, |
VFB_GENERIC, 1024,768, 1024,768, |
3479 |
8, "VXL", 1); |
8, "VXL"); |
3480 |
break; |
break; |
3481 |
} |
} |
3482 |
|
|
3495 |
|
|
3496 |
#if 0 |
#if 0 |
3497 |
Not yet. |
Not yet. |
3498 |
dev_wdc_init(machine, mem, 0x900001f0ULL, 8+16 + 14, 0); |
/* irq = 8+16 + 14 */ |
3499 |
|
device_add(machine, "wdc addr=0x900001f0, irq=38"); |
3500 |
#endif |
#endif |
3501 |
|
|
3502 |
break; |
break; |
3511 |
* See http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html. |
* See http://mail-index.netbsd.org/port-arc/2000/10/18/0001.html. |
3512 |
*/ |
*/ |
3513 |
|
|
3514 |
strcat(machine->machine_name, " (Microsoft Jazz, Olivetti M700)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, Olivetti M700)", |
3515 |
|
MACHINE_NAME_MAXBUF); |
3516 |
|
|
3517 |
machine->md_int.jazz_data = device_add(machine, |
machine->md_int.jazz_data = device_add(machine, |
3518 |
"jazz addr=0x80000000"); |
"jazz addr=0x80000000"); |
3526 |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3527 |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
3528 |
#endif |
#endif |
3529 |
j = dev_ns16550_init(machine, mem, |
|
3530 |
0x80006000ULL, 8 + 8, 1, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=16 addr=0x80006000 in_use=%i name2=tty0", machine->use_x11? 0 : 1); |
3531 |
machine->use_x11? 0 : 1, "serial 0"); |
j = (size_t)device_add(machine, tmpstr); |
3532 |
dev_ns16550_init(machine, mem, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=17 addr=0x80007000 in_use=%i name2=tty1", 0); |
3533 |
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
device_add(machine, tmpstr); |
3534 |
|
|
3535 |
if (machine->use_x11) |
if (machine->use_x11) |
3536 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3550 |
* http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html |
* http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html |
3551 |
*/ |
*/ |
3552 |
|
|
3553 |
strcat(machine->machine_name, " (Deskstation Tyne)"); |
strlcat(machine->machine_name, " (Deskstation Tyne)", |
3554 |
|
MACHINE_NAME_MAXBUF); |
3555 |
|
|
3556 |
i = dev_ns16550_init(machine, mem, 0x9000003f8ULL, 0, 1, machine->use_x11? 0 : 1, "serial 0"); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x9000003f8 in_use=%i name2=tty0", machine->use_x11? 0 : 1); |
3557 |
dev_ns16550_init(machine, mem, 0x9000002f8ULL, 0, 1, 0, "serial 1"); |
i = (size_t)device_add(machine, tmpstr); |
3558 |
dev_ns16550_init(machine, mem, 0x9000003e8ULL, 0, 1, 0, "serial 2"); |
device_add(machine, "ns16550 irq=0 addr=0x9000002f8 in_use=0 name2=tty1"); |
3559 |
dev_ns16550_init(machine, mem, 0x9000002e8ULL, 0, 1, 0, "serial 3"); |
device_add(machine, "ns16550 irq=0 addr=0x9000003e8 in_use=0 name2=tty2"); |
3560 |
|
device_add(machine, "ns16550 irq=0 addr=0x9000002e8 in_use=0 name2=tty3"); |
3561 |
|
|
3562 |
dev_mc146818_init(machine, mem, |
dev_mc146818_init(machine, mem, |
3563 |
0x900000070ULL, 2, MC146818_PC_CMOS, 1); |
0x900000070ULL, 2, MC146818_PC_CMOS, 1); |
3564 |
|
|
3565 |
#if 0 |
#if 0 |
3566 |
dev_wdc_init(machine, mem, 0x9000001f0ULL, 0, 0); |
/* TODO: irq, etc */ |
3567 |
dev_wdc_init(machine, mem, 0x900000170ULL, 0, 2); |
device_add(machine, "wdc addr=0x9000001f0, irq=0"); |
3568 |
|
device_add(machine, "wdc addr=0x900000170, irq=0"); |
3569 |
#endif |
#endif |
3570 |
/* PC kbd */ |
/* PC kbd */ |
3571 |
j = dev_pckbc_init(machine, mem, 0x900000060ULL, |
j = dev_pckbc_init(machine, mem, 0x900000060ULL, |
3599 |
* point. |
* point. |
3600 |
*/ |
*/ |
3601 |
|
|
3602 |
if (machine->prom_emulation) |
if (machine->prom_emulation) { |
3603 |
arcbios_init(machine, arc_wordlen == sizeof(uint64_t), |
arcbios_init(machine, arc_wordlen == sizeof(uint64_t), |
3604 |
sgi_ram_offset); |
sgi_ram_offset); |
|
else |
|
|
goto no_arc_prom_emulation; /* TODO: ugly */ |
|
|
|
|
|
/* |
|
|
* TODO: How to build the component tree intermixed with |
|
|
* the rest of device initialization? |
|
|
*/ |
|
3605 |
|
|
3606 |
/* |
/* |
3607 |
* Boot string in ARC format: |
* TODO: How to build the component tree intermixed with |
3608 |
* |
* the rest of device initialization? |
3609 |
* TODO: How about floppies? multi()disk()fdisk() |
*/ |
|
* Is tftp() good for netbooting? |
|
|
*/ |
|
|
init_bootpath = malloc(500); |
|
|
if (init_bootpath == NULL) { |
|
|
fprintf(stderr, "out of mem, bootpath\n"); |
|
|
exit(1); |
|
|
} |
|
|
init_bootpath[0] = '\0'; |
|
3610 |
|
|
3611 |
if (bootdev_id < 0 || machine->force_netboot) { |
/* |
3612 |
snprintf(init_bootpath, 400, "tftp()"); |
* Boot string in ARC format: |
3613 |
} else { |
* |
3614 |
/* TODO: Make this nicer. */ |
* TODO: How about floppies? multi()disk()fdisk() |
3615 |
if (machine->machine_type == MACHINE_SGI) { |
* Is tftp() good for netbooting? |
3616 |
if (machine->machine_subtype == 30) |
*/ |
3617 |
strcat(init_bootpath, "xio(0)pci(15)"); |
init_bootpath = malloc(500); |
3618 |
if (machine->machine_subtype == 32) |
if (init_bootpath == NULL) { |
3619 |
strcat(init_bootpath, "pci(0)"); |
fprintf(stderr, "out of mem, bootpath\n"); |
3620 |
|
exit(1); |
3621 |
} |
} |
3622 |
|
init_bootpath[0] = '\0'; |
3623 |
|
|
3624 |
if (diskimage_is_a_cdrom(machine, bootdev_id, |
if (bootdev_id < 0 || machine->force_netboot) { |
3625 |
bootdev_type)) |
snprintf(init_bootpath, 400, "tftp()"); |
3626 |
snprintf(init_bootpath + strlen(init_bootpath), |
} else { |
3627 |
400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); |
/* TODO: Make this nicer. */ |
3628 |
else |
if (machine->machine_type == MACHINE_SGI) { |
3629 |
snprintf(init_bootpath + strlen(init_bootpath), |
if (machine->machine_subtype == 30) |
3630 |
400,"scsi(0)disk(%i)rdisk(0)partition(1)", |
strlcat(init_bootpath, "xio(0)pci(15)", |
3631 |
bootdev_id); |
MACHINE_NAME_MAXBUF); |
3632 |
} |
if (machine->machine_subtype == 32) |
3633 |
|
strlcat(init_bootpath, "pci(0)", |
3634 |
if (machine->machine_type == MACHINE_ARC) |
MACHINE_NAME_MAXBUF); |
3635 |
strcat(init_bootpath, "\\"); |
} |
3636 |
|
|
3637 |
bootstr = malloc(strlen(init_bootpath) + |
if (diskimage_is_a_cdrom(machine, bootdev_id, |
3638 |
strlen(machine->boot_kernel_filename) + 1); |
bootdev_type)) |
3639 |
strcpy(bootstr, init_bootpath); |
snprintf(init_bootpath + strlen(init_bootpath), |
3640 |
strcat(bootstr, machine->boot_kernel_filename); |
400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); |
3641 |
|
else |
3642 |
|
snprintf(init_bootpath + strlen(init_bootpath), |
3643 |
|
400,"scsi(0)disk(%i)rdisk(0)partition(1)", |
3644 |
|
bootdev_id); |
3645 |
|
} |
3646 |
|
|
3647 |
/* Boot args., eg "-a" */ |
if (machine->machine_type == MACHINE_ARC) |
3648 |
bootarg = machine->boot_string_argument; |
strlcat(init_bootpath, "\\", MACHINE_NAME_MAXBUF); |
3649 |
|
|
3650 |
/* argc, argv, envp in a0, a1, a2: */ |
bootstr = malloc(BOOTSTR_BUFLEN); |
3651 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ |
if (bootstr == NULL) { |
3652 |
|
fprintf(stderr, "out of memory\n"); |
3653 |
|
exit(1); |
3654 |
|
} |
3655 |
|
strlcpy(bootstr, init_bootpath, BOOTSTR_BUFLEN); |
3656 |
|
if (strlcat(bootstr, machine->boot_kernel_filename, |
3657 |
|
BOOTSTR_BUFLEN) >= BOOTSTR_BUFLEN) { |
3658 |
|
fprintf(stderr, "boot string too long?\n"); |
3659 |
|
exit(1); |
3660 |
|
} |
3661 |
|
|
3662 |
/* TODO: not needed? */ |
/* Boot args., eg "-a" */ |
3663 |
cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) |
bootarg = machine->boot_string_argument; |
|
(machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); |
|
3664 |
|
|
3665 |
/* Set up argc/argv: */ |
/* argc, argv, envp in a0, a1, a2: */ |
3666 |
addr = ARC_ENV_STRINGS; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ |
|
addr2 = ARC_ARGV_START; |
|
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; |
|
3667 |
|
|
3668 |
/* bootstr: */ |
/* TODO: not needed? */ |
3669 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) |
3670 |
add_environment_string(cpu, bootstr, &addr); |
(machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); |
3671 |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
|
3672 |
|
/* Set up argc/argv: */ |
3673 |
|
addr = ARC_ENV_STRINGS; |
3674 |
|
addr2 = ARC_ARGV_START; |
3675 |
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; |
3676 |
|
|
3677 |
/* bootarg: */ |
/* bootstr: */ |
|
if (bootarg[0] != '\0') { |
|
3678 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3679 |
add_environment_string(cpu, bootarg, &addr); |
add_environment_string(cpu, bootstr, &addr); |
3680 |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
|
} |
|
3681 |
|
|
3682 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; |
/* bootarg: */ |
3683 |
|
if (bootarg[0] != '\0') { |
3684 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3685 |
|
add_environment_string(cpu, bootarg, &addr); |
3686 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
3687 |
|
} |
3688 |
|
|
3689 |
/* |
cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; |
3690 |
* Add environment variables. For each variable, add it |
|
3691 |
* as a string using add_environment_string(), and add a |
/* |
3692 |
* pointer to it to the ARC_ENV_POINTERS array. |
* Add environment variables. For each variable, add it |
3693 |
*/ |
* as a string using add_environment_string(), and add a |
3694 |
if (machine->use_x11) { |
* pointer to it to the ARC_ENV_POINTERS array. |
3695 |
if (machine->machine_type == MACHINE_ARC) { |
*/ |
3696 |
|
if (machine->use_x11) { |
3697 |
|
if (machine->machine_type == MACHINE_ARC) { |
3698 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3699 |
|
add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); |
3700 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3701 |
|
add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); |
3702 |
|
} else { |
3703 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3704 |
|
add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); |
3705 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3706 |
|
add_environment_string(cpu, "ConsoleOut=video()", &addr); |
3707 |
|
|
3708 |
|
/* g for graphical mode. G for graphical mode |
3709 |
|
with SGI logo visible on Irix? */ |
3710 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3711 |
|
add_environment_string(cpu, "console=g", &addr); |
3712 |
|
} |
3713 |
|
} else { |
3714 |
|
if (machine->machine_type == MACHINE_ARC) { |
3715 |
|
/* TODO: serial console for ARC? */ |
3716 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3717 |
|
add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); |
3718 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3719 |
|
add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); |
3720 |
|
} else { |
3721 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3722 |
|
add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); |
3723 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3724 |
|
add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); |
3725 |
|
|
3726 |
|
/* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ |
3727 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3728 |
|
add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ |
3729 |
|
} |
3730 |
|
} |
3731 |
|
|
3732 |
|
if (machine->machine_type == MACHINE_SGI) { |
3733 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3734 |
add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); |
add_environment_string(cpu, "AutoLoad=No", &addr); |
3735 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3736 |
add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); |
add_environment_string(cpu, "diskless=0", &addr); |
|
} else { |
|
3737 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3738 |
add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); |
add_environment_string(cpu, "volume=80", &addr); |
3739 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3740 |
add_environment_string(cpu, "ConsoleOut=video()", &addr); |
add_environment_string(cpu, "sgilogo=y", &addr); |
3741 |
|
|
|
/* g for graphical mode. G for graphical mode |
|
|
with SGI logo visible on Irix? */ |
|
3742 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3743 |
add_environment_string(cpu, "console=g", &addr); |
add_environment_string(cpu, "monitor=h", &addr); |
|
} |
|
|
} else { |
|
|
if (machine->machine_type == MACHINE_ARC) { |
|
|
/* TODO: serial console for ARC? */ |
|
3744 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3745 |
add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); |
add_environment_string(cpu, "TimeZone=GMT", &addr); |
3746 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3747 |
add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); |
add_environment_string(cpu, "nogfxkbd=1", &addr); |
3748 |
} else { |
|
3749 |
|
/* TODO: 'xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(0)' on IP30 at least */ |
3750 |
|
|
3751 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3752 |
add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); |
add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &addr); |
3753 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3754 |
add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); |
add_environment_string(cpu, "OSLoadPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(0)", &addr); |
|
|
|
|
/* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ |
|
3755 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3756 |
add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ |
add_environment_string(cpu, "OSLoadFilename=/unix", &addr); |
3757 |
} |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3758 |
} |
add_environment_string(cpu, "OSLoader=sash", &addr); |
|
|
|
|
if (machine->machine_type == MACHINE_SGI) { |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "AutoLoad=No", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "diskless=0", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "volume=80", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "sgilogo=y", &addr); |
|
|
|
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "monitor=h", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "TimeZone=GMT", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "nogfxkbd=1", &addr); |
|
3759 |
|
|
3760 |
/* TODO: 'xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(0)' on IP30 at least */ |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3761 |
|
add_environment_string(cpu, "rbaud=9600", &addr); |
3762 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3763 |
|
add_environment_string(cpu, "rebound=y", &addr); |
3764 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3765 |
|
add_environment_string(cpu, "crt_option=1", &addr); |
3766 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3767 |
|
add_environment_string(cpu, "netaddr=10.0.0.1", &addr); |
3768 |
|
|
3769 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3770 |
add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &addr); |
add_environment_string(cpu, "keybd=US", &addr); |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "OSLoadPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(0)", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "OSLoadFilename=/unix", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "OSLoader=sash", &addr); |
|
3771 |
|
|
3772 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3773 |
add_environment_string(cpu, "rbaud=9600", &addr); |
add_environment_string(cpu, "cpufreq=3", &addr); |
3774 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3775 |
add_environment_string(cpu, "rebound=y", &addr); |
add_environment_string(cpu, "dbaud=9600", &addr); |
3776 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3777 |
add_environment_string(cpu, "crt_option=1", &addr); |
add_environment_string(cpu, eaddr_string, &addr); |
3778 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3779 |
add_environment_string(cpu, "netaddr=10.0.0.1", &addr); |
add_environment_string(cpu, "verbose=istrue", &addr); |
3780 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3781 |
|
add_environment_string(cpu, "showconfig=istrue", &addr); |
3782 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3783 |
|
add_environment_string(cpu, "diagmode=v", &addr); |
3784 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3785 |
|
add_environment_string(cpu, "kernname=unix", &addr); |
3786 |
|
} else { |
3787 |
|
char *tmp; |
3788 |
|
size_t mlen = strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2; |
3789 |
|
tmp = malloc(mlen); |
3790 |
|
snprintf(tmp, mlen, "OSLOADOPTIONS=%s", bootarg); |
3791 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3792 |
|
add_environment_string(cpu, tmp, &addr); |
3793 |
|
|
3794 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3795 |
add_environment_string(cpu, "keybd=US", &addr); |
add_environment_string(cpu, "OSLOADPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
3796 |
|
|
3797 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3798 |
add_environment_string(cpu, "cpufreq=3", &addr); |
add_environment_string(cpu, "SYSTEMPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
3799 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
} |
|
add_environment_string(cpu, "dbaud=9600", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, eaddr_string, &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "verbose=istrue", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "showconfig=istrue", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "diagmode=v", &addr); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, "kernname=unix", &addr); |
|
|
} else { |
|
|
char *tmp; |
|
|
tmp = malloc(strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2); |
|
|
sprintf(tmp, "OSLOADOPTIONS=%s", bootarg); |
|
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
|
|
add_environment_string(cpu, tmp, &addr); |
|
3800 |
|
|
3801 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
/* End the environment strings with an empty zero-terminated |
3802 |
add_environment_string(cpu, "OSLOADPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
string, and the envp array with a NULL pointer. */ |
3803 |
|
add_environment_string(cpu, "", &addr); /* the end */ |
3804 |
|
store_pointer_and_advance(cpu, &addr2, |
3805 |
|
0, arc_wordlen==sizeof(uint64_t)); |
3806 |
|
|
3807 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
/* Return address: (0x20 = ReturnFromMain()) */ |
3808 |
add_environment_string(cpu, "SYSTEMPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); |
cpu->cd.mips.gpr[MIPS_GPR_RA] = ARC_FIRMWARE_ENTRIES + 0x20; |
3809 |
} |
} |
3810 |
|
|
|
/* End the environment strings with an empty zero-terminated |
|
|
string, and the envp array with a NULL pointer. */ |
|
|
add_environment_string(cpu, "", &addr); /* the end */ |
|
|
store_pointer_and_advance(cpu, &addr2, |
|
|
0, arc_wordlen==sizeof(uint64_t)); |
|
|
|
|
|
no_arc_prom_emulation: /* TODO: ugly, get rid of the goto */ |
|
|
|
|
|
/* Return address: (0x20 = ReturnFromMain()) */ |
|
|
cpu->cd.mips.gpr[MIPS_GPR_RA] = ARC_FIRMWARE_ENTRIES + 0x20; |
|
|
|
|
3811 |
break; |
break; |
3812 |
|
|
3813 |
case MACHINE_MESHCUBE: |
case MACHINE_MESHCUBE: |
3837 |
|
|
3838 |
device_add(machine, "random addr=0x1017fffc len=4"); |
device_add(machine, "random addr=0x1017fffc len=4"); |
3839 |
|
|
3840 |
/* |
if (machine->prom_emulation) { |
3841 |
* TODO: A Linux kernel wants "memsize" from somewhere... I |
/* |
3842 |
* haven't found any docs on how it is used though. |
* TODO: A Linux kernel wants "memsize" from somewhere... I |
3843 |
*/ |
* haven't found any docs on how it is used though. |
3844 |
|
*/ |
3845 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; |
3846 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; |
cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; |
3847 |
store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], |
store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], |
3848 |
0xa0002000ULL); |
0xa0002000ULL); |
3849 |
store_string(cpu, 0xa0002000ULL, "something=somethingelse"); |
store_string(cpu, 0xa0002000ULL, "something=somethingelse"); |
|
|
|
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; |
|
|
store_string(cpu, 0xa0002000ULL, "hello=world\n"); |
|
3850 |
|
|
3851 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; |
3852 |
|
store_string(cpu, 0xa0002000ULL, "hello=world\n"); |
3853 |
|
} |
3854 |
break; |
break; |
3855 |
|
|
3856 |
case MACHINE_NETGEAR: |
case MACHINE_NETGEAR: |
3857 |
machine->machine_name = "NetGear WG602"; |
machine->machine_name = "NetGear WG602v1"; |
3858 |
|
|
3859 |
if (machine->use_x11) |
if (machine->use_x11) |
3860 |
fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); |
fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); |
3861 |
if (machine->physical_ram_in_mb != 16) |
if (machine->physical_ram_in_mb != 16) |
3862 |
fprintf(stderr, "WARNING! Real NetGear WG602 boxes have exactly 16 MB RAM. Continuing anyway.\n"); |
fprintf(stderr, "WARNING! Real NetGear WG602v1 boxes have exactly 16 MB RAM. Continuing anyway.\n"); |
3863 |
|
|
3864 |
/* |
/* |
3865 |
* Lots of info about the IDT 79RC 32334 |
* Lots of info about the IDT 79RC 32334 |
3892 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
3893 |
machine->machine_name = "Sony NeWS (NET WORK STATION)"; |
machine->machine_name = "Sony NeWS (NET WORK STATION)"; |
3894 |
|
|
3895 |
/* This is just a test. TODO */ |
if (machine->prom_emulation) { |
3896 |
{ |
/* This is just a test. TODO */ |
3897 |
int i; |
int i; |
3898 |
for (i=0; i<32; i++) |
for (i=0; i<32; i++) |
3899 |
cpu->cd.mips.gpr[i] = |
cpu->cd.mips.gpr[i] = |
3905 |
|
|
3906 |
break; |
break; |
3907 |
|
|
3908 |
|
case MACHINE_EVBMIPS: |
3909 |
|
/* http://www.netbsd.org/Ports/evbmips/ */ |
3910 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
3911 |
|
|
3912 |
|
switch (machine->machine_subtype) { |
3913 |
|
case MACHINE_EVBMIPS_MALTA: |
3914 |
|
case MACHINE_EVBMIPS_MALTA_BE: |
3915 |
|
machine->machine_name = "MALTA (evbmips, little endian)"; |
3916 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
3917 |
|
|
3918 |
|
if (machine->machine_subtype == MACHINE_EVBMIPS_MALTA_BE) { |
3919 |
|
machine->machine_name = "MALTA (evbmips, big endian)"; |
3920 |
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
3921 |
|
} |
3922 |
|
|
3923 |
|
/* ISA interrupt controllers: */ |
3924 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x18000020"); |
3925 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
3926 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x180000a0"); |
3927 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
3928 |
|
machine->md_interrupt = malta_interrupt; |
3929 |
|
|
3930 |
|
dev_mc146818_init(machine, mem, 0x18000070, 8 + 8, MC146818_PC_CMOS, 1); |
3931 |
|
|
3932 |
|
machine->main_console_handle = (size_t) |
3933 |
|
device_add(machine, "ns16550 irq=12 addr=0x180003f8 name2=tty0"); |
3934 |
|
device_add(machine, "ns16550 irq=11 addr=0x180002f8 name2=tty1"); |
3935 |
|
|
3936 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART); |
3937 |
|
device_add(machine, tmpstr); |
3938 |
|
/* TODO: Irqs */ |
3939 |
|
pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120); |
3940 |
|
|
3941 |
|
/* TODO: Haha, this is bogus. Just a cut&paste |
3942 |
|
from the Cobalt emulation above. */ |
3943 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
3944 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
3945 |
|
|
3946 |
|
device_add(machine, "malta_lcd addr=0x1f000400"); |
3947 |
|
break; |
3948 |
|
case MACHINE_EVBMIPS_PB1000: |
3949 |
|
machine->machine_name = "PB1000 (evbmips)"; |
3950 |
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
3951 |
|
|
3952 |
|
machine->md_interrupt = au1x00_interrupt; |
3953 |
|
machine->md_int.au1x00_ic_data = dev_au1x00_init(machine, mem); |
3954 |
|
/* TODO */ |
3955 |
|
break; |
3956 |
|
default: |
3957 |
|
fatal("Unimplemented EVBMIPS model.\n"); |
3958 |
|
exit(1); |
3959 |
|
} |
3960 |
|
|
3961 |
|
if (machine->prom_emulation) { |
3962 |
|
/* This is just a test. TODO */ |
3963 |
|
for (i=0; i<32; i++) |
3964 |
|
cpu->cd.mips.gpr[i] = |
3965 |
|
0x01230000 + (i << 8) + 0x55; |
3966 |
|
|
3967 |
|
/* NetBSD/evbmips wants these: (at least for Malta) */ |
3968 |
|
|
3969 |
|
/* a0 = argc */ |
3970 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; |
3971 |
|
|
3972 |
|
/* a1 = argv */ |
3973 |
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = (int32_t)0x9fc01000; |
3974 |
|
store_32bit_word(cpu, (int32_t)0x9fc01000, 0x9fc01040); |
3975 |
|
store_32bit_word(cpu, (int32_t)0x9fc01004, 0x9fc01200); |
3976 |
|
store_32bit_word(cpu, (int32_t)0x9fc01008, 0); |
3977 |
|
|
3978 |
|
bootstr = strdup(machine->boot_kernel_filename); |
3979 |
|
bootarg = strdup(machine->boot_string_argument); |
3980 |
|
store_string(cpu, (int32_t)0x9fc01040, bootstr); |
3981 |
|
store_string(cpu, (int32_t)0x9fc01200, bootarg); |
3982 |
|
|
3983 |
|
/* a2 = (yamon_env_var *)envp */ |
3984 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800; |
3985 |
|
{ |
3986 |
|
uint64_t env = cpu->cd.mips.gpr[MIPS_GPR_A2]; |
3987 |
|
uint64_t tmpptr = 0xffffffff9fc01c00ULL; |
3988 |
|
char tmps[50]; |
3989 |
|
|
3990 |
|
snprintf(tmps, sizeof(tmps), "0x%08x", |
3991 |
|
machine->physical_ram_in_mb * 1048576); |
3992 |
|
add_environment_string_dual(cpu, |
3993 |
|
&env, &tmpptr, "memsize", tmps); |
3994 |
|
|
3995 |
|
add_environment_string_dual(cpu, |
3996 |
|
&env, &tmpptr, "yamonrev", "02.06"); |
3997 |
|
|
3998 |
|
/* End of env: */ |
3999 |
|
tmpptr = 0; |
4000 |
|
add_environment_string_dual(cpu, |
4001 |
|
&env, &tmpptr, NULL, NULL); |
4002 |
|
} |
4003 |
|
|
4004 |
|
/* a3 = memsize */ |
4005 |
|
cpu->cd.mips.gpr[MIPS_GPR_A3] = |
4006 |
|
machine->physical_ram_in_mb * 1048576; |
4007 |
|
/* Hm. Linux ignores a3. */ |
4008 |
|
|
4009 |
|
/* |
4010 |
|
* TODO: |
4011 |
|
* Core ID numbers. |
4012 |
|
* How much of this is not valid for PBxxxx? |
4013 |
|
* |
4014 |
|
* See maltareg.h for more info. |
4015 |
|
*/ |
4016 |
|
store_32bit_word(cpu, (int32_t)(0x80000000 + MALTA_REVISION), (1 << 10) + 0x26); |
4017 |
|
|
4018 |
|
/* Call vectors at 0x9fc005xx: */ |
4019 |
|
for (i=0; i<0x100; i+=4) |
4020 |
|
store_32bit_word(cpu, (int64_t)(int32_t)0x9fc00500 + i, |
4021 |
|
(int64_t)(int32_t)0x9fc00800 + i); |
4022 |
|
} |
4023 |
|
break; |
4024 |
|
|
4025 |
|
case MACHINE_PSP: |
4026 |
|
/* |
4027 |
|
* The Playstation Portable seems to be a strange beast. |
4028 |
|
* |
4029 |
|
* http://yun.cup.com/psppg004.html (in Japanese) seems to |
4030 |
|
* suggest that virtual addresses are not displaced by |
4031 |
|
* 0x80000000 as on normal CPUs, but by 0x40000000? |
4032 |
|
*/ |
4033 |
|
machine->machine_name = "Playstation Portable"; |
4034 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
4035 |
|
|
4036 |
|
if (!machine->use_x11 && !quiet_mode) |
4037 |
|
fprintf(stderr, "-------------------------------------" |
4038 |
|
"------------------------------------------\n" |
4039 |
|
"\n WARNING! You are emulating a PSP without -X. " |
4040 |
|
"You will miss graphical output!\n\n" |
4041 |
|
"-------------------------------------" |
4042 |
|
"------------------------------------------\n"); |
4043 |
|
|
4044 |
|
/* 480 x 272 pixels framebuffer (512 bytes per line) */ |
4045 |
|
fb = dev_fb_init(machine, mem, 0x04000000, VFB_HPCMIPS, |
4046 |
|
480,272, 512,1088, -15, "Playstation Portable"); |
4047 |
|
|
4048 |
|
/* |
4049 |
|
* TODO/NOTE: This is ugly, but necessary since GXemul doesn't |
4050 |
|
* emulate any MIPS CPU without MMU right now. |
4051 |
|
*/ |
4052 |
|
mips_coproc_tlb_set_entry(cpu, 0, 1048576*16, |
4053 |
|
0x44000000 /*vaddr*/, 0x4000000, 0x4000000 + 1048576*16, |
4054 |
|
1,1,1,1,1, 0, 2, 2); |
4055 |
|
mips_coproc_tlb_set_entry(cpu, 1, 1048576*16, |
4056 |
|
0x8000000 /*vaddr*/, 0x0, 0x0 + 1048576*16, |
4057 |
|
1,1,1,1,1, 0, 2, 2); |
4058 |
|
mips_coproc_tlb_set_entry(cpu, 2, 1048576*16, |
4059 |
|
0x9000000 /*vaddr*/, 0x01000000, 0x01000000 + 1048576*16, |
4060 |
|
1,1,1,1,1, 0, 2, 2); |
4061 |
|
mips_coproc_tlb_set_entry(cpu, 3, 1048576*16, |
4062 |
|
0x0 /*vaddr*/, 0, 0 + 1048576*16, 1,1,1,1,1, 0, 2, 2); |
4063 |
|
|
4064 |
|
cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0; |
4065 |
|
|
4066 |
|
break; |
4067 |
|
#endif /* ENABLE_MIPS */ |
4068 |
|
|
4069 |
|
#ifdef ENABLE_PPC |
4070 |
case MACHINE_BAREPPC: |
case MACHINE_BAREPPC: |
4071 |
/* |
/* |
4072 |
* A "bare" PPC machine. |
* A "bare" PPC machine. |
4083 |
machine->machine_name = "PPC test machine"; |
machine->machine_name = "PPC test machine"; |
4084 |
|
|
4085 |
/* TODO: interrupt for PPC? */ |
/* TODO: interrupt for PPC? */ |
4086 |
machine->main_console_handle = dev_cons_init( |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4087 |
machine, mem, DEV_CONS_ADDRESS, "console", 0); |
(long long)DEV_CONS_ADDRESS); |
4088 |
|
cons_data = device_add(machine, tmpstr); |
4089 |
|
machine->main_console_handle = cons_data->console_handle; |
4090 |
|
|
4091 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4092 |
(long long)DEV_MP_ADDRESS); |
(long long)DEV_MP_ADDRESS); |
4093 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4094 |
|
|
4095 |
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4096 |
640,480, 640,480, 24, "generic", 1); |
640,480, 640,480, 24, "testppc generic"); |
4097 |
|
|
4098 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4099 |
|
(long long)DEV_DISK_ADDRESS); |
4100 |
|
device_add(machine, tmpstr); |
4101 |
|
|
4102 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4103 |
|
(long long)DEV_ETHER_ADDRESS); |
4104 |
|
device_add(machine, tmpstr); |
4105 |
|
|
4106 |
break; |
break; |
4107 |
|
|
4108 |
case MACHINE_WALNUT: |
case MACHINE_WALNUT: |
4122 |
dev_pmppc_init(mem); |
dev_pmppc_init(mem); |
4123 |
|
|
4124 |
/* com0 = 0xff600300, com1 = 0xff600400 */ |
/* com0 = 0xff600300, com1 = 0xff600400 */ |
4125 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
|
4126 |
0xff600300, 0, 1, 1, "serial 0"); |
machine->main_console_handle = (size_t)device_add(machine, "ns16550 irq=0 addr=0xff600300 name2=tty0"); |
4127 |
dev_ns16550_init(machine, mem, |
device_add(machine, "ns16550 irq=0 addr=0xff600400 in_use=0 name2=tty1"); |
|
0xff600400, 0, 1, 0, "serial 1"); |
|
4128 |
|
|
4129 |
break; |
break; |
4130 |
|
|
4151 |
|
|
4152 |
device_add(machine, "bebox"); |
device_add(machine, "bebox"); |
4153 |
|
|
4154 |
/* Serial, used by NetBSD: */ |
machine->main_console_handle = (size_t) |
4155 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
device_add(machine, "ns16550 irq=0 addr=0x800003f8 name2=tty0"); |
4156 |
0x800003f8, 0, 1, 1, "serial 0"); |
device_add(machine, "ns16550 irq=0 addr=0x800002f8 name2=tty1 in_use=0"); |
4157 |
|
|
4158 |
/* Serial, used by Linux: */ |
dev_pckbc_init(machine, mem, 0x80000060, PCKBC_8042, |
4159 |
dev_ns16550_init(machine, mem, 0x800002f8, 0, 1, 0, "serial 1"); |
1, 12, machine->use_x11, 1); |
4160 |
|
|
4161 |
/* This is used by Linux too: */ |
if (machine->use_x11) |
4162 |
dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL, |
dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL, |
4163 |
machine->machine_name); |
machine->machine_name); |
|
|
|
|
store_32bit_word(cpu, 0x3010, |
|
|
machine->physical_ram_in_mb * 1048576); |
|
|
|
|
|
/* TODO: List of stuff, see http://www.beatjapan.org/ |
|
|
mirror/www.be.com/aboutbe/benewsletter/ |
|
|
Issue27.html#Cookbook for the details. */ |
|
|
store_32bit_word(cpu, 0x301c, 0); |
|
|
|
|
|
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
|
|
r5 = args, r6 = ptr to bootinfo? */ |
|
|
cpu->cd.ppc.gpr[3] = 0x3100; |
|
|
cpu->cd.ppc.gpr[4] = 0x200000; |
|
|
cpu->cd.ppc.gpr[5] = 0x2000; |
|
|
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
|
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 |
|
|
- 0x100; |
|
|
|
|
|
/* See NetBSD's bebox/include/bootinfo.h for details */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 0, 12); /* next */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 4, 0); /* mem */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 8, |
|
|
machine->physical_ram_in_mb * 1048576); |
|
|
|
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 12, 20); /* next */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 16, 1); /* console */ |
|
|
store_buf(cpu, cpu->cd.ppc.gpr[6] + 20, "com", 4); |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 24, 0x3f8);/* addr */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 28, 9600);/* speed */ |
|
|
|
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 32, 0); /* next */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 36, 2); /* clock */ |
|
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 40, 100); |
|
4164 |
|
|
4165 |
|
if (machine->prom_emulation) { |
4166 |
|
store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576); |
4167 |
|
|
4168 |
|
/* TODO: List of stuff, see http://www.beatjapan.org/ |
4169 |
|
mirror/www.be.com/aboutbe/benewsletter/ |
4170 |
|
Issue27.html#Cookbook for the details. */ |
4171 |
|
store_32bit_word(cpu, 0x301c, 0); |
4172 |
|
|
4173 |
|
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
4174 |
|
r5 = args, r6 = ptr to bootinfo? */ |
4175 |
|
cpu->cd.ppc.gpr[3] = 0x3100; |
4176 |
|
cpu->cd.ppc.gpr[4] = 0x200000; |
4177 |
|
cpu->cd.ppc.gpr[5] = 0x2000; |
4178 |
|
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
4179 |
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100; |
4180 |
|
|
4181 |
|
/* See NetBSD's bebox/include/bootinfo.h for details */ |
4182 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 0, 12); /* next */ |
4183 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 4, 0); /* mem */ |
4184 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 8, |
4185 |
|
machine->physical_ram_in_mb * 1048576); |
4186 |
|
|
4187 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 12, 20); /* next */ |
4188 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 16, 1); /* console */ |
4189 |
|
store_buf(cpu, cpu->cd.ppc.gpr[6] + 20, |
4190 |
|
machine->use_x11? "vga" : "com", 4); |
4191 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 24, 0x3f8);/* addr */ |
4192 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 28, 9600);/* speed */ |
4193 |
|
|
4194 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 32, 0); /* next */ |
4195 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 36, 2); /* clock */ |
4196 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 40, 100); |
4197 |
|
} |
4198 |
break; |
break; |
4199 |
|
|
4200 |
case MACHINE_PREP: |
case MACHINE_PREP: |
4203 |
*/ |
*/ |
4204 |
machine->machine_name = "PowerPC Reference Platform"; |
machine->machine_name = "PowerPC Reference Platform"; |
4205 |
|
|
4206 |
{ |
if (machine->prom_emulation) { |
4207 |
int i; |
/* Linux on PReP has 0xdeadc0de at address 0? (See |
4208 |
for (i=0; i<32; i++) |
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
4209 |
cpu->cd.ppc.gpr[i] = |
store_32bit_word(cpu, 0, 0xdeadc0de); |
|
0x12340000 + (i << 8) + 0x55; |
|
|
} |
|
|
|
|
|
/* Linux on PReP has 0xdeadc0de at address 0? (See |
|
|
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
|
|
store_32bit_word(cpu, 0, 0xdeadc0de); |
|
|
|
|
|
/* r6 should point to "residual data"? */ |
|
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 |
|
|
- 0x1000; |
|
4210 |
|
|
4211 |
|
/* r6 should point to "residual data"? */ |
4212 |
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x1000; |
4213 |
|
} |
4214 |
break; |
break; |
4215 |
|
|
4216 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
4220 |
*/ |
*/ |
4221 |
machine->machine_name = "Macintosh (PPC)"; |
machine->machine_name = "Macintosh (PPC)"; |
4222 |
|
|
4223 |
/* r5 = OpenFirmware entry point */ |
if (machine->prom_emulation) { |
4224 |
cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; |
uint64_t b = 8 * 1048576, a = b - 0x800; |
4225 |
|
int i; |
4226 |
|
/* |
4227 |
|
* r3 = pointer to boot_args (for the Mach kernel). |
4228 |
|
* See http://darwinsource.opendarwin.org/10.3/ |
4229 |
|
* BootX-59/bootx.tproj/include.subproj/boot_args.h |
4230 |
|
* for more info. |
4231 |
|
*/ |
4232 |
|
cpu->cd.ppc.gpr[3] = a; |
4233 |
|
store_16bit_word(cpu, a + 0x0000, 1); /* revision */ |
4234 |
|
store_16bit_word(cpu, a + 0x0002, 2); /* version */ |
4235 |
|
store_buf(cpu, a + 0x0004, machine->boot_string_argument, 256); |
4236 |
|
/* 26 dram banks; "long base; long size" */ |
4237 |
|
store_32bit_word(cpu, a + 0x0104, 0); /* base */ |
4238 |
|
store_32bit_word(cpu, a + 0x0108, machine->physical_ram_in_mb |
4239 |
|
* 256); /* size (in pages) */ |
4240 |
|
for (i=8; i<26*8; i+= 4) |
4241 |
|
store_32bit_word(cpu, a + 0x0104 + i, 0); |
4242 |
|
a += (0x104 + 26 * 8); |
4243 |
|
/* Video info: */ |
4244 |
|
store_32bit_word(cpu, a+0, 0xd0000000); /* video base */ |
4245 |
|
store_32bit_word(cpu, a+4, 0); /* display code (?) */ |
4246 |
|
store_32bit_word(cpu, a+8, 800); /* bytes per pixel row */ |
4247 |
|
store_32bit_word(cpu, a+12, 800); /* width */ |
4248 |
|
store_32bit_word(cpu, a+16, 600); /* height */ |
4249 |
|
store_32bit_word(cpu, a+20, 8); /* pixel depth */ |
4250 |
|
a += 24; |
4251 |
|
store_32bit_word(cpu, a+0, 127); /* gestalt number (TODO) */ |
4252 |
|
store_32bit_word(cpu, a+4, 0); /* device tree pointer (TODO) */ |
4253 |
|
store_32bit_word(cpu, a+8, 0); /* device tree length */ |
4254 |
|
store_32bit_word(cpu, a+12, b); /* last address of kernel data area */ |
4255 |
|
|
4256 |
|
/* r4 = "MOSX" (0x4D4F5358) */ |
4257 |
|
cpu->cd.ppc.gpr[4] = 0x4D4F5358; |
4258 |
|
|
4259 |
|
/* |
4260 |
|
* r5 = OpenFirmware entry point. NOTE: See |
4261 |
|
* cpu_ppc.c for the rest of this semi-ugly hack. |
4262 |
|
*/ |
4263 |
|
dev_ram_init(cpu->mem, cpu->cd.ppc.of_emul_addr, |
4264 |
|
0x1000, DEV_RAM_RAM, 0x0); |
4265 |
|
store_32bit_word(cpu, cpu->cd.ppc.of_emul_addr, |
4266 |
|
0x44ee0002); |
4267 |
|
cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; |
4268 |
|
} |
4269 |
break; |
break; |
4270 |
|
|
4271 |
case MACHINE_DB64360: |
case MACHINE_DB64360: |
4272 |
/* For playing with PMON2000 for PPC: */ |
/* For playing with PMON2000 for PPC: */ |
4273 |
machine->machine_name = "DB64360"; |
machine->machine_name = "DB64360"; |
4274 |
|
|
4275 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
machine->main_console_handle = (size_t)device_add(machine, |
4276 |
0x1d000020, 0, 4, 1, "serial console"); |
"ns16550 irq=0 addr=0x1d000020 addr_mult=4"); |
4277 |
|
|
4278 |
{ |
if (machine->prom_emulation) { |
4279 |
int i; |
int i; |
4280 |
for (i=0; i<32; i++) |
for (i=0; i<32; i++) |
4281 |
cpu->cd.ppc.gpr[i] = |
cpu->cd.ppc.gpr[i] = |
4283 |
} |
} |
4284 |
|
|
4285 |
break; |
break; |
4286 |
|
#endif /* ENABLE_PPC */ |
4287 |
|
|
4288 |
case MACHINE_BARESPARC: |
#ifdef ENABLE_SH |
4289 |
/* A bare SPARC machine, with no devices. */ |
case MACHINE_BARESH: |
4290 |
machine->machine_name = "\"Bare\" SPARC machine"; |
/* A bare SH machine, with no devices. */ |
4291 |
|
machine->machine_name = "\"Bare\" SH machine"; |
4292 |
break; |
break; |
4293 |
|
|
4294 |
case MACHINE_ULTRA1: |
case MACHINE_TESTSH: |
4295 |
/* |
machine->machine_name = "SH test machine"; |
4296 |
* NetBSD/sparc64 (http://www.netbsd.org/Ports/sparc64/) |
|
4297 |
* OpenBSD/sparc64 (http://www.openbsd.org/sparc64.html) |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4298 |
*/ |
(long long)DEV_CONS_ADDRESS); |
4299 |
machine->machine_name = "Sun Ultra1"; |
cons_data = device_add(machine, tmpstr); |
4300 |
break; |
machine->main_console_handle = cons_data->console_handle; |
4301 |
|
|
4302 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4303 |
|
(long long)DEV_MP_ADDRESS); |
4304 |
|
device_add(machine, tmpstr); |
4305 |
|
|
4306 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4307 |
|
640,480, 640,480, 24, "testsh generic"); |
4308 |
|
|
4309 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4310 |
|
(long long)DEV_DISK_ADDRESS); |
4311 |
|
device_add(machine, tmpstr); |
4312 |
|
|
4313 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4314 |
|
(long long)DEV_ETHER_ADDRESS); |
4315 |
|
device_add(machine, tmpstr); |
4316 |
|
|
|
case MACHINE_BAREURISC: |
|
|
machine->machine_name = "\"Bare\" URISC machine"; |
|
4317 |
break; |
break; |
4318 |
|
|
4319 |
case MACHINE_TESTURISC: |
case MACHINE_HPCSH: |
4320 |
machine->machine_name = "URISC test machine"; |
/* Handheld SH-based machines: */ |
4321 |
|
machine->machine_name = "HPCsh"; |
4322 |
|
|
4323 |
/* TODO */ |
/* TODO */ |
|
/* A special "device" for accessing normal devices |
|
|
using urisc accesses? */ |
|
|
|
|
|
device_add(machine, "urisc addr=0x12341234"); |
|
4324 |
|
|
4325 |
break; |
break; |
4326 |
|
#endif /* ENABLE_SH */ |
4327 |
|
|
4328 |
|
#ifdef ENABLE_HPPA |
4329 |
case MACHINE_BAREHPPA: |
case MACHINE_BAREHPPA: |
4330 |
|
/* A bare HPPA machine, with no devices. */ |
4331 |
machine->machine_name = "\"Bare\" HPPA machine"; |
machine->machine_name = "\"Bare\" HPPA machine"; |
4332 |
break; |
break; |
4333 |
|
|
4334 |
case MACHINE_TESTHPPA: |
case MACHINE_TESTHPPA: |
4335 |
machine->machine_name = "HPPA test machine"; |
machine->machine_name = "HPPA test machine"; |
4336 |
|
|
4337 |
/* TODO */ |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4338 |
|
(long long)DEV_CONS_ADDRESS); |
4339 |
|
cons_data = device_add(machine, tmpstr); |
4340 |
|
machine->main_console_handle = cons_data->console_handle; |
4341 |
|
|
4342 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4343 |
|
(long long)DEV_MP_ADDRESS); |
4344 |
|
device_add(machine, tmpstr); |
4345 |
|
|
4346 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4347 |
|
640,480, 640,480, 24, "testhppa generic"); |
4348 |
|
|
4349 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4350 |
|
(long long)DEV_DISK_ADDRESS); |
4351 |
|
device_add(machine, tmpstr); |
4352 |
|
|
4353 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4354 |
|
(long long)DEV_ETHER_ADDRESS); |
4355 |
|
device_add(machine, tmpstr); |
4356 |
|
|
4357 |
|
break; |
4358 |
|
#endif /* ENABLE_HPPA */ |
4359 |
|
|
4360 |
|
#ifdef ENABLE_I960 |
4361 |
|
case MACHINE_BAREI960: |
4362 |
|
/* A bare I960 machine, with no devices. */ |
4363 |
|
machine->machine_name = "\"Bare\" i960 machine"; |
4364 |
|
break; |
4365 |
|
|
4366 |
|
case MACHINE_TESTI960: |
4367 |
|
machine->machine_name = "i960 test machine"; |
4368 |
|
|
4369 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4370 |
|
(long long)DEV_CONS_ADDRESS); |
4371 |
|
cons_data = device_add(machine, tmpstr); |
4372 |
|
machine->main_console_handle = cons_data->console_handle; |
4373 |
|
|
4374 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4375 |
|
(long long)DEV_MP_ADDRESS); |
4376 |
|
device_add(machine, tmpstr); |
4377 |
|
|
4378 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4379 |
|
640,480, 640,480, 24, "testi960 generic"); |
4380 |
|
|
4381 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4382 |
|
(long long)DEV_DISK_ADDRESS); |
4383 |
|
device_add(machine, tmpstr); |
4384 |
|
|
4385 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4386 |
|
(long long)DEV_ETHER_ADDRESS); |
4387 |
|
device_add(machine, tmpstr); |
4388 |
|
|
4389 |
|
break; |
4390 |
|
#endif /* ENABLE_I960 */ |
4391 |
|
|
4392 |
|
#ifdef ENABLE_SPARC |
4393 |
|
case MACHINE_BARESPARC: |
4394 |
|
/* A bare SPARC machine, with no devices. */ |
4395 |
|
machine->machine_name = "\"Bare\" SPARC machine"; |
4396 |
break; |
break; |
4397 |
|
|
4398 |
|
case MACHINE_TESTSPARC: |
4399 |
|
machine->machine_name = "SPARC test machine"; |
4400 |
|
|
4401 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4402 |
|
(long long)DEV_CONS_ADDRESS); |
4403 |
|
cons_data = device_add(machine, tmpstr); |
4404 |
|
machine->main_console_handle = cons_data->console_handle; |
4405 |
|
|
4406 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4407 |
|
(long long)DEV_MP_ADDRESS); |
4408 |
|
device_add(machine, tmpstr); |
4409 |
|
|
4410 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4411 |
|
640,480, 640,480, 24, "testsparc generic"); |
4412 |
|
|
4413 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4414 |
|
(long long)DEV_DISK_ADDRESS); |
4415 |
|
device_add(machine, tmpstr); |
4416 |
|
|
4417 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4418 |
|
(long long)DEV_ETHER_ADDRESS); |
4419 |
|
device_add(machine, tmpstr); |
4420 |
|
|
4421 |
|
break; |
4422 |
|
|
4423 |
|
case MACHINE_ULTRA1: |
4424 |
|
/* |
4425 |
|
* NetBSD/sparc64 (http://www.netbsd.org/Ports/sparc64/) |
4426 |
|
* OpenBSD/sparc64 (http://www.openbsd.org/sparc64.html) |
4427 |
|
*/ |
4428 |
|
machine->machine_name = "Sun Ultra1"; |
4429 |
|
break; |
4430 |
|
#endif /* ENABLE_SPARC */ |
4431 |
|
|
4432 |
|
#ifdef ENABLE_ALPHA |
4433 |
case MACHINE_BAREALPHA: |
case MACHINE_BAREALPHA: |
4434 |
machine->machine_name = "\"Bare\" Alpha machine"; |
machine->machine_name = "\"Bare\" Alpha machine"; |
4435 |
break; |
break; |
4437 |
case MACHINE_TESTALPHA: |
case MACHINE_TESTALPHA: |
4438 |
machine->machine_name = "Alpha test machine"; |
machine->machine_name = "Alpha test machine"; |
4439 |
|
|
4440 |
/* TODO */ |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4441 |
|
(long long)DEV_CONS_ADDRESS); |
4442 |
|
cons_data = device_add(machine, tmpstr); |
4443 |
|
machine->main_console_handle = cons_data->console_handle; |
4444 |
|
|
4445 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4446 |
|
(long long)DEV_MP_ADDRESS); |
4447 |
|
device_add(machine, tmpstr); |
4448 |
|
|
4449 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4450 |
|
640,480, 640,480, 24, "testalpha generic"); |
4451 |
|
|
4452 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4453 |
|
(long long)DEV_DISK_ADDRESS); |
4454 |
|
device_add(machine, tmpstr); |
4455 |
|
|
4456 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4457 |
|
(long long)DEV_ETHER_ADDRESS); |
4458 |
|
device_add(machine, tmpstr); |
4459 |
|
|
4460 |
break; |
break; |
4461 |
|
|
4462 |
|
case MACHINE_ALPHA: |
4463 |
|
if (machine->prom_emulation) { |
4464 |
|
struct rpb rpb; |
4465 |
|
struct crb crb; |
4466 |
|
struct ctb ctb; |
4467 |
|
|
4468 |
|
/* TODO: Most of these... They are used by NetBSD/alpha: */ |
4469 |
|
/* a0 = First free Page Frame Number */ |
4470 |
|
/* a1 = PFN of current Level 1 page table */ |
4471 |
|
/* a2 = Bootinfo magic */ |
4472 |
|
/* a3 = Bootinfo pointer */ |
4473 |
|
/* a4 = Bootinfo version */ |
4474 |
|
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
4475 |
|
cpu->cd.alpha.r[ALPHA_A1] = 0; |
4476 |
|
cpu->cd.alpha.r[ALPHA_A2] = 0; |
4477 |
|
cpu->cd.alpha.r[ALPHA_A3] = 0; |
4478 |
|
cpu->cd.alpha.r[ALPHA_A4] = 0; |
4479 |
|
|
4480 |
|
/* HWRPB: Hardware Restart Parameter Block */ |
4481 |
|
memset(&rpb, 0, sizeof(struct rpb)); |
4482 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4483 |
|
&(rpb.rpb_phys), HWRPB_ADDR); |
4484 |
|
strlcpy((char *)&(rpb.rpb_magic), "HWRPB", 8); |
4485 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4486 |
|
&(rpb.rpb_size), sizeof(struct rpb)); |
4487 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4488 |
|
&(rpb.rpb_page_size), 8192); |
4489 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4490 |
|
&(rpb.rpb_type), machine->machine_subtype); |
4491 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4492 |
|
&(rpb.rpb_cc_freq), 100000000); |
4493 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4494 |
|
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
4495 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4496 |
|
&(rpb.rpb_crb_off), CRB_ADDR - HWRPB_ADDR); |
4497 |
|
|
4498 |
|
/* CTB: Console Terminal Block */ |
4499 |
|
memset(&ctb, 0, sizeof(struct ctb)); |
4500 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4501 |
|
&(ctb.ctb_term_type), machine->use_x11? |
4502 |
|
CTB_GRAPHICS : CTB_PRINTERPORT); |
4503 |
|
|
4504 |
|
/* CRB: Console Routine Block */ |
4505 |
|
memset(&crb, 0, sizeof(struct crb)); |
4506 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4507 |
|
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
4508 |
|
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, 0x10000); |
4509 |
|
|
4510 |
|
/* |
4511 |
|
* Place a special "hack" palcode call at 0x10000: |
4512 |
|
* (Hopefully nothing else will be there.) |
4513 |
|
*/ |
4514 |
|
store_32bit_word(cpu, 0x10000, 0x3fffffe); |
4515 |
|
|
4516 |
|
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
4517 |
|
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
4518 |
|
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
4519 |
|
} |
4520 |
|
|
4521 |
|
switch (machine->machine_subtype) { |
4522 |
|
case ST_DEC_3000_300: |
4523 |
|
machine->machine_name = "DEC 3000/300"; |
4524 |
|
machine->main_console_handle = |
4525 |
|
dev_zs_init(machine, mem, 0x1b0200000ULL, |
4526 |
|
0, 4, "serial zs"); /* serial? netbsd? */ |
4527 |
|
break; |
4528 |
|
case ST_EB164: |
4529 |
|
machine->machine_name = "EB164"; |
4530 |
|
break; |
4531 |
|
default:fatal("Unimplemented Alpha machine type %i\n", |
4532 |
|
machine->machine_subtype); |
4533 |
|
exit(1); |
4534 |
|
} |
4535 |
|
|
4536 |
|
break; |
4537 |
|
#endif /* ENABLE_ALPHA */ |
4538 |
|
|
4539 |
|
#ifdef ENABLE_ARM |
4540 |
case MACHINE_BAREARM: |
case MACHINE_BAREARM: |
4541 |
machine->machine_name = "\"Bare\" ARM machine"; |
machine->machine_name = "\"Bare\" ARM machine"; |
4542 |
break; |
break; |
4544 |
case MACHINE_TESTARM: |
case MACHINE_TESTARM: |
4545 |
machine->machine_name = "ARM test machine"; |
machine->machine_name = "ARM test machine"; |
4546 |
|
|
4547 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4548 |
|
(long long)DEV_CONS_ADDRESS); |
4549 |
|
cons_data = device_add(machine, tmpstr); |
4550 |
|
machine->main_console_handle = cons_data->console_handle; |
4551 |
|
|
4552 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4553 |
|
(long long)DEV_MP_ADDRESS); |
4554 |
|
device_add(machine, tmpstr); |
4555 |
|
|
4556 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4557 |
|
640,480, 640,480, 24, "testarm generic"); |
4558 |
|
|
4559 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4560 |
|
(long long)DEV_DISK_ADDRESS); |
4561 |
|
device_add(machine, tmpstr); |
4562 |
|
|
4563 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4564 |
|
(long long)DEV_ETHER_ADDRESS); |
4565 |
|
device_add(machine, tmpstr); |
4566 |
|
|
4567 |
|
/* Place a tiny stub at end of memory, and set the link |
4568 |
|
register to point to it. This stub halts the machine. */ |
4569 |
|
cpu->cd.arm.r[ARM_SP] = |
4570 |
|
machine->physical_ram_in_mb * 1048576 - 4096; |
4571 |
|
cpu->cd.arm.r[ARM_LR] = cpu->cd.arm.r[ARM_SP] + 32; |
4572 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 0, 0xe3a00201); |
4573 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 4, 0xe5c00010); |
4574 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 8, |
4575 |
|
0xeafffffe); |
4576 |
|
break; |
4577 |
|
|
4578 |
|
case MACHINE_CATS: |
4579 |
|
machine->machine_name = "CATS evaluation board"; |
4580 |
|
|
4581 |
|
if (machine->emulated_hz == 0) |
4582 |
|
machine->emulated_hz = 50000000; |
4583 |
|
|
4584 |
|
if (machine->physical_ram_in_mb > 256) |
4585 |
|
fprintf(stderr, "WARNING! Real CATS machines cannot" |
4586 |
|
" have more than 256 MB RAM. Continuing anyway.\n"); |
4587 |
|
|
4588 |
|
machine->md_int.footbridge_data = |
4589 |
|
device_add(machine, "footbridge addr=0x42000000"); |
4590 |
|
machine->md_interrupt = footbridge_interrupt; |
4591 |
|
|
4592 |
|
/* NetBSD and OpenBSD clean their caches here: */ |
4593 |
|
dev_ram_init(mem, 0x50000000, 0x4000, DEV_RAM_RAM, 0); |
4594 |
|
|
4595 |
|
/* Interrupt ack space? */ |
4596 |
|
dev_ram_init(mem, 0x80000000, 0x1000, DEV_RAM_RAM, 0); |
4597 |
|
|
4598 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
4599 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4600 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
4601 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4602 |
|
|
4603 |
|
device_add(machine, "pccmos addr=0x7c000070"); |
4604 |
|
|
4605 |
|
if (machine->use_x11) { |
4606 |
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4607 |
|
mem, 0xc0, 8, 0, pci_s3_virge_init, pci_s3_virge_rr); |
4608 |
|
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
4609 |
|
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
4610 |
|
32 + 1, 32 + 12, machine->use_x11, 0); |
4611 |
|
machine->main_console_handle = j; |
4612 |
|
} |
4613 |
|
|
4614 |
|
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0 in_use=0"); |
4615 |
|
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1 in_use=0"); |
4616 |
|
|
4617 |
|
device_add(machine, "lpt irq=39 addr=0x7c000378 name2=lpt in_use=0"); |
4618 |
|
|
4619 |
|
if (machine->prom_emulation) { |
4620 |
|
struct ebsaboot ebsaboot; |
4621 |
|
char bs[300]; |
4622 |
|
int boot_id = bootdev_id >= 0? bootdev_id : 0; |
4623 |
|
|
4624 |
|
cpu->cd.arm.r[0] = /* machine->physical_ram_in_mb */ |
4625 |
|
7 * 1048576 - 0x1000; |
4626 |
|
|
4627 |
|
memset(&ebsaboot, 0, sizeof(struct ebsaboot)); |
4628 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4629 |
|
&(ebsaboot.bt_magic), BT_MAGIC_NUMBER_CATS); |
4630 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4631 |
|
&(ebsaboot.bt_vargp), 0); |
4632 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4633 |
|
&(ebsaboot.bt_pargp), 0); |
4634 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4635 |
|
&(ebsaboot.bt_args), cpu->cd.arm.r[0] |
4636 |
|
+ sizeof(struct ebsaboot)); |
4637 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4638 |
|
&(ebsaboot.bt_l1), 7 * 1048576 - 32768); |
4639 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4640 |
|
&(ebsaboot.bt_memstart), 0); |
4641 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4642 |
|
&(ebsaboot.bt_memend), |
4643 |
|
machine->physical_ram_in_mb * 1048576); |
4644 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4645 |
|
&(ebsaboot.bt_memavail), 7 * 1048576); |
4646 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4647 |
|
&(ebsaboot.bt_fclk), 50 * 1000000); |
4648 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4649 |
|
&(ebsaboot.bt_pciclk), 66 * 1000000); |
4650 |
|
/* TODO: bt_vers */ |
4651 |
|
/* TODO: bt_features */ |
4652 |
|
|
4653 |
|
store_buf(cpu, cpu->cd.arm.r[0], |
4654 |
|
(char *)&ebsaboot, sizeof(struct ebsaboot)); |
4655 |
|
|
4656 |
|
snprintf(bs, sizeof(bs), "(hd%i)%s%s%s", |
4657 |
|
boot_id, machine->boot_kernel_filename, |
4658 |
|
(machine->boot_string_argument[0])? " " : "", |
4659 |
|
machine->boot_string_argument); |
4660 |
|
|
4661 |
|
store_string(cpu, cpu->cd.arm.r[0] + |
4662 |
|
sizeof(struct ebsaboot), bs); |
4663 |
|
|
4664 |
|
arm_setup_initial_translation_table(cpu, |
4665 |
|
7 * 1048576 - 32768); |
4666 |
|
} |
4667 |
|
break; |
4668 |
|
|
4669 |
|
case MACHINE_HPCARM: |
4670 |
|
machine->machine_name = "HPCarm"; |
4671 |
|
dev_ram_init(mem, 0xc0000000, 0x10000000, DEV_RAM_MIRROR, 0x0); |
4672 |
|
|
4673 |
|
/* TODO: Different models */ |
4674 |
|
|
4675 |
|
if (machine->prom_emulation) { |
4676 |
|
cpu->cd.arm.r[0] = 1; |
4677 |
|
cpu->cd.arm.r[ARM_SP] = 0xc000c000; |
4678 |
|
} |
4679 |
|
break; |
4680 |
|
|
4681 |
|
case MACHINE_ZAURUS: |
4682 |
|
machine->machine_name = "Zaurus"; |
4683 |
|
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
4684 |
|
device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4"); |
4685 |
/* TODO */ |
/* TODO */ |
4686 |
|
if (machine->prom_emulation) { |
4687 |
|
arm_setup_initial_translation_table(cpu, 0x4000); |
4688 |
|
} |
4689 |
break; |
break; |
4690 |
|
|
4691 |
|
case MACHINE_NETWINDER: |
4692 |
|
machine->machine_name = "NetWinder"; |
4693 |
|
|
4694 |
|
if (machine->physical_ram_in_mb > 256) |
4695 |
|
fprintf(stderr, "WARNING! Real NetWinders cannot" |
4696 |
|
" have more than 256 MB RAM. Continuing anyway.\n"); |
4697 |
|
|
4698 |
|
machine->md_int.footbridge_data = |
4699 |
|
device_add(machine, "footbridge addr=0x42000000"); |
4700 |
|
machine->md_interrupt = footbridge_interrupt; |
4701 |
|
|
4702 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
4703 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4704 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
4705 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4706 |
|
|
4707 |
|
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0"); |
4708 |
|
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1"); |
4709 |
|
|
4710 |
|
if (machine->use_x11) { |
4711 |
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4712 |
|
mem, 0xc0, 8, 0, pci_igsfb_init, pci_igsfb_rr); |
4713 |
|
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
4714 |
|
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
4715 |
|
32 + 1, 32 + 12, machine->use_x11, 0); |
4716 |
|
machine->main_console_handle = j; |
4717 |
|
} |
4718 |
|
|
4719 |
|
if (machine->prom_emulation) { |
4720 |
|
arm_setup_initial_translation_table(cpu, 0x4000); |
4721 |
|
} |
4722 |
|
break; |
4723 |
|
|
4724 |
|
case MACHINE_SHARK: |
4725 |
|
machine->machine_name = "Digital DNARD (\"Shark\")"; |
4726 |
|
if (machine->prom_emulation) { |
4727 |
|
arm_setup_initial_translation_table(cpu, |
4728 |
|
machine->physical_ram_in_mb * 1048576 - 65536); |
4729 |
|
|
4730 |
|
/* |
4731 |
|
* r0 = OpenFirmware entry point. NOTE: See |
4732 |
|
* cpu_arm.c for the rest of this semi-ugly hack. |
4733 |
|
*/ |
4734 |
|
cpu->cd.arm.r[0] = cpu->cd.arm.of_emul_addr; |
4735 |
|
} |
4736 |
|
break; |
4737 |
|
|
4738 |
|
case MACHINE_IQ80321: |
4739 |
|
/* |
4740 |
|
* Intel IQ80321. See http://sources.redhat.com/ecos/docs-latest/redboot/iq80321.html |
4741 |
|
* for more details about the memory map. |
4742 |
|
*/ |
4743 |
|
machine->machine_name = "Intel IQ80321 (ARM)"; |
4744 |
|
cpu->cd.arm.coproc[6] = arm_coproc_i80321; |
4745 |
|
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4746 |
|
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
4747 |
|
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
4748 |
|
dev_ram_init(mem, 0xc0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
4749 |
|
if (machine->prom_emulation) { |
4750 |
|
arm_setup_initial_translation_table(cpu, 0x8000); |
4751 |
|
} |
4752 |
|
break; |
4753 |
|
|
4754 |
|
case MACHINE_IYONIX: |
4755 |
|
machine->machine_name = "Iyonix"; |
4756 |
|
cpu->cd.arm.coproc[6] = arm_coproc_i80321; |
4757 |
|
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4758 |
|
if (machine->prom_emulation) { |
4759 |
|
arm_setup_initial_translation_table(cpu, |
4760 |
|
machine->physical_ram_in_mb * 1048576 - 65536); |
4761 |
|
} |
4762 |
|
break; |
4763 |
|
#endif /* ENABLE_ARM */ |
4764 |
|
|
4765 |
|
#ifdef ENABLE_AVR |
4766 |
|
case MACHINE_BAREAVR: |
4767 |
|
/* A bare Atmel AVR machine, with no devices. */ |
4768 |
|
machine->machine_name = "\"Bare\" Atmel AVR machine"; |
4769 |
|
break; |
4770 |
|
#endif /* ENABLE_AVR */ |
4771 |
|
|
4772 |
|
#ifdef ENABLE_IA64 |
4773 |
|
case MACHINE_BAREIA64: |
4774 |
|
machine->machine_name = "\"Bare\" IA64 machine"; |
4775 |
|
break; |
4776 |
|
|
4777 |
|
case MACHINE_TESTIA64: |
4778 |
|
machine->machine_name = "IA64 test machine"; |
4779 |
|
|
4780 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4781 |
|
(long long)DEV_CONS_ADDRESS); |
4782 |
|
cons_data = device_add(machine, tmpstr); |
4783 |
|
machine->main_console_handle = cons_data->console_handle; |
4784 |
|
|
4785 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4786 |
|
(long long)DEV_MP_ADDRESS); |
4787 |
|
device_add(machine, tmpstr); |
4788 |
|
|
4789 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4790 |
|
640,480, 640,480, 24, "testia64 generic"); |
4791 |
|
|
4792 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4793 |
|
(long long)DEV_DISK_ADDRESS); |
4794 |
|
device_add(machine, tmpstr); |
4795 |
|
|
4796 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4797 |
|
(long long)DEV_ETHER_ADDRESS); |
4798 |
|
device_add(machine, tmpstr); |
4799 |
|
|
4800 |
|
break; |
4801 |
|
#endif /* ENABLE_IA64 */ |
4802 |
|
|
4803 |
|
#ifdef ENABLE_M68K |
4804 |
|
case MACHINE_BAREM68K: |
4805 |
|
machine->machine_name = "\"Bare\" M68K machine"; |
4806 |
|
break; |
4807 |
|
|
4808 |
|
case MACHINE_TESTM68K: |
4809 |
|
machine->machine_name = "M68K test machine"; |
4810 |
|
|
4811 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4812 |
|
(long long)DEV_CONS_ADDRESS); |
4813 |
|
cons_data = device_add(machine, tmpstr); |
4814 |
|
machine->main_console_handle = cons_data->console_handle; |
4815 |
|
|
4816 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4817 |
|
(long long)DEV_MP_ADDRESS); |
4818 |
|
device_add(machine, tmpstr); |
4819 |
|
|
4820 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4821 |
|
640,480, 640,480, 24, "testm68k generic"); |
4822 |
|
|
4823 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4824 |
|
(long long)DEV_DISK_ADDRESS); |
4825 |
|
device_add(machine, tmpstr); |
4826 |
|
|
4827 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4828 |
|
(long long)DEV_ETHER_ADDRESS); |
4829 |
|
device_add(machine, tmpstr); |
4830 |
|
|
4831 |
|
break; |
4832 |
|
#endif /* ENABLE_M68K */ |
4833 |
|
|
4834 |
|
#ifdef ENABLE_X86 |
4835 |
case MACHINE_BAREX86: |
case MACHINE_BAREX86: |
4836 |
machine->machine_name = "\"Bare\" x86 machine"; |
machine->machine_name = "\"Bare\" x86 machine"; |
4837 |
break; |
break; |
4843 |
machine->machine_name = "Generic x86 PC"; |
machine->machine_name = "Generic x86 PC"; |
4844 |
|
|
4845 |
/* Interrupt controllers: */ |
/* Interrupt controllers: */ |
4846 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8259 addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx", |
4847 |
(long long)(X86_IO_BASE + 0x20)); |
(long long)(X86_IO_BASE + 0x20)); |
4848 |
machine->md.pc.pic1 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4849 |
if (machine->machine_subtype != MACHINE_X86_XT) { |
if (machine->machine_subtype != MACHINE_X86_XT) { |
4850 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8259 addr=0x%llx irq=2", |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx irq=2", |
4851 |
(long long)(X86_IO_BASE + 0xa0)); |
(long long)(X86_IO_BASE + 0xa0)); |
4852 |
machine->md.pc.pic2 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4853 |
} |
} |
4854 |
|
|
4855 |
machine->md_interrupt = x86_pc_interrupt; |
machine->md_interrupt = x86_pc_interrupt; |
4856 |
|
|
4857 |
/* Timer: */ |
/* Timer: */ |
4858 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8253 addr=0x%llx irq=0", |
snprintf(tmpstr, sizeof(tmpstr), "8253 addr=0x%llx irq=0", |
4859 |
(long long)(X86_IO_BASE + 0x40)); |
(long long)(X86_IO_BASE + 0x40)); |
4860 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4861 |
|
|
4862 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "pccmos addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "pccmos addr=0x%llx", |
4863 |
(long long)(X86_IO_BASE + 0x70)); |
(long long)(X86_IO_BASE + 0x70)); |
4864 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4865 |
|
|
4867 |
|
|
4868 |
/* IDE controllers: */ |
/* IDE controllers: */ |
4869 |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
4870 |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
4871 |
dev_wdc_init(machine, mem, X86_IO_BASE + 0x1f0, 14, 0); |
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
4872 |
|
X86_IO_BASE + 0x1f0, 14); |
4873 |
|
device_add(machine, tmpstr); |
4874 |
|
} |
4875 |
if (diskimage_exist(machine, 2, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 2, DISKIMAGE_IDE) || |
4876 |
diskimage_exist(machine, 3, DISKIMAGE_IDE)) |
diskimage_exist(machine, 3, DISKIMAGE_IDE)) { |
4877 |
dev_wdc_init(machine, mem, X86_IO_BASE + 0x170, 15, 2); |
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
4878 |
|
X86_IO_BASE + 0x170, 15); |
4879 |
|
device_add(machine, tmpstr); |
4880 |
|
} |
4881 |
|
|
4882 |
/* Floppy controller at irq 6 */ |
/* Floppy controller at irq 6 */ |
4883 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "fdc addr=0x%llx irq=6", |
snprintf(tmpstr, sizeof(tmpstr), "fdc addr=0x%llx irq=6", |
4884 |
(long long)(X86_IO_BASE + 0x3f0)); |
(long long)(X86_IO_BASE + 0x3f0)); |
4885 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4886 |
|
|
4889 |
/* TODO: parallel port */ |
/* TODO: parallel port */ |
4890 |
|
|
4891 |
/* Serial ports: (TODO: 8250 for PC XT?) */ |
/* Serial ports: (TODO: 8250 for PC XT?) */ |
4892 |
dev_ns16550_init(machine, mem, X86_IO_BASE + 0x3f8, 4, 1, 0, "com1"); |
|
4893 |
dev_ns16550_init(machine, mem, X86_IO_BASE + 0x378, 3, 1, 0, "com2"); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%llx name2=com1 in_use=0", |
4894 |
|
(long long)X86_IO_BASE + 0x3f8); |
4895 |
|
device_add(machine, tmpstr); |
4896 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=3 addr=0x%llx name2=com2 in_use=0", |
4897 |
|
(long long)X86_IO_BASE + 0x2f8); |
4898 |
|
device_add(machine, tmpstr); |
4899 |
|
|
4900 |
/* VGA + keyboard: */ |
/* VGA + keyboard: */ |
4901 |
dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0, |
dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0, |
4914 |
"-------------------------------------" |
"-------------------------------------" |
4915 |
"------------------------------------------\n"); |
"------------------------------------------\n"); |
4916 |
break; |
break; |
4917 |
|
#endif /* ENABLE_X86 */ |
4918 |
|
|
4919 |
default: |
default: |
4920 |
fatal("Unknown emulation type %i\n", machine->machine_type); |
fatal("Unknown emulation type %i\n", machine->machine_type); |
4983 |
case MACHINE_NETGEAR: |
case MACHINE_NETGEAR: |
4984 |
m->physical_ram_in_mb = 16; |
m->physical_ram_in_mb = 16; |
4985 |
break; |
break; |
4986 |
|
case MACHINE_EVBMIPS: |
4987 |
|
m->physical_ram_in_mb = 64; |
4988 |
|
break; |
4989 |
|
case MACHINE_PSP: |
4990 |
|
/* |
4991 |
|
* According to |
4992 |
|
* http://wiki.ps2dev.org/psp:memory_map: |
4993 |
|
* 0×08000000 = 8 MB kernel memory |
4994 |
|
* 0×08800000 = 24 MB user memory |
4995 |
|
*/ |
4996 |
|
m->physical_ram_in_mb = 8 + 24; |
4997 |
|
break; |
4998 |
case MACHINE_ARC: |
case MACHINE_ARC: |
4999 |
switch (m->machine_subtype) { |
switch (m->machine_subtype) { |
5000 |
case MACHINE_ARC_JAZZ_PICA: |
case MACHINE_ARC_JAZZ_PICA: |
5016 |
m->physical_ram_in_mb = 32; |
m->physical_ram_in_mb = 32; |
5017 |
} |
} |
5018 |
break; |
break; |
5019 |
|
case MACHINE_ALPHA: |
5020 |
|
m->physical_ram_in_mb = 64; |
5021 |
|
break; |
5022 |
case MACHINE_BEBOX: |
case MACHINE_BEBOX: |
5023 |
m->physical_ram_in_mb = 64; |
m->physical_ram_in_mb = 64; |
5024 |
break; |
break; |
5025 |
case MACHINE_BAREURISC: |
case MACHINE_CATS: |
5026 |
case MACHINE_TESTURISC: |
m->physical_ram_in_mb = 64; |
5027 |
m->physical_ram_in_mb = 2; |
break; |
5028 |
|
case MACHINE_ZAURUS: |
5029 |
|
m->physical_ram_in_mb = 64; |
5030 |
|
break; |
5031 |
|
case MACHINE_HPCARM: |
5032 |
|
m->physical_ram_in_mb = 32; |
5033 |
|
break; |
5034 |
|
case MACHINE_NETWINDER: |
5035 |
|
m->physical_ram_in_mb = 16; |
5036 |
break; |
break; |
5037 |
case MACHINE_X86: |
case MACHINE_X86: |
5038 |
if (m->machine_subtype == MACHINE_X86_XT) |
if (m->machine_subtype == MACHINE_X86_XT) |
5169 |
if (m->cpu_name == NULL) |
if (m->cpu_name == NULL) |
5170 |
m->cpu_name = strdup("R4400"); |
m->cpu_name = strdup("R4400"); |
5171 |
break; |
break; |
5172 |
|
case MACHINE_EVBMIPS: |
5173 |
|
switch (m->machine_subtype) { |
5174 |
|
case MACHINE_EVBMIPS_MALTA: |
5175 |
|
case MACHINE_EVBMIPS_MALTA_BE: |
5176 |
|
m->cpu_name = strdup("5Kc"); |
5177 |
|
break; |
5178 |
|
case MACHINE_EVBMIPS_PB1000: |
5179 |
|
m->cpu_name = strdup("AU1000"); |
5180 |
|
break; |
5181 |
|
default:fatal("Unimpl. evbmips.\n"); |
5182 |
|
exit(1); |
5183 |
|
} |
5184 |
|
break; |
5185 |
|
case MACHINE_PSP: |
5186 |
|
m->cpu_name = strdup("Allegrex"); |
5187 |
|
break; |
5188 |
|
|
5189 |
/* PowerPC: */ |
/* PowerPC: */ |
5190 |
case MACHINE_BAREPPC: |
case MACHINE_BAREPPC: |
5219 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
5220 |
switch (m->machine_subtype) { |
switch (m->machine_subtype) { |
5221 |
case MACHINE_MACPPC_G4: |
case MACHINE_MACPPC_G4: |
5222 |
m->cpu_name = strdup("G4e"); |
m->cpu_name = strdup("PPC750"); |
5223 |
break; |
break; |
5224 |
case MACHINE_MACPPC_G5: |
case MACHINE_MACPPC_G5: |
5225 |
m->cpu_name = strdup("PPC970"); |
m->cpu_name = strdup("PPC970"); |
5230 |
m->cpu_name = strdup("PPC750"); |
m->cpu_name = strdup("PPC750"); |
5231 |
break; |
break; |
5232 |
|
|
5233 |
/* SPARC: */ |
/* SH: */ |
5234 |
case MACHINE_BARESPARC: |
case MACHINE_BARESH: |
5235 |
m->cpu_name = strdup("SPARCV9"); |
case MACHINE_TESTSH: |
5236 |
break; |
case MACHINE_HPCSH: |
5237 |
case MACHINE_ULTRA1: |
m->cpu_name = strdup("SH"); |
|
m->cpu_name = strdup("SPARCV9"); |
|
|
break; |
|
|
|
|
|
/* URISC: */ |
|
|
case MACHINE_BAREURISC: |
|
|
case MACHINE_TESTURISC: |
|
|
m->cpu_name = strdup("URISC"); |
|
5238 |
break; |
break; |
5239 |
|
|
5240 |
/* HPPA: */ |
/* HPPA: */ |
5241 |
case MACHINE_BAREHPPA: |
case MACHINE_BAREHPPA: |
5242 |
case MACHINE_TESTHPPA: |
case MACHINE_TESTHPPA: |
5243 |
m->cpu_name = strdup("HPPA2.0"); |
m->cpu_name = strdup("HPPA"); |
5244 |
|
break; |
5245 |
|
|
5246 |
|
/* i960: */ |
5247 |
|
case MACHINE_BAREI960: |
5248 |
|
case MACHINE_TESTI960: |
5249 |
|
m->cpu_name = strdup("i960"); |
5250 |
|
break; |
5251 |
|
|
5252 |
|
/* SPARC: */ |
5253 |
|
case MACHINE_BARESPARC: |
5254 |
|
case MACHINE_TESTSPARC: |
5255 |
|
case MACHINE_ULTRA1: |
5256 |
|
m->cpu_name = strdup("SPARCv9"); |
5257 |
break; |
break; |
5258 |
|
|
5259 |
/* Alpha: */ |
/* Alpha: */ |
5260 |
case MACHINE_BAREALPHA: |
case MACHINE_BAREALPHA: |
5261 |
case MACHINE_TESTALPHA: |
case MACHINE_TESTALPHA: |
5262 |
m->cpu_name = strdup("EV4"); |
case MACHINE_ALPHA: |
5263 |
|
m->cpu_name = strdup("Alpha"); |
5264 |
break; |
break; |
5265 |
|
|
5266 |
/* ARM: */ |
/* ARM: */ |
5267 |
case MACHINE_BAREARM: |
case MACHINE_BAREARM: |
5268 |
case MACHINE_TESTARM: |
case MACHINE_TESTARM: |
5269 |
m->cpu_name = strdup("ARM"); |
case MACHINE_HPCARM: |
5270 |
|
m->cpu_name = strdup("SA1110"); |
5271 |
|
break; |
5272 |
|
case MACHINE_IQ80321: |
5273 |
|
case MACHINE_IYONIX: |
5274 |
|
m->cpu_name = strdup("80321_600_B0"); |
5275 |
|
break; |
5276 |
|
case MACHINE_CATS: |
5277 |
|
case MACHINE_NETWINDER: |
5278 |
|
case MACHINE_SHARK: |
5279 |
|
m->cpu_name = strdup("SA110"); |
5280 |
|
break; |
5281 |
|
case MACHINE_ZAURUS: |
5282 |
|
m->cpu_name = strdup("PXA210"); |
5283 |
|
break; |
5284 |
|
|
5285 |
|
/* AVR: */ |
5286 |
|
case MACHINE_BAREAVR: |
5287 |
|
m->cpu_name = strdup("AVR"); |
5288 |
|
break; |
5289 |
|
|
5290 |
|
/* IA64: */ |
5291 |
|
case MACHINE_BAREIA64: |
5292 |
|
case MACHINE_TESTIA64: |
5293 |
|
m->cpu_name = strdup("IA64"); |
5294 |
|
break; |
5295 |
|
|
5296 |
|
/* M68K: */ |
5297 |
|
case MACHINE_BAREM68K: |
5298 |
|
case MACHINE_TESTM68K: |
5299 |
|
m->cpu_name = strdup("68020"); |
5300 |
break; |
break; |
5301 |
|
|
5302 |
/* x86: */ |
/* x86: */ |
5345 |
if (m->single_step_on_bad_addr) |
if (m->single_step_on_bad_addr) |
5346 |
debug("single-step on bad addresses\n"); |
debug("single-step on bad addresses\n"); |
5347 |
|
|
5348 |
if (m->bintrans_enable) |
if (m->arch == ARCH_MIPS) { |
5349 |
debug("bintrans enabled (%i MB cache)\n", |
if (m->bintrans_enable) |
5350 |
(int) (m->bintrans_size / 1048576)); |
debug("bintrans enabled (%i MB cache)\n", |
5351 |
else |
(int) (m->bintrans_size / 1048576)); |
5352 |
debug("bintrans disabled, other speedtricks %s\n", |
else |
5353 |
m->speed_tricks? "enabled" : "disabled"); |
debug("bintrans disabled, other speedtricks %s\n", |
5354 |
|
m->speed_tricks? "enabled" : "disabled"); |
5355 |
|
} |
5356 |
|
|
5357 |
debug("clock: "); |
debug("clock: "); |
5358 |
if (m->automatic_clock_adjustment) |
if (m->automatic_clock_adjustment) |
5539 |
debug("\n"); |
debug("\n"); |
5540 |
|
|
5541 |
useremul_list_emuls(); |
useremul_list_emuls(); |
5542 |
|
debug("Userland emulation works for programs with the complexity" |
5543 |
|
" of Hello World,\nbut not much more.\n"); |
5544 |
} |
} |
5545 |
|
|
5546 |
|
|
5559 |
* entries will appear in normal order when listed. :-) |
* entries will appear in normal order when listed. :-) |
5560 |
*/ |
*/ |
5561 |
|
|
5562 |
|
/* Zaurus: */ |
5563 |
|
me = machine_entry_new("Zaurus (ARM)", |
5564 |
|
ARCH_ARM, MACHINE_ZAURUS, 1, 0); |
5565 |
|
me->aliases[0] = "zaurus"; |
5566 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5567 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5568 |
|
} |
5569 |
|
|
5570 |
/* X86 machine: */ |
/* X86 machine: */ |
5571 |
me = machine_entry_new("x86-based PC", ARCH_X86, |
me = machine_entry_new("x86-based PC", ARCH_X86, |
5572 |
MACHINE_X86, 2, 2); |
MACHINE_X86, 2, 2); |
5590 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5591 |
} |
} |
5592 |
|
|
5593 |
/* Test-machine for URISC: */ |
/* Test-machine for SPARC: */ |
5594 |
me = machine_entry_new("Test-machine for URISC", ARCH_URISC, |
me = machine_entry_new("Test-machine for SPARC", ARCH_SPARC, |
5595 |
MACHINE_TESTURISC, 1, 0); |
MACHINE_TESTSPARC, 1, 0); |
5596 |
me->aliases[0] = "testurisc"; |
me->aliases[0] = "testsparc"; |
5597 |
if (cpu_family_ptr_by_number(ARCH_URISC) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_SPARC) != NULL) { |
5598 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5599 |
|
} |
5600 |
|
|
5601 |
|
/* Test-machine for SH: */ |
5602 |
|
me = machine_entry_new("Test-machine for SH", ARCH_SH, |
5603 |
|
MACHINE_TESTSH, 1, 0); |
5604 |
|
me->aliases[0] = "testsh"; |
5605 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5606 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5607 |
} |
} |
5608 |
|
|
5622 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5623 |
} |
} |
5624 |
|
|
5625 |
|
/* Test-machine for M68K: */ |
5626 |
|
me = machine_entry_new("Test-machine for M68K", ARCH_M68K, |
5627 |
|
MACHINE_TESTM68K, 1, 0); |
5628 |
|
me->aliases[0] = "testm68k"; |
5629 |
|
if (cpu_family_ptr_by_number(ARCH_M68K) != NULL) { |
5630 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5631 |
|
} |
5632 |
|
|
5633 |
|
/* Test-machine for IA64: */ |
5634 |
|
me = machine_entry_new("Test-machine for IA64", ARCH_IA64, |
5635 |
|
MACHINE_TESTIA64, 1, 0); |
5636 |
|
me->aliases[0] = "testia64"; |
5637 |
|
if (cpu_family_ptr_by_number(ARCH_IA64) != NULL) { |
5638 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5639 |
|
} |
5640 |
|
|
5641 |
|
/* Test-machine for i960: */ |
5642 |
|
me = machine_entry_new("Test-machine for i960", ARCH_I960, |
5643 |
|
MACHINE_TESTI960, 1, 0); |
5644 |
|
me->aliases[0] = "testi960"; |
5645 |
|
if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { |
5646 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5647 |
|
} |
5648 |
|
|
5649 |
/* Test-machine for HPPA: */ |
/* Test-machine for HPPA: */ |
5650 |
me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, |
me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, |
5651 |
MACHINE_TESTHPPA, 1, 0); |
MACHINE_TESTHPPA, 1, 0); |
5696 |
} |
} |
5697 |
|
|
5698 |
/* SGI: */ |
/* SGI: */ |
5699 |
me = machine_entry_new("SGI", ARCH_MIPS, MACHINE_SGI, 2, 9); |
me = machine_entry_new("SGI", ARCH_MIPS, MACHINE_SGI, 2, 10); |
5700 |
me->aliases[0] = "silicon graphics"; |
me->aliases[0] = "silicon graphics"; |
5701 |
me->aliases[1] = "sgi"; |
me->aliases[1] = "sgi"; |
5702 |
me->subtype[0] = machine_entry_subtype_new("IP19", 19, 1); |
me->subtype[0] = machine_entry_subtype_new("IP12", 12, 1); |
5703 |
me->subtype[0]->aliases[0] = "ip19"; |
me->subtype[0]->aliases[0] = "ip12"; |
5704 |
me->subtype[1] = machine_entry_subtype_new("IP20", 20, 1); |
me->subtype[1] = machine_entry_subtype_new("IP19", 19, 1); |
5705 |
me->subtype[1]->aliases[0] = "ip20"; |
me->subtype[1]->aliases[0] = "ip19"; |
5706 |
me->subtype[2] = machine_entry_subtype_new("IP22", 22, 2); |
me->subtype[2] = machine_entry_subtype_new("IP20", 20, 1); |
5707 |
me->subtype[2]->aliases[0] = "ip22"; |
me->subtype[2]->aliases[0] = "ip20"; |
5708 |
me->subtype[2]->aliases[1] = "indy"; |
me->subtype[3] = machine_entry_subtype_new("IP22", 22, 2); |
5709 |
me->subtype[3] = machine_entry_subtype_new("IP24", 24, 1); |
me->subtype[3]->aliases[0] = "ip22"; |
5710 |
me->subtype[3]->aliases[0] = "ip24"; |
me->subtype[3]->aliases[1] = "indy"; |
5711 |
me->subtype[4] = machine_entry_subtype_new("IP27", 27, 3); |
me->subtype[4] = machine_entry_subtype_new("IP24", 24, 1); |
5712 |
me->subtype[4]->aliases[0] = "ip27"; |
me->subtype[4]->aliases[0] = "ip24"; |
5713 |
me->subtype[4]->aliases[1] = "origin 200"; |
me->subtype[5] = machine_entry_subtype_new("IP27", 27, 3); |
5714 |
me->subtype[4]->aliases[2] = "origin 2000"; |
me->subtype[5]->aliases[0] = "ip27"; |
5715 |
me->subtype[5] = machine_entry_subtype_new("IP28", 28, 1); |
me->subtype[5]->aliases[1] = "origin 200"; |
5716 |
me->subtype[5]->aliases[0] = "ip28"; |
me->subtype[5]->aliases[2] = "origin 2000"; |
5717 |
me->subtype[6] = machine_entry_subtype_new("IP30", 30, 2); |
me->subtype[6] = machine_entry_subtype_new("IP28", 28, 1); |
5718 |
me->subtype[6]->aliases[0] = "ip30"; |
me->subtype[6]->aliases[0] = "ip28"; |
5719 |
me->subtype[6]->aliases[1] = "octane"; |
me->subtype[7] = machine_entry_subtype_new("IP30", 30, 2); |
5720 |
me->subtype[7] = machine_entry_subtype_new("IP32", 32, 2); |
me->subtype[7]->aliases[0] = "ip30"; |
5721 |
me->subtype[7]->aliases[0] = "ip32"; |
me->subtype[7]->aliases[1] = "octane"; |
5722 |
me->subtype[7]->aliases[1] = "o2"; |
me->subtype[8] = machine_entry_subtype_new("IP32", 32, 2); |
5723 |
me->subtype[8] = machine_entry_subtype_new("IP35", 35, 1); |
me->subtype[8]->aliases[0] = "ip32"; |
5724 |
me->subtype[8]->aliases[0] = "ip35"; |
me->subtype[8]->aliases[1] = "o2"; |
5725 |
|
me->subtype[9] = machine_entry_subtype_new("IP35", 35, 1); |
5726 |
|
me->subtype[9]->aliases[0] = "ip35"; |
5727 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5728 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5729 |
} |
} |
5736 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5737 |
} |
} |
5738 |
|
|
5739 |
|
/* Playstation Portable: */ |
5740 |
|
me = machine_entry_new("Playstation Portable", ARCH_MIPS, |
5741 |
|
MACHINE_PSP, 1, 0); |
5742 |
|
me->aliases[0] = "psp"; |
5743 |
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5744 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5745 |
|
} |
5746 |
|
|
5747 |
|
/* NetWinder: */ |
5748 |
|
me = machine_entry_new("NetWinder", ARCH_ARM, MACHINE_NETWINDER, 1, 0); |
5749 |
|
me->aliases[0] = "netwinder"; |
5750 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5751 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5752 |
|
} |
5753 |
|
|
5754 |
/* NetGear: */ |
/* NetGear: */ |
5755 |
me = machine_entry_new("NetGear WG602", ARCH_MIPS, |
me = machine_entry_new("NetGear WG602v1", ARCH_MIPS, |
5756 |
MACHINE_NETGEAR, 2, 0); |
MACHINE_NETGEAR, 2, 0); |
5757 |
me->aliases[0] = "netgear"; |
me->aliases[0] = "netgear"; |
5758 |
me->aliases[1] = "wg602"; |
me->aliases[1] = "wg602v1"; |
5759 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5760 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5761 |
} |
} |
5789 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5790 |
} |
} |
5791 |
|
|
5792 |
|
/* Iyonix: */ |
5793 |
|
me = machine_entry_new("Iyonix", ARCH_ARM, |
5794 |
|
MACHINE_IYONIX, 1, 0); |
5795 |
|
me->aliases[0] = "iyonix"; |
5796 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5797 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5798 |
|
} |
5799 |
|
|
5800 |
|
/* Intel IQ80321 (ARM): */ |
5801 |
|
me = machine_entry_new("Intel IQ80321 (ARM)", ARCH_ARM, |
5802 |
|
MACHINE_IQ80321, 1, 0); |
5803 |
|
me->aliases[0] = "iq80321"; |
5804 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5805 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5806 |
|
} |
5807 |
|
|
5808 |
|
/* HPCarm: */ |
5809 |
|
me = machine_entry_new("Handheld SH (HPCsh)", |
5810 |
|
ARCH_SH, MACHINE_HPCSH, 1, 2); |
5811 |
|
me->aliases[0] = "hpcsh"; |
5812 |
|
me->subtype[0] = machine_entry_subtype_new("Jornada 680", |
5813 |
|
MACHINE_HPCSH_JORNADA680, 1); |
5814 |
|
me->subtype[0]->aliases[0] = "jornada680"; |
5815 |
|
me->subtype[1] = machine_entry_subtype_new( |
5816 |
|
"Jornada 690", MACHINE_HPCSH_JORNADA690, 1); |
5817 |
|
me->subtype[1]->aliases[0] = "jornada690"; |
5818 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5819 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5820 |
|
} |
5821 |
|
|
5822 |
/* HPCmips: */ |
/* HPCmips: */ |
5823 |
me = machine_entry_new("Handheld MIPS (HPC)", |
me = machine_entry_new("Handheld MIPS (HPCmips)", |
5824 |
ARCH_MIPS, MACHINE_HPCMIPS, 2, 8); |
ARCH_MIPS, MACHINE_HPCMIPS, 1, 8); |
5825 |
me->aliases[0] = "hpcmips"; |
me->aliases[0] = "hpcmips"; |
|
me->aliases[1] = "hpc"; |
|
5826 |
me->subtype[0] = machine_entry_subtype_new( |
me->subtype[0] = machine_entry_subtype_new( |
5827 |
"Casio Cassiopeia BE-300", MACHINE_HPCMIPS_CASIO_BE300, 2); |
"Casio Cassiopeia BE-300", MACHINE_HPCMIPS_CASIO_BE300, 2); |
5828 |
me->subtype[0]->aliases[0] = "be-300"; |
me->subtype[0]->aliases[0] = "be-300"; |
5855 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5856 |
} |
} |
5857 |
|
|
5858 |
|
/* HPCarm: */ |
5859 |
|
me = machine_entry_new("Handheld ARM (HPCarm)", |
5860 |
|
ARCH_ARM, MACHINE_HPCARM, 1, 2); |
5861 |
|
me->aliases[0] = "hpcarm"; |
5862 |
|
me->subtype[0] = machine_entry_subtype_new("Ipaq", |
5863 |
|
MACHINE_HPCARM_IPAQ, 1); |
5864 |
|
me->subtype[0]->aliases[0] = "ipaq"; |
5865 |
|
me->subtype[1] = machine_entry_subtype_new( |
5866 |
|
"Jornada 720", MACHINE_HPCARM_JORNADA720, 1); |
5867 |
|
me->subtype[1]->aliases[0] = "jornada720"; |
5868 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5869 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5870 |
|
} |
5871 |
|
|
5872 |
/* Generic "bare" X86 machine: */ |
/* Generic "bare" X86 machine: */ |
5873 |
me = machine_entry_new("Generic \"bare\" X86 machine", ARCH_X86, |
me = machine_entry_new("Generic \"bare\" X86 machine", ARCH_X86, |
5874 |
MACHINE_BAREX86, 1, 0); |
MACHINE_BAREX86, 1, 0); |
5877 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5878 |
} |
} |
5879 |
|
|
|
/* Generic "bare" URISC machine: */ |
|
|
me = machine_entry_new("Generic \"bare\" URISC machine", ARCH_URISC, |
|
|
MACHINE_BAREURISC, 1, 0); |
|
|
me->aliases[0] = "bareurisc"; |
|
|
if (cpu_family_ptr_by_number(ARCH_URISC) != NULL) { |
|
|
me->next = first_machine_entry; first_machine_entry = me; |
|
|
} |
|
|
|
|
5880 |
/* Generic "bare" SPARC machine: */ |
/* Generic "bare" SPARC machine: */ |
5881 |
me = machine_entry_new("Generic \"bare\" SPARC machine", ARCH_SPARC, |
me = machine_entry_new("Generic \"bare\" SPARC machine", ARCH_SPARC, |
5882 |
MACHINE_BARESPARC, 1, 0); |
MACHINE_BARESPARC, 1, 0); |
5885 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5886 |
} |
} |
5887 |
|
|
5888 |
|
/* Generic "bare" SH machine: */ |
5889 |
|
me = machine_entry_new("Generic \"bare\" SH machine", ARCH_SH, |
5890 |
|
MACHINE_BARESH, 1, 0); |
5891 |
|
me->aliases[0] = "baresh"; |
5892 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5893 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5894 |
|
} |
5895 |
|
|
5896 |
/* Generic "bare" PPC machine: */ |
/* Generic "bare" PPC machine: */ |
5897 |
me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, |
me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, |
5898 |
MACHINE_BAREPPC, 1, 0); |
MACHINE_BAREPPC, 1, 0); |
5909 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5910 |
} |
} |
5911 |
|
|
5912 |
|
/* Generic "bare" M68K machine: */ |
5913 |
|
me = machine_entry_new("Generic \"bare\" M68K machine", ARCH_M68K, |
5914 |
|
MACHINE_BAREM68K, 1, 0); |
5915 |
|
me->aliases[0] = "barem68k"; |
5916 |
|
if (cpu_family_ptr_by_number(ARCH_M68K) != NULL) { |
5917 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5918 |
|
} |
5919 |
|
|
5920 |
|
/* Generic "bare" IA64 machine: */ |
5921 |
|
me = machine_entry_new("Generic \"bare\" IA64 machine", ARCH_IA64, |
5922 |
|
MACHINE_BAREIA64, 1, 0); |
5923 |
|
me->aliases[0] = "bareia64"; |
5924 |
|
if (cpu_family_ptr_by_number(ARCH_IA64) != NULL) { |
5925 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5926 |
|
} |
5927 |
|
|
5928 |
|
/* Generic "bare" i960 machine: */ |
5929 |
|
me = machine_entry_new("Generic \"bare\" i960 machine", ARCH_I960, |
5930 |
|
MACHINE_BAREI960, 1, 0); |
5931 |
|
me->aliases[0] = "barei960"; |
5932 |
|
if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { |
5933 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5934 |
|
} |
5935 |
|
|
5936 |
/* Generic "bare" HPPA machine: */ |
/* Generic "bare" HPPA machine: */ |
5937 |
me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, |
me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, |
5938 |
MACHINE_BAREHPPA, 1, 0); |
MACHINE_BAREHPPA, 1, 0); |
5941 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5942 |
} |
} |
5943 |
|
|
5944 |
|
/* Generic "bare" Atmel AVR machine: */ |
5945 |
|
me = machine_entry_new("Generic \"bare\" Atmel AVR machine", ARCH_AVR, |
5946 |
|
MACHINE_BAREAVR, 1, 0); |
5947 |
|
me->aliases[0] = "bareavr"; |
5948 |
|
if (cpu_family_ptr_by_number(ARCH_AVR) != NULL) { |
5949 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5950 |
|
} |
5951 |
|
|
5952 |
/* Generic "bare" ARM machine: */ |
/* Generic "bare" ARM machine: */ |
5953 |
me = machine_entry_new("Generic \"bare\" ARM machine", ARCH_ARM, |
me = machine_entry_new("Generic \"bare\" ARM machine", ARCH_ARM, |
5954 |
MACHINE_BAREARM, 1, 0); |
MACHINE_BAREARM, 1, 0); |
5965 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5966 |
} |
} |
5967 |
|
|
5968 |
|
/* Evaluation Boards (MALTA etc): */ |
5969 |
|
me = machine_entry_new("Evaluation boards (evbmips)", ARCH_MIPS, |
5970 |
|
MACHINE_EVBMIPS, 1, 3); |
5971 |
|
me->aliases[0] = "evbmips"; |
5972 |
|
me->subtype[0] = machine_entry_subtype_new("Malta", |
5973 |
|
MACHINE_EVBMIPS_MALTA, 1); |
5974 |
|
me->subtype[0]->aliases[0] = "malta"; |
5975 |
|
me->subtype[1] = machine_entry_subtype_new("Malta (Big-Endian)", |
5976 |
|
MACHINE_EVBMIPS_MALTA_BE, 1); |
5977 |
|
me->subtype[1]->aliases[0] = "maltabe"; |
5978 |
|
me->subtype[2] = machine_entry_subtype_new("PB1000", |
5979 |
|
MACHINE_EVBMIPS_PB1000, 1); |
5980 |
|
me->subtype[2]->aliases[0] = "pb1000"; |
5981 |
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5982 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5983 |
|
} |
5984 |
|
|
5985 |
|
/* Digital DNARD ("Shark"): */ |
5986 |
|
me = machine_entry_new("Digital DNARD (\"Shark\")", ARCH_ARM, |
5987 |
|
MACHINE_SHARK, 2, 0); |
5988 |
|
me->aliases[0] = "shark"; |
5989 |
|
me->aliases[1] = "dnard"; |
5990 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5991 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5992 |
|
} |
5993 |
|
|
5994 |
/* DECstation: */ |
/* DECstation: */ |
5995 |
me = machine_entry_new("DECstation/DECsystem", |
me = machine_entry_new("DECstation/DECsystem", |
5996 |
ARCH_MIPS, MACHINE_DEC, 3, 9); |
ARCH_MIPS, MACHINE_DEC, 3, 9); |
6058 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6059 |
} |
} |
6060 |
|
|
6061 |
|
/* CATS (ARM) evaluation board: */ |
6062 |
|
me = machine_entry_new("CATS evaluation board (ARM)", ARCH_ARM, |
6063 |
|
MACHINE_CATS, 1, 0); |
6064 |
|
me->aliases[0] = "cats"; |
6065 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
6066 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6067 |
|
} |
6068 |
|
|
6069 |
/* BeBox: (NetBSD/bebox) */ |
/* BeBox: (NetBSD/bebox) */ |
6070 |
me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); |
me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); |
6071 |
me->aliases[0] = "bebox"; |
me->aliases[0] = "bebox"; |
6130 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
6131 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6132 |
} |
} |
6133 |
|
|
6134 |
|
/* Alpha: */ |
6135 |
|
me = machine_entry_new("Alpha", ARCH_ALPHA, MACHINE_ALPHA, 1, 2); |
6136 |
|
me->aliases[0] = "alpha"; |
6137 |
|
me->subtype[0] = machine_entry_subtype_new( |
6138 |
|
"DEC 3000/300", ST_DEC_3000_300, 1); |
6139 |
|
me->subtype[0]->aliases[0] = "3000/300"; |
6140 |
|
me->subtype[1] = machine_entry_subtype_new( |
6141 |
|
"EB164", ST_EB164, 1); |
6142 |
|
me->subtype[1]->aliases[0] = "eb164"; |
6143 |
|
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
6144 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6145 |
|
} |
6146 |
} |
} |
6147 |
|
|