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.577 2005/10/27 14:01:12 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; |
1528 |
struct btinfo_symtab c; |
struct btinfo_symtab c; |
1529 |
} xx; |
} xx; |
1530 |
struct hpc_bootinfo hpc_bootinfo; |
struct hpc_bootinfo hpc_bootinfo; |
1531 |
uint64_t hpcmips_fb_addr = 0; |
int hpc_platid_flags = 0, hpc_platid_cpu_submodel = 0, |
1532 |
int hpcmips_fb_bits = 0, hpcmips_fb_encoding = 0; |
hpc_platid_cpu_model = 0, hpc_platid_cpu_series = 0, |
1533 |
int hpcmips_fb_xsize = 0; |
hpc_platid_cpu_arch = 0, |
1534 |
int hpcmips_fb_ysize = 0; |
hpc_platid_submodel = 0, hpc_platid_model = 0, |
1535 |
int hpcmips_fb_xsize_mem = 0; |
hpc_platid_series = 0, hpc_platid_vendor = 0; |
1536 |
int hpcmips_fb_ysize_mem = 0; |
uint64_t hpc_fb_addr = 0; |
1537 |
|
int hpc_fb_bits = 0, hpc_fb_encoding = 0; |
1538 |
|
int hpc_fb_xsize = 0; |
1539 |
|
int hpc_fb_ysize = 0; |
1540 |
|
int hpc_fb_xsize_mem = 0; |
1541 |
|
int hpc_fb_ysize_mem = 0; |
1542 |
|
|
1543 |
/* ARCBIOS stuff: */ |
/* ARCBIOS stuff: */ |
1544 |
uint64_t sgi_ram_offset = 0; |
uint64_t sgi_ram_offset = 0; |
1554 |
char *init_bootpath; |
char *init_bootpath; |
1555 |
|
|
1556 |
/* PCI stuff: */ |
/* PCI stuff: */ |
1557 |
struct pci_data *pci_data; |
struct pci_data *pci_data = NULL; |
1558 |
|
|
1559 |
/* Framebuffer stuff: */ |
/* Framebuffer stuff: */ |
1560 |
struct vfb_data *fb; |
struct vfb_data *fb = NULL; |
1561 |
|
|
1562 |
/* Abreviation: :-) */ |
/* Abreviation: :-) */ |
1563 |
struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; |
struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; |
1574 |
case MACHINE_ARC: |
case MACHINE_ARC: |
1575 |
machine->boot_string_argument = "-aN"; |
machine->boot_string_argument = "-aN"; |
1576 |
break; |
break; |
1577 |
|
case MACHINE_CATS: |
1578 |
|
machine->boot_string_argument = "-A"; |
1579 |
|
break; |
1580 |
case MACHINE_DEC: |
case MACHINE_DEC: |
1581 |
machine->boot_string_argument = "-a"; |
machine->boot_string_argument = "-a"; |
1582 |
break; |
break; |
1593 |
printf("\nNo emulation type specified.\n"); |
printf("\nNo emulation type specified.\n"); |
1594 |
exit(1); |
exit(1); |
1595 |
|
|
1596 |
|
#ifdef ENABLE_MIPS |
1597 |
case MACHINE_BAREMIPS: |
case MACHINE_BAREMIPS: |
1598 |
/* |
/* |
1599 |
* A "bare" MIPS test machine. |
* A "bare" MIPS test machine. |
1606 |
|
|
1607 |
case MACHINE_TESTMIPS: |
case MACHINE_TESTMIPS: |
1608 |
/* |
/* |
1609 |
* A MIPS test machine (which happens to work with my |
* A MIPS test machine (which happens to work with the |
1610 |
* thesis work). |
* code in my master's thesis). :-) |
1611 |
|
* |
1612 |
|
* IRQ map: |
1613 |
|
* 7 CPU counter |
1614 |
|
* 6 SMP IPIs |
1615 |
|
* 5 not used yet |
1616 |
|
* 4 not used yet |
1617 |
|
* 3 ethernet |
1618 |
|
* 2 serial console |
1619 |
*/ |
*/ |
1620 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
1621 |
machine->machine_name = "MIPS test machine"; |
machine->machine_name = "MIPS test machine"; |
1622 |
|
|
1623 |
machine->main_console_handle = dev_cons_init( |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=2", |
1624 |
machine, mem, DEV_CONS_ADDRESS, "console", 2); |
(long long)DEV_CONS_ADDRESS); |
1625 |
|
cons_data = device_add(machine, tmpstr); |
1626 |
|
machine->main_console_handle = cons_data->console_handle; |
1627 |
|
|
1628 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
1629 |
(long long)DEV_MP_ADDRESS); |
(long long)DEV_MP_ADDRESS); |
1630 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
1631 |
|
|
1632 |
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
1633 |
640,480, 640,480, 24, "generic", 1); |
640,480, 640,480, 24, "testmips generic"); |
1634 |
|
|
1635 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
1636 |
|
(long long)DEV_DISK_ADDRESS); |
1637 |
|
device_add(machine, tmpstr); |
1638 |
|
|
1639 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=3", |
1640 |
|
(long long)DEV_ETHER_ADDRESS); |
1641 |
|
device_add(machine, tmpstr); |
1642 |
|
|
1643 |
break; |
break; |
1644 |
|
|
1645 |
case MACHINE_DEC: |
case MACHINE_DEC: |
1681 |
*/ |
*/ |
1682 |
fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START, |
fb = dev_fb_init(machine, mem, KN01_PHYS_FBUF_START, |
1683 |
color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01, |
color_fb_flag? VFB_DEC_VFB02 : VFB_DEC_VFB01, |
1684 |
0,0,0,0,0, color_fb_flag? "VFB02":"VFB01", 1); |
0,0,0,0,0, color_fb_flag? "VFB02":"VFB01"); |
1685 |
dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START, &fb->color_plane_mask); |
dev_colorplanemask_init(mem, KN01_PHYS_COLMASK_START, &fb->color_plane_mask); |
1686 |
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); |
1687 |
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); |
2113 |
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); |
2114 |
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); |
2115 |
|
|
2116 |
snprintf(tmpstr, sizeof(tmpstr) - 1, |
snprintf(tmpstr, sizeof(tmpstr), |
2117 |
"kn230 addr=0x%llx", (long long)KN230_SYS_ICSR); |
"kn230 addr=0x%llx", (long long)KN230_SYS_ICSR); |
2118 |
machine->md_int.kn230_csr = device_add(machine, tmpstr); |
machine->md_int.kn230_csr = device_add(machine, tmpstr); |
2119 |
|
|
2126 |
|
|
2127 |
/* |
/* |
2128 |
* Most OSes on DECstation use physical addresses below |
* Most OSes on DECstation use physical addresses below |
2129 |
* 0x20000000, but OSF/1 seems to use 0xbe...... as if it was |
* 0x20000000, but both OSF/1 and Sprite use 0xbe...... as if |
2130 |
* 0x1e......, so we need this hack: |
* it was 0x1e......, so we need this hack: |
2131 |
*/ |
*/ |
2132 |
dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
2133 |
|
DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0); |
2134 |
|
|
2135 |
/* DECstation PROM stuff: (TODO: endianness) */ |
if (machine->prom_emulation) { |
2136 |
for (i=0; i<100; i++) |
/* DECstation PROM stuff: (TODO: endianness) */ |
2137 |
store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, |
for (i=0; i<100; i++) |
2138 |
DEC_PROM_EMULATION + i*8); |
store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, |
2139 |
|
DEC_PROM_EMULATION + i*8); |
2140 |
/* Fill PROM with dummy return instructions: (TODO: make this nicer) */ |
|
2141 |
for (i=0; i<100; i++) { |
/* Fill PROM with dummy return instructions: (TODO: make this nicer) */ |
2142 |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, |
for (i=0; i<100; i++) { |
2143 |
0x03e00008); /* return */ |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, |
2144 |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, |
0x03e00008); /* return */ |
2145 |
0x00000000); /* nop */ |
store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, |
2146 |
} |
0x00000000); /* nop */ |
2147 |
|
} |
2148 |
|
|
2149 |
/* |
/* |
2150 |
* According to dec_prom.h from NetBSD: |
* According to dec_prom.h from NetBSD: |
2151 |
* |
* |
2152 |
* "Programs loaded by the new PROMs pass the following arguments: |
* "Programs loaded by the new PROMs pass the following arguments: |
2153 |
* a0 argc |
* a0 argc |
2154 |
* a1 argv |
* a1 argv |
2155 |
* a2 DEC_PROM_MAGIC |
* a2 DEC_PROM_MAGIC |
2156 |
* a3 The callback vector defined below" |
* a3 The callback vector defined below" |
2157 |
* |
* |
2158 |
* 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 |
2159 |
* loaded. |
* loaded. |
2160 |
*/ |
*/ |
2161 |
|
|
2162 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; |
2163 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; |
cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; |
2164 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; |
cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; |
2165 |
cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; |
cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; |
2166 |
|
|
2167 |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, |
2168 |
BOOTINFO_MAGIC); |
BOOTINFO_MAGIC); |
2169 |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, |
store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, |
2170 |
BOOTINFO_ADDR); |
BOOTINFO_ADDR); |
2171 |
|
|
2172 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, |
2173 |
(DEC_PROM_INITIAL_ARGV + 0x10)); |
(DEC_PROM_INITIAL_ARGV + 0x10)); |
2174 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, |
2175 |
(DEC_PROM_INITIAL_ARGV + 0x70)); |
(DEC_PROM_INITIAL_ARGV + 0x70)); |
2176 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, |
2177 |
(DEC_PROM_INITIAL_ARGV + 0xe0)); |
(DEC_PROM_INITIAL_ARGV + 0xe0)); |
2178 |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); |
store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); |
2179 |
|
|
2180 |
/* |
/* |
2181 |
* NetBSD and Ultrix expect the boot args to be like this: |
* NetBSD and Ultrix expect the boot args to be like this: |
2182 |
* |
* |
2183 |
* "boot" "bootdev" [args?] |
* "boot" "bootdev" [args?] |
2184 |
* |
* |
2185 |
* where bootdev is supposed to be "rz(0,0,0)netbsd" for |
* where bootdev is supposed to be "rz(0,0,0)netbsd" for |
2186 |
* 3100/2100 (although that crashes Ultrix :-/), and |
* 3100/2100 (although that crashes Ultrix :-/), and |
2187 |
* "5/rz0a/netbsd" for all others. The number '5' is the |
* "5/rz0a/netbsd" for all others. The number '5' is the |
2188 |
* slot number of the boot device. |
* slot number of the boot device. |
2189 |
* |
* |
2190 |
* 'rz' for disks, 'tz' for tapes. |
* 'rz' for disks, 'tz' for tapes. |
2191 |
* |
* |
2192 |
* TODO: Make this nicer. |
* TODO: Make this nicer. |
2193 |
*/ |
*/ |
2194 |
{ |
{ |
2195 |
char bootpath[200]; |
char bootpath[200]; |
|
|
|
2196 |
#if 0 |
#if 0 |
2197 |
if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) |
if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) |
2198 |
strcpy(bootpath, "rz(0,0,0)"); |
strlcpy(bootpath, "rz(0,0,0)", sizeof(bootpath)); |
2199 |
else |
else |
2200 |
#endif |
#endif |
2201 |
strcpy(bootpath, "5/rz1/"); |
strlcpy(bootpath, "5/rz1/", sizeof(bootpath)); |
2202 |
|
|
2203 |
if (bootdev_id < 0 || machine->force_netboot) { |
if (bootdev_id < 0 || machine->force_netboot) { |
2204 |
/* tftp boot: */ |
/* tftp boot: */ |
2205 |
strcpy(bootpath, "5/tftp/"); |
strlcpy(bootpath, "5/tftp/", sizeof(bootpath)); |
2206 |
bootpath[0] = '0' + boot_net_boardnumber; |
bootpath[0] = '0' + boot_net_boardnumber; |
2207 |
} else { |
} else { |
2208 |
/* disk boot: */ |
/* disk boot: */ |
2214 |
} |
} |
2215 |
|
|
2216 |
init_bootpath = bootpath; |
init_bootpath = bootpath; |
2217 |
} |
} |
2218 |
|
|
2219 |
bootarg = malloc(strlen(init_bootpath) + |
bootarg = malloc(BOOTARG_BUFLEN); |
2220 |
strlen(machine->boot_kernel_filename) + 1 + |
if (bootarg == NULL) { |
2221 |
strlen(machine->boot_string_argument) + 1); |
fprintf(stderr, "out of memory\n"); |
2222 |
strcpy(bootarg, init_bootpath); |
exit(1); |
2223 |
strcat(bootarg, machine->boot_kernel_filename); |
} |
2224 |
|
strlcpy(bootarg, init_bootpath, BOOTARG_BUFLEN); |
2225 |
bootstr = "boot"; |
if (strlcat(bootarg, machine->boot_kernel_filename, |
2226 |
|
BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { |
2227 |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); |
fprintf(stderr, "bootarg truncated?\n"); |
2228 |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); |
exit(1); |
2229 |
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; |
|
2230 |
|
|
2231 |
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
bootstr = "boot"; |
2232 |
|
|
2233 |
/* |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); |
2234 |
* The system's memmap: (memmap is a global variable, in |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); |
2235 |
* dec_prom.h) |
store_string(cpu, DEC_PROM_INITIAL_ARGV+0xe0, |
2236 |
*/ |
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); |
|
2237 |
|
|
2238 |
/* |
/* Decrease the nr of args, if there are no args :-) */ |
2239 |
* The KN5800 (SMP system) uses a CCA (console communications |
if (machine->boot_string_argument == NULL || |
2240 |
* area): (See VAX 6000 documentation for details.) |
machine->boot_string_argument[0] == '\0') |
2241 |
*/ |
cpu->cd.mips.gpr[MIPS_GPR_A0] --; |
2242 |
{ |
|
2243 |
char tmps[300]; |
if (machine->boot_string_argument[0] != '\0') { |
2244 |
sprintf(tmps, "cca=%x", |
strlcat(bootarg, " ", BOOTARG_BUFLEN); |
2245 |
(int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); |
if (strlcat(bootarg, machine->boot_string_argument, |
2246 |
add_environment_string(cpu, tmps, &addr); |
BOOTARG_BUFLEN) >= BOOTARG_BUFLEN) { |
2247 |
} |
fprintf(stderr, "bootstr truncated?\n"); |
2248 |
|
exit(1); |
2249 |
|
} |
2250 |
|
} |
2251 |
|
|
2252 |
/* These are needed for Sprite to boot: */ |
xx.a.common.next = (char *)&xx.b - (char *)&xx; |
2253 |
{ |
xx.a.common.type = BTINFO_MAGIC; |
2254 |
char tmps[300]; |
xx.a.magic = BOOTINFO_MAGIC; |
2255 |
|
|
2256 |
|
xx.b.common.next = (char *)&xx.c - (char *)&xx.b; |
2257 |
|
xx.b.common.type = BTINFO_BOOTPATH; |
2258 |
|
strlcpy(xx.b.bootpath, bootstr, sizeof(xx.b.bootpath)); |
2259 |
|
|
2260 |
|
xx.c.common.next = 0; |
2261 |
|
xx.c.common.type = BTINFO_SYMTAB; |
2262 |
|
xx.c.nsym = 0; |
2263 |
|
xx.c.ssym = 0; |
2264 |
|
xx.c.esym = machine->file_loaded_end_addr; |
2265 |
|
|
2266 |
|
store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); |
2267 |
|
|
2268 |
|
/* |
2269 |
|
* The system's memmap: (memmap is a global variable, in |
2270 |
|
* dec_prom.h) |
2271 |
|
*/ |
2272 |
|
store_32bit_word_in_host(cpu, |
2273 |
|
(unsigned char *)&memmap.pagesize, 4096); |
2274 |
|
{ |
2275 |
|
unsigned int i; |
2276 |
|
for (i=0; i<sizeof(memmap.bitmap); i++) |
2277 |
|
memmap.bitmap[i] = ((int)i * 4096*8 < |
2278 |
|
1048576*machine->physical_ram_in_mb)? |
2279 |
|
0xff : 0x00; |
2280 |
|
} |
2281 |
|
store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap)); |
2282 |
|
|
2283 |
|
/* Environment variables: */ |
2284 |
|
addr = DEC_PROM_STRINGS; |
2285 |
|
|
2286 |
|
if (machine->use_x11 && machine->n_gfx_cards > 0) |
2287 |
|
/* (0,3) Keyboard and Framebuffer */ |
2288 |
|
add_environment_string(cpu, framebuffer_console_name, &addr); |
2289 |
|
else |
2290 |
|
/* Serial console */ |
2291 |
|
add_environment_string(cpu, serial_console_name, &addr); |
2292 |
|
|
2293 |
|
/* |
2294 |
|
* The KN5800 (SMP system) uses a CCA (console communications |
2295 |
|
* area): (See VAX 6000 documentation for details.) |
2296 |
|
*/ |
2297 |
|
{ |
2298 |
|
char tmps[300]; |
2299 |
|
snprintf(tmps, sizeof(tmps), "cca=%x", |
2300 |
|
(int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); |
2301 |
|
add_environment_string(cpu, tmps, &addr); |
2302 |
|
} |
2303 |
|
|
2304 |
sprintf(tmps, "boot=%s", bootarg); |
/* These are needed for Sprite to boot: */ |
2305 |
add_environment_string(cpu, tmps, &addr); |
{ |
2306 |
|
char tmps[500]; |
2307 |
|
|
2308 |
|
snprintf(tmps, sizeof(tmps), "boot=%s", bootarg); |
2309 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2310 |
|
add_environment_string(cpu, tmps, &addr); |
2311 |
|
|
2312 |
|
snprintf(tmps, sizeof(tmps), "bitmap=0x%x", (uint32_t)(( |
2313 |
|
DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) |
2314 |
|
& 0xffffffffULL)); |
2315 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2316 |
|
add_environment_string(cpu, tmps, &addr); |
2317 |
|
|
2318 |
|
snprintf(tmps, sizeof(tmps), "bitmaplen=0x%x", |
2319 |
|
machine->physical_ram_in_mb * 1048576 / 4096 / 8); |
2320 |
|
tmps[sizeof(tmps)-1] = '\0'; |
2321 |
|
add_environment_string(cpu, tmps, &addr); |
2322 |
|
} |
2323 |
|
|
2324 |
sprintf(tmps, "bitmap=0x%x", (uint32_t)(( |
add_environment_string(cpu, "scsiid0=7", &addr); |
2325 |
DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) |
add_environment_string(cpu, "bootmode=a", &addr); |
2326 |
& 0xffffffffULL)); |
add_environment_string(cpu, "testaction=q", &addr); |
2327 |
add_environment_string(cpu, tmps, &addr); |
add_environment_string(cpu, "haltaction=h", &addr); |
2328 |
|
add_environment_string(cpu, "more=24", &addr); |
2329 |
sprintf(tmps, "bitmaplen=0x%x", |
|
2330 |
machine->physical_ram_in_mb * 1048576 / 4096 / 8); |
/* Used in at least Ultrix on the 5100: */ |
2331 |
add_environment_string(cpu, tmps, &addr); |
add_environment_string(cpu, "scsiid=7", &addr); |
2332 |
} |
add_environment_string(cpu, "baud0=9600", &addr); |
2333 |
|
add_environment_string(cpu, "baud1=9600", &addr); |
2334 |
add_environment_string(cpu, "scsiid0=7", &addr); |
add_environment_string(cpu, "baud2=9600", &addr); |
2335 |
add_environment_string(cpu, "bootmode=a", &addr); |
add_environment_string(cpu, "baud3=9600", &addr); |
2336 |
add_environment_string(cpu, "testaction=q", &addr); |
add_environment_string(cpu, "iooption=0x1", &addr); |
|
add_environment_string(cpu, "haltaction=h", &addr); |
|
|
add_environment_string(cpu, "more=24", &addr); |
|
|
|
|
|
/* Used in at least Ultrix on the 5100: */ |
|
|
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); |
|
2337 |
|
|
2338 |
/* The end: */ |
/* The end: */ |
2339 |
add_environment_string(cpu, "", &addr); |
add_environment_string(cpu, "", &addr); |
2340 |
|
} |
2341 |
|
|
2342 |
break; |
break; |
2343 |
|
|
2354 |
* 4 Tulip 1 |
* 4 Tulip 1 |
2355 |
* 5 16550 UART (serial console) |
* 5 16550 UART (serial console) |
2356 |
* 6 VIA southbridge PIC |
* 6 VIA southbridge PIC |
2357 |
* 7 PCI |
* 7 PCI (Note: Not used. The PCI controller |
2358 |
|
* interrupts at ISA interrupt 9.) |
2359 |
*/ |
*/ |
2360 |
/* dev_XXX_init(cpu, mem, 0x10000000, machine->emulated_hz); */ |
|
2361 |
|
/* ISA interrupt controllers: */ |
2362 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x10000020"); |
2363 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
2364 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0"); |
2365 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
2366 |
|
machine->md_interrupt = cobalt_interrupt; |
2367 |
|
|
2368 |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
2369 |
|
|
2370 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
machine->main_console_handle = (size_t) |
2371 |
0x1c800000, 5, 1, 1, "serial console"); |
device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1"); |
2372 |
|
|
2373 |
#if 0 |
#if 0 |
2374 |
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"); |
|
2375 |
#endif |
#endif |
2376 |
|
|
2377 |
/* |
/* |
2383 |
* 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 |
2384 |
* 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 |
2385 |
* 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 |
2386 |
|
* |
2387 |
|
* The PCI controller interrupts at ISA interrupt 9. |
2388 |
*/ |
*/ |
2389 |
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); |
2390 |
/* 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); */ |
2391 |
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 */ |
2392 |
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); |
2393 |
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); |
2394 |
/* 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); */ |
2395 |
|
|
2396 |
/* |
if (machine->prom_emulation) { |
2397 |
* NetBSD/cobalt expects memsize in a0, but it seems that what |
/* |
2398 |
* it really wants is the end of memory + 0x80000000. |
* NetBSD/cobalt expects memsize in a0, but it seems that what |
2399 |
* |
* it really wants is the end of memory + 0x80000000. |
2400 |
* The bootstring should be stored starting 512 bytes before end |
* |
2401 |
* of physical ram. |
* The bootstring is stored 512 bytes before the end of |
2402 |
*/ |
* physical ram. |
2403 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = machine->physical_ram_in_mb * 1048576 + 0x80000000; |
*/ |
2404 |
bootstr = "root=/dev/hda1 ro"; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = |
2405 |
/* bootstr = "nfsroot=/usr/cobalt/"; */ |
machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL; |
2406 |
store_string(cpu, 0xffffffff80000000ULL + |
bootstr = "root=/dev/hda1 ro"; |
2407 |
machine->physical_ram_in_mb * 1048576 - 512, bootstr); |
/* bootstr = "nfsroot=/usr/cobalt/"; */ |
2408 |
|
/* TODO: bootarg, and/or automagic boot device detection */ |
2409 |
|
store_string(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0] - 512, bootstr); |
2410 |
|
} |
2411 |
break; |
break; |
2412 |
|
|
2413 |
case MACHINE_HPCMIPS: |
case MACHINE_HPCMIPS: |
2414 |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2415 |
memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo)); |
memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo)); |
|
/* TODO: set platid from netbsd/usr/src/sys/arch/hpc/include/platid* */ |
|
|
/* |
|
|
#define PLATID_FLAGS_SHIFT 0 |
|
|
#define PLATID_CPU_SUBMODEL_SHIFT 8 |
|
|
#define PLATID_CPU_MODEL_SHIFT 14 |
|
|
#define PLATID_CPU_SERIES_SHIFT 20 |
|
|
#define PLATID_CPU_ARCH_SHIFT 26 |
|
|
|
|
|
#define PLATID_SUBMODEL_SHIFT 0 |
|
|
#define PLATID_MODEL_SHIFT 8 |
|
|
#define PLATID_SERIES_SHIFT 16 |
|
|
#define PLATID_VENDOR_SHIFT 22 |
|
|
*/ |
|
|
|
|
2416 |
/* |
/* |
2417 |
NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&forum=23 |
NOTE: See http://forums.projectmayo.com/viewtopic.php?topic=2743&forum=23 |
2418 |
for info on framebuffer addresses. |
for info on framebuffer addresses. |
2422 |
case MACHINE_HPCMIPS_CASIO_BE300: |
case MACHINE_HPCMIPS_CASIO_BE300: |
2423 |
/* 166MHz VR4131 */ |
/* 166MHz VR4131 */ |
2424 |
machine->machine_name = "Casio Cassiopeia BE-300"; |
machine->machine_name = "Casio Cassiopeia BE-300"; |
2425 |
hpcmips_fb_addr = 0x0a200000; |
hpc_fb_addr = 0x0a200000; |
2426 |
hpcmips_fb_xsize = 240; |
hpc_fb_xsize = 240; |
2427 |
hpcmips_fb_ysize = 320; |
hpc_fb_ysize = 320; |
2428 |
hpcmips_fb_xsize_mem = 256; |
hpc_fb_xsize_mem = 256; |
2429 |
hpcmips_fb_ysize_mem = 320; |
hpc_fb_ysize_mem = 320; |
2430 |
hpcmips_fb_bits = 15; |
hpc_fb_bits = 15; |
2431 |
hpcmips_fb_encoding = BIFB_D16_0000; |
hpc_fb_encoding = BIFB_D16_0000; |
2432 |
|
|
2433 |
machine->main_console_handle = dev_ns16550_init( |
/* TODO: irq? */ |
2434 |
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); |
2435 |
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
2436 |
|
|
2437 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4131); |
2438 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2439 |
|
|
2440 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2441 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2442 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2443 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 6; /* VR4131 */ |
2444 |
+ (6 << 8) /* 6 = VR4131 */ |
hpc_platid_vendor = 3; /* Casio */ |
2445 |
); |
hpc_platid_series = 1; /* CASSIOPEIAE */ |
2446 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 2; /* EXXX */ |
2447 |
(3 << 22) /* 22: vendor 3=casio */ |
hpc_platid_submodel = 3; /* E500 */ |
|
+ (1 << 16) /* 16: series 1=CASSIOPEIAE*/ |
|
|
+ (2 << 8) /* 8: model 2=EXXX*/ |
|
|
+ (3) /* 0: submodel 3=E500 */ |
|
|
); |
|
2448 |
/* TODO: Don't use model number for E500, it's a BE300! */ |
/* TODO: Don't use model number for E500, it's a BE300! */ |
2449 |
break; |
break; |
2450 |
case MACHINE_HPCMIPS_CASIO_E105: |
case MACHINE_HPCMIPS_CASIO_E105: |
2451 |
/* 131MHz VR4121 */ |
/* 131MHz VR4121 */ |
2452 |
machine->machine_name = "Casio Cassiopeia E-105"; |
machine->machine_name = "Casio Cassiopeia E-105"; |
2453 |
hpcmips_fb_addr = 0x0a200000; /* TODO? */ |
hpc_fb_addr = 0x0a200000; /* TODO? */ |
2454 |
hpcmips_fb_xsize = 240; |
hpc_fb_xsize = 240; |
2455 |
hpcmips_fb_ysize = 320; |
hpc_fb_ysize = 320; |
2456 |
hpcmips_fb_xsize_mem = 256; |
hpc_fb_xsize_mem = 256; |
2457 |
hpcmips_fb_ysize_mem = 320; |
hpc_fb_ysize_mem = 320; |
2458 |
hpcmips_fb_bits = 16; |
hpc_fb_bits = 16; |
2459 |
hpcmips_fb_encoding = BIFB_D16_0000; |
hpc_fb_encoding = BIFB_D16_0000; |
2460 |
|
|
2461 |
machine->main_console_handle = dev_ns16550_init( |
/* TODO: irq? */ |
2462 |
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); |
2463 |
machine->use_x11? 0 : 1, "serial console"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
2464 |
|
|
2465 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2466 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2467 |
|
|
2468 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2469 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2470 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2471 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2472 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 3; /* Casio */ |
2473 |
); |
hpc_platid_series = 1; /* CASSIOPEIAE */ |
2474 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 2; /* EXXX */ |
2475 |
(3 << 22) /* 22: vendor 3=casio */ |
hpc_platid_submodel = 2; /* E105 */ |
|
+ (1 << 16) /* 16: series 1=CASSIOPEIAE*/ |
|
|
+ (2 << 8) /* 8: model 2=EXXX*/ |
|
|
+ (2) /* 0: submodel 2=E105 */ |
|
|
); |
|
2476 |
break; |
break; |
2477 |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_770: |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_770: |
2478 |
/* 131 MHz VR4121 */ |
/* 131 MHz VR4121 */ |
2479 |
machine->machine_name = "NEC MobilePro 770"; |
machine->machine_name = "NEC MobilePro 770"; |
2480 |
/* TODO: */ |
hpc_fb_addr = 0xa000000; |
2481 |
hpcmips_fb_addr = 0xa000000; |
hpc_fb_xsize = 640; |
2482 |
hpcmips_fb_xsize = 640; |
hpc_fb_ysize = 240; |
2483 |
hpcmips_fb_ysize = 240; |
hpc_fb_xsize_mem = 800; |
2484 |
hpcmips_fb_xsize_mem = 800; |
hpc_fb_ysize_mem = 240; |
2485 |
hpcmips_fb_ysize_mem = 240; |
hpc_fb_bits = 16; |
2486 |
hpcmips_fb_bits = 16; |
hpc_fb_encoding = BIFB_D16_0000; |
|
hpcmips_fb_encoding = BIFB_D16_0000; |
|
2487 |
|
|
2488 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2489 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2490 |
|
|
2491 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2492 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2493 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2494 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2495 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 1; /* NEC */ |
2496 |
); |
hpc_platid_series = 2; /* NEC MCR */ |
2497 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 2; /* MCR 5XX */ |
2498 |
(1 << 22) /* 22: vendor 1=NEC */ |
hpc_platid_submodel = 4; /* MCR 520A */ |
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
|
|
+ (2 << 8) /* 8: model 2="MCR 5XX" */ |
|
|
+ (4) /* 0: submodel 4="MCR 520A" */ |
|
|
); |
|
2499 |
break; |
break; |
2500 |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_780: |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_780: |
2501 |
/* 166 (or 168) MHz VR4121 */ |
/* 166 (or 168) MHz VR4121 */ |
2502 |
machine->machine_name = "NEC MobilePro 780"; |
machine->machine_name = "NEC MobilePro 780"; |
2503 |
/* TODO: */ |
hpc_fb_addr = 0xa180100; |
2504 |
hpcmips_fb_addr = 0xa180100; |
hpc_fb_xsize = 640; |
2505 |
hpcmips_fb_xsize = 640; |
hpc_fb_ysize = 240; |
2506 |
hpcmips_fb_ysize = 240; |
hpc_fb_xsize_mem = 640; |
2507 |
hpcmips_fb_xsize_mem = 640; |
hpc_fb_ysize_mem = 240; |
2508 |
hpcmips_fb_ysize_mem = 240; |
hpc_fb_bits = 16; |
2509 |
hpcmips_fb_bits = 16; |
hpc_fb_encoding = BIFB_D16_0000; |
|
hpcmips_fb_encoding = BIFB_D16_0000; |
|
2510 |
|
|
2511 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2512 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2513 |
|
|
2514 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2515 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2516 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2517 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2518 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 1; /* NEC */ |
2519 |
); |
hpc_platid_series = 2; /* NEC MCR */ |
2520 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 2; /* MCR 5XX */ |
2521 |
(1 << 22) /* 22: vendor 1=NEC */ |
hpc_platid_submodel = 8; /* MCR 530A */ |
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
|
|
+ (2 << 8) /* 8: model 2="MCR 5XX" */ |
|
|
+ (8) /* 0: submodel 8="MCR 530A" */ |
|
|
); |
|
2522 |
break; |
break; |
2523 |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_800: |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_800: |
2524 |
/* 131 MHz VR4121 */ |
/* 131 MHz VR4121 */ |
2525 |
machine->machine_name = "NEC MobilePro 800"; |
machine->machine_name = "NEC MobilePro 800"; |
2526 |
/* TODO: */ |
hpc_fb_addr = 0xa000000; |
2527 |
hpcmips_fb_addr = 0xa000000; |
hpc_fb_xsize = 800; |
2528 |
hpcmips_fb_xsize = 800; |
hpc_fb_ysize = 600; |
2529 |
hpcmips_fb_ysize = 600; |
hpc_fb_xsize_mem = 800; |
2530 |
hpcmips_fb_xsize_mem = 800; |
hpc_fb_ysize_mem = 600; |
2531 |
hpcmips_fb_ysize_mem = 600; |
hpc_fb_bits = 16; |
2532 |
hpcmips_fb_bits = 16; |
hpc_fb_encoding = BIFB_D16_0000; |
|
hpcmips_fb_encoding = BIFB_D16_0000; |
|
2533 |
|
|
2534 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2535 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2536 |
|
|
2537 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2538 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2539 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2540 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2541 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 1; /* NEC */ |
2542 |
); |
hpc_platid_series = 2; /* NEC MCR */ |
2543 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 3; /* MCR 7XX */ |
2544 |
(1 << 22) /* 22: vendor 1=NEC */ |
hpc_platid_submodel = 2; /* MCR 700A */ |
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
|
|
+ (3 << 8) /* 8: model 3="MCR 7XX" */ |
|
|
+ (2) /* 0: submodel 2="MCR 700A" */ |
|
|
); |
|
2545 |
break; |
break; |
2546 |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_880: |
case MACHINE_HPCMIPS_NEC_MOBILEPRO_880: |
2547 |
/* 168 MHz VR4121 */ |
/* 168 MHz VR4121 */ |
2548 |
machine->machine_name = "NEC MobilePro 880"; |
machine->machine_name = "NEC MobilePro 880"; |
2549 |
/* TODO: */ |
hpc_fb_addr = 0xa0ea600; |
2550 |
hpcmips_fb_addr = 0xa0ea600; |
hpc_fb_xsize = 800; |
2551 |
hpcmips_fb_xsize = 800; |
hpc_fb_ysize = 600; |
2552 |
hpcmips_fb_ysize = 600; |
hpc_fb_xsize_mem = 800; |
2553 |
hpcmips_fb_xsize_mem = 800; |
hpc_fb_ysize_mem = 600; |
2554 |
hpcmips_fb_ysize_mem = 600; |
hpc_fb_bits = 16; |
2555 |
hpcmips_fb_bits = 16; |
hpc_fb_encoding = BIFB_D16_0000; |
|
hpcmips_fb_encoding = BIFB_D16_0000; |
|
2556 |
|
|
2557 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2558 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2559 |
|
|
2560 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2561 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2562 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2563 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2564 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 1; /* NEC */ |
2565 |
); |
hpc_platid_series = 2; /* NEC MCR */ |
2566 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 3; /* MCR 7XX */ |
2567 |
(1 << 22) /* 22: vendor 1=NEC */ |
hpc_platid_submodel = 4; /* MCR 730A */ |
|
+ (2 << 16) /* 16: series 2="NEC MCR" */ |
|
|
+ (3 << 8) /* 8: model 3="MCR 7XX" */ |
|
|
+ (4) /* 0: submodel 4="MCR 730A" */ |
|
|
); |
|
2568 |
break; |
break; |
2569 |
case MACHINE_HPCMIPS_AGENDA_VR3: |
case MACHINE_HPCMIPS_AGENDA_VR3: |
2570 |
/* 66 MHz VR4181 */ |
/* 66 MHz VR4181 */ |
2571 |
machine->machine_name = "Agenda VR3"; |
machine->machine_name = "Agenda VR3"; |
2572 |
/* TODO: */ |
/* TODO: */ |
2573 |
hpcmips_fb_addr = 0x1000; |
hpc_fb_addr = 0x1000; |
2574 |
hpcmips_fb_xsize = 160; |
hpc_fb_xsize = 160; |
2575 |
hpcmips_fb_ysize = 240; |
hpc_fb_ysize = 240; |
2576 |
hpcmips_fb_xsize_mem = 160; |
hpc_fb_xsize_mem = 160; |
2577 |
hpcmips_fb_ysize_mem = 240; |
hpc_fb_ysize_mem = 240; |
2578 |
hpcmips_fb_bits = 4; |
hpc_fb_bits = 4; |
2579 |
hpcmips_fb_encoding = BIFB_D4_M2L_F; |
hpc_fb_encoding = BIFB_D4_M2L_F; |
2580 |
|
|
2581 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4181); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4181); |
2582 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2585 |
VRIP_INTR_SIU (=9) here? */ |
VRIP_INTR_SIU (=9) here? */ |
2586 |
{ |
{ |
2587 |
int x; |
int x; |
2588 |
x = dev_ns16550_init(machine, mem, 0x0c000010, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x0c000010", 8 + VRIP_INTR_SIU); |
2589 |
8 + VRIP_INTR_SIU, 1, 1, "serial 0"); |
x = (size_t)device_add(machine, tmpstr); |
2590 |
|
|
2591 |
if (!machine->use_x11) |
if (!machine->use_x11) |
2592 |
machine->main_console_handle = x; |
machine->main_console_handle = x; |
2593 |
} |
} |
2594 |
|
|
2595 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2596 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2597 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2598 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 4; /* VR4181 */ |
2599 |
+ (4 << 8) /* 4 = VR4181 */ |
hpc_platid_vendor = 15; /* Agenda */ |
2600 |
); |
hpc_platid_series = 1; /* VR */ |
2601 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 1; /* VR3 */ |
2602 |
(15 << 22) /* 22: vendor 15=Agenda */ |
hpc_platid_submodel = 0; /* - */ |
|
+ (1 << 16) /* 16: series 2=VR */ |
|
|
+ (1 << 8) /* 8: model 1=VR3 */ |
|
|
+ (0) /* 0: submodel 0="VR3" */ |
|
|
); |
|
2603 |
|
|
2604 |
dev_ram_init(mem, 0x0f000000, 0x01000000, DEV_RAM_MIRROR, 0x0); |
dev_ram_init(machine, 0x0f000000, 0x01000000, |
2605 |
|
DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0); |
2606 |
break; |
break; |
2607 |
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
case MACHINE_HPCMIPS_IBM_WORKPAD_Z50: |
2608 |
/* 131 MHz VR4121 */ |
/* 131 MHz VR4121 */ |
2609 |
machine->machine_name = "Agenda VR3"; |
machine->machine_name = "IBM Workpad Z50"; |
2610 |
/* TODO: */ |
/* TODO: */ |
2611 |
hpcmips_fb_addr = 0xa000000; |
hpc_fb_addr = 0xa000000; |
2612 |
hpcmips_fb_xsize = 640; |
hpc_fb_xsize = 640; |
2613 |
hpcmips_fb_ysize = 480; |
hpc_fb_ysize = 480; |
2614 |
hpcmips_fb_xsize_mem = 640; |
hpc_fb_xsize_mem = 640; |
2615 |
hpcmips_fb_ysize_mem = 480; |
hpc_fb_ysize_mem = 480; |
2616 |
hpcmips_fb_bits = 16; |
hpc_fb_bits = 16; |
2617 |
hpcmips_fb_encoding = BIFB_D16_0000; |
hpc_fb_encoding = BIFB_D16_0000; |
2618 |
|
|
2619 |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
machine->md_int.vr41xx_data = dev_vr41xx_init(machine, mem, 4121); |
2620 |
machine->md_interrupt = vr41xx_interrupt; |
machine->md_interrupt = vr41xx_interrupt; |
2621 |
|
|
2622 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
hpc_platid_cpu_arch = 1; /* MIPS */ |
2623 |
(1 << 26) /* 1 = MIPS */ |
hpc_platid_cpu_series = 1; /* VR */ |
2624 |
+ (1 << 20) /* 1 = VR */ |
hpc_platid_cpu_model = 1; /* VR41XX */ |
2625 |
+ (1 << 14) /* 1 = VR41XX */ |
hpc_platid_cpu_submodel = 3; /* VR4121 */ |
2626 |
+ (3 << 8) /* 3 = VR4121 */ |
hpc_platid_vendor = 9; /* IBM */ |
2627 |
); |
hpc_platid_series = 1; /* WorkPad */ |
2628 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
hpc_platid_model = 1; /* Z50 */ |
2629 |
(9 << 22) /* 22: vendor 9=IBM */ |
hpc_platid_submodel = 0; /* 0 */ |
|
+ (1 << 16) /* 16: series 1=WorkPad */ |
|
|
+ (1 << 8) /* 8: model 1=Z50 */ |
|
|
+ (0) /* 0: submodel 0 */ |
|
|
); |
|
2630 |
break; |
break; |
2631 |
default: |
default: |
2632 |
printf("Unimplemented hpcmips machine number.\n"); |
printf("Unimplemented hpcmips machine number.\n"); |
2633 |
exit(1); |
exit(1); |
2634 |
} |
} |
2635 |
|
|
2636 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
2637 |
|
(hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20) |
2638 |
|
+ (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel << 8) |
2639 |
|
+ hpc_platid_flags); |
2640 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
2641 |
|
(hpc_platid_vendor << 22) + (hpc_platid_series << 16) |
2642 |
|
+ (hpc_platid_model << 8) + hpc_platid_submodel); |
2643 |
|
|
2644 |
if (machine->use_x11) |
if (machine->use_x11) |
2645 |
machine->main_console_handle = |
machine->main_console_handle = |
2646 |
machine->md_int.vr41xx_data->kiu_console_handle; |
machine->md_int.vr41xx_data->kiu_console_handle; |
2647 |
|
|
2648 |
/* NetBSD/hpcmips and possibly others expects the following: */ |
if (machine->prom_emulation) { |
2649 |
|
/* NetBSD/hpcmips and possibly others expects the following: */ |
2650 |
|
|
2651 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ |
2652 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 |
2653 |
+ 0xffffffff80000000ULL - 512; /* argv */ |
+ 0xffffffff80000000ULL - 512; /* argv */ |
2654 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 |
2655 |
+ 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ |
+ 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ |
2656 |
|
|
2657 |
bootstr = machine->boot_kernel_filename; |
bootstr = machine->boot_kernel_filename; |
2658 |
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, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512, |
2659 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16); |
2660 |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
store_32bit_word(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
2661 |
|
store_string(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
2662 |
/* Special case for the Agenda VR3: */ |
|
2663 |
if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { |
/* Special case for the Agenda VR3: */ |
2664 |
const int tmplen = 1000; |
if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { |
2665 |
char *tmp = malloc(tmplen); |
const int tmplen = 1000; |
2666 |
|
char *tmp = malloc(tmplen); |
2667 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ |
|
2668 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ |
2669 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
|
2670 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2671 |
|
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
2672 |
|
|
2673 |
|
snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," |
2674 |
|
"gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); |
2675 |
|
tmp[tmplen-1] = '\0'; |
2676 |
|
|
2677 |
snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," |
if (!machine->use_x11) |
2678 |
"gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); |
2679 |
tmp[tmplen-1] = '\0'; |
tmp[tmplen-1] = '\0'; |
|
|
|
|
if (!machine->use_x11) |
|
|
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); |
|
|
tmp[tmplen-1] = '\0'; |
|
2680 |
|
|
2681 |
if (machine->boot_string_argument[0]) |
if (machine->boot_string_argument[0]) |
2682 |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); |
2683 |
tmp[tmplen-1] = '\0'; |
tmp[tmplen-1] = '\0'; |
2684 |
|
|
2685 |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, tmp); |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, tmp); |
2686 |
|
|
2687 |
bootarg = tmp; |
bootarg = tmp; |
2688 |
} else if (machine->boot_string_argument[0]) { |
} else if (machine->boot_string_argument[0]) { |
2689 |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ |
2690 |
|
|
2691 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64); |
2692 |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
2693 |
|
|
2694 |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, |
store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, |
2695 |
machine->boot_string_argument); |
machine->boot_string_argument); |
2696 |
|
|
2697 |
bootarg = machine->boot_string_argument; |
bootarg = machine->boot_string_argument; |
2698 |
} |
} |
2699 |
|
|
2700 |
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
2701 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
2702 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpc_fb_addr); |
2703 |
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_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8); |
2704 |
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_width, hpc_fb_xsize); |
2705 |
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_height, hpc_fb_ysize); |
2706 |
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.fb_type, hpc_fb_encoding); |
2707 |
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ |
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ |
2708 |
|
|
2709 |
/* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); |
/* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); |
2710 |
printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ |
printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ |
2711 |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
2712 |
store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
2713 |
|
} |
2714 |
if (hpcmips_fb_addr != 0) { |
|
2715 |
dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS, |
if (hpc_fb_addr != 0) { |
2716 |
hpcmips_fb_xsize, hpcmips_fb_ysize, |
dev_fb_init(machine, mem, hpc_fb_addr, VFB_HPC, |
2717 |
hpcmips_fb_xsize_mem, hpcmips_fb_ysize_mem, |
hpc_fb_xsize, hpc_fb_ysize, |
2718 |
hpcmips_fb_bits, "HPCmips", 0); |
hpc_fb_xsize_mem, hpc_fb_ysize_mem, |
2719 |
|
hpc_fb_bits, machine->machine_name); |
2720 |
|
|
2721 |
/* NetBSD/hpcmips uses framebuffer at physical |
/* NetBSD/hpcmips uses framebuffer at physical |
2722 |
address 0x8.......: */ |
address 0x8.......: */ |
2723 |
dev_ram_init(mem, 0x80000000, 0x20000000, |
dev_ram_init(machine, 0x80000000, 0x20000000, |
2724 |
DEV_RAM_MIRROR, 0x0); |
DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x0); |
2725 |
} |
} |
2726 |
|
|
2727 |
break; |
break; |
2749 |
machine->md_int.ps2_data = dev_ps2_stuff_init(machine, mem, 0x10000000); |
machine->md_int.ps2_data = dev_ps2_stuff_init(machine, mem, 0x10000000); |
2750 |
device_add(machine, "ps2_gs addr=0x12000000"); |
device_add(machine, "ps2_gs addr=0x12000000"); |
2751 |
device_add(machine, "ps2_ether addr=0x14001000"); |
device_add(machine, "ps2_ether addr=0x14001000"); |
2752 |
dev_ram_init(mem, 0x1c000000, 4 * 1048576, DEV_RAM_RAM, 0); /* TODO: how much? */ |
dev_ram_init(machine, 0x1c000000, 4 * 1048576, DEV_RAM_RAM, 0); /* TODO: how much? */ |
2753 |
/* irq = 8 + 32 + 1 (SBUS/USB) */ |
/* irq = 8 + 32 + 1 (SBUS/USB) */ |
2754 |
device_add(machine, "ohci addr=0x1f801600 irq=41"); |
device_add(machine, "ohci addr=0x1f801600 irq=41"); |
2755 |
|
|
2756 |
machine->md_interrupt = ps2_interrupt; |
machine->md_interrupt = ps2_interrupt; |
2757 |
|
|
|
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); |
|
|
|
|
2758 |
/* Set the Harddisk controller present flag, if either |
/* Set the Harddisk controller present flag, if either |
2759 |
disk 0 or 1 is present: */ |
disk 0 or 1 is present: */ |
2760 |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
2761 |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
2762 |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); |
if (machine->prom_emulation) |
2763 |
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); |
2764 |
dev_ps2_spd_init(machine, mem, 0x14000000); |
dev_ps2_spd_init(machine, mem, 0x14000000); |
2765 |
} |
} |
2766 |
|
|
2767 |
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); |
if (machine->prom_emulation) { |
|
{ |
|
2768 |
int tmplen = 1000; |
int tmplen = 1000; |
2769 |
char *tmp = malloc(tmplen); |
char *tmp = malloc(tmplen); |
2770 |
|
time_t timet; |
2771 |
|
struct tm *tm_ptr; |
2772 |
|
|
2773 |
|
add_symbol_name(&machine->symbol_context, |
2774 |
|
PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0, 0); |
2775 |
|
store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); |
2776 |
|
store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); |
2777 |
|
|
2778 |
|
store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); |
2779 |
if (tmp == NULL) { |
if (tmp == NULL) { |
2780 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
2781 |
exit(1); |
exit(1); |
2782 |
} |
} |
2783 |
|
|
2784 |
strcpy(tmp, "root=/dev/hda1 crtmode=vesa0,60"); |
strlcpy(tmp, "root=/dev/hda1 crtmode=vesa0,60", tmplen); |
2785 |
|
|
2786 |
if (machine->boot_string_argument[0]) |
if (machine->boot_string_argument[0]) |
2787 |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), |
snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), |
2790 |
|
|
2791 |
bootstr = tmp; |
bootstr = tmp; |
2792 |
store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); |
store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); |
|
} |
|
2793 |
|
|
2794 |
/* TODO: netbsd's bootinfo.h, for symbolic names */ |
/* TODO: netbsd's bootinfo.h, for symbolic names */ |
|
{ |
|
|
time_t timet; |
|
|
struct tm *tmp; |
|
2795 |
|
|
2796 |
/* RTC data given by the BIOS: */ |
/* RTC data given by the BIOS: */ |
2797 |
timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ |
timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ |
2798 |
tmp = gmtime(&timet); |
tm_ptr = gmtime(&timet); |
2799 |
/* TODO: are these 0- or 1-based? */ |
/* TODO: are these 0- or 1-based? */ |
2800 |
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)); |
2801 |
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)); |
2802 |
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)); |
2803 |
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)); |
2804 |
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)); |
2805 |
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)); |
|
} |
|
2806 |
|
|
2807 |
/* "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. */ |
2808 |
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); |
2809 |
|
} |
2810 |
|
|
2811 |
break; |
break; |
2812 |
|
|
2820 |
* detailed list of IP ("Inhouse Processor") model numbers. |
* detailed list of IP ("Inhouse Processor") model numbers. |
2821 |
* (Or http://hardware.majix.org/computers/sgi/iptable.shtml) |
* (Or http://hardware.majix.org/computers/sgi/iptable.shtml) |
2822 |
*/ |
*/ |
2823 |
machine->machine_name = malloc(500); |
machine->machine_name = malloc(MACHINE_NAME_MAXBUF); |
2824 |
if (machine->machine_name == NULL) { |
if (machine->machine_name == NULL) { |
2825 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
2826 |
exit(1); |
exit(1); |
2828 |
|
|
2829 |
if (machine->machine_type == MACHINE_SGI) { |
if (machine->machine_type == MACHINE_SGI) { |
2830 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
2831 |
sprintf(machine->machine_name, "SGI-IP%i", machine->machine_subtype); |
snprintf(machine->machine_name, MACHINE_NAME_MAXBUF, |
2832 |
|
"SGI-IP%i", machine->machine_subtype); |
2833 |
|
|
2834 |
sgi_ram_offset = 1048576 * machine->memory_offset_in_mb; |
sgi_ram_offset = 1048576 * machine->memory_offset_in_mb; |
2835 |
|
|
2836 |
/* Special cases for IP20,22,24,26 memory offset: */ |
/* Special cases for IP20,22,24,26 memory offset: */ |
2837 |
if (machine->machine_subtype == 20 || machine->machine_subtype == 22 || |
if (machine->machine_subtype == 20 || machine->machine_subtype == 22 || |
2838 |
machine->machine_subtype == 24 || machine->machine_subtype == 26) { |
machine->machine_subtype == 24 || machine->machine_subtype == 26) { |
2839 |
dev_ram_init(mem, 0x00000000, 0x10000, DEV_RAM_MIRROR, sgi_ram_offset); |
dev_ram_init(machine, 0x00000000, 0x10000, DEV_RAM_MIRROR |
2840 |
dev_ram_init(mem, 0x00050000, sgi_ram_offset-0x50000, DEV_RAM_MIRROR, sgi_ram_offset + 0x50000); |
| DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset); |
2841 |
|
dev_ram_init(machine, 0x00050000, sgi_ram_offset-0x50000, |
2842 |
|
DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset + 0x50000); |
2843 |
} |
} |
2844 |
|
|
2845 |
/* Special cases for IP28,30 memory offset: */ |
/* Special cases for IP28,30 memory offset: */ |
2846 |
if (machine->machine_subtype == 28 || machine->machine_subtype == 30) { |
if (machine->machine_subtype == 28 || machine->machine_subtype == 30) { |
2847 |
/* TODO: length below should maybe not be 128MB? */ |
/* TODO: length below should maybe not be 128MB? */ |
2848 |
dev_ram_init(mem, 0x00000000, 128*1048576, DEV_RAM_MIRROR, sgi_ram_offset); |
dev_ram_init(machine, 0x00000000, 128*1048576, DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, sgi_ram_offset); |
2849 |
} |
} |
2850 |
} else { |
} else { |
2851 |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
2852 |
sprintf(machine->machine_name, "ARC"); |
snprintf(machine->machine_name, |
2853 |
|
MACHINE_NAME_MAXBUF, "ARC"); |
2854 |
} |
} |
2855 |
|
|
2856 |
if (machine->machine_type == MACHINE_SGI) { |
if (machine->machine_type == MACHINE_SGI) { |
2857 |
/* TODO: Other SGI machine types? */ |
/* TODO: Other SGI machine types? */ |
2858 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
2859 |
|
case 10: |
2860 |
|
strlcat(machine->machine_name, " (4D/25)", MACHINE_NAME_MAXBUF); |
2861 |
|
/* TODO */ |
2862 |
|
break; |
2863 |
case 12: |
case 12: |
2864 |
strcat(machine->machine_name, " (Iris Indigo IP12)"); |
strlcat(machine->machine_name, |
2865 |
|
" (Iris Indigo IP12)", MACHINE_NAME_MAXBUF); |
2866 |
|
|
2867 |
/* TODO */ |
/* TODO */ |
2868 |
/* 33 MHz R3000, according to http://www.irisindigo.com/ */ |
/* 33 MHz R3000, according to http://www.irisindigo.com/ */ |
2870 |
|
|
2871 |
break; |
break; |
2872 |
case 19: |
case 19: |
2873 |
strcat(machine->machine_name, " (Everest IP19)"); |
strlcat(machine->machine_name, |
2874 |
|
" (Everest IP19)", MACHINE_NAME_MAXBUF); |
2875 |
machine->main_console_handle = |
machine->main_console_handle = |
2876 |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "serial zs"); /* serial? netbsd? */ |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "serial zs"); /* serial? netbsd? */ |
2877 |
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? */ |
2891 |
|
|
2892 |
break; |
break; |
2893 |
case 20: |
case 20: |
2894 |
strcat(machine->machine_name, " (Indigo)"); |
strlcat(machine->machine_name, |
2895 |
|
" (Indigo)", MACHINE_NAME_MAXBUF); |
2896 |
|
|
2897 |
/* |
/* |
2898 |
* Guesses based on NetBSD 2.0 beta, 20040606. |
* Guesses based on NetBSD 2.0 beta, 20040606. |
2937 |
|
|
2938 |
break; |
break; |
2939 |
case 21: |
case 21: |
2940 |
strcat(machine->machine_name, " (uknown SGI-IP21 ?)"); /* TODO */ |
strlcat(machine->machine_name, /* TODO */ |
2941 |
|
" (uknown SGI-IP21 ?)", MACHINE_NAME_MAXBUF); |
2942 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
2943 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
2944 |
|
|
2948 |
case 22: |
case 22: |
2949 |
case 24: |
case 24: |
2950 |
if (machine->machine_subtype == 22) { |
if (machine->machine_subtype == 22) { |
2951 |
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Full-house)"); |
strlcat(machine->machine_name, |
2952 |
|
" (Indy, Indigo2, Challenge S; Full-house)", |
2953 |
|
MACHINE_NAME_MAXBUF); |
2954 |
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); |
2955 |
} else { |
} else { |
2956 |
strcat(machine->machine_name, " (Indy, Indigo2, Challenge S; Guiness)"); |
strlcat(machine->machine_name, |
2957 |
|
" (Indy, Indigo2, Challenge S; Guiness)", |
2958 |
|
MACHINE_NAME_MAXBUF); |
2959 |
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); |
2960 |
} |
} |
2961 |
|
|
2962 |
/* |
/* |
2963 |
Why is this here? TODO |
Why is this here? TODO |
2964 |
dev_ram_init(mem, 0x88000000ULL, |
dev_ram_init(machine, 0x88000000ULL, |
2965 |
128 * 1048576, DEV_RAM_MIRROR, 0x08000000); |
128 * 1048576, DEV_RAM_MIRROR, 0x08000000); |
2966 |
*/ |
*/ |
2967 |
machine->md_interrupt = sgi_ip22_interrupt; |
machine->md_interrupt = sgi_ip22_interrupt; |
3028 |
case 25: |
case 25: |
3029 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3030 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3031 |
strcat(machine->machine_name, " (Everest IP25)"); |
strlcat(machine->machine_name, |
3032 |
|
" (Everest IP25)", MACHINE_NAME_MAXBUF); |
3033 |
|
|
3034 |
/* serial? irix? */ |
/* serial? irix? */ |
3035 |
dev_scc_init(machine, mem, |
dev_scc_init(machine, mem, |
3050 |
case 26: |
case 26: |
3051 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3052 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3053 |
strcat(machine->machine_name, |
strlcat(machine->machine_name, |
3054 |
" (uknown SGI-IP26 ?)"); /* TODO */ |
" (uknown SGI-IP26 ?)", |
3055 |
|
MACHINE_NAME_MAXBUF); /* TODO */ |
3056 |
machine->main_console_handle = |
machine->main_console_handle = |
3057 |
dev_zs_init(machine, mem, 0x1fbd9830, |
dev_zs_init(machine, mem, 0x1fbd9830, |
3058 |
0, 1, "zs console"); |
0, 1, "zs console"); |
3059 |
break; |
break; |
3060 |
case 27: |
case 27: |
3061 |
strcat(machine->machine_name, |
strlcat(machine->machine_name, |
3062 |
" (Origin 200/2000, Onyx2)"); |
" (Origin 200/2000, Onyx2)", |
3063 |
|
MACHINE_NAME_MAXBUF); |
3064 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3065 |
/* 2 cpus per node */ |
/* 2 cpus per node */ |
3066 |
|
|
3071 |
case 28: |
case 28: |
3072 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3073 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3074 |
strcat(machine->machine_name, " (Impact Indigo2 ?)"); |
strlcat(machine->machine_name, |
3075 |
|
" (Impact Indigo2 ?)", MACHINE_NAME_MAXBUF); |
3076 |
|
|
3077 |
device_add(machine, "random addr=0x1fbe0000, len=1"); |
device_add(machine, "random addr=0x1fbe0000, len=1"); |
3078 |
|
|
3082 |
case 30: |
case 30: |
3083 |
/* NOTE: Special case for arc_wordlen: */ |
/* NOTE: Special case for arc_wordlen: */ |
3084 |
arc_wordlen = sizeof(uint64_t); |
arc_wordlen = sizeof(uint64_t); |
3085 |
strcat(machine->machine_name, " (Octane)"); |
strlcat(machine->machine_name, |
3086 |
|
" (Octane)", MACHINE_NAME_MAXBUF); |
3087 |
|
|
3088 |
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); |
3089 |
machine->md_interrupt = sgi_ip30_interrupt; |
machine->md_interrupt = sgi_ip30_interrupt; |
3090 |
|
|
3091 |
dev_ram_init(mem, 0xa0000000ULL, |
dev_ram_init(machine, 0xa0000000ULL, |
3092 |
128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
128 * 1048576, DEV_RAM_MIRROR |
3093 |
|
| DEV_RAM_MIGHT_POINT_TO_DEVICES, |
3094 |
|
0x00000000); |
3095 |
|
|
3096 |
dev_ram_init(mem, 0x80000000ULL, |
dev_ram_init(machine, 0x80000000ULL, |
3097 |
32 * 1048576, DEV_RAM_RAM, 0x00000000); |
32 * 1048576, DEV_RAM_RAM, 0x00000000); |
3098 |
|
|
3099 |
/* |
/* |
3109 |
* program dumps something there, but it doesn't look like |
* program dumps something there, but it doesn't look like |
3110 |
* readable text. (TODO) |
* readable text. (TODO) |
3111 |
*/ |
*/ |
3112 |
machine->main_console_handle = dev_ns16550_init(machine, mem, 0x1f620170, 0, 1, |
|
3113 |
machine->use_x11? 0 : 1, "serial 0"); /* TODO: irq? */ |
/* TODO: irq! */ |
3114 |
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); |
3115 |
0, "serial 1"); /* TODO: irq? */ |
machine->main_console_handle = (size_t)device_add(machine, tmpstr); |
3116 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x1f620178 name2=tty1 in_use=0"); |
3117 |
|
device_add(machine, tmpstr); |
3118 |
|
|
3119 |
/* MardiGras graphics: */ |
/* MardiGras graphics: */ |
3120 |
device_add(machine, "sgi_mardigras addr=0x1c000000"); |
device_add(machine, "sgi_mardigras addr=0x1c000000"); |
3121 |
|
|
3122 |
break; |
break; |
3123 |
case 32: |
case 32: |
3124 |
strcat(machine->machine_name, " (O2)"); |
strlcat(machine->machine_name, |
3125 |
|
" (O2)", MACHINE_NAME_MAXBUF); |
3126 |
|
|
3127 |
/* TODO: Find out where the physical ram is actually located. */ |
/* TODO: Find out where the physical ram is actually located. */ |
3128 |
dev_ram_init(mem, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
dev_ram_init(machine, 0x07ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
3129 |
dev_ram_init(mem, 0x10000000ULL, 256, DEV_RAM_MIRROR, 0x00000000); |
dev_ram_init(machine, 0x10000000ULL, 256, DEV_RAM_MIRROR, 0x00000000); |
3130 |
dev_ram_init(mem, 0x11ffff00ULL, 256, DEV_RAM_MIRROR, 0x01ffff00); |
dev_ram_init(machine, 0x11ffff00ULL, 256, DEV_RAM_MIRROR, 0x01ffff00); |
3131 |
dev_ram_init(mem, 0x12000000ULL, 256, DEV_RAM_MIRROR, 0x02000000); |
dev_ram_init(machine, 0x12000000ULL, 256, DEV_RAM_MIRROR, 0x02000000); |
3132 |
dev_ram_init(mem, 0x17ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
dev_ram_init(machine, 0x17ffff00ULL, 256, DEV_RAM_MIRROR, 0x03ffff00); |
3133 |
dev_ram_init(mem, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
dev_ram_init(machine, 0x20000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x00000000); |
3134 |
dev_ram_init(mem, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000); |
dev_ram_init(machine, 0x40000000ULL, 128 * 1048576, DEV_RAM_MIRROR, 0x10000000); |
3135 |
|
|
3136 |
machine->md_int.ip32.crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11); /* crime0 */ |
machine->md_int.ip32.crime_data = dev_crime_init(machine, mem, 0x14000000, 2, machine->use_x11); /* crime0 */ |
3137 |
dev_sgi_mte_init(mem, 0x15000000); /* mte ??? memory thing */ |
dev_sgi_mte_init(mem, 0x15000000); /* mte ??? memory thing */ |
3177 |
* intr 7 = MACE_PCI_BRIDGE |
* intr 7 = MACE_PCI_BRIDGE |
3178 |
*/ |
*/ |
3179 |
|
|
|
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) */ |
|
|
|
|
3180 |
net_generate_unique_mac(machine, macaddr); |
net_generate_unique_mac(machine, macaddr); |
3181 |
eaddr_string = malloc(30); |
eaddr_string = malloc(ETHERNET_STRING_MAXLEN); |
3182 |
if (eaddr_string == NULL) { |
if (eaddr_string == NULL) { |
3183 |
fprintf(stderr, "out of memory\n"); |
fprintf(stderr, "out of memory\n"); |
3184 |
exit(1); |
exit(1); |
3185 |
} |
} |
3186 |
sprintf(eaddr_string, "eaddr=%02x:%02x:" |
snprintf(eaddr_string, ETHERNET_STRING_MAXLEN, |
3187 |
"%02x:%02x:%02x:%02x", |
"eaddr=%02x:%02x:%02x:%02x:%02x:%02x", |
3188 |
macaddr[0], macaddr[1], macaddr[2], |
macaddr[0], macaddr[1], macaddr[2], |
3189 |
macaddr[3], macaddr[4], macaddr[5]); |
macaddr[3], macaddr[4], macaddr[5]); |
3190 |
dev_sgi_mec_init(machine, mem, 0x1f280000, MACE_ETHERNET, macaddr); |
dev_sgi_mec_init(machine, mem, 0x1f280000, |
3191 |
|
MACE_ETHERNET, macaddr); |
3192 |
|
|
3193 |
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
dev_sgi_ust_init(mem, 0x1f340000); /* ust? */ |
3194 |
|
|
3195 |
j = dev_ns16550_init(machine, mem, 0x1f390000, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f390000 addr_mult=0x100 in_use=%i name2=tty0", |
3196 |
(1<<20) + MACE_PERIPH_SERIAL, 0x100, |
(1<<20) + MACE_PERIPH_SERIAL, machine->use_x11? 0 : 1); |
3197 |
machine->use_x11? 0 : 1, "serial 0"); /* com0 */ |
j = (size_t)device_add(machine, tmpstr); |
3198 |
dev_ns16550_init(machine, mem, 0x1f398000, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f398000 addr_mult=0x100 in_use=%i name2=tty1", |
3199 |
(1<<26) + MACE_PERIPH_SERIAL, 0x100, |
(1<<26) + MACE_PERIPH_SERIAL, 0); |
3200 |
0, "serial 1"); /* com1 */ |
device_add(machine, tmpstr); |
3201 |
|
|
3202 |
if (machine->use_x11) |
machine->main_console_handle = j; |
3203 |
|
|
3204 |
|
/* TODO: Once this works, it should be enabled |
3205 |
|
always, not just when using X! */ |
3206 |
|
if (machine->use_x11) { |
3207 |
|
i = dev_pckbc_init(machine, mem, 0x1f320000, |
3208 |
|
PCKBC_8242, 0x200 + MACE_PERIPH_MISC, |
3209 |
|
0x800 + MACE_PERIPH_MISC, machine->use_x11, 0); |
3210 |
|
/* keyb+mouse (mace irq numbers) */ |
3211 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3212 |
else |
} |
|
machine->main_console_handle = j; |
|
3213 |
|
|
3214 |
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 */ |
3215 |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); |
3241 |
|
|
3242 |
break; |
break; |
3243 |
case 35: |
case 35: |
3244 |
strcat(machine->machine_name, " (Origin 3000)"); |
strlcat(machine->machine_name, |
3245 |
|
" (Origin 3000)", MACHINE_NAME_MAXBUF); |
3246 |
/* 4 cpus per node */ |
/* 4 cpus per node */ |
3247 |
|
|
3248 |
machine->main_console_handle = |
machine->main_console_handle = |
3250 |
0, 1, "zs console"); |
0, 1, "zs console"); |
3251 |
break; |
break; |
3252 |
case 53: |
case 53: |
3253 |
strcat(machine->machine_name, " (Origin 350)"); |
strlcat(machine->machine_name, |
3254 |
|
" (Origin 350)", MACHINE_NAME_MAXBUF); |
3255 |
/* |
/* |
3256 |
* According to http://kumba.drachentekh.net/xml/myguide.html |
* According to http://kumba.drachentekh.net/xml/myguide.html |
3257 |
* Origin 350, Tezro IP53 R16000 |
* Origin 350, Tezro IP53 R16000 |
3278 |
|
|
3279 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
3280 |
case MACHINE_ARC_NEC_RD94: |
case MACHINE_ARC_NEC_RD94: |
3281 |
strcat(machine->machine_name, " (NEC-RD94, NEC RISCstation 2250)"); |
strlcat(machine->machine_name, |
3282 |
|
" (NEC-RD94, NEC RISCstation 2250)", |
3283 |
|
MACHINE_NAME_MAXBUF); |
3284 |
break; |
break; |
3285 |
case MACHINE_ARC_NEC_R94: |
case MACHINE_ARC_NEC_R94: |
3286 |
strcat(machine->machine_name, " (NEC-R94; NEC RISCstation 2200)"); |
strlcat(machine->machine_name, " (NEC-R94; NEC RISCstation 2200)", |
3287 |
|
MACHINE_NAME_MAXBUF); |
3288 |
break; |
break; |
3289 |
case MACHINE_ARC_NEC_R96: |
case MACHINE_ARC_NEC_R96: |
3290 |
strcat(machine->machine_name, " (NEC-R96; NEC Express RISCserver)"); |
strlcat(machine->machine_name, " (NEC-R96; NEC Express RISCserver)", |
3291 |
|
MACHINE_NAME_MAXBUF); |
3292 |
break; |
break; |
3293 |
} |
} |
3294 |
|
|
3300 |
device_add(machine, "sn addr=0x80001000 irq=0"); |
device_add(machine, "sn addr=0x80001000 irq=0"); |
3301 |
dev_mc146818_init(machine, mem, 0x80004000ULL, 0, MC146818_ARC_NEC, 1); |
dev_mc146818_init(machine, mem, 0x80004000ULL, 0, MC146818_ARC_NEC, 1); |
3302 |
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); |
3303 |
j = dev_ns16550_init(machine, mem, 0x80006000ULL, |
|
3304 |
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); |
3305 |
dev_ns16550_init(machine, mem, 0x80007000ULL, |
j = (size_t)device_add(machine, tmpstr); |
3306 |
0, 1, 0, "serial 1"); /* com1 */ |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=0 addr=0x80007000 in_use=%i name2=tty1", 0); |
3307 |
|
device_add(machine, tmpstr); |
3308 |
|
|
3309 |
if (machine->use_x11) |
if (machine->use_x11) |
3310 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3324 |
case MACHINE_ARC_NEC_R96: |
case MACHINE_ARC_NEC_R96: |
3325 |
dev_fb_init(machine, mem, 0x100e00000ULL, |
dev_fb_init(machine, mem, 0x100e00000ULL, |
3326 |
VFB_GENERIC, 640,480, 1024,480, |
VFB_GENERIC, 640,480, 1024,480, |
3327 |
8, "necvdfrb", 1); |
8, "necvdfrb"); |
3328 |
break; |
break; |
3329 |
} |
} |
3330 |
break; |
break; |
3343 |
* Parallel at "start: 0x 0 18c10278, length: 0x1000, level: 5, vector: 5" |
* Parallel at "start: 0x 0 18c10278, length: 0x1000, level: 5, vector: 5" |
3344 |
*/ |
*/ |
3345 |
|
|
3346 |
strcat(machine->machine_name, " (NEC-R98; NEC RISCserver 4200)"); |
strlcat(machine->machine_name, |
3347 |
|
" (NEC-R98; NEC RISCserver 4200)", |
3348 |
|
MACHINE_NAME_MAXBUF); |
3349 |
|
|
3350 |
/* |
/* |
3351 |
* Windows NT access stuff at these addresses: |
* Windows NT access stuff at these addresses: |
3401 |
|
|
3402 |
switch (machine->machine_subtype) { |
switch (machine->machine_subtype) { |
3403 |
case MACHINE_ARC_JAZZ_PICA: |
case MACHINE_ARC_JAZZ_PICA: |
3404 |
strcat(machine->machine_name, " (Microsoft Jazz, Acer PICA-61)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, Acer PICA-61)", |
3405 |
|
MACHINE_NAME_MAXBUF); |
3406 |
break; |
break; |
3407 |
case MACHINE_ARC_JAZZ_MAGNUM: |
case MACHINE_ARC_JAZZ_MAGNUM: |
3408 |
strcat(machine->machine_name, " (Microsoft Jazz, MIPS Magnum)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, MIPS Magnum)", |
3409 |
|
MACHINE_NAME_MAXBUF); |
3410 |
break; |
break; |
3411 |
default: |
default: |
3412 |
fatal("error in machine.c. jazz\n"); |
fatal("error in machine.c. jazz\n"); |
3420 |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3421 |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
3422 |
|
|
3423 |
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); |
3424 |
0x80006000ULL, 8 + 8, 1, |
j = (size_t)device_add(machine, tmpstr); |
3425 |
machine->use_x11? 0 : 1, "serial 0"); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=17 addr=0x80007000 in_use=%i name2=tty1", 0); |
3426 |
dev_ns16550_init(machine, mem, |
device_add(machine, tmpstr); |
|
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
|
3427 |
|
|
3428 |
if (machine->use_x11) |
if (machine->use_x11) |
3429 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3442 |
break; |
break; |
3443 |
case MACHINE_ARC_JAZZ_MAGNUM: |
case MACHINE_ARC_JAZZ_MAGNUM: |
3444 |
/* PROM mirror? */ |
/* PROM mirror? */ |
3445 |
dev_ram_init(mem, 0xfff00000, 0x100000, |
dev_ram_init(machine, 0xfff00000, 0x100000, |
3446 |
DEV_RAM_MIRROR, 0x1fc00000); |
DEV_RAM_MIRROR | DEV_RAM_MIGHT_POINT_TO_DEVICES, 0x1fc00000); |
3447 |
|
|
3448 |
/* VXL. TODO */ |
/* VXL. TODO */ |
3449 |
/* control at 0x60100000? */ |
/* control at 0x60100000? */ |
3450 |
dev_fb_init(machine, mem, 0x60200000ULL, |
dev_fb_init(machine, mem, 0x60200000ULL, |
3451 |
VFB_GENERIC, 1024,768, 1024,768, |
VFB_GENERIC, 1024,768, 1024,768, |
3452 |
8, "VXL", 1); |
8, "VXL"); |
3453 |
break; |
break; |
3454 |
} |
} |
3455 |
|
|
3468 |
|
|
3469 |
#if 0 |
#if 0 |
3470 |
Not yet. |
Not yet. |
3471 |
dev_wdc_init(machine, mem, 0x900001f0ULL, 8+16 + 14, 0); |
/* irq = 8+16 + 14 */ |
3472 |
|
device_add(machine, "wdc addr=0x900001f0, irq=38"); |
3473 |
#endif |
#endif |
3474 |
|
|
3475 |
break; |
break; |
3484 |
* 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. |
3485 |
*/ |
*/ |
3486 |
|
|
3487 |
strcat(machine->machine_name, " (Microsoft Jazz, Olivetti M700)"); |
strlcat(machine->machine_name, " (Microsoft Jazz, Olivetti M700)", |
3488 |
|
MACHINE_NAME_MAXBUF); |
3489 |
|
|
3490 |
machine->md_int.jazz_data = device_add(machine, |
machine->md_int.jazz_data = device_add(machine, |
3491 |
"jazz addr=0x80000000"); |
"jazz addr=0x80000000"); |
3499 |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
i = dev_pckbc_init(machine, mem, 0x80005000ULL, |
3500 |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
PCKBC_JAZZ, 8 + 6, 8 + 7, machine->use_x11, 0); |
3501 |
#endif |
#endif |
3502 |
j = dev_ns16550_init(machine, mem, |
|
3503 |
0x80006000ULL, 8 + 8, 1, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=16 addr=0x80006000 in_use=%i name2=tty0", machine->use_x11? 0 : 1); |
3504 |
machine->use_x11? 0 : 1, "serial 0"); |
j = (size_t)device_add(machine, tmpstr); |
3505 |
dev_ns16550_init(machine, mem, |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=17 addr=0x80007000 in_use=%i name2=tty1", 0); |
3506 |
0x80007000ULL, 8 + 9, 1, 0, "serial 1"); |
device_add(machine, tmpstr); |
3507 |
|
|
3508 |
if (machine->use_x11) |
if (machine->use_x11) |
3509 |
machine->main_console_handle = i; |
machine->main_console_handle = i; |
3523 |
* http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html |
* http://mail-index.netbsd.org/port-arc/2000/10/14/0000.html |
3524 |
*/ |
*/ |
3525 |
|
|
3526 |
strcat(machine->machine_name, " (Deskstation Tyne)"); |
strlcat(machine->machine_name, " (Deskstation Tyne)", |
3527 |
|
MACHINE_NAME_MAXBUF); |
3528 |
|
|
3529 |
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); |
3530 |
dev_ns16550_init(machine, mem, 0x9000002f8ULL, 0, 1, 0, "serial 1"); |
i = (size_t)device_add(machine, tmpstr); |
3531 |
dev_ns16550_init(machine, mem, 0x9000003e8ULL, 0, 1, 0, "serial 2"); |
device_add(machine, "ns16550 irq=0 addr=0x9000002f8 in_use=0 name2=tty1"); |
3532 |
dev_ns16550_init(machine, mem, 0x9000002e8ULL, 0, 1, 0, "serial 3"); |
device_add(machine, "ns16550 irq=0 addr=0x9000003e8 in_use=0 name2=tty2"); |
3533 |
|
device_add(machine, "ns16550 irq=0 addr=0x9000002e8 in_use=0 name2=tty3"); |
3534 |
|
|
3535 |
dev_mc146818_init(machine, mem, |
dev_mc146818_init(machine, mem, |
3536 |
0x900000070ULL, 2, MC146818_PC_CMOS, 1); |
0x900000070ULL, 2, MC146818_PC_CMOS, 1); |
3537 |
|
|
3538 |
#if 0 |
#if 0 |
3539 |
dev_wdc_init(machine, mem, 0x9000001f0ULL, 0, 0); |
/* TODO: irq, etc */ |
3540 |
dev_wdc_init(machine, mem, 0x900000170ULL, 0, 2); |
device_add(machine, "wdc addr=0x9000001f0, irq=0"); |
3541 |
|
device_add(machine, "wdc addr=0x900000170, irq=0"); |
3542 |
#endif |
#endif |
3543 |
/* PC kbd */ |
/* PC kbd */ |
3544 |
j = dev_pckbc_init(machine, mem, 0x900000060ULL, |
j = dev_pckbc_init(machine, mem, 0x900000060ULL, |
3572 |
* point. |
* point. |
3573 |
*/ |
*/ |
3574 |
|
|
3575 |
if (machine->prom_emulation) |
if (machine->prom_emulation) { |
3576 |
arcbios_init(machine, arc_wordlen == sizeof(uint64_t), |
arcbios_init(machine, arc_wordlen == sizeof(uint64_t), |
3577 |
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? |
|
|
*/ |
|
3578 |
|
|
3579 |
/* |
/* |
3580 |
* Boot string in ARC format: |
* TODO: How to build the component tree intermixed with |
3581 |
* |
* the rest of device initialization? |
3582 |
* 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'; |
|
3583 |
|
|
3584 |
if (bootdev_id < 0 || machine->force_netboot) { |
/* |
3585 |
snprintf(init_bootpath, 400, "tftp()"); |
* Boot string in ARC format: |
3586 |
} else { |
* |
3587 |
/* TODO: Make this nicer. */ |
* TODO: How about floppies? multi()disk()fdisk() |
3588 |
if (machine->machine_type == MACHINE_SGI) { |
* Is tftp() good for netbooting? |
3589 |
if (machine->machine_subtype == 30) |
*/ |
3590 |
strcat(init_bootpath, "xio(0)pci(15)"); |
init_bootpath = malloc(500); |
3591 |
if (machine->machine_subtype == 32) |
if (init_bootpath == NULL) { |
3592 |
strcat(init_bootpath, "pci(0)"); |
fprintf(stderr, "out of mem, bootpath\n"); |
3593 |
|
exit(1); |
3594 |
} |
} |
3595 |
|
init_bootpath[0] = '\0'; |
3596 |
|
|
3597 |
if (diskimage_is_a_cdrom(machine, bootdev_id, |
if (bootdev_id < 0 || machine->force_netboot) { |
3598 |
bootdev_type)) |
snprintf(init_bootpath, 400, "tftp()"); |
3599 |
snprintf(init_bootpath + strlen(init_bootpath), |
} else { |
3600 |
400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); |
/* TODO: Make this nicer. */ |
3601 |
else |
if (machine->machine_type == MACHINE_SGI) { |
3602 |
snprintf(init_bootpath + strlen(init_bootpath), |
if (machine->machine_subtype == 30) |
3603 |
400,"scsi(0)disk(%i)rdisk(0)partition(1)", |
strlcat(init_bootpath, "xio(0)pci(15)", |
3604 |
bootdev_id); |
MACHINE_NAME_MAXBUF); |
3605 |
} |
if (machine->machine_subtype == 32) |
3606 |
|
strlcat(init_bootpath, "pci(0)", |
3607 |
if (machine->machine_type == MACHINE_ARC) |
MACHINE_NAME_MAXBUF); |
3608 |
strcat(init_bootpath, "\\"); |
} |
3609 |
|
|
3610 |
bootstr = malloc(strlen(init_bootpath) + |
if (diskimage_is_a_cdrom(machine, bootdev_id, |
3611 |
strlen(machine->boot_kernel_filename) + 1); |
bootdev_type)) |
3612 |
strcpy(bootstr, init_bootpath); |
snprintf(init_bootpath + strlen(init_bootpath), |
3613 |
strcat(bootstr, machine->boot_kernel_filename); |
400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); |
3614 |
|
else |
3615 |
|
snprintf(init_bootpath + strlen(init_bootpath), |
3616 |
|
400,"scsi(0)disk(%i)rdisk(0)partition(1)", |
3617 |
|
bootdev_id); |
3618 |
|
} |
3619 |
|
|
3620 |
/* Boot args., eg "-a" */ |
if (machine->machine_type == MACHINE_ARC) |
3621 |
bootarg = machine->boot_string_argument; |
strlcat(init_bootpath, "\\", MACHINE_NAME_MAXBUF); |
3622 |
|
|
3623 |
/* argc, argv, envp in a0, a1, a2: */ |
bootstr = malloc(BOOTSTR_BUFLEN); |
3624 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ |
if (bootstr == NULL) { |
3625 |
|
fprintf(stderr, "out of memory\n"); |
3626 |
|
exit(1); |
3627 |
|
} |
3628 |
|
strlcpy(bootstr, init_bootpath, BOOTSTR_BUFLEN); |
3629 |
|
if (strlcat(bootstr, machine->boot_kernel_filename, |
3630 |
|
BOOTSTR_BUFLEN) >= BOOTSTR_BUFLEN) { |
3631 |
|
fprintf(stderr, "boot string too long?\n"); |
3632 |
|
exit(1); |
3633 |
|
} |
3634 |
|
|
3635 |
/* TODO: not needed? */ |
/* Boot args., eg "-a" */ |
3636 |
cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) |
bootarg = machine->boot_string_argument; |
|
(machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); |
|
3637 |
|
|
3638 |
/* Set up argc/argv: */ |
/* argc, argv, envp in a0, a1, a2: */ |
3639 |
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; |
|
3640 |
|
|
3641 |
/* bootstr: */ |
/* TODO: not needed? */ |
3642 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) |
3643 |
add_environment_string(cpu, bootstr, &addr); |
(machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); |
3644 |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
|
3645 |
|
/* Set up argc/argv: */ |
3646 |
|
addr = ARC_ENV_STRINGS; |
3647 |
|
addr2 = ARC_ARGV_START; |
3648 |
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; |
3649 |
|
|
3650 |
/* bootarg: */ |
/* bootstr: */ |
|
if (bootarg[0] != '\0') { |
|
3651 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3652 |
add_environment_string(cpu, bootarg, &addr); |
add_environment_string(cpu, bootstr, &addr); |
3653 |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
|
} |
|
3654 |
|
|
3655 |
cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; |
/* bootarg: */ |
3656 |
|
if (bootarg[0] != '\0') { |
3657 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3658 |
|
add_environment_string(cpu, bootarg, &addr); |
3659 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] ++; |
3660 |
|
} |
3661 |
|
|
3662 |
/* |
cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; |
3663 |
* Add environment variables. For each variable, add it |
|
3664 |
* as a string using add_environment_string(), and add a |
/* |
3665 |
* pointer to it to the ARC_ENV_POINTERS array. |
* Add environment variables. For each variable, add it |
3666 |
*/ |
* as a string using add_environment_string(), and add a |
3667 |
if (machine->use_x11) { |
* pointer to it to the ARC_ENV_POINTERS array. |
3668 |
if (machine->machine_type == MACHINE_ARC) { |
*/ |
3669 |
|
if (machine->use_x11) { |
3670 |
|
if (machine->machine_type == MACHINE_ARC) { |
3671 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3672 |
|
add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); |
3673 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3674 |
|
add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); |
3675 |
|
} else { |
3676 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3677 |
|
add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); |
3678 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3679 |
|
add_environment_string(cpu, "ConsoleOut=video()", &addr); |
3680 |
|
|
3681 |
|
/* g for graphical mode. G for graphical mode |
3682 |
|
with SGI logo visible on Irix? */ |
3683 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3684 |
|
add_environment_string(cpu, "console=g", &addr); |
3685 |
|
} |
3686 |
|
} else { |
3687 |
|
if (machine->machine_type == MACHINE_ARC) { |
3688 |
|
/* TODO: serial console for ARC? */ |
3689 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3690 |
|
add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); |
3691 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3692 |
|
add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); |
3693 |
|
} else { |
3694 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3695 |
|
add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); |
3696 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3697 |
|
add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); |
3698 |
|
|
3699 |
|
/* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ |
3700 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3701 |
|
add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ |
3702 |
|
} |
3703 |
|
} |
3704 |
|
|
3705 |
|
if (machine->machine_type == MACHINE_SGI) { |
3706 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3707 |
add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); |
add_environment_string(cpu, "AutoLoad=No", &addr); |
3708 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3709 |
add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); |
add_environment_string(cpu, "diskless=0", &addr); |
|
} else { |
|
3710 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3711 |
add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); |
add_environment_string(cpu, "volume=80", &addr); |
3712 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3713 |
add_environment_string(cpu, "ConsoleOut=video()", &addr); |
add_environment_string(cpu, "sgilogo=y", &addr); |
3714 |
|
|
|
/* g for graphical mode. G for graphical mode |
|
|
with SGI logo visible on Irix? */ |
|
3715 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3716 |
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? */ |
|
3717 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3718 |
add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); |
add_environment_string(cpu, "TimeZone=GMT", &addr); |
3719 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3720 |
add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); |
add_environment_string(cpu, "nogfxkbd=1", &addr); |
3721 |
} else { |
|
3722 |
|
/* TODO: 'xio(0)pci(15)scsi(0)disk(1)rdisk(0)partition(0)' on IP30 at least */ |
3723 |
|
|
3724 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3725 |
add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); |
add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &addr); |
3726 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3727 |
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? */ |
|
3728 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3729 |
add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ |
add_environment_string(cpu, "OSLoadFilename=/unix", &addr); |
3730 |
} |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3731 |
} |
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); |
|
3732 |
|
|
3733 |
/* 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)); |
3734 |
|
add_environment_string(cpu, "rbaud=9600", &addr); |
3735 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3736 |
|
add_environment_string(cpu, "rebound=y", &addr); |
3737 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3738 |
|
add_environment_string(cpu, "crt_option=1", &addr); |
3739 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3740 |
|
add_environment_string(cpu, "netaddr=10.0.0.1", &addr); |
3741 |
|
|
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, "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); |
|
3744 |
|
|
3745 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3746 |
add_environment_string(cpu, "rbaud=9600", &addr); |
add_environment_string(cpu, "cpufreq=3", &addr); |
3747 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3748 |
add_environment_string(cpu, "rebound=y", &addr); |
add_environment_string(cpu, "dbaud=9600", &addr); |
3749 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3750 |
add_environment_string(cpu, "crt_option=1", &addr); |
add_environment_string(cpu, eaddr_string, &addr); |
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, "netaddr=10.0.0.1", &addr); |
add_environment_string(cpu, "verbose=istrue", &addr); |
3753 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3754 |
|
add_environment_string(cpu, "showconfig=istrue", &addr); |
3755 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3756 |
|
add_environment_string(cpu, "diagmode=v", &addr); |
3757 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3758 |
|
add_environment_string(cpu, "kernname=unix", &addr); |
3759 |
|
} else { |
3760 |
|
char *tmp; |
3761 |
|
size_t mlen = strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2; |
3762 |
|
tmp = malloc(mlen); |
3763 |
|
snprintf(tmp, mlen, "OSLOADOPTIONS=%s", bootarg); |
3764 |
|
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3765 |
|
add_environment_string(cpu, tmp, &addr); |
3766 |
|
|
3767 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3768 |
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); |
3769 |
|
|
3770 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
3771 |
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); |
3772 |
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); |
|
3773 |
|
|
3774 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
/* End the environment strings with an empty zero-terminated |
3775 |
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. */ |
3776 |
|
add_environment_string(cpu, "", &addr); /* the end */ |
3777 |
|
store_pointer_and_advance(cpu, &addr2, |
3778 |
|
0, arc_wordlen==sizeof(uint64_t)); |
3779 |
|
|
3780 |
store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); |
/* Return address: (0x20 = ReturnFromMain()) */ |
3781 |
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; |
3782 |
} |
} |
3783 |
|
|
|
/* 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; |
|
|
|
|
3784 |
break; |
break; |
3785 |
|
|
3786 |
case MACHINE_MESHCUBE: |
case MACHINE_MESHCUBE: |
3810 |
|
|
3811 |
device_add(machine, "random addr=0x1017fffc len=4"); |
device_add(machine, "random addr=0x1017fffc len=4"); |
3812 |
|
|
3813 |
/* |
if (machine->prom_emulation) { |
3814 |
* TODO: A Linux kernel wants "memsize" from somewhere... I |
/* |
3815 |
* haven't found any docs on how it is used though. |
* TODO: A Linux kernel wants "memsize" from somewhere... I |
3816 |
*/ |
* haven't found any docs on how it is used though. |
3817 |
|
*/ |
3818 |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; |
cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; |
3819 |
cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; |
cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; |
3820 |
store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], |
store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], |
3821 |
0xa0002000ULL); |
0xa0002000ULL); |
3822 |
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"); |
|
3823 |
|
|
3824 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; |
3825 |
|
store_string(cpu, 0xa0002000ULL, "hello=world\n"); |
3826 |
|
} |
3827 |
break; |
break; |
3828 |
|
|
3829 |
case MACHINE_NETGEAR: |
case MACHINE_NETGEAR: |
3830 |
machine->machine_name = "NetGear WG602"; |
machine->machine_name = "NetGear WG602v1"; |
3831 |
|
|
3832 |
if (machine->use_x11) |
if (machine->use_x11) |
3833 |
fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); |
fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); |
3834 |
if (machine->physical_ram_in_mb != 16) |
if (machine->physical_ram_in_mb != 16) |
3835 |
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"); |
3836 |
|
|
3837 |
/* |
/* |
3838 |
* Lots of info about the IDT 79RC 32334 |
* Lots of info about the IDT 79RC 32334 |
3865 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
3866 |
machine->machine_name = "Sony NeWS (NET WORK STATION)"; |
machine->machine_name = "Sony NeWS (NET WORK STATION)"; |
3867 |
|
|
3868 |
/* This is just a test. TODO */ |
if (machine->prom_emulation) { |
3869 |
{ |
/* This is just a test. TODO */ |
3870 |
int i; |
int i; |
3871 |
for (i=0; i<32; i++) |
for (i=0; i<32; i++) |
3872 |
cpu->cd.mips.gpr[i] = |
cpu->cd.mips.gpr[i] = |
3878 |
|
|
3879 |
break; |
break; |
3880 |
|
|
3881 |
|
case MACHINE_EVBMIPS: |
3882 |
|
/* http://www.netbsd.org/Ports/evbmips/ */ |
3883 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
3884 |
|
|
3885 |
|
switch (machine->machine_subtype) { |
3886 |
|
case MACHINE_EVBMIPS_MALTA: |
3887 |
|
case MACHINE_EVBMIPS_MALTA_BE: |
3888 |
|
machine->machine_name = "MALTA (evbmips, little endian)"; |
3889 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
3890 |
|
|
3891 |
|
if (machine->machine_subtype == MACHINE_EVBMIPS_MALTA_BE) { |
3892 |
|
machine->machine_name = "MALTA (evbmips, big endian)"; |
3893 |
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
3894 |
|
} |
3895 |
|
|
3896 |
|
/* ISA interrupt controllers: */ |
3897 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x18000020"); |
3898 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
3899 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x180000a0"); |
3900 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
3901 |
|
machine->md_interrupt = malta_interrupt; |
3902 |
|
|
3903 |
|
dev_mc146818_init(machine, mem, 0x18000070, 8 + 8, MC146818_PC_CMOS, 1); |
3904 |
|
|
3905 |
|
machine->main_console_handle = (size_t) |
3906 |
|
device_add(machine, "ns16550 irq=12 addr=0x180003f8 name2=tty0"); |
3907 |
|
device_add(machine, "ns16550 irq=11 addr=0x180002f8 name2=tty1"); |
3908 |
|
|
3909 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART); |
3910 |
|
device_add(machine, tmpstr); |
3911 |
|
/* TODO: Irqs */ |
3912 |
|
pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120); |
3913 |
|
|
3914 |
|
/* TODO: Haha, this is bogus. Just a cut&paste |
3915 |
|
from the Cobalt emulation above. */ |
3916 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
3917 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
3918 |
|
|
3919 |
|
device_add(machine, "malta_lcd addr=0x1f000400"); |
3920 |
|
break; |
3921 |
|
case MACHINE_EVBMIPS_PB1000: |
3922 |
|
machine->machine_name = "PB1000 (evbmips)"; |
3923 |
|
cpu->byte_order = EMUL_BIG_ENDIAN; |
3924 |
|
|
3925 |
|
machine->md_interrupt = au1x00_interrupt; |
3926 |
|
machine->md_int.au1x00_ic_data = dev_au1x00_init(machine, mem); |
3927 |
|
/* TODO */ |
3928 |
|
break; |
3929 |
|
default: |
3930 |
|
fatal("Unimplemented EVBMIPS model.\n"); |
3931 |
|
exit(1); |
3932 |
|
} |
3933 |
|
|
3934 |
|
if (machine->prom_emulation) { |
3935 |
|
/* This is just a test. TODO */ |
3936 |
|
for (i=0; i<32; i++) |
3937 |
|
cpu->cd.mips.gpr[i] = |
3938 |
|
0x01230000 + (i << 8) + 0x55; |
3939 |
|
|
3940 |
|
/* NetBSD/evbmips wants these: (at least for Malta) */ |
3941 |
|
|
3942 |
|
/* a0 = argc */ |
3943 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; |
3944 |
|
|
3945 |
|
/* a1 = argv */ |
3946 |
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = (int32_t)0x9fc01000; |
3947 |
|
store_32bit_word(cpu, (int32_t)0x9fc01000, 0x9fc01040); |
3948 |
|
store_32bit_word(cpu, (int32_t)0x9fc01004, 0x9fc01200); |
3949 |
|
store_32bit_word(cpu, (int32_t)0x9fc01008, 0); |
3950 |
|
|
3951 |
|
bootstr = strdup(machine->boot_kernel_filename); |
3952 |
|
bootarg = strdup(machine->boot_string_argument); |
3953 |
|
store_string(cpu, (int32_t)0x9fc01040, bootstr); |
3954 |
|
store_string(cpu, (int32_t)0x9fc01200, bootarg); |
3955 |
|
|
3956 |
|
/* a2 = (yamon_env_var *)envp */ |
3957 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800; |
3958 |
|
{ |
3959 |
|
uint64_t env = cpu->cd.mips.gpr[MIPS_GPR_A2]; |
3960 |
|
uint64_t tmpptr = 0xffffffff9fc01c00ULL; |
3961 |
|
char tmps[50]; |
3962 |
|
|
3963 |
|
snprintf(tmps, sizeof(tmps), "0x%08x", |
3964 |
|
machine->physical_ram_in_mb * 1048576); |
3965 |
|
add_environment_string_dual(cpu, |
3966 |
|
&env, &tmpptr, "memsize", tmps); |
3967 |
|
|
3968 |
|
add_environment_string_dual(cpu, |
3969 |
|
&env, &tmpptr, "yamonrev", "02.06"); |
3970 |
|
|
3971 |
|
/* End of env: */ |
3972 |
|
tmpptr = 0; |
3973 |
|
add_environment_string_dual(cpu, |
3974 |
|
&env, &tmpptr, NULL, NULL); |
3975 |
|
} |
3976 |
|
|
3977 |
|
/* a3 = memsize */ |
3978 |
|
cpu->cd.mips.gpr[MIPS_GPR_A3] = |
3979 |
|
machine->physical_ram_in_mb * 1048576; |
3980 |
|
/* Hm. Linux ignores a3. */ |
3981 |
|
|
3982 |
|
/* |
3983 |
|
* TODO: |
3984 |
|
* Core ID numbers. |
3985 |
|
* How much of this is not valid for PBxxxx? |
3986 |
|
* |
3987 |
|
* See maltareg.h for more info. |
3988 |
|
*/ |
3989 |
|
store_32bit_word(cpu, (int32_t)(0x80000000 + MALTA_REVISION), (1 << 10) + 0x26); |
3990 |
|
|
3991 |
|
/* Call vectors at 0x9fc005xx: */ |
3992 |
|
for (i=0; i<0x100; i+=4) |
3993 |
|
store_32bit_word(cpu, (int64_t)(int32_t)0x9fc00500 + i, |
3994 |
|
(int64_t)(int32_t)0x9fc00800 + i); |
3995 |
|
} |
3996 |
|
break; |
3997 |
|
|
3998 |
|
case MACHINE_PSP: |
3999 |
|
/* |
4000 |
|
* The Playstation Portable seems to be a strange beast. |
4001 |
|
* |
4002 |
|
* http://yun.cup.com/psppg004.html (in Japanese) seems to |
4003 |
|
* suggest that virtual addresses are not displaced by |
4004 |
|
* 0x80000000 as on normal CPUs, but by 0x40000000? |
4005 |
|
*/ |
4006 |
|
machine->machine_name = "Playstation Portable"; |
4007 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
4008 |
|
|
4009 |
|
if (!machine->use_x11 && !quiet_mode) |
4010 |
|
fprintf(stderr, "-------------------------------------" |
4011 |
|
"------------------------------------------\n" |
4012 |
|
"\n WARNING! You are emulating a PSP without -X. " |
4013 |
|
"You will miss graphical output!\n\n" |
4014 |
|
"-------------------------------------" |
4015 |
|
"------------------------------------------\n"); |
4016 |
|
|
4017 |
|
/* 480 x 272 pixels framebuffer (512 bytes per line) */ |
4018 |
|
fb = dev_fb_init(machine, mem, 0x04000000, VFB_HPC, |
4019 |
|
480,272, 512,1088, -15, "Playstation Portable"); |
4020 |
|
|
4021 |
|
/* |
4022 |
|
* TODO/NOTE: This is ugly, but necessary since GXemul doesn't |
4023 |
|
* emulate any MIPS CPU without MMU right now. |
4024 |
|
*/ |
4025 |
|
mips_coproc_tlb_set_entry(cpu, 0, 1048576*16, |
4026 |
|
0x44000000 /*vaddr*/, 0x4000000, 0x4000000 + 1048576*16, |
4027 |
|
1,1,1,1,1, 0, 2, 2); |
4028 |
|
mips_coproc_tlb_set_entry(cpu, 1, 1048576*16, |
4029 |
|
0x8000000 /*vaddr*/, 0x0, 0x0 + 1048576*16, |
4030 |
|
1,1,1,1,1, 0, 2, 2); |
4031 |
|
mips_coproc_tlb_set_entry(cpu, 2, 1048576*16, |
4032 |
|
0x9000000 /*vaddr*/, 0x01000000, 0x01000000 + 1048576*16, |
4033 |
|
1,1,1,1,1, 0, 2, 2); |
4034 |
|
mips_coproc_tlb_set_entry(cpu, 3, 1048576*16, |
4035 |
|
0x0 /*vaddr*/, 0, 0 + 1048576*16, 1,1,1,1,1, 0, 2, 2); |
4036 |
|
|
4037 |
|
cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0; |
4038 |
|
|
4039 |
|
break; |
4040 |
|
#endif /* ENABLE_MIPS */ |
4041 |
|
|
4042 |
|
#ifdef ENABLE_PPC |
4043 |
case MACHINE_BAREPPC: |
case MACHINE_BAREPPC: |
4044 |
/* |
/* |
4045 |
* A "bare" PPC machine. |
* A "bare" PPC machine. |
4056 |
machine->machine_name = "PPC test machine"; |
machine->machine_name = "PPC test machine"; |
4057 |
|
|
4058 |
/* TODO: interrupt for PPC? */ |
/* TODO: interrupt for PPC? */ |
4059 |
machine->main_console_handle = dev_cons_init( |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4060 |
machine, mem, DEV_CONS_ADDRESS, "console", 0); |
(long long)DEV_CONS_ADDRESS); |
4061 |
|
cons_data = device_add(machine, tmpstr); |
4062 |
|
machine->main_console_handle = cons_data->console_handle; |
4063 |
|
|
4064 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "mp addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4065 |
(long long)DEV_MP_ADDRESS); |
(long long)DEV_MP_ADDRESS); |
4066 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4067 |
|
|
4068 |
fb = dev_fb_init(machine, mem, 0x12000000, VFB_GENERIC, |
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4069 |
640,480, 640,480, 24, "generic", 1); |
640,480, 640,480, 24, "testppc generic"); |
4070 |
|
|
4071 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4072 |
|
(long long)DEV_DISK_ADDRESS); |
4073 |
|
device_add(machine, tmpstr); |
4074 |
|
|
4075 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4076 |
|
(long long)DEV_ETHER_ADDRESS); |
4077 |
|
device_add(machine, tmpstr); |
4078 |
|
|
4079 |
break; |
break; |
4080 |
|
|
4081 |
case MACHINE_WALNUT: |
case MACHINE_WALNUT: |
4095 |
dev_pmppc_init(mem); |
dev_pmppc_init(mem); |
4096 |
|
|
4097 |
/* com0 = 0xff600300, com1 = 0xff600400 */ |
/* com0 = 0xff600300, com1 = 0xff600400 */ |
4098 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
|
4099 |
0xff600300, 0, 1, 1, "serial 0"); |
machine->main_console_handle = (size_t)device_add(machine, "ns16550 irq=0 addr=0xff600300 name2=tty0"); |
4100 |
dev_ns16550_init(machine, mem, |
device_add(machine, "ns16550 irq=0 addr=0xff600400 in_use=0 name2=tty1"); |
|
0xff600400, 0, 1, 0, "serial 1"); |
|
4101 |
|
|
4102 |
break; |
break; |
4103 |
|
|
4124 |
|
|
4125 |
device_add(machine, "bebox"); |
device_add(machine, "bebox"); |
4126 |
|
|
4127 |
/* Serial, used by NetBSD: */ |
machine->main_console_handle = (size_t) |
4128 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
device_add(machine, "ns16550 irq=0 addr=0x800003f8 name2=tty0"); |
4129 |
0x800003f8, 0, 1, 1, "serial 0"); |
device_add(machine, "ns16550 irq=0 addr=0x800002f8 name2=tty1 in_use=0"); |
|
|
|
|
/* Serial, used by Linux: */ |
|
|
dev_ns16550_init(machine, mem, 0x800002f8, 0, 1, 0, "serial 1"); |
|
|
|
|
|
/* This is used by Linux too: */ |
|
|
dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL, |
|
|
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); |
|
4130 |
|
|
4131 |
|
dev_pckbc_init(machine, mem, 0x80000060, PCKBC_8042, |
4132 |
|
1, 12, machine->use_x11, 1); |
4133 |
|
|
4134 |
|
if (machine->use_x11) |
4135 |
|
dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL, |
4136 |
|
machine->machine_name); |
4137 |
|
|
4138 |
|
if (machine->prom_emulation) { |
4139 |
|
store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576); |
4140 |
|
|
4141 |
|
/* TODO: List of stuff, see http://www.beatjapan.org/ |
4142 |
|
mirror/www.be.com/aboutbe/benewsletter/ |
4143 |
|
Issue27.html#Cookbook for the details. */ |
4144 |
|
store_32bit_word(cpu, 0x301c, 0); |
4145 |
|
|
4146 |
|
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
4147 |
|
r5 = args, r6 = ptr to bootinfo? */ |
4148 |
|
cpu->cd.ppc.gpr[3] = 0x3100; |
4149 |
|
cpu->cd.ppc.gpr[4] = 0x200000; |
4150 |
|
cpu->cd.ppc.gpr[5] = 0x2000; |
4151 |
|
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
4152 |
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100; |
4153 |
|
|
4154 |
|
/* See NetBSD's bebox/include/bootinfo.h for details */ |
4155 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 0, 12); /* next */ |
4156 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 4, 0); /* mem */ |
4157 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 8, |
4158 |
|
machine->physical_ram_in_mb * 1048576); |
4159 |
|
|
4160 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 12, 20); /* next */ |
4161 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 16, 1); /* console */ |
4162 |
|
store_buf(cpu, cpu->cd.ppc.gpr[6] + 20, |
4163 |
|
machine->use_x11? "vga" : "com", 4); |
4164 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 24, 0x3f8);/* addr */ |
4165 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 28, 9600);/* speed */ |
4166 |
|
|
4167 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 32, 0); /* next */ |
4168 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 36, 2); /* clock */ |
4169 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6] + 40, 100); |
4170 |
|
} |
4171 |
break; |
break; |
4172 |
|
|
4173 |
case MACHINE_PREP: |
case MACHINE_PREP: |
4176 |
*/ |
*/ |
4177 |
machine->machine_name = "PowerPC Reference Platform"; |
machine->machine_name = "PowerPC Reference Platform"; |
4178 |
|
|
4179 |
{ |
if (machine->prom_emulation) { |
4180 |
int i; |
/* Linux on PReP has 0xdeadc0de at address 0? (See |
4181 |
for (i=0; i<32; i++) |
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
4182 |
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; |
|
4183 |
|
|
4184 |
|
/* r6 should point to "residual data"? */ |
4185 |
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x1000; |
4186 |
|
} |
4187 |
break; |
break; |
4188 |
|
|
4189 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
4193 |
*/ |
*/ |
4194 |
machine->machine_name = "Macintosh (PPC)"; |
machine->machine_name = "Macintosh (PPC)"; |
4195 |
|
|
4196 |
/* r5 = OpenFirmware entry point */ |
if (machine->prom_emulation) { |
4197 |
cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; |
uint64_t b = 8 * 1048576, a = b - 0x800; |
4198 |
|
int i; |
4199 |
|
/* |
4200 |
|
* r3 = pointer to boot_args (for the Mach kernel). |
4201 |
|
* See http://darwinsource.opendarwin.org/10.3/ |
4202 |
|
* BootX-59/bootx.tproj/include.subproj/boot_args.h |
4203 |
|
* for more info. |
4204 |
|
*/ |
4205 |
|
cpu->cd.ppc.gpr[3] = a; |
4206 |
|
store_16bit_word(cpu, a + 0x0000, 1); /* revision */ |
4207 |
|
store_16bit_word(cpu, a + 0x0002, 2); /* version */ |
4208 |
|
store_buf(cpu, a + 0x0004, machine->boot_string_argument, 256); |
4209 |
|
/* 26 dram banks; "long base; long size" */ |
4210 |
|
store_32bit_word(cpu, a + 0x0104, 0); /* base */ |
4211 |
|
store_32bit_word(cpu, a + 0x0108, machine->physical_ram_in_mb |
4212 |
|
* 256); /* size (in pages) */ |
4213 |
|
for (i=8; i<26*8; i+= 4) |
4214 |
|
store_32bit_word(cpu, a + 0x0104 + i, 0); |
4215 |
|
a += (0x104 + 26 * 8); |
4216 |
|
/* Video info: */ |
4217 |
|
store_32bit_word(cpu, a+0, 0xd0000000); /* video base */ |
4218 |
|
store_32bit_word(cpu, a+4, 0); /* display code (?) */ |
4219 |
|
store_32bit_word(cpu, a+8, 800); /* bytes per pixel row */ |
4220 |
|
store_32bit_word(cpu, a+12, 800); /* width */ |
4221 |
|
store_32bit_word(cpu, a+16, 600); /* height */ |
4222 |
|
store_32bit_word(cpu, a+20, 8); /* pixel depth */ |
4223 |
|
a += 24; |
4224 |
|
store_32bit_word(cpu, a+0, 127); /* gestalt number (TODO) */ |
4225 |
|
store_32bit_word(cpu, a+4, 0); /* device tree pointer (TODO) */ |
4226 |
|
store_32bit_word(cpu, a+8, 0); /* device tree length */ |
4227 |
|
store_32bit_word(cpu, a+12, b); /* last address of kernel data area */ |
4228 |
|
|
4229 |
|
/* r4 = "MOSX" (0x4D4F5358) */ |
4230 |
|
cpu->cd.ppc.gpr[4] = 0x4D4F5358; |
4231 |
|
|
4232 |
|
/* |
4233 |
|
* r5 = OpenFirmware entry point. NOTE: See |
4234 |
|
* cpu_ppc.c for the rest of this semi-ugly hack. |
4235 |
|
*/ |
4236 |
|
dev_ram_init(machine, cpu->cd.ppc.of_emul_addr, |
4237 |
|
0x1000, DEV_RAM_RAM, 0x0); |
4238 |
|
store_32bit_word(cpu, cpu->cd.ppc.of_emul_addr, |
4239 |
|
0x44ee0002); |
4240 |
|
cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; |
4241 |
|
} |
4242 |
break; |
break; |
4243 |
|
|
4244 |
case MACHINE_DB64360: |
case MACHINE_DB64360: |
4245 |
/* For playing with PMON2000 for PPC: */ |
/* For playing with PMON2000 for PPC: */ |
4246 |
machine->machine_name = "DB64360"; |
machine->machine_name = "DB64360"; |
4247 |
|
|
4248 |
machine->main_console_handle = dev_ns16550_init(machine, mem, |
machine->main_console_handle = (size_t)device_add(machine, |
4249 |
0x1d000020, 0, 4, 1, "serial console"); |
"ns16550 irq=0 addr=0x1d000020 addr_mult=4"); |
4250 |
|
|
4251 |
{ |
if (machine->prom_emulation) { |
4252 |
int i; |
int i; |
4253 |
for (i=0; i<32; i++) |
for (i=0; i<32; i++) |
4254 |
cpu->cd.ppc.gpr[i] = |
cpu->cd.ppc.gpr[i] = |
4256 |
} |
} |
4257 |
|
|
4258 |
break; |
break; |
4259 |
|
#endif /* ENABLE_PPC */ |
4260 |
|
|
4261 |
case MACHINE_BARESPARC: |
#ifdef ENABLE_SH |
4262 |
/* A bare SPARC machine, with no devices. */ |
case MACHINE_BARESH: |
4263 |
machine->machine_name = "\"Bare\" SPARC machine"; |
/* A bare SH machine, with no devices. */ |
4264 |
|
machine->machine_name = "\"Bare\" SH machine"; |
4265 |
break; |
break; |
4266 |
|
|
4267 |
case MACHINE_ULTRA1: |
case MACHINE_TESTSH: |
4268 |
/* |
machine->machine_name = "SH test machine"; |
4269 |
* NetBSD/sparc64 (http://www.netbsd.org/Ports/sparc64/) |
|
4270 |
* OpenBSD/sparc64 (http://www.openbsd.org/sparc64.html) |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4271 |
*/ |
(long long)DEV_CONS_ADDRESS); |
4272 |
machine->machine_name = "Sun Ultra1"; |
cons_data = device_add(machine, tmpstr); |
4273 |
break; |
machine->main_console_handle = cons_data->console_handle; |
4274 |
|
|
4275 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4276 |
|
(long long)DEV_MP_ADDRESS); |
4277 |
|
device_add(machine, tmpstr); |
4278 |
|
|
4279 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4280 |
|
640,480, 640,480, 24, "testsh generic"); |
4281 |
|
|
4282 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4283 |
|
(long long)DEV_DISK_ADDRESS); |
4284 |
|
device_add(machine, tmpstr); |
4285 |
|
|
4286 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4287 |
|
(long long)DEV_ETHER_ADDRESS); |
4288 |
|
device_add(machine, tmpstr); |
4289 |
|
|
|
case MACHINE_BAREURISC: |
|
|
machine->machine_name = "\"Bare\" URISC machine"; |
|
4290 |
break; |
break; |
4291 |
|
|
4292 |
case MACHINE_TESTURISC: |
case MACHINE_HPCSH: |
4293 |
machine->machine_name = "URISC test machine"; |
/* Handheld SH-based machines: */ |
4294 |
|
machine->machine_name = "HPCsh"; |
4295 |
|
|
4296 |
/* TODO */ |
/* TODO */ |
|
/* A special "device" for accessing normal devices |
|
|
using urisc accesses? */ |
|
|
|
|
|
device_add(machine, "urisc addr=0x12341234"); |
|
4297 |
|
|
4298 |
break; |
break; |
4299 |
|
#endif /* ENABLE_SH */ |
4300 |
|
|
4301 |
|
#ifdef ENABLE_HPPA |
4302 |
case MACHINE_BAREHPPA: |
case MACHINE_BAREHPPA: |
4303 |
|
/* A bare HPPA machine, with no devices. */ |
4304 |
machine->machine_name = "\"Bare\" HPPA machine"; |
machine->machine_name = "\"Bare\" HPPA machine"; |
4305 |
break; |
break; |
4306 |
|
|
4307 |
case MACHINE_TESTHPPA: |
case MACHINE_TESTHPPA: |
4308 |
machine->machine_name = "HPPA test machine"; |
machine->machine_name = "HPPA test machine"; |
4309 |
|
|
4310 |
/* TODO */ |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4311 |
|
(long long)DEV_CONS_ADDRESS); |
4312 |
|
cons_data = device_add(machine, tmpstr); |
4313 |
|
machine->main_console_handle = cons_data->console_handle; |
4314 |
|
|
4315 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4316 |
|
(long long)DEV_MP_ADDRESS); |
4317 |
|
device_add(machine, tmpstr); |
4318 |
|
|
4319 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4320 |
|
640,480, 640,480, 24, "testhppa generic"); |
4321 |
|
|
4322 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4323 |
|
(long long)DEV_DISK_ADDRESS); |
4324 |
|
device_add(machine, tmpstr); |
4325 |
|
|
4326 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4327 |
|
(long long)DEV_ETHER_ADDRESS); |
4328 |
|
device_add(machine, tmpstr); |
4329 |
|
|
4330 |
|
break; |
4331 |
|
#endif /* ENABLE_HPPA */ |
4332 |
|
|
4333 |
|
#ifdef ENABLE_I960 |
4334 |
|
case MACHINE_BAREI960: |
4335 |
|
/* A bare I960 machine, with no devices. */ |
4336 |
|
machine->machine_name = "\"Bare\" i960 machine"; |
4337 |
break; |
break; |
4338 |
|
|
4339 |
|
case MACHINE_TESTI960: |
4340 |
|
machine->machine_name = "i960 test machine"; |
4341 |
|
|
4342 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4343 |
|
(long long)DEV_CONS_ADDRESS); |
4344 |
|
cons_data = device_add(machine, tmpstr); |
4345 |
|
machine->main_console_handle = cons_data->console_handle; |
4346 |
|
|
4347 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4348 |
|
(long long)DEV_MP_ADDRESS); |
4349 |
|
device_add(machine, tmpstr); |
4350 |
|
|
4351 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4352 |
|
640,480, 640,480, 24, "testi960 generic"); |
4353 |
|
|
4354 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4355 |
|
(long long)DEV_DISK_ADDRESS); |
4356 |
|
device_add(machine, tmpstr); |
4357 |
|
|
4358 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4359 |
|
(long long)DEV_ETHER_ADDRESS); |
4360 |
|
device_add(machine, tmpstr); |
4361 |
|
|
4362 |
|
break; |
4363 |
|
#endif /* ENABLE_I960 */ |
4364 |
|
|
4365 |
|
#ifdef ENABLE_SPARC |
4366 |
|
case MACHINE_BARESPARC: |
4367 |
|
/* A bare SPARC machine, with no devices. */ |
4368 |
|
machine->machine_name = "\"Bare\" SPARC machine"; |
4369 |
|
break; |
4370 |
|
|
4371 |
|
case MACHINE_TESTSPARC: |
4372 |
|
machine->machine_name = "SPARC test machine"; |
4373 |
|
|
4374 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4375 |
|
(long long)DEV_CONS_ADDRESS); |
4376 |
|
cons_data = device_add(machine, tmpstr); |
4377 |
|
machine->main_console_handle = cons_data->console_handle; |
4378 |
|
|
4379 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4380 |
|
(long long)DEV_MP_ADDRESS); |
4381 |
|
device_add(machine, tmpstr); |
4382 |
|
|
4383 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4384 |
|
640,480, 640,480, 24, "testsparc generic"); |
4385 |
|
|
4386 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4387 |
|
(long long)DEV_DISK_ADDRESS); |
4388 |
|
device_add(machine, tmpstr); |
4389 |
|
|
4390 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4391 |
|
(long long)DEV_ETHER_ADDRESS); |
4392 |
|
device_add(machine, tmpstr); |
4393 |
|
|
4394 |
|
break; |
4395 |
|
|
4396 |
|
case MACHINE_ULTRA1: |
4397 |
|
/* |
4398 |
|
* NetBSD/sparc64 (http://www.netbsd.org/Ports/sparc64/) |
4399 |
|
* OpenBSD/sparc64 (http://www.openbsd.org/sparc64.html) |
4400 |
|
*/ |
4401 |
|
machine->machine_name = "Sun Ultra1"; |
4402 |
|
break; |
4403 |
|
#endif /* ENABLE_SPARC */ |
4404 |
|
|
4405 |
|
#ifdef ENABLE_ALPHA |
4406 |
case MACHINE_BAREALPHA: |
case MACHINE_BAREALPHA: |
4407 |
machine->machine_name = "\"Bare\" Alpha machine"; |
machine->machine_name = "\"Bare\" Alpha machine"; |
4408 |
break; |
break; |
4410 |
case MACHINE_TESTALPHA: |
case MACHINE_TESTALPHA: |
4411 |
machine->machine_name = "Alpha test machine"; |
machine->machine_name = "Alpha test machine"; |
4412 |
|
|
4413 |
/* TODO */ |
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4414 |
|
(long long)DEV_CONS_ADDRESS); |
4415 |
|
cons_data = device_add(machine, tmpstr); |
4416 |
|
machine->main_console_handle = cons_data->console_handle; |
4417 |
|
|
4418 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4419 |
|
(long long)DEV_MP_ADDRESS); |
4420 |
|
device_add(machine, tmpstr); |
4421 |
|
|
4422 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4423 |
|
640,480, 640,480, 24, "testalpha generic"); |
4424 |
|
|
4425 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4426 |
|
(long long)DEV_DISK_ADDRESS); |
4427 |
|
device_add(machine, tmpstr); |
4428 |
|
|
4429 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4430 |
|
(long long)DEV_ETHER_ADDRESS); |
4431 |
|
device_add(machine, tmpstr); |
4432 |
|
|
4433 |
break; |
break; |
4434 |
|
|
4435 |
|
case MACHINE_ALPHA: |
4436 |
|
if (machine->prom_emulation) { |
4437 |
|
struct rpb rpb; |
4438 |
|
struct crb crb; |
4439 |
|
struct ctb ctb; |
4440 |
|
|
4441 |
|
/* TODO: Most of these... They are used by NetBSD/alpha: */ |
4442 |
|
/* a0 = First free Page Frame Number */ |
4443 |
|
/* a1 = PFN of current Level 1 page table */ |
4444 |
|
/* a2 = Bootinfo magic */ |
4445 |
|
/* a3 = Bootinfo pointer */ |
4446 |
|
/* a4 = Bootinfo version */ |
4447 |
|
cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; |
4448 |
|
cpu->cd.alpha.r[ALPHA_A1] = 0; |
4449 |
|
cpu->cd.alpha.r[ALPHA_A2] = 0; |
4450 |
|
cpu->cd.alpha.r[ALPHA_A3] = 0; |
4451 |
|
cpu->cd.alpha.r[ALPHA_A4] = 0; |
4452 |
|
|
4453 |
|
/* HWRPB: Hardware Restart Parameter Block */ |
4454 |
|
memset(&rpb, 0, sizeof(struct rpb)); |
4455 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4456 |
|
&(rpb.rpb_phys), HWRPB_ADDR); |
4457 |
|
strlcpy((char *)&(rpb.rpb_magic), "HWRPB", 8); |
4458 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4459 |
|
&(rpb.rpb_size), sizeof(struct rpb)); |
4460 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4461 |
|
&(rpb.rpb_page_size), 8192); |
4462 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4463 |
|
&(rpb.rpb_type), machine->machine_subtype); |
4464 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4465 |
|
&(rpb.rpb_cc_freq), 100000000); |
4466 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4467 |
|
&(rpb.rpb_ctb_off), CTB_ADDR - HWRPB_ADDR); |
4468 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4469 |
|
&(rpb.rpb_crb_off), CRB_ADDR - HWRPB_ADDR); |
4470 |
|
|
4471 |
|
/* CTB: Console Terminal Block */ |
4472 |
|
memset(&ctb, 0, sizeof(struct ctb)); |
4473 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4474 |
|
&(ctb.ctb_term_type), machine->use_x11? |
4475 |
|
CTB_GRAPHICS : CTB_PRINTERPORT); |
4476 |
|
|
4477 |
|
/* CRB: Console Routine Block */ |
4478 |
|
memset(&crb, 0, sizeof(struct crb)); |
4479 |
|
store_64bit_word_in_host(cpu, (unsigned char *) |
4480 |
|
&(crb.crb_v_dispatch), CRB_ADDR - 0x100); |
4481 |
|
store_64bit_word(cpu, CRB_ADDR - 0x100 + 8, 0x10000); |
4482 |
|
|
4483 |
|
/* |
4484 |
|
* Place a special "hack" palcode call at 0x10000: |
4485 |
|
* (Hopefully nothing else will be there.) |
4486 |
|
*/ |
4487 |
|
store_32bit_word(cpu, 0x10000, 0x3fffffe); |
4488 |
|
|
4489 |
|
store_buf(cpu, HWRPB_ADDR, (char *)&rpb, sizeof(struct rpb)); |
4490 |
|
store_buf(cpu, CTB_ADDR, (char *)&ctb, sizeof(struct ctb)); |
4491 |
|
store_buf(cpu, CRB_ADDR, (char *)&crb, sizeof(struct crb)); |
4492 |
|
} |
4493 |
|
|
4494 |
|
switch (machine->machine_subtype) { |
4495 |
|
case ST_DEC_3000_300: |
4496 |
|
machine->machine_name = "DEC 3000/300"; |
4497 |
|
machine->main_console_handle = |
4498 |
|
dev_zs_init(machine, mem, 0x1b0200000ULL, |
4499 |
|
0, 4, "serial zs"); /* serial? netbsd? */ |
4500 |
|
break; |
4501 |
|
case ST_EB164: |
4502 |
|
machine->machine_name = "EB164"; |
4503 |
|
break; |
4504 |
|
default:fatal("Unimplemented Alpha machine type %i\n", |
4505 |
|
machine->machine_subtype); |
4506 |
|
exit(1); |
4507 |
|
} |
4508 |
|
|
4509 |
|
break; |
4510 |
|
#endif /* ENABLE_ALPHA */ |
4511 |
|
|
4512 |
|
#ifdef ENABLE_ARM |
4513 |
case MACHINE_BAREARM: |
case MACHINE_BAREARM: |
4514 |
machine->machine_name = "\"Bare\" ARM machine"; |
machine->machine_name = "\"Bare\" ARM machine"; |
4515 |
break; |
break; |
4517 |
case MACHINE_TESTARM: |
case MACHINE_TESTARM: |
4518 |
machine->machine_name = "ARM test machine"; |
machine->machine_name = "ARM test machine"; |
4519 |
|
|
4520 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4521 |
|
(long long)DEV_CONS_ADDRESS); |
4522 |
|
cons_data = device_add(machine, tmpstr); |
4523 |
|
machine->main_console_handle = cons_data->console_handle; |
4524 |
|
|
4525 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4526 |
|
(long long)DEV_MP_ADDRESS); |
4527 |
|
device_add(machine, tmpstr); |
4528 |
|
|
4529 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4530 |
|
640,480, 640,480, 24, "testarm generic"); |
4531 |
|
|
4532 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4533 |
|
(long long)DEV_DISK_ADDRESS); |
4534 |
|
device_add(machine, tmpstr); |
4535 |
|
|
4536 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4537 |
|
(long long)DEV_ETHER_ADDRESS); |
4538 |
|
device_add(machine, tmpstr); |
4539 |
|
|
4540 |
|
/* Place a tiny stub at end of memory, and set the link |
4541 |
|
register to point to it. This stub halts the machine. */ |
4542 |
|
cpu->cd.arm.r[ARM_SP] = |
4543 |
|
machine->physical_ram_in_mb * 1048576 - 4096; |
4544 |
|
cpu->cd.arm.r[ARM_LR] = cpu->cd.arm.r[ARM_SP] + 32; |
4545 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 0, 0xe3a00201); |
4546 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 4, 0xe5c00010); |
4547 |
|
store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 8, |
4548 |
|
0xeafffffe); |
4549 |
|
break; |
4550 |
|
|
4551 |
|
case MACHINE_CATS: |
4552 |
|
machine->machine_name = "CATS evaluation board"; |
4553 |
|
|
4554 |
|
if (machine->emulated_hz == 0) |
4555 |
|
machine->emulated_hz = 50000000; |
4556 |
|
|
4557 |
|
if (machine->physical_ram_in_mb > 256) |
4558 |
|
fprintf(stderr, "WARNING! Real CATS machines cannot" |
4559 |
|
" have more than 256 MB RAM. Continuing anyway.\n"); |
4560 |
|
|
4561 |
|
machine->md_int.footbridge_data = |
4562 |
|
device_add(machine, "footbridge addr=0x42000000"); |
4563 |
|
machine->md_interrupt = footbridge_interrupt; |
4564 |
|
|
4565 |
|
/* NetBSD and OpenBSD clean their caches here: */ |
4566 |
|
dev_ram_init(machine, 0x50000000, 0x4000, DEV_RAM_RAM, 0); |
4567 |
|
|
4568 |
|
/* Interrupt ack space? */ |
4569 |
|
dev_ram_init(machine, 0x80000000, 0x1000, DEV_RAM_RAM, 0); |
4570 |
|
|
4571 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
4572 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4573 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
4574 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4575 |
|
|
4576 |
|
device_add(machine, "pccmos addr=0x7c000070"); |
4577 |
|
|
4578 |
|
if (machine->use_x11) { |
4579 |
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4580 |
|
mem, 0xc0, 8, 0, pci_s3_virge_init, pci_s3_virge_rr); |
4581 |
|
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
4582 |
|
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
4583 |
|
32 + 1, 32 + 12, machine->use_x11, 0); |
4584 |
|
machine->main_console_handle = j; |
4585 |
|
} |
4586 |
|
|
4587 |
|
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0 in_use=0"); |
4588 |
|
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1 in_use=0"); |
4589 |
|
|
4590 |
|
device_add(machine, "lpt irq=39 addr=0x7c000378 name2=lpt in_use=0"); |
4591 |
|
|
4592 |
|
if (machine->prom_emulation) { |
4593 |
|
struct ebsaboot ebsaboot; |
4594 |
|
char bs[300]; |
4595 |
|
int boot_id = bootdev_id >= 0? bootdev_id : 0; |
4596 |
|
|
4597 |
|
cpu->cd.arm.r[0] = /* machine->physical_ram_in_mb */ |
4598 |
|
7 * 1048576 - 0x1000; |
4599 |
|
|
4600 |
|
memset(&ebsaboot, 0, sizeof(struct ebsaboot)); |
4601 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4602 |
|
&(ebsaboot.bt_magic), BT_MAGIC_NUMBER_CATS); |
4603 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4604 |
|
&(ebsaboot.bt_vargp), 0); |
4605 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4606 |
|
&(ebsaboot.bt_pargp), 0); |
4607 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4608 |
|
&(ebsaboot.bt_args), cpu->cd.arm.r[0] |
4609 |
|
+ sizeof(struct ebsaboot)); |
4610 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4611 |
|
&(ebsaboot.bt_l1), 7 * 1048576 - 32768); |
4612 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4613 |
|
&(ebsaboot.bt_memstart), 0); |
4614 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4615 |
|
&(ebsaboot.bt_memend), |
4616 |
|
machine->physical_ram_in_mb * 1048576); |
4617 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4618 |
|
&(ebsaboot.bt_memavail), 7 * 1048576); |
4619 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4620 |
|
&(ebsaboot.bt_fclk), 50 * 1000000); |
4621 |
|
store_32bit_word_in_host(cpu, (unsigned char *) |
4622 |
|
&(ebsaboot.bt_pciclk), 66 * 1000000); |
4623 |
|
/* TODO: bt_vers */ |
4624 |
|
/* TODO: bt_features */ |
4625 |
|
|
4626 |
|
store_buf(cpu, cpu->cd.arm.r[0], |
4627 |
|
(char *)&ebsaboot, sizeof(struct ebsaboot)); |
4628 |
|
|
4629 |
|
snprintf(bs, sizeof(bs), "(hd%i)%s%s%s", |
4630 |
|
boot_id, machine->boot_kernel_filename, |
4631 |
|
(machine->boot_string_argument[0])? " " : "", |
4632 |
|
machine->boot_string_argument); |
4633 |
|
|
4634 |
|
store_string(cpu, cpu->cd.arm.r[0] + |
4635 |
|
sizeof(struct ebsaboot), bs); |
4636 |
|
|
4637 |
|
arm_setup_initial_translation_table(cpu, |
4638 |
|
7 * 1048576 - 32768); |
4639 |
|
} |
4640 |
|
break; |
4641 |
|
|
4642 |
|
case MACHINE_HPCARM: |
4643 |
|
cpu->byte_order = EMUL_LITTLE_ENDIAN; |
4644 |
|
memset(&hpc_bootinfo, 0, sizeof(hpc_bootinfo)); |
4645 |
|
switch (machine->machine_subtype) { |
4646 |
|
case MACHINE_HPCARM_IPAQ: |
4647 |
|
/* SA-1110 206MHz */ |
4648 |
|
machine->machine_name = "Compaq iPAQ H3600"; |
4649 |
|
hpc_fb_addr = 0x48200000; /* TODO */ |
4650 |
|
hpc_fb_xsize = 240; |
4651 |
|
hpc_fb_ysize = 320; |
4652 |
|
hpc_fb_xsize_mem = 256; |
4653 |
|
hpc_fb_ysize_mem = 320; |
4654 |
|
hpc_fb_bits = 15; |
4655 |
|
hpc_fb_encoding = BIFB_D16_0000; |
4656 |
|
hpc_platid_cpu_arch = 3; /* ARM */ |
4657 |
|
hpc_platid_cpu_series = 1; /* StrongARM */ |
4658 |
|
hpc_platid_cpu_model = 2; /* SA-1110 */ |
4659 |
|
hpc_platid_cpu_submodel = 0; |
4660 |
|
hpc_platid_vendor = 7; /* Compaq */ |
4661 |
|
hpc_platid_series = 4; /* IPAQ */ |
4662 |
|
hpc_platid_model = 2; /* H36xx */ |
4663 |
|
hpc_platid_submodel = 1; /* H3600 */ |
4664 |
|
break; |
4665 |
|
case MACHINE_HPCARM_JORNADA720: |
4666 |
|
/* SA-1110 206MHz */ |
4667 |
|
machine->machine_name = "Jornada 720"; |
4668 |
|
hpc_fb_addr = 0x48200000; |
4669 |
|
hpc_fb_xsize = 640; |
4670 |
|
hpc_fb_ysize = 240; |
4671 |
|
hpc_fb_xsize_mem = 640; |
4672 |
|
hpc_fb_ysize_mem = 240; |
4673 |
|
hpc_fb_bits = 16; |
4674 |
|
hpc_fb_encoding = BIFB_D16_0000; |
4675 |
|
hpc_platid_cpu_arch = 3; /* ARM */ |
4676 |
|
hpc_platid_cpu_series = 1; /* StrongARM */ |
4677 |
|
hpc_platid_cpu_model = 2; /* SA-1110 */ |
4678 |
|
hpc_platid_cpu_submodel = 0; |
4679 |
|
hpc_platid_vendor = 11; /* HP */ |
4680 |
|
hpc_platid_series = 2; /* Jornada */ |
4681 |
|
hpc_platid_model = 2; /* 7xx */ |
4682 |
|
hpc_platid_submodel = 1; /* 720 */ |
4683 |
|
break; |
4684 |
|
default: |
4685 |
|
printf("Unimplemented hpcarm machine number.\n"); |
4686 |
|
exit(1); |
4687 |
|
} |
4688 |
|
|
4689 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_cpu, |
4690 |
|
(hpc_platid_cpu_arch << 26) + (hpc_platid_cpu_series << 20) |
4691 |
|
+ (hpc_platid_cpu_model << 14) + (hpc_platid_cpu_submodel << 8) |
4692 |
|
+ hpc_platid_flags); |
4693 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.platid_machine, |
4694 |
|
(hpc_platid_vendor << 22) + (hpc_platid_series << 16) |
4695 |
|
+ (hpc_platid_model << 8) + hpc_platid_submodel); |
4696 |
|
|
4697 |
|
if (machine->prom_emulation) { |
4698 |
|
/* NetBSD/hpcarm and possibly others expects the following: */ |
4699 |
|
|
4700 |
|
cpu->cd.arm.r[0] = 1; /* argc */ |
4701 |
|
cpu->cd.arm.r[1] = machine->physical_ram_in_mb * 1048576 - 512; /* argv */ |
4702 |
|
cpu->cd.arm.r[2] = machine->physical_ram_in_mb * 1048576 - 256; /* ptr to hpc_bootinfo */ |
4703 |
|
|
4704 |
|
bootstr = machine->boot_kernel_filename; |
4705 |
|
store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512, |
4706 |
|
machine->physical_ram_in_mb * 1048576 - 512 + 16); |
4707 |
|
store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); |
4708 |
|
store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); |
4709 |
|
|
4710 |
|
if (machine->boot_string_argument[0]) { |
4711 |
|
cpu->cd.arm.r[0] ++; /* argc */ |
4712 |
|
|
4713 |
|
store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 4, machine->physical_ram_in_mb * 1048576 - 512 + 64); |
4714 |
|
store_32bit_word(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 8, 0); |
4715 |
|
|
4716 |
|
store_string(cpu, machine->physical_ram_in_mb * 1048576 - 512 + 64, |
4717 |
|
machine->boot_string_argument); |
4718 |
|
|
4719 |
|
bootarg = machine->boot_string_argument; |
4720 |
|
} |
4721 |
|
|
4722 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); |
4723 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); |
4724 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, hpc_fb_addr); |
4725 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpc_fb_xsize_mem * (((hpc_fb_bits-1)|7)+1) / 8); |
4726 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpc_fb_xsize); |
4727 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpc_fb_ysize); |
4728 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpc_fb_encoding); |
4729 |
|
store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, |
4730 |
|
machine->use_x11? BI_CNUSE_BUILTIN : BI_CNUSE_SERIAL); |
4731 |
|
|
4732 |
|
store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); |
4733 |
|
store_buf(cpu, machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); |
4734 |
|
|
4735 |
|
/* |
4736 |
|
* TODO: ugly hack, only works with small NetBSD |
4737 |
|
* kernels! |
4738 |
|
*/ |
4739 |
|
cpu->cd.arm.r[ARM_SP] = 0xc02c0000; |
4740 |
|
} |
4741 |
|
|
4742 |
|
/* Physical RAM at 0xc0000000: */ |
4743 |
|
dev_ram_init(machine, 0xc0000000, 0x20000000, |
4744 |
|
DEV_RAM_MIRROR, 0x0); |
4745 |
|
|
4746 |
|
/* Cache flush region: */ |
4747 |
|
dev_ram_init(machine, 0xe0000000, 0x10000, DEV_RAM_RAM, 0x0); |
4748 |
|
|
4749 |
|
if (hpc_fb_addr != 0) { |
4750 |
|
dev_fb_init(machine, mem, hpc_fb_addr, VFB_HPC, |
4751 |
|
hpc_fb_xsize, hpc_fb_ysize, |
4752 |
|
hpc_fb_xsize_mem, hpc_fb_ysize_mem, |
4753 |
|
hpc_fb_bits, machine->machine_name); |
4754 |
|
} |
4755 |
|
break; |
4756 |
|
|
4757 |
|
case MACHINE_ZAURUS: |
4758 |
|
machine->machine_name = "Zaurus"; |
4759 |
|
dev_ram_init(machine, 0xa0000000, 0x20000000, |
4760 |
|
DEV_RAM_MIRROR, 0x0); |
4761 |
|
device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4"); |
4762 |
/* TODO */ |
/* TODO */ |
4763 |
|
if (machine->prom_emulation) { |
4764 |
|
arm_setup_initial_translation_table(cpu, 0x4000); |
4765 |
|
} |
4766 |
break; |
break; |
4767 |
|
|
4768 |
|
case MACHINE_NETWINDER: |
4769 |
|
machine->machine_name = "NetWinder"; |
4770 |
|
|
4771 |
|
if (machine->physical_ram_in_mb > 256) |
4772 |
|
fprintf(stderr, "WARNING! Real NetWinders cannot" |
4773 |
|
" have more than 256 MB RAM. Continuing anyway.\n"); |
4774 |
|
|
4775 |
|
machine->md_int.footbridge_data = |
4776 |
|
device_add(machine, "footbridge addr=0x42000000"); |
4777 |
|
machine->md_interrupt = footbridge_interrupt; |
4778 |
|
|
4779 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
4780 |
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4781 |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
4782 |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4783 |
|
|
4784 |
|
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0"); |
4785 |
|
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1"); |
4786 |
|
|
4787 |
|
if (machine->use_x11) { |
4788 |
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4789 |
|
mem, 0xc0, 8, 0, pci_igsfb_init, pci_igsfb_rr); |
4790 |
|
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
4791 |
|
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
4792 |
|
32 + 1, 32 + 12, machine->use_x11, 0); |
4793 |
|
machine->main_console_handle = j; |
4794 |
|
} |
4795 |
|
|
4796 |
|
if (machine->prom_emulation) { |
4797 |
|
arm_setup_initial_translation_table(cpu, 0x4000); |
4798 |
|
} |
4799 |
|
break; |
4800 |
|
|
4801 |
|
case MACHINE_SHARK: |
4802 |
|
machine->machine_name = "Digital DNARD (\"Shark\")"; |
4803 |
|
if (machine->prom_emulation) { |
4804 |
|
arm_setup_initial_translation_table(cpu, |
4805 |
|
machine->physical_ram_in_mb * 1048576 - 65536); |
4806 |
|
|
4807 |
|
/* |
4808 |
|
* r0 = OpenFirmware entry point. NOTE: See |
4809 |
|
* cpu_arm.c for the rest of this semi-ugly hack. |
4810 |
|
*/ |
4811 |
|
cpu->cd.arm.r[0] = cpu->cd.arm.of_emul_addr; |
4812 |
|
} |
4813 |
|
break; |
4814 |
|
|
4815 |
|
case MACHINE_IQ80321: |
4816 |
|
/* |
4817 |
|
* Intel IQ80321. See http://sources.redhat.com/ecos/docs-latest/redboot/iq80321.html |
4818 |
|
* for more details about the memory map. |
4819 |
|
*/ |
4820 |
|
machine->machine_name = "Intel IQ80321 (ARM)"; |
4821 |
|
cpu->cd.arm.coproc[6] = arm_coproc_i80321; |
4822 |
|
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4823 |
|
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
4824 |
|
|
4825 |
|
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
4826 |
|
dev_ram_init(machine, 0xa0000000, 0x20000000, |
4827 |
|
DEV_RAM_MIRROR, 0x0); |
4828 |
|
dev_ram_init(machine, 0xc0000000, 0x20000000, |
4829 |
|
DEV_RAM_MIRROR, 0x0); |
4830 |
|
|
4831 |
|
/* 0xe0000000 and 0xff000000 = cache flush regions */ |
4832 |
|
dev_ram_init(machine, 0xe0000000, 0x100000, DEV_RAM_RAM, 0x0); |
4833 |
|
dev_ram_init(machine, 0xff000000, 0x100000, DEV_RAM_RAM, 0x0); |
4834 |
|
|
4835 |
|
device_add(machine, "i80321 addr=0xffffe000"); |
4836 |
|
|
4837 |
|
if (machine->prom_emulation) { |
4838 |
|
arm_setup_initial_translation_table(cpu, 0x4000); |
4839 |
|
arm_translation_table_set_l1(cpu, 0xa0000000, 0xa0000000); |
4840 |
|
arm_translation_table_set_l1(cpu, 0xc0000000, 0xa0000000); |
4841 |
|
arm_translation_table_set_l1(cpu, 0xe0000000, 0xe0000000); |
4842 |
|
arm_translation_table_set_l1(cpu, 0xf0000000, 0xf0000000); |
4843 |
|
} |
4844 |
|
break; |
4845 |
|
|
4846 |
|
case MACHINE_IYONIX: |
4847 |
|
machine->machine_name = "Iyonix"; |
4848 |
|
cpu->cd.arm.coproc[6] = arm_coproc_i80321; |
4849 |
|
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4850 |
|
|
4851 |
|
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
4852 |
|
|
4853 |
|
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
4854 |
|
dev_ram_init(machine, 0xa0000000, 0x20000000, |
4855 |
|
DEV_RAM_MIRROR, 0x0); |
4856 |
|
dev_ram_init(machine, 0xc0000000, 0x20000000, |
4857 |
|
DEV_RAM_MIRROR, 0x0); |
4858 |
|
|
4859 |
|
device_add(machine, "i80321 addr=0xffffe000"); |
4860 |
|
|
4861 |
|
if (machine->prom_emulation) { |
4862 |
|
arm_setup_initial_translation_table(cpu, |
4863 |
|
machine->physical_ram_in_mb * 1048576 - 65536); |
4864 |
|
arm_translation_table_set_l1(cpu, 0xa0000000, 0xa0000000); |
4865 |
|
arm_translation_table_set_l1(cpu, 0xc0000000, 0xa0000000); |
4866 |
|
arm_translation_table_set_l1_b(cpu, 0xff000000, 0xff000000); |
4867 |
|
} |
4868 |
|
break; |
4869 |
|
#endif /* ENABLE_ARM */ |
4870 |
|
|
4871 |
|
#ifdef ENABLE_AVR |
4872 |
|
case MACHINE_BAREAVR: |
4873 |
|
/* A bare Atmel AVR machine, with no devices. */ |
4874 |
|
machine->machine_name = "\"Bare\" Atmel AVR machine"; |
4875 |
|
break; |
4876 |
|
#endif /* ENABLE_AVR */ |
4877 |
|
|
4878 |
|
#ifdef ENABLE_IA64 |
4879 |
|
case MACHINE_BAREIA64: |
4880 |
|
machine->machine_name = "\"Bare\" IA64 machine"; |
4881 |
|
break; |
4882 |
|
|
4883 |
|
case MACHINE_TESTIA64: |
4884 |
|
machine->machine_name = "IA64 test machine"; |
4885 |
|
|
4886 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4887 |
|
(long long)DEV_CONS_ADDRESS); |
4888 |
|
cons_data = device_add(machine, tmpstr); |
4889 |
|
machine->main_console_handle = cons_data->console_handle; |
4890 |
|
|
4891 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4892 |
|
(long long)DEV_MP_ADDRESS); |
4893 |
|
device_add(machine, tmpstr); |
4894 |
|
|
4895 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4896 |
|
640,480, 640,480, 24, "testia64 generic"); |
4897 |
|
|
4898 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4899 |
|
(long long)DEV_DISK_ADDRESS); |
4900 |
|
device_add(machine, tmpstr); |
4901 |
|
|
4902 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4903 |
|
(long long)DEV_ETHER_ADDRESS); |
4904 |
|
device_add(machine, tmpstr); |
4905 |
|
|
4906 |
|
break; |
4907 |
|
#endif /* ENABLE_IA64 */ |
4908 |
|
|
4909 |
|
#ifdef ENABLE_M68K |
4910 |
|
case MACHINE_BAREM68K: |
4911 |
|
machine->machine_name = "\"Bare\" M68K machine"; |
4912 |
|
break; |
4913 |
|
|
4914 |
|
case MACHINE_TESTM68K: |
4915 |
|
machine->machine_name = "M68K test machine"; |
4916 |
|
|
4917 |
|
snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", |
4918 |
|
(long long)DEV_CONS_ADDRESS); |
4919 |
|
cons_data = device_add(machine, tmpstr); |
4920 |
|
machine->main_console_handle = cons_data->console_handle; |
4921 |
|
|
4922 |
|
snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", |
4923 |
|
(long long)DEV_MP_ADDRESS); |
4924 |
|
device_add(machine, tmpstr); |
4925 |
|
|
4926 |
|
fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, |
4927 |
|
640,480, 640,480, 24, "testm68k generic"); |
4928 |
|
|
4929 |
|
snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", |
4930 |
|
(long long)DEV_DISK_ADDRESS); |
4931 |
|
device_add(machine, tmpstr); |
4932 |
|
|
4933 |
|
snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", |
4934 |
|
(long long)DEV_ETHER_ADDRESS); |
4935 |
|
device_add(machine, tmpstr); |
4936 |
|
|
4937 |
|
break; |
4938 |
|
#endif /* ENABLE_M68K */ |
4939 |
|
|
4940 |
|
#ifdef ENABLE_X86 |
4941 |
case MACHINE_BAREX86: |
case MACHINE_BAREX86: |
4942 |
machine->machine_name = "\"Bare\" x86 machine"; |
machine->machine_name = "\"Bare\" x86 machine"; |
4943 |
break; |
break; |
4949 |
machine->machine_name = "Generic x86 PC"; |
machine->machine_name = "Generic x86 PC"; |
4950 |
|
|
4951 |
/* Interrupt controllers: */ |
/* Interrupt controllers: */ |
4952 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8259 addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx", |
4953 |
(long long)(X86_IO_BASE + 0x20)); |
(long long)(X86_IO_BASE + 0x20)); |
4954 |
machine->md.pc.pic1 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4955 |
if (machine->machine_subtype != MACHINE_X86_XT) { |
if (machine->machine_subtype != MACHINE_X86_XT) { |
4956 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8259 addr=0x%llx irq=2", |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx irq=2", |
4957 |
(long long)(X86_IO_BASE + 0xa0)); |
(long long)(X86_IO_BASE + 0xa0)); |
4958 |
machine->md.pc.pic2 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
4959 |
} |
} |
4960 |
|
|
4961 |
machine->md_interrupt = x86_pc_interrupt; |
machine->md_interrupt = x86_pc_interrupt; |
4962 |
|
|
4963 |
/* Timer: */ |
/* Timer: */ |
4964 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "8253 addr=0x%llx irq=0", |
snprintf(tmpstr, sizeof(tmpstr), "8253 addr=0x%llx irq=0", |
4965 |
(long long)(X86_IO_BASE + 0x40)); |
(long long)(X86_IO_BASE + 0x40)); |
4966 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4967 |
|
|
4968 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "pccmos addr=0x%llx", |
snprintf(tmpstr, sizeof(tmpstr), "pccmos addr=0x%llx", |
4969 |
(long long)(X86_IO_BASE + 0x70)); |
(long long)(X86_IO_BASE + 0x70)); |
4970 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4971 |
|
|
4973 |
|
|
4974 |
/* IDE controllers: */ |
/* IDE controllers: */ |
4975 |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
4976 |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) |
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
4977 |
dev_wdc_init(machine, mem, X86_IO_BASE + 0x1f0, 14, 0); |
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
4978 |
|
X86_IO_BASE + 0x1f0, 14); |
4979 |
|
device_add(machine, tmpstr); |
4980 |
|
} |
4981 |
if (diskimage_exist(machine, 2, DISKIMAGE_IDE) || |
if (diskimage_exist(machine, 2, DISKIMAGE_IDE) || |
4982 |
diskimage_exist(machine, 3, DISKIMAGE_IDE)) |
diskimage_exist(machine, 3, DISKIMAGE_IDE)) { |
4983 |
dev_wdc_init(machine, mem, X86_IO_BASE + 0x170, 15, 2); |
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
4984 |
|
X86_IO_BASE + 0x170, 15); |
4985 |
|
device_add(machine, tmpstr); |
4986 |
|
} |
4987 |
|
|
4988 |
/* Floppy controller at irq 6 */ |
/* Floppy controller at irq 6 */ |
4989 |
snprintf(tmpstr, sizeof(tmpstr) - 1, "fdc addr=0x%llx irq=6", |
snprintf(tmpstr, sizeof(tmpstr), "fdc addr=0x%llx irq=6", |
4990 |
(long long)(X86_IO_BASE + 0x3f0)); |
(long long)(X86_IO_BASE + 0x3f0)); |
4991 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
4992 |
|
|
4995 |
/* TODO: parallel port */ |
/* TODO: parallel port */ |
4996 |
|
|
4997 |
/* Serial ports: (TODO: 8250 for PC XT?) */ |
/* Serial ports: (TODO: 8250 for PC XT?) */ |
4998 |
dev_ns16550_init(machine, mem, X86_IO_BASE + 0x3f8, 4, 1, 0, "com1"); |
|
4999 |
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", |
5000 |
|
(long long)X86_IO_BASE + 0x3f8); |
5001 |
|
device_add(machine, tmpstr); |
5002 |
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=3 addr=0x%llx name2=com2 in_use=0", |
5003 |
|
(long long)X86_IO_BASE + 0x2f8); |
5004 |
|
device_add(machine, tmpstr); |
5005 |
|
|
5006 |
/* VGA + keyboard: */ |
/* VGA + keyboard: */ |
5007 |
dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0, |
dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0, |
5020 |
"-------------------------------------" |
"-------------------------------------" |
5021 |
"------------------------------------------\n"); |
"------------------------------------------\n"); |
5022 |
break; |
break; |
5023 |
|
#endif /* ENABLE_X86 */ |
5024 |
|
|
5025 |
default: |
default: |
5026 |
fatal("Unknown emulation type %i\n", machine->machine_type); |
fatal("Unknown emulation type %i\n", machine->machine_type); |
5089 |
case MACHINE_NETGEAR: |
case MACHINE_NETGEAR: |
5090 |
m->physical_ram_in_mb = 16; |
m->physical_ram_in_mb = 16; |
5091 |
break; |
break; |
5092 |
|
case MACHINE_EVBMIPS: |
5093 |
|
m->physical_ram_in_mb = 64; |
5094 |
|
break; |
5095 |
|
case MACHINE_PSP: |
5096 |
|
/* |
5097 |
|
* According to |
5098 |
|
* http://wiki.ps2dev.org/psp:memory_map: |
5099 |
|
* 0×08000000 = 8 MB kernel memory |
5100 |
|
* 0×08800000 = 24 MB user memory |
5101 |
|
*/ |
5102 |
|
m->physical_ram_in_mb = 8 + 24; |
5103 |
|
break; |
5104 |
case MACHINE_ARC: |
case MACHINE_ARC: |
5105 |
switch (m->machine_subtype) { |
switch (m->machine_subtype) { |
5106 |
case MACHINE_ARC_JAZZ_PICA: |
case MACHINE_ARC_JAZZ_PICA: |
5122 |
m->physical_ram_in_mb = 32; |
m->physical_ram_in_mb = 32; |
5123 |
} |
} |
5124 |
break; |
break; |
5125 |
|
case MACHINE_ALPHA: |
5126 |
|
m->physical_ram_in_mb = 64; |
5127 |
|
break; |
5128 |
case MACHINE_BEBOX: |
case MACHINE_BEBOX: |
5129 |
m->physical_ram_in_mb = 64; |
m->physical_ram_in_mb = 64; |
5130 |
break; |
break; |
5131 |
case MACHINE_BAREURISC: |
case MACHINE_CATS: |
5132 |
case MACHINE_TESTURISC: |
m->physical_ram_in_mb = 64; |
5133 |
m->physical_ram_in_mb = 2; |
break; |
5134 |
|
case MACHINE_ZAURUS: |
5135 |
|
m->physical_ram_in_mb = 64; |
5136 |
|
break; |
5137 |
|
case MACHINE_HPCARM: |
5138 |
|
m->physical_ram_in_mb = 32; |
5139 |
|
break; |
5140 |
|
case MACHINE_NETWINDER: |
5141 |
|
m->physical_ram_in_mb = 16; |
5142 |
break; |
break; |
5143 |
case MACHINE_X86: |
case MACHINE_X86: |
5144 |
if (m->machine_subtype == MACHINE_X86_XT) |
if (m->machine_subtype == MACHINE_X86_XT) |
5275 |
if (m->cpu_name == NULL) |
if (m->cpu_name == NULL) |
5276 |
m->cpu_name = strdup("R4400"); |
m->cpu_name = strdup("R4400"); |
5277 |
break; |
break; |
5278 |
|
case MACHINE_EVBMIPS: |
5279 |
|
switch (m->machine_subtype) { |
5280 |
|
case MACHINE_EVBMIPS_MALTA: |
5281 |
|
case MACHINE_EVBMIPS_MALTA_BE: |
5282 |
|
m->cpu_name = strdup("5Kc"); |
5283 |
|
break; |
5284 |
|
case MACHINE_EVBMIPS_PB1000: |
5285 |
|
m->cpu_name = strdup("AU1000"); |
5286 |
|
break; |
5287 |
|
default:fatal("Unimpl. evbmips.\n"); |
5288 |
|
exit(1); |
5289 |
|
} |
5290 |
|
break; |
5291 |
|
case MACHINE_PSP: |
5292 |
|
m->cpu_name = strdup("Allegrex"); |
5293 |
|
break; |
5294 |
|
|
5295 |
/* PowerPC: */ |
/* PowerPC: */ |
5296 |
case MACHINE_BAREPPC: |
case MACHINE_BAREPPC: |
5325 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
5326 |
switch (m->machine_subtype) { |
switch (m->machine_subtype) { |
5327 |
case MACHINE_MACPPC_G4: |
case MACHINE_MACPPC_G4: |
5328 |
m->cpu_name = strdup("G4e"); |
m->cpu_name = strdup("PPC750"); |
5329 |
break; |
break; |
5330 |
case MACHINE_MACPPC_G5: |
case MACHINE_MACPPC_G5: |
5331 |
m->cpu_name = strdup("PPC970"); |
m->cpu_name = strdup("PPC970"); |
5336 |
m->cpu_name = strdup("PPC750"); |
m->cpu_name = strdup("PPC750"); |
5337 |
break; |
break; |
5338 |
|
|
5339 |
/* SPARC: */ |
/* SH: */ |
5340 |
case MACHINE_BARESPARC: |
case MACHINE_BARESH: |
5341 |
m->cpu_name = strdup("SPARCV9"); |
case MACHINE_TESTSH: |
5342 |
break; |
case MACHINE_HPCSH: |
5343 |
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"); |
|
5344 |
break; |
break; |
5345 |
|
|
5346 |
/* HPPA: */ |
/* HPPA: */ |
5347 |
case MACHINE_BAREHPPA: |
case MACHINE_BAREHPPA: |
5348 |
case MACHINE_TESTHPPA: |
case MACHINE_TESTHPPA: |
5349 |
m->cpu_name = strdup("HPPA2.0"); |
m->cpu_name = strdup("HPPA"); |
5350 |
|
break; |
5351 |
|
|
5352 |
|
/* i960: */ |
5353 |
|
case MACHINE_BAREI960: |
5354 |
|
case MACHINE_TESTI960: |
5355 |
|
m->cpu_name = strdup("i960"); |
5356 |
|
break; |
5357 |
|
|
5358 |
|
/* SPARC: */ |
5359 |
|
case MACHINE_BARESPARC: |
5360 |
|
case MACHINE_TESTSPARC: |
5361 |
|
case MACHINE_ULTRA1: |
5362 |
|
m->cpu_name = strdup("SPARCv9"); |
5363 |
break; |
break; |
5364 |
|
|
5365 |
/* Alpha: */ |
/* Alpha: */ |
5366 |
case MACHINE_BAREALPHA: |
case MACHINE_BAREALPHA: |
5367 |
case MACHINE_TESTALPHA: |
case MACHINE_TESTALPHA: |
5368 |
m->cpu_name = strdup("EV4"); |
case MACHINE_ALPHA: |
5369 |
|
m->cpu_name = strdup("Alpha"); |
5370 |
break; |
break; |
5371 |
|
|
5372 |
/* ARM: */ |
/* ARM: */ |
5373 |
case MACHINE_BAREARM: |
case MACHINE_BAREARM: |
5374 |
case MACHINE_TESTARM: |
case MACHINE_TESTARM: |
5375 |
m->cpu_name = strdup("ARM"); |
case MACHINE_HPCARM: |
5376 |
|
m->cpu_name = strdup("SA1110"); |
5377 |
|
break; |
5378 |
|
case MACHINE_IQ80321: |
5379 |
|
case MACHINE_IYONIX: |
5380 |
|
m->cpu_name = strdup("80321_600_B0"); |
5381 |
|
break; |
5382 |
|
case MACHINE_CATS: |
5383 |
|
case MACHINE_NETWINDER: |
5384 |
|
case MACHINE_SHARK: |
5385 |
|
m->cpu_name = strdup("SA110"); |
5386 |
|
break; |
5387 |
|
case MACHINE_ZAURUS: |
5388 |
|
m->cpu_name = strdup("PXA210"); |
5389 |
|
break; |
5390 |
|
|
5391 |
|
/* AVR: */ |
5392 |
|
case MACHINE_BAREAVR: |
5393 |
|
m->cpu_name = strdup("AVR"); |
5394 |
|
break; |
5395 |
|
|
5396 |
|
/* IA64: */ |
5397 |
|
case MACHINE_BAREIA64: |
5398 |
|
case MACHINE_TESTIA64: |
5399 |
|
m->cpu_name = strdup("IA64"); |
5400 |
|
break; |
5401 |
|
|
5402 |
|
/* M68K: */ |
5403 |
|
case MACHINE_BAREM68K: |
5404 |
|
case MACHINE_TESTM68K: |
5405 |
|
m->cpu_name = strdup("68020"); |
5406 |
break; |
break; |
5407 |
|
|
5408 |
/* x86: */ |
/* x86: */ |
5451 |
if (m->single_step_on_bad_addr) |
if (m->single_step_on_bad_addr) |
5452 |
debug("single-step on bad addresses\n"); |
debug("single-step on bad addresses\n"); |
5453 |
|
|
5454 |
if (m->bintrans_enable) |
if (m->arch == ARCH_MIPS) { |
5455 |
debug("bintrans enabled (%i MB cache)\n", |
if (m->bintrans_enable) |
5456 |
(int) (m->bintrans_size / 1048576)); |
debug("bintrans enabled (%i MB cache)\n", |
5457 |
else |
(int) (m->bintrans_size / 1048576)); |
5458 |
debug("bintrans disabled, other speedtricks %s\n", |
else |
5459 |
m->speed_tricks? "enabled" : "disabled"); |
debug("bintrans disabled, other speedtricks %s\n", |
5460 |
|
m->speed_tricks? "enabled" : "disabled"); |
5461 |
|
} |
5462 |
|
|
5463 |
debug("clock: "); |
debug("clock: "); |
5464 |
if (m->automatic_clock_adjustment) |
if (m->automatic_clock_adjustment) |
5645 |
debug("\n"); |
debug("\n"); |
5646 |
|
|
5647 |
useremul_list_emuls(); |
useremul_list_emuls(); |
5648 |
|
debug("Userland emulation works for programs with the complexity" |
5649 |
|
" of Hello World,\nbut not much more.\n"); |
5650 |
} |
} |
5651 |
|
|
5652 |
|
|
5665 |
* entries will appear in normal order when listed. :-) |
* entries will appear in normal order when listed. :-) |
5666 |
*/ |
*/ |
5667 |
|
|
5668 |
|
/* Zaurus: */ |
5669 |
|
me = machine_entry_new("Zaurus (ARM)", |
5670 |
|
ARCH_ARM, MACHINE_ZAURUS, 1, 0); |
5671 |
|
me->aliases[0] = "zaurus"; |
5672 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5673 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5674 |
|
} |
5675 |
|
|
5676 |
/* X86 machine: */ |
/* X86 machine: */ |
5677 |
me = machine_entry_new("x86-based PC", ARCH_X86, |
me = machine_entry_new("x86-based PC", ARCH_X86, |
5678 |
MACHINE_X86, 2, 2); |
MACHINE_X86, 2, 2); |
5696 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5697 |
} |
} |
5698 |
|
|
5699 |
/* Test-machine for URISC: */ |
/* Test-machine for SPARC: */ |
5700 |
me = machine_entry_new("Test-machine for URISC", ARCH_URISC, |
me = machine_entry_new("Test-machine for SPARC", ARCH_SPARC, |
5701 |
MACHINE_TESTURISC, 1, 0); |
MACHINE_TESTSPARC, 1, 0); |
5702 |
me->aliases[0] = "testurisc"; |
me->aliases[0] = "testsparc"; |
5703 |
if (cpu_family_ptr_by_number(ARCH_URISC) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_SPARC) != NULL) { |
5704 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5705 |
|
} |
5706 |
|
|
5707 |
|
/* Test-machine for SH: */ |
5708 |
|
me = machine_entry_new("Test-machine for SH", ARCH_SH, |
5709 |
|
MACHINE_TESTSH, 1, 0); |
5710 |
|
me->aliases[0] = "testsh"; |
5711 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5712 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5713 |
} |
} |
5714 |
|
|
5728 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5729 |
} |
} |
5730 |
|
|
5731 |
|
/* Test-machine for M68K: */ |
5732 |
|
me = machine_entry_new("Test-machine for M68K", ARCH_M68K, |
5733 |
|
MACHINE_TESTM68K, 1, 0); |
5734 |
|
me->aliases[0] = "testm68k"; |
5735 |
|
if (cpu_family_ptr_by_number(ARCH_M68K) != NULL) { |
5736 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5737 |
|
} |
5738 |
|
|
5739 |
|
/* Test-machine for IA64: */ |
5740 |
|
me = machine_entry_new("Test-machine for IA64", ARCH_IA64, |
5741 |
|
MACHINE_TESTIA64, 1, 0); |
5742 |
|
me->aliases[0] = "testia64"; |
5743 |
|
if (cpu_family_ptr_by_number(ARCH_IA64) != NULL) { |
5744 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5745 |
|
} |
5746 |
|
|
5747 |
|
/* Test-machine for i960: */ |
5748 |
|
me = machine_entry_new("Test-machine for i960", ARCH_I960, |
5749 |
|
MACHINE_TESTI960, 1, 0); |
5750 |
|
me->aliases[0] = "testi960"; |
5751 |
|
if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { |
5752 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5753 |
|
} |
5754 |
|
|
5755 |
/* Test-machine for HPPA: */ |
/* Test-machine for HPPA: */ |
5756 |
me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, |
me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, |
5757 |
MACHINE_TESTHPPA, 1, 0); |
MACHINE_TESTHPPA, 1, 0); |
5802 |
} |
} |
5803 |
|
|
5804 |
/* SGI: */ |
/* SGI: */ |
5805 |
me = machine_entry_new("SGI", ARCH_MIPS, MACHINE_SGI, 2, 9); |
me = machine_entry_new("SGI", ARCH_MIPS, MACHINE_SGI, 2, 10); |
5806 |
me->aliases[0] = "silicon graphics"; |
me->aliases[0] = "silicon graphics"; |
5807 |
me->aliases[1] = "sgi"; |
me->aliases[1] = "sgi"; |
5808 |
me->subtype[0] = machine_entry_subtype_new("IP19", 19, 1); |
me->subtype[0] = machine_entry_subtype_new("IP12", 12, 1); |
5809 |
me->subtype[0]->aliases[0] = "ip19"; |
me->subtype[0]->aliases[0] = "ip12"; |
5810 |
me->subtype[1] = machine_entry_subtype_new("IP20", 20, 1); |
me->subtype[1] = machine_entry_subtype_new("IP19", 19, 1); |
5811 |
me->subtype[1]->aliases[0] = "ip20"; |
me->subtype[1]->aliases[0] = "ip19"; |
5812 |
me->subtype[2] = machine_entry_subtype_new("IP22", 22, 2); |
me->subtype[2] = machine_entry_subtype_new("IP20", 20, 1); |
5813 |
me->subtype[2]->aliases[0] = "ip22"; |
me->subtype[2]->aliases[0] = "ip20"; |
5814 |
me->subtype[2]->aliases[1] = "indy"; |
me->subtype[3] = machine_entry_subtype_new("IP22", 22, 2); |
5815 |
me->subtype[3] = machine_entry_subtype_new("IP24", 24, 1); |
me->subtype[3]->aliases[0] = "ip22"; |
5816 |
me->subtype[3]->aliases[0] = "ip24"; |
me->subtype[3]->aliases[1] = "indy"; |
5817 |
me->subtype[4] = machine_entry_subtype_new("IP27", 27, 3); |
me->subtype[4] = machine_entry_subtype_new("IP24", 24, 1); |
5818 |
me->subtype[4]->aliases[0] = "ip27"; |
me->subtype[4]->aliases[0] = "ip24"; |
5819 |
me->subtype[4]->aliases[1] = "origin 200"; |
me->subtype[5] = machine_entry_subtype_new("IP27", 27, 3); |
5820 |
me->subtype[4]->aliases[2] = "origin 2000"; |
me->subtype[5]->aliases[0] = "ip27"; |
5821 |
me->subtype[5] = machine_entry_subtype_new("IP28", 28, 1); |
me->subtype[5]->aliases[1] = "origin 200"; |
5822 |
me->subtype[5]->aliases[0] = "ip28"; |
me->subtype[5]->aliases[2] = "origin 2000"; |
5823 |
me->subtype[6] = machine_entry_subtype_new("IP30", 30, 2); |
me->subtype[6] = machine_entry_subtype_new("IP28", 28, 1); |
5824 |
me->subtype[6]->aliases[0] = "ip30"; |
me->subtype[6]->aliases[0] = "ip28"; |
5825 |
me->subtype[6]->aliases[1] = "octane"; |
me->subtype[7] = machine_entry_subtype_new("IP30", 30, 2); |
5826 |
me->subtype[7] = machine_entry_subtype_new("IP32", 32, 2); |
me->subtype[7]->aliases[0] = "ip30"; |
5827 |
me->subtype[7]->aliases[0] = "ip32"; |
me->subtype[7]->aliases[1] = "octane"; |
5828 |
me->subtype[7]->aliases[1] = "o2"; |
me->subtype[8] = machine_entry_subtype_new("IP32", 32, 2); |
5829 |
me->subtype[8] = machine_entry_subtype_new("IP35", 35, 1); |
me->subtype[8]->aliases[0] = "ip32"; |
5830 |
me->subtype[8]->aliases[0] = "ip35"; |
me->subtype[8]->aliases[1] = "o2"; |
5831 |
|
me->subtype[9] = machine_entry_subtype_new("IP35", 35, 1); |
5832 |
|
me->subtype[9]->aliases[0] = "ip35"; |
5833 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5834 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5835 |
} |
} |
5842 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5843 |
} |
} |
5844 |
|
|
5845 |
|
/* Playstation Portable: */ |
5846 |
|
me = machine_entry_new("Playstation Portable", ARCH_MIPS, |
5847 |
|
MACHINE_PSP, 1, 0); |
5848 |
|
me->aliases[0] = "psp"; |
5849 |
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5850 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5851 |
|
} |
5852 |
|
|
5853 |
|
/* NetWinder: */ |
5854 |
|
me = machine_entry_new("NetWinder", ARCH_ARM, MACHINE_NETWINDER, 1, 0); |
5855 |
|
me->aliases[0] = "netwinder"; |
5856 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5857 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5858 |
|
} |
5859 |
|
|
5860 |
/* NetGear: */ |
/* NetGear: */ |
5861 |
me = machine_entry_new("NetGear WG602", ARCH_MIPS, |
me = machine_entry_new("NetGear WG602v1", ARCH_MIPS, |
5862 |
MACHINE_NETGEAR, 2, 0); |
MACHINE_NETGEAR, 2, 0); |
5863 |
me->aliases[0] = "netgear"; |
me->aliases[0] = "netgear"; |
5864 |
me->aliases[1] = "wg602"; |
me->aliases[1] = "wg602v1"; |
5865 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
5866 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5867 |
} |
} |
5895 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5896 |
} |
} |
5897 |
|
|
5898 |
|
/* Iyonix: */ |
5899 |
|
me = machine_entry_new("Iyonix", ARCH_ARM, |
5900 |
|
MACHINE_IYONIX, 1, 0); |
5901 |
|
me->aliases[0] = "iyonix"; |
5902 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5903 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5904 |
|
} |
5905 |
|
|
5906 |
|
/* Intel IQ80321 (ARM): */ |
5907 |
|
me = machine_entry_new("Intel IQ80321 (ARM)", ARCH_ARM, |
5908 |
|
MACHINE_IQ80321, 1, 0); |
5909 |
|
me->aliases[0] = "iq80321"; |
5910 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5911 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5912 |
|
} |
5913 |
|
|
5914 |
|
/* HPCarm: */ |
5915 |
|
me = machine_entry_new("Handheld SH (HPCsh)", |
5916 |
|
ARCH_SH, MACHINE_HPCSH, 1, 2); |
5917 |
|
me->aliases[0] = "hpcsh"; |
5918 |
|
me->subtype[0] = machine_entry_subtype_new("Jornada 680", |
5919 |
|
MACHINE_HPCSH_JORNADA680, 1); |
5920 |
|
me->subtype[0]->aliases[0] = "jornada680"; |
5921 |
|
me->subtype[1] = machine_entry_subtype_new( |
5922 |
|
"Jornada 690", MACHINE_HPCSH_JORNADA690, 1); |
5923 |
|
me->subtype[1]->aliases[0] = "jornada690"; |
5924 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5925 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5926 |
|
} |
5927 |
|
|
5928 |
/* HPCmips: */ |
/* HPCmips: */ |
5929 |
me = machine_entry_new("Handheld MIPS (HPC)", |
me = machine_entry_new("Handheld MIPS (HPCmips)", |
5930 |
ARCH_MIPS, MACHINE_HPCMIPS, 2, 8); |
ARCH_MIPS, MACHINE_HPCMIPS, 1, 8); |
5931 |
me->aliases[0] = "hpcmips"; |
me->aliases[0] = "hpcmips"; |
|
me->aliases[1] = "hpc"; |
|
5932 |
me->subtype[0] = machine_entry_subtype_new( |
me->subtype[0] = machine_entry_subtype_new( |
5933 |
"Casio Cassiopeia BE-300", MACHINE_HPCMIPS_CASIO_BE300, 2); |
"Casio Cassiopeia BE-300", MACHINE_HPCMIPS_CASIO_BE300, 2); |
5934 |
me->subtype[0]->aliases[0] = "be-300"; |
me->subtype[0]->aliases[0] = "be-300"; |
5961 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5962 |
} |
} |
5963 |
|
|
5964 |
|
/* HPCarm: */ |
5965 |
|
me = machine_entry_new("Handheld ARM (HPCarm)", |
5966 |
|
ARCH_ARM, MACHINE_HPCARM, 1, 2); |
5967 |
|
me->aliases[0] = "hpcarm"; |
5968 |
|
me->subtype[0] = machine_entry_subtype_new("Ipaq", |
5969 |
|
MACHINE_HPCARM_IPAQ, 1); |
5970 |
|
me->subtype[0]->aliases[0] = "ipaq"; |
5971 |
|
me->subtype[1] = machine_entry_subtype_new( |
5972 |
|
"Jornada 720", MACHINE_HPCARM_JORNADA720, 1); |
5973 |
|
me->subtype[1]->aliases[0] = "jornada720"; |
5974 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
5975 |
|
me->next = first_machine_entry; first_machine_entry = me; |
5976 |
|
} |
5977 |
|
|
5978 |
/* Generic "bare" X86 machine: */ |
/* Generic "bare" X86 machine: */ |
5979 |
me = machine_entry_new("Generic \"bare\" X86 machine", ARCH_X86, |
me = machine_entry_new("Generic \"bare\" X86 machine", ARCH_X86, |
5980 |
MACHINE_BAREX86, 1, 0); |
MACHINE_BAREX86, 1, 0); |
5983 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5984 |
} |
} |
5985 |
|
|
|
/* 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; |
|
|
} |
|
|
|
|
5986 |
/* Generic "bare" SPARC machine: */ |
/* Generic "bare" SPARC machine: */ |
5987 |
me = machine_entry_new("Generic \"bare\" SPARC machine", ARCH_SPARC, |
me = machine_entry_new("Generic \"bare\" SPARC machine", ARCH_SPARC, |
5988 |
MACHINE_BARESPARC, 1, 0); |
MACHINE_BARESPARC, 1, 0); |
5991 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
5992 |
} |
} |
5993 |
|
|
5994 |
|
/* Generic "bare" SH machine: */ |
5995 |
|
me = machine_entry_new("Generic \"bare\" SH machine", ARCH_SH, |
5996 |
|
MACHINE_BARESH, 1, 0); |
5997 |
|
me->aliases[0] = "baresh"; |
5998 |
|
if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { |
5999 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6000 |
|
} |
6001 |
|
|
6002 |
/* Generic "bare" PPC machine: */ |
/* Generic "bare" PPC machine: */ |
6003 |
me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, |
me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, |
6004 |
MACHINE_BAREPPC, 1, 0); |
MACHINE_BAREPPC, 1, 0); |
6015 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6016 |
} |
} |
6017 |
|
|
6018 |
|
/* Generic "bare" M68K machine: */ |
6019 |
|
me = machine_entry_new("Generic \"bare\" M68K machine", ARCH_M68K, |
6020 |
|
MACHINE_BAREM68K, 1, 0); |
6021 |
|
me->aliases[0] = "barem68k"; |
6022 |
|
if (cpu_family_ptr_by_number(ARCH_M68K) != NULL) { |
6023 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6024 |
|
} |
6025 |
|
|
6026 |
|
/* Generic "bare" IA64 machine: */ |
6027 |
|
me = machine_entry_new("Generic \"bare\" IA64 machine", ARCH_IA64, |
6028 |
|
MACHINE_BAREIA64, 1, 0); |
6029 |
|
me->aliases[0] = "bareia64"; |
6030 |
|
if (cpu_family_ptr_by_number(ARCH_IA64) != NULL) { |
6031 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6032 |
|
} |
6033 |
|
|
6034 |
|
/* Generic "bare" i960 machine: */ |
6035 |
|
me = machine_entry_new("Generic \"bare\" i960 machine", ARCH_I960, |
6036 |
|
MACHINE_BAREI960, 1, 0); |
6037 |
|
me->aliases[0] = "barei960"; |
6038 |
|
if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { |
6039 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6040 |
|
} |
6041 |
|
|
6042 |
/* Generic "bare" HPPA machine: */ |
/* Generic "bare" HPPA machine: */ |
6043 |
me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, |
me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, |
6044 |
MACHINE_BAREHPPA, 1, 0); |
MACHINE_BAREHPPA, 1, 0); |
6047 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6048 |
} |
} |
6049 |
|
|
6050 |
|
/* Generic "bare" Atmel AVR machine: */ |
6051 |
|
me = machine_entry_new("Generic \"bare\" Atmel AVR machine", ARCH_AVR, |
6052 |
|
MACHINE_BAREAVR, 1, 0); |
6053 |
|
me->aliases[0] = "bareavr"; |
6054 |
|
if (cpu_family_ptr_by_number(ARCH_AVR) != NULL) { |
6055 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6056 |
|
} |
6057 |
|
|
6058 |
/* Generic "bare" ARM machine: */ |
/* Generic "bare" ARM machine: */ |
6059 |
me = machine_entry_new("Generic \"bare\" ARM machine", ARCH_ARM, |
me = machine_entry_new("Generic \"bare\" ARM machine", ARCH_ARM, |
6060 |
MACHINE_BAREARM, 1, 0); |
MACHINE_BAREARM, 1, 0); |
6071 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6072 |
} |
} |
6073 |
|
|
6074 |
|
/* Evaluation Boards (MALTA etc): */ |
6075 |
|
me = machine_entry_new("Evaluation boards (evbmips)", ARCH_MIPS, |
6076 |
|
MACHINE_EVBMIPS, 1, 3); |
6077 |
|
me->aliases[0] = "evbmips"; |
6078 |
|
me->subtype[0] = machine_entry_subtype_new("Malta", |
6079 |
|
MACHINE_EVBMIPS_MALTA, 1); |
6080 |
|
me->subtype[0]->aliases[0] = "malta"; |
6081 |
|
me->subtype[1] = machine_entry_subtype_new("Malta (Big-Endian)", |
6082 |
|
MACHINE_EVBMIPS_MALTA_BE, 1); |
6083 |
|
me->subtype[1]->aliases[0] = "maltabe"; |
6084 |
|
me->subtype[2] = machine_entry_subtype_new("PB1000", |
6085 |
|
MACHINE_EVBMIPS_PB1000, 1); |
6086 |
|
me->subtype[2]->aliases[0] = "pb1000"; |
6087 |
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
6088 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6089 |
|
} |
6090 |
|
|
6091 |
|
/* Digital DNARD ("Shark"): */ |
6092 |
|
me = machine_entry_new("Digital DNARD (\"Shark\")", ARCH_ARM, |
6093 |
|
MACHINE_SHARK, 2, 0); |
6094 |
|
me->aliases[0] = "shark"; |
6095 |
|
me->aliases[1] = "dnard"; |
6096 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
6097 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6098 |
|
} |
6099 |
|
|
6100 |
/* DECstation: */ |
/* DECstation: */ |
6101 |
me = machine_entry_new("DECstation/DECsystem", |
me = machine_entry_new("DECstation/DECsystem", |
6102 |
ARCH_MIPS, MACHINE_DEC, 3, 9); |
ARCH_MIPS, MACHINE_DEC, 3, 9); |
6164 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6165 |
} |
} |
6166 |
|
|
6167 |
|
/* CATS (ARM) evaluation board: */ |
6168 |
|
me = machine_entry_new("CATS evaluation board (ARM)", ARCH_ARM, |
6169 |
|
MACHINE_CATS, 1, 0); |
6170 |
|
me->aliases[0] = "cats"; |
6171 |
|
if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { |
6172 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6173 |
|
} |
6174 |
|
|
6175 |
/* BeBox: (NetBSD/bebox) */ |
/* BeBox: (NetBSD/bebox) */ |
6176 |
me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); |
me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); |
6177 |
me->aliases[0] = "bebox"; |
me->aliases[0] = "bebox"; |
6236 |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
6237 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6238 |
} |
} |
6239 |
|
|
6240 |
|
/* Alpha: */ |
6241 |
|
me = machine_entry_new("Alpha", ARCH_ALPHA, MACHINE_ALPHA, 1, 2); |
6242 |
|
me->aliases[0] = "alpha"; |
6243 |
|
me->subtype[0] = machine_entry_subtype_new( |
6244 |
|
"DEC 3000/300", ST_DEC_3000_300, 1); |
6245 |
|
me->subtype[0]->aliases[0] = "3000/300"; |
6246 |
|
me->subtype[1] = machine_entry_subtype_new( |
6247 |
|
"EB164", ST_EB164, 1); |
6248 |
|
me->subtype[1]->aliases[0] = "eb164"; |
6249 |
|
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
6250 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6251 |
|
} |
6252 |
} |
} |
6253 |
|
|