25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: machine.c,v 1.577 2005/10/27 14:01:12 debug Exp $ |
* $Id: machine.c,v 1.611 2005/11/23 23:31:34 debug Exp $ |
29 |
* |
* |
30 |
* Emulation of specific machines. |
* Emulation of specific machines. |
31 |
* |
* |
51 |
#include <unistd.h> |
#include <unistd.h> |
52 |
|
|
53 |
#include "arcbios.h" |
#include "arcbios.h" |
54 |
|
#include "bus_isa.h" |
55 |
#include "bus_pci.h" |
#include "bus_pci.h" |
56 |
#include "cpu.h" |
#include "cpu.h" |
57 |
#include "device.h" |
#include "device.h" |
166 |
m->boot_string_argument = NULL; |
m->boot_string_argument = NULL; |
167 |
m->automatic_clock_adjustment = 1; |
m->automatic_clock_adjustment = 1; |
168 |
m->x11_scaledown = 1; |
m->x11_scaledown = 1; |
169 |
|
m->x11_scaleup = 1; |
170 |
m->n_gfx_cards = 1; |
m->n_gfx_cards = 1; |
171 |
m->dbe_on_nonexistant_memaccess = 1; |
m->dbe_on_nonexistant_memaccess = 1; |
172 |
m->show_symbolic_register_names = 1; |
m->show_symbolic_register_names = 1; |
1295 |
|
|
1296 |
|
|
1297 |
/* |
/* |
1298 |
* Malta (evbmips) interrupts: |
* CPC700 interrupt routine: |
1299 |
* |
* |
1300 |
* ISA interrupts. |
* irq_nr should be 0..31. (32 means reassertion.) |
|
* (irq_nr = 16+8 can be used to just reassert/deassert interrupts.) |
|
1301 |
*/ |
*/ |
1302 |
void malta_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, |
void cpc700_interrupt(struct machine *m, struct cpu *cpu, |
1303 |
int assrt) |
int irq_nr, int assrt) |
1304 |
{ |
{ |
1305 |
int mask; |
if (irq_nr < 32) { |
1306 |
|
uint32_t mask = 1 << (irq_nr & 31); |
|
irq_nr -= 8; |
|
|
mask = 1 << (irq_nr & 7); |
|
|
|
|
|
if (irq_nr < 8) { |
|
|
if (assrt) |
|
|
m->isa_pic_data.pic1->irr |= mask; |
|
|
else |
|
|
m->isa_pic_data.pic1->irr &= ~mask; |
|
|
} else if (irq_nr < 16) { |
|
1307 |
if (assrt) |
if (assrt) |
1308 |
m->isa_pic_data.pic2->irr |= mask; |
m->md_int.cpc700_data->sr |= mask; |
1309 |
else |
else |
1310 |
m->isa_pic_data.pic2->irr &= ~mask; |
m->md_int.cpc700_data->sr &= ~mask; |
1311 |
} |
} |
1312 |
|
|
1313 |
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
if ((m->md_int.cpc700_data->sr & m->md_int.cpc700_data->er) != 0) |
1314 |
/* (TODO: don't hardcode this here) */ |
cpu_interrupt(cpu, 65); |
|
if (m->isa_pic_data.pic2->irr & |
|
|
~m->isa_pic_data.pic2->ier) |
|
|
m->isa_pic_data.pic1->irr |= 0x04; |
|
|
else |
|
|
m->isa_pic_data.pic1->irr &= ~0x04; |
|
|
|
|
|
/* Now, PIC1: */ |
|
|
if (m->isa_pic_data.pic1->irr & |
|
|
~m->isa_pic_data.pic1->ier) |
|
|
cpu_interrupt(cpu, 2); |
|
1315 |
else |
else |
1316 |
cpu_interrupt_ack(cpu, 2); |
cpu_interrupt_ack(cpu, 65); |
|
|
|
|
/* printf("MALTA: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " |
|
|
"ier=0x%02x\n", m->isa_pic_data.pic1->irr, |
|
|
m->isa_pic_data.pic1->ier, |
|
|
m->isa_pic_data.pic2->irr, |
|
|
m->isa_pic_data.pic2->ier); */ |
|
1317 |
} |
} |
1318 |
|
|
1319 |
|
|
1320 |
/* |
/* |
1321 |
* Cobalt interrupts: |
* Interrupt function for Cobalt, evbmips (Malta), and Algor. |
1322 |
* |
* |
1323 |
* (irq_nr = 8 + 16 can be used to just reassert/deassert interrupts.) |
* (irq_nr = 8 + 16 can be used to just reassert/deassert interrupts.) |
1324 |
*/ |
*/ |
1325 |
void cobalt_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
void isa8_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, int assrt) |
1326 |
{ |
{ |
1327 |
int mask; |
int mask, x; |
1328 |
|
int old_isa_assert, new_isa_assert; |
1329 |
|
|
1330 |
|
old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1331 |
|
|
1332 |
irq_nr -= 8; |
irq_nr -= 8; |
1333 |
mask = 1 << (irq_nr & 7); |
mask = 1 << (irq_nr & 7); |
1346 |
|
|
1347 |
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
/* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ |
1348 |
/* (TODO: don't hardcode this here) */ |
/* (TODO: don't hardcode this here) */ |
1349 |
if (m->isa_pic_data.pic2->irr & |
if (m->isa_pic_data.pic2->irr & ~m->isa_pic_data.pic2->ier) |
|
~m->isa_pic_data.pic2->ier) |
|
1350 |
m->isa_pic_data.pic1->irr |= 0x04; |
m->isa_pic_data.pic1->irr |= 0x04; |
1351 |
else |
else |
1352 |
m->isa_pic_data.pic1->irr &= ~0x04; |
m->isa_pic_data.pic1->irr &= ~0x04; |
1353 |
|
|
1354 |
/* Now, PIC1: */ |
/* Now, PIC1: */ |
1355 |
if (m->isa_pic_data.pic1->irr & |
new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1356 |
~m->isa_pic_data.pic1->ier) |
if (old_isa_assert != new_isa_assert) { |
1357 |
cpu_interrupt(cpu, 6); |
for (x=0; x<16; x++) { |
1358 |
else |
if (x == 2) |
1359 |
cpu_interrupt_ack(cpu, 6); |
continue; |
1360 |
|
if (x < 8 && (m->isa_pic_data.pic1->irr & |
1361 |
|
~m->isa_pic_data.pic1->ier & (1 << x))) |
1362 |
|
break; |
1363 |
|
if (x >= 8 && (m->isa_pic_data.pic2->irr & |
1364 |
|
~m->isa_pic_data.pic2->ier & (1 << (x&7)))) |
1365 |
|
break; |
1366 |
|
} |
1367 |
|
m->isa_pic_data.last_int = x; |
1368 |
|
} |
1369 |
|
|
1370 |
/* printf("COBALT: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " |
if (m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier) |
1371 |
"ier=0x%02x\n", m->isa_pic_data.pic1->irr, |
cpu_interrupt(cpu, m->isa_pic_data.native_irq); |
1372 |
m->isa_pic_data.pic1->ier, |
else |
1373 |
m->isa_pic_data.pic2->irr, |
cpu_interrupt_ack(cpu, m->isa_pic_data.native_irq); |
|
m->isa_pic_data.pic2->ier); */ |
|
1374 |
} |
} |
1375 |
|
|
1376 |
|
|
1418 |
|
|
1419 |
|
|
1420 |
/* |
/* |
1421 |
* Footbridge interrupts: |
* "Generic" ISA interrupt management, 32 native interrupts, 16 ISA |
1422 |
|
* interrupts. So far: Footbridge (CATS, NetWinder), BeBox, and PReP. |
1423 |
* |
* |
1424 |
* 0..31 = footbridge interrupt |
* 0..31 = footbridge interrupt |
1425 |
* 32..47 = ISA (connected to IRQ_IN_L2 on CATS, L3 on NetWinder) |
* 32..47 = ISA interrupts |
1426 |
* 64 = reassert |
* 48 = ISA reassert |
1427 |
|
* 64 = reassert (non-ISA) |
1428 |
*/ |
*/ |
1429 |
void footbridge_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, |
void isa32_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, |
1430 |
int assrt) |
int assrt) |
1431 |
{ |
{ |
1432 |
uint32_t mask = 1 << (irq_nr & 31); |
uint32_t mask = 1 << (irq_nr & 31); |
1433 |
int old_isa_assert, new_isa_assert; |
int old_isa_assert, new_isa_assert; |
|
int isa_int = m->machine_type == MACHINE_CATS? 10 : 11; |
|
1434 |
|
|
1435 |
old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1436 |
|
|
1457 |
|
|
1458 |
/* Now, PIC1: */ |
/* Now, PIC1: */ |
1459 |
new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; |
1460 |
if (old_isa_assert != new_isa_assert) { |
if (old_isa_assert != new_isa_assert || irq_nr == 48) { |
1461 |
if (new_isa_assert) |
if (new_isa_assert) { |
1462 |
cpu_interrupt(cpu, isa_int); |
int x; |
1463 |
else |
for (x=0; x<16; x++) { |
1464 |
cpu_interrupt_ack(cpu, isa_int); |
if (x == 2) |
1465 |
|
continue; |
1466 |
|
if (x < 8 && (m->isa_pic_data.pic1->irr & |
1467 |
|
~m->isa_pic_data.pic1->ier & (1 << x))) |
1468 |
|
break; |
1469 |
|
if (x >= 8 && (m->isa_pic_data.pic2->irr & |
1470 |
|
~m->isa_pic_data.pic2->ier & (1 << (x&7)))) |
1471 |
|
break; |
1472 |
|
} |
1473 |
|
m->isa_pic_data.last_int = x; |
1474 |
|
cpu_interrupt(cpu, m->isa_pic_data.native_irq); |
1475 |
|
} else |
1476 |
|
cpu_interrupt_ack(cpu, m->isa_pic_data.native_irq); |
1477 |
return; |
return; |
1478 |
} |
} |
1479 |
|
|
1480 |
if (irq_nr < 32) { |
switch (m->machine_type) { |
1481 |
if (assrt) |
case MACHINE_CATS: |
1482 |
m->md_int.footbridge_data->irq_status |= mask; |
case MACHINE_NETWINDER: |
1483 |
|
if (irq_nr < 32) { |
1484 |
|
if (assrt) |
1485 |
|
m->md_int.footbridge_data->irq_status |= mask; |
1486 |
|
else |
1487 |
|
m->md_int.footbridge_data->irq_status &= ~mask; |
1488 |
|
} |
1489 |
|
if (m->md_int.footbridge_data->irq_status & |
1490 |
|
m->md_int.footbridge_data->irq_enable) |
1491 |
|
cpu_interrupt(cpu, 65); |
1492 |
|
else |
1493 |
|
cpu_interrupt_ack(cpu, 65); |
1494 |
|
break; |
1495 |
|
case MACHINE_BEBOX: |
1496 |
|
if (irq_nr < 32) { |
1497 |
|
if (assrt) |
1498 |
|
m->md_int.bebox_data->int_status |= mask; |
1499 |
|
else |
1500 |
|
m->md_int.bebox_data->int_status &= ~mask; |
1501 |
|
} |
1502 |
|
if (m->md_int.bebox_data->int_status & |
1503 |
|
m->md_int.bebox_data->cpu0_int_mask) |
1504 |
|
cpu_interrupt(m->cpus[0], 65); |
1505 |
|
else |
1506 |
|
cpu_interrupt_ack(m->cpus[0], 65); |
1507 |
|
if (m->ncpus > 1 && |
1508 |
|
m->md_int.bebox_data->int_status & |
1509 |
|
m->md_int.bebox_data->cpu1_int_mask) |
1510 |
|
cpu_interrupt(m->cpus[1], 65); |
1511 |
else |
else |
1512 |
m->md_int.footbridge_data->irq_status &= ~mask; |
cpu_interrupt_ack(m->cpus[1], 65); |
1513 |
|
break; |
1514 |
|
case MACHINE_PREP: |
1515 |
|
if (irq_nr < 32) { |
1516 |
|
if (assrt) |
1517 |
|
m->md_int.prep_data->int_status |= mask; |
1518 |
|
else |
1519 |
|
m->md_int.prep_data->int_status &= ~mask; |
1520 |
|
} |
1521 |
|
if (m->md_int.prep_data->int_status & 2) |
1522 |
|
cpu_interrupt(cpu, 65); |
1523 |
|
else |
1524 |
|
cpu_interrupt_ack(cpu, 65); |
1525 |
|
break; |
1526 |
} |
} |
|
|
|
|
if (m->md_int.footbridge_data->irq_status & |
|
|
m->md_int.footbridge_data->irq_enable) |
|
|
cpu_interrupt(cpu, 65); |
|
|
else |
|
|
cpu_interrupt_ack(cpu, 65); |
|
1527 |
} |
} |
1528 |
|
|
1529 |
|
|
2397 |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
2398 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0"); |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0"); |
2399 |
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
2400 |
machine->md_interrupt = cobalt_interrupt; |
machine->md_interrupt = isa8_interrupt; |
2401 |
|
machine->isa_pic_data.native_irq = 6; |
2402 |
|
|
2403 |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); |
2404 |
|
|
2405 |
machine->main_console_handle = (size_t) |
machine->main_console_handle = (size_t) |
2406 |
device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1"); |
device_add(machine, "ns16550 irq=5 addr=0x1c800000 name2=tty0 in_use=1"); |
2407 |
|
|
2408 |
|
/* TODO: bus_isa() ? */ |
2409 |
|
|
2410 |
#if 0 |
#if 0 |
2411 |
device_add(machine, "ns16550 irq=0 addr=0x1f000010 name2=tty1 in_use=0"); |
device_add(machine, "ns16550 irq=0 addr=0x1f000010 name2=tty1 in_use=0"); |
2412 |
#endif |
#endif |
2424 |
* The PCI controller interrupts at ISA interrupt 9. |
* The PCI controller interrupts at ISA interrupt 9. |
2425 |
*/ |
*/ |
2426 |
pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 8 + 9, 11); |
pci_data = dev_gt_init(machine, mem, 0x14000000, 2, 8 + 9, 11); |
2427 |
/* 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, "dec21143"); |
2428 |
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, "symbios_860"); PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_860 */ |
2429 |
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, "vt82c586_isa"); |
2430 |
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, "vt82c586_ide"); |
2431 |
/* 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, "dec21143"); */ |
2432 |
|
|
2433 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
2434 |
/* |
/* |
3260 |
*/ |
*/ |
3261 |
|
|
3262 |
pci_data = dev_macepci_init(mem, 0x1f080000, MACE_PCI_BRIDGE); /* macepci0 */ |
pci_data = dev_macepci_init(mem, 0x1f080000, MACE_PCI_BRIDGE); /* macepci0 */ |
3263 |
/* bus_pci_add(machine, pci_data, mem, 0, 0, 0, pci_ne2000_init, pci_ne2000_rr); TODO */ |
/* bus_pci_add(machine, pci_data, mem, 0, 0, 0, "ne2000"); TODO */ |
3264 |
|
|
3265 |
/* TODO: make this nicer */ |
/* TODO: make this nicer */ |
3266 |
if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) || |
if (diskimage_exist(machine, 0, DISKIMAGE_SCSI) || |
3271 |
diskimage_exist(machine, 5, DISKIMAGE_SCSI) || |
diskimage_exist(machine, 5, DISKIMAGE_SCSI) || |
3272 |
diskimage_exist(machine, 6, DISKIMAGE_SCSI) || |
diskimage_exist(machine, 6, DISKIMAGE_SCSI) || |
3273 |
diskimage_exist(machine, 7, DISKIMAGE_SCSI)) |
diskimage_exist(machine, 7, DISKIMAGE_SCSI)) |
3274 |
bus_pci_add(machine, pci_data, mem, 0, 1, 0, pci_ahc_init, pci_ahc_rr); |
bus_pci_add(machine, pci_data, mem, 0, 1, 0, "ahc"); |
3275 |
|
|
3276 |
/* TODO: second ahc */ |
/* TODO: second ahc */ |
3277 |
/* bus_pci_add(machine, pci_data, mem, 0, 2, 0, pci_ahc_init, pci_ahc_rr); */ |
/* bus_pci_add(machine, pci_data, mem, 0, 2, 0, "ahc"); */ |
3278 |
|
|
3279 |
break; |
break; |
3280 |
case 35: |
case 35: |
3356 |
case MACHINE_ARC_NEC_RD94: |
case MACHINE_ARC_NEC_RD94: |
3357 |
case MACHINE_ARC_NEC_R94: |
case MACHINE_ARC_NEC_R94: |
3358 |
/* PCI devices: (NOTE: bus must be 0, device must be 3, 4, or 5, for NetBSD to accept interrupts) */ |
/* PCI devices: (NOTE: bus must be 0, device must be 3, 4, or 5, for NetBSD to accept interrupts) */ |
3359 |
bus_pci_add(machine, pci_data, mem, 0, 3, 0, pci_dec21030_init, pci_dec21030_rr); /* tga graphics */ |
bus_pci_add(machine, pci_data, mem, 0, 3, 0, "dec21030"); /* tga graphics */ |
3360 |
break; |
break; |
3361 |
case MACHINE_ARC_NEC_R96: |
case MACHINE_ARC_NEC_R96: |
3362 |
dev_fb_init(machine, mem, 0x100e00000ULL, |
dev_fb_init(machine, mem, 0x100e00000ULL, |
3930 |
cpu->byte_order = EMUL_BIG_ENDIAN; |
cpu->byte_order = EMUL_BIG_ENDIAN; |
3931 |
} |
} |
3932 |
|
|
3933 |
/* ISA interrupt controllers: */ |
machine->md_interrupt = isa8_interrupt; |
3934 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x18000020"); |
machine->isa_pic_data.native_irq = 2; |
3935 |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
|
3936 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x180000a0"); |
bus_isa(machine, 0, 0x18000000, 0x10000000, 8, 24); |
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
|
|
machine->md_interrupt = malta_interrupt; |
|
|
|
|
|
dev_mc146818_init(machine, mem, 0x18000070, 8 + 8, MC146818_PC_CMOS, 1); |
|
|
|
|
|
machine->main_console_handle = (size_t) |
|
|
device_add(machine, "ns16550 irq=12 addr=0x180003f8 name2=tty0"); |
|
|
device_add(machine, "ns16550 irq=11 addr=0x180002f8 name2=tty1"); |
|
3937 |
|
|
3938 |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART); |
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x name2=tty2", MALTA_CBUSUART); |
3939 |
device_add(machine, tmpstr); |
device_add(machine, tmpstr); |
3940 |
/* TODO: Irqs */ |
|
3941 |
pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120); |
pci_data = dev_gt_init(machine, mem, 0x1be00000, 8+9, 8+9, 120); |
3942 |
|
|
3943 |
/* TODO: Haha, this is bogus. Just a cut&paste |
if (machine->use_x11) { |
3944 |
from the Cobalt emulation above. */ |
if (strlen(machine->boot_string_argument) < 3) |
3945 |
bus_pci_add(machine, pci_data, mem, 0, 9, 0, pci_vt82c586_isa_init, pci_vt82c586_isa_rr); |
fatal("WARNING: remember to use -o 'console=tty0' " |
3946 |
bus_pci_add(machine, pci_data, mem, 0, 9, 1, pci_vt82c586_ide_init, pci_vt82c586_ide_rr); |
"if you are emulating Linux. (Not needed for NetBSD.)\n"); |
3947 |
|
bus_pci_add(machine, pci_data, mem, 0xc0, 8, 0, "s3_virge"); |
3948 |
|
} |
3949 |
|
|
3950 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 0, "i82371ab_isa"); |
3951 |
|
bus_pci_add(machine, pci_data, mem, 0, 9, 1, "i82371ab_ide"); |
3952 |
|
|
3953 |
device_add(machine, "malta_lcd addr=0x1f000400"); |
device_add(machine, "malta_lcd addr=0x1f000400"); |
3954 |
break; |
break; |
3966 |
} |
} |
3967 |
|
|
3968 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
|
/* This is just a test. TODO */ |
|
|
for (i=0; i<32; i++) |
|
|
cpu->cd.mips.gpr[i] = |
|
|
0x01230000 + (i << 8) + 0x55; |
|
|
|
|
3969 |
/* NetBSD/evbmips wants these: (at least for Malta) */ |
/* NetBSD/evbmips wants these: (at least for Malta) */ |
3970 |
|
|
3971 |
/* a0 = argc */ |
/* a0 = argc */ |
4066 |
cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0; |
cpu->cd.mips.gpr[MIPS_GPR_SP] = 0xfff0; |
4067 |
|
|
4068 |
break; |
break; |
4069 |
|
|
4070 |
|
case MACHINE_ALGOR: |
4071 |
|
switch (machine->machine_subtype) { |
4072 |
|
case MACHINE_ALGOR_P4032: |
4073 |
|
machine->machine_name = "\"Algor\" P4032"; |
4074 |
|
break; |
4075 |
|
case MACHINE_ALGOR_P5064: |
4076 |
|
machine->machine_name = "\"Algor\" P5064"; |
4077 |
|
break; |
4078 |
|
default:fatal("Unimplemented Algor machine.\n"); |
4079 |
|
exit(1); |
4080 |
|
} |
4081 |
|
|
4082 |
|
machine->md_interrupt = isa8_interrupt; |
4083 |
|
machine->isa_pic_data.native_irq = 6; |
4084 |
|
|
4085 |
|
/* TODO: correct isa irq? 6 is just a bogus guess */ |
4086 |
|
|
4087 |
|
bus_isa(machine, 0, 0x1d000000, 0xc0000000, 8, 24); |
4088 |
|
|
4089 |
|
if (machine->prom_emulation) { |
4090 |
|
/* NetBSD/algor wants these: */ |
4091 |
|
|
4092 |
|
/* a0 = argc */ |
4093 |
|
cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; |
4094 |
|
|
4095 |
|
/* a1 = argv */ |
4096 |
|
cpu->cd.mips.gpr[MIPS_GPR_A1] = (int32_t)0x9fc01000; |
4097 |
|
store_32bit_word(cpu, (int32_t)0x9fc01000, 0x9fc01040); |
4098 |
|
store_32bit_word(cpu, (int32_t)0x9fc01004, 0x9fc01200); |
4099 |
|
store_32bit_word(cpu, (int32_t)0x9fc01008, 0); |
4100 |
|
|
4101 |
|
bootstr = strdup(machine->boot_kernel_filename); |
4102 |
|
bootarg = strdup(machine->boot_string_argument); |
4103 |
|
store_string(cpu, (int32_t)0x9fc01040, bootstr); |
4104 |
|
store_string(cpu, (int32_t)0x9fc01200, bootarg); |
4105 |
|
|
4106 |
|
/* a2 = (yamon_env_var *)envp */ |
4107 |
|
cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800; |
4108 |
|
{ |
4109 |
|
char tmps[50]; |
4110 |
|
|
4111 |
|
store_32bit_word(cpu, (int32_t)0x9fc01800, 0x9fc01900); |
4112 |
|
store_32bit_word(cpu, (int32_t)0x9fc01804, 0x9fc01a00); |
4113 |
|
store_32bit_word(cpu, (int32_t)0x9fc01808, 0); |
4114 |
|
|
4115 |
|
snprintf(tmps, sizeof(tmps), "memsize=0x%08x", |
4116 |
|
machine->physical_ram_in_mb * 1048576); |
4117 |
|
store_string(cpu, (int)0x9fc01900, tmps); |
4118 |
|
store_string(cpu, (int)0x9fc01a00, "ethaddr=10:20:30:30:20:10"); |
4119 |
|
} |
4120 |
|
} |
4121 |
|
break; |
4122 |
#endif /* ENABLE_MIPS */ |
#endif /* ENABLE_MIPS */ |
4123 |
|
|
4124 |
#ifdef ENABLE_PPC |
#ifdef ENABLE_PPC |
4166 |
*/ |
*/ |
4167 |
machine->machine_name = "Walnut evaluation board"; |
machine->machine_name = "Walnut evaluation board"; |
4168 |
|
|
4169 |
|
/* "OpenBIOS" entrypoint (?): */ |
4170 |
|
dev_ram_init(machine, 0xfffe0b50, 8, DEV_RAM_RAM, 0); |
4171 |
|
store_32bit_word(cpu, 0xfffe0b50, 0xfffe0b54); |
4172 |
|
store_32bit_word(cpu, 0xfffe0b54, 0x4e800020); /* blr */ |
4173 |
|
|
4174 |
break; |
break; |
4175 |
|
|
4176 |
case MACHINE_PMPPC: |
case MACHINE_PMPPC: |
4178 |
* NetBSD/pmppc (http://www.netbsd.org/Ports/pmppc/) |
* NetBSD/pmppc (http://www.netbsd.org/Ports/pmppc/) |
4179 |
*/ |
*/ |
4180 |
machine->machine_name = "Artesyn's PM/PPC board"; |
machine->machine_name = "Artesyn's PM/PPC board"; |
4181 |
|
machine->emulated_hz = 10000000; |
4182 |
|
|
4183 |
dev_pmppc_init(mem); |
dev_pmppc_init(mem); |
4184 |
|
|
4185 |
/* com0 = 0xff600300, com1 = 0xff600400 */ |
machine->md_int.cpc700_data = dev_cpc700_init(machine, mem); |
4186 |
|
machine->md_interrupt = cpc700_interrupt; |
4187 |
|
|
4188 |
machine->main_console_handle = (size_t)device_add(machine, "ns16550 irq=0 addr=0xff600300 name2=tty0"); |
/* RTC at "ext int 5" = "int 25" in IBM jargon, int |
4189 |
device_add(machine, "ns16550 irq=0 addr=0xff600400 in_use=0 name2=tty1"); |
31-25 = 6 for the rest of us. */ |
4190 |
|
dev_mc146818_init(machine, mem, 0x7ff00000, 31-25, MC146818_PMPPC, 1); |
4191 |
|
|
4192 |
|
bus_pci_add(machine, machine->md_int.cpc700_data->pci_data, |
4193 |
|
mem, 0, 8, 0, "dec21143"); |
4194 |
|
|
4195 |
break; |
break; |
4196 |
|
|
4200 |
*/ |
*/ |
4201 |
machine->machine_name = "Motorola Sandpoint"; |
machine->machine_name = "Motorola Sandpoint"; |
4202 |
|
|
4203 |
{ |
/* r4 should point to first free byte after the loaded kernel: */ |
4204 |
int i; |
cpu->cd.ppc.gpr[4] = 6 * 1048576; |
|
for (i=0; i<32; i++) |
|
|
cpu->cd.ppc.gpr[i] = |
|
|
0x12340000 + (i << 8) + 0x55; |
|
|
} |
|
4205 |
|
|
4206 |
break; |
break; |
4207 |
|
|
4211 |
*/ |
*/ |
4212 |
machine->machine_name = "BeBox"; |
machine->machine_name = "BeBox"; |
4213 |
|
|
4214 |
device_add(machine, "bebox"); |
machine->md_int.bebox_data = device_add(machine, "bebox"); |
4215 |
|
machine->isa_pic_data.native_irq = 5; |
4216 |
|
machine->md_interrupt = isa32_interrupt; |
4217 |
|
|
4218 |
machine->main_console_handle = (size_t) |
pci_data = dev_eagle_init(machine, mem, |
4219 |
device_add(machine, "ns16550 irq=0 addr=0x800003f8 name2=tty0"); |
32 /* isa irq base */, 0 /* pci irq: TODO */); |
|
device_add(machine, "ns16550 irq=0 addr=0x800002f8 name2=tty1 in_use=0"); |
|
4220 |
|
|
4221 |
dev_pckbc_init(machine, mem, 0x80000060, PCKBC_8042, |
bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_VGA, |
4222 |
1, 12, machine->use_x11, 1); |
0x80000000, 0xc0000000, 32, 48); |
|
|
|
|
if (machine->use_x11) |
|
|
dev_vga_init(machine, mem, 0xc00a0000ULL, 0x800003c0ULL, |
|
|
machine->machine_name); |
|
4223 |
|
|
4224 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
4225 |
|
/* According to the docs, and also used by NetBSD: */ |
4226 |
store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576); |
store_32bit_word(cpu, 0x3010, machine->physical_ram_in_mb * 1048576); |
4227 |
|
|
4228 |
|
/* Used by Linux: */ |
4229 |
|
store_32bit_word(cpu, 0x32f8, machine->physical_ram_in_mb * 1048576); |
4230 |
|
|
4231 |
/* TODO: List of stuff, see http://www.beatjapan.org/ |
/* TODO: List of stuff, see http://www.beatjapan.org/ |
4232 |
mirror/www.be.com/aboutbe/benewsletter/ |
mirror/www.be.com/aboutbe/benewsletter/ |
4233 |
Issue27.html#Cookbook for the details. */ |
Issue27.html#Cookbook for the details. */ |
4236 |
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
/* NetBSD/bebox: r3 = startkernel, r4 = endkernel, |
4237 |
r5 = args, r6 = ptr to bootinfo? */ |
r5 = args, r6 = ptr to bootinfo? */ |
4238 |
cpu->cd.ppc.gpr[3] = 0x3100; |
cpu->cd.ppc.gpr[3] = 0x3100; |
4239 |
cpu->cd.ppc.gpr[4] = 0x200000; |
cpu->cd.ppc.gpr[4] = 0x400000; |
4240 |
cpu->cd.ppc.gpr[5] = 0x2000; |
cpu->cd.ppc.gpr[5] = 0x2000; |
4241 |
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
store_string(cpu, cpu->cd.ppc.gpr[5], "-a"); |
4242 |
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100; |
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x100; |
4265 |
* NetBSD/prep (http://www.netbsd.org/Ports/prep/) |
* NetBSD/prep (http://www.netbsd.org/Ports/prep/) |
4266 |
*/ |
*/ |
4267 |
machine->machine_name = "PowerPC Reference Platform"; |
machine->machine_name = "PowerPC Reference Platform"; |
4268 |
|
machine->emulated_hz = 20000000; |
4269 |
|
|
4270 |
|
machine->md_int.bebox_data = device_add(machine, "prep"); |
4271 |
|
machine->isa_pic_data.native_irq = 1; /* Semi-bogus */ |
4272 |
|
machine->md_interrupt = isa32_interrupt; |
4273 |
|
|
4274 |
|
pci_data = dev_eagle_init(machine, mem, |
4275 |
|
32 /* isa irq base */, 0 /* pci irq: TODO */); |
4276 |
|
|
4277 |
|
bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1, |
4278 |
|
0x80000000, 0xc0000000, 32, 48); |
4279 |
|
|
4280 |
|
bus_pci_add(machine, pci_data, mem, 0, 13, 0, "dec21143"); |
4281 |
|
|
4282 |
|
if (machine->use_x11) |
4283 |
|
bus_pci_add(machine, pci_data, mem, 0, 14, 0, "s3_virge"); |
4284 |
|
|
4285 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
4286 |
/* Linux on PReP has 0xdeadc0de at address 0? (See |
/* Linux on PReP has 0xdeadc0de at address 0? (See |
4287 |
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
http://joshua.raleigh.nc.us/docs/linux-2.4.10_html/113568.html) */ |
4288 |
store_32bit_word(cpu, 0, 0xdeadc0de); |
store_32bit_word(cpu, 0, 0xdeadc0de); |
4289 |
|
|
4290 |
/* r6 should point to "residual data"? */ |
/* r4 should point to first free byte after the loaded kernel: */ |
4291 |
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x1000; |
cpu->cd.ppc.gpr[4] = 6 * 1048576; |
4292 |
|
|
4293 |
|
/* |
4294 |
|
* r6 should point to bootinfo. |
4295 |
|
* (See NetBSD's prep/include/bootinfo.h for details.) |
4296 |
|
*/ |
4297 |
|
cpu->cd.ppc.gpr[6] = machine->physical_ram_in_mb * 1048576 - 0x8000; |
4298 |
|
|
4299 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 0, 12); /* next */ |
4300 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 4, 2); /* type: clock */ |
4301 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+ 8, machine->emulated_hz); |
4302 |
|
|
4303 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+12, 20); /* next */ |
4304 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+16, 1); /* type: console */ |
4305 |
|
store_buf(cpu, cpu->cd.ppc.gpr[6] + 20, |
4306 |
|
machine->use_x11? "vga" : "com", 4); |
4307 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+24, 0x3f8); /* addr */ |
4308 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+28, 9600); /* speed */ |
4309 |
|
|
4310 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+32, 0); /* next */ |
4311 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+36, 0); /* type: residual */ |
4312 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+40, /* addr of data */ |
4313 |
|
cpu->cd.ppc.gpr[6] + 0x100); |
4314 |
|
|
4315 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100, 0x200); /* TODO: residual */ |
4316 |
|
/* store_string(cpu, cpu->cd.ppc.gpr[6]+0x100+0x8, "IBM PPS Model 7248 (E)"); */ |
4317 |
|
store_string(cpu, cpu->cd.ppc.gpr[6]+0x100+0x8, "IBM PPS Model 6050/6070 (E)"); |
4318 |
|
|
4319 |
|
store_32bit_word(cpu, cpu->cd.ppc.gpr[6]+0x100+0x1f8, machine->physical_ram_in_mb * 1048576); /* memsize */ |
4320 |
} |
} |
4321 |
break; |
break; |
4322 |
|
|
4694 |
|
|
4695 |
machine->md_int.footbridge_data = |
machine->md_int.footbridge_data = |
4696 |
device_add(machine, "footbridge addr=0x42000000"); |
device_add(machine, "footbridge addr=0x42000000"); |
4697 |
machine->md_interrupt = footbridge_interrupt; |
machine->md_interrupt = isa32_interrupt; |
4698 |
|
machine->isa_pic_data.native_irq = 10; |
4699 |
|
|
4700 |
|
/* |
4701 |
|
* DC21285_ROM_BASE (0x41000000): "reboot" code. Works |
4702 |
|
* with NetBSD. |
4703 |
|
*/ |
4704 |
|
dev_ram_init(machine, 0x41000000, 12, DEV_RAM_RAM, 0); |
4705 |
|
store_32bit_word(cpu, 0x41000008ULL, 0xef8c64ebUL); |
4706 |
|
|
4707 |
|
/* OpenBSD reboot needs 0xf??????? to be mapped to phys.: */ |
4708 |
|
dev_ram_init(machine, 0xf0000000, 0x1000000, |
4709 |
|
DEV_RAM_MIRROR, 0x0); |
4710 |
|
|
4711 |
/* NetBSD and OpenBSD clean their caches here: */ |
/* NetBSD and OpenBSD clean their caches here: */ |
4712 |
dev_ram_init(machine, 0x50000000, 0x4000, DEV_RAM_RAM, 0); |
dev_ram_init(machine, 0x50000000, 0x4000, DEV_RAM_RAM, 0); |
4714 |
/* Interrupt ack space? */ |
/* Interrupt ack space? */ |
4715 |
dev_ram_init(machine, 0x80000000, 0x1000, DEV_RAM_RAM, 0); |
dev_ram_init(machine, 0x80000000, 0x1000, DEV_RAM_RAM, 0); |
4716 |
|
|
4717 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
bus_isa(machine, BUS_ISA_PCKBC_FORCE_USE | BUS_ISA_PCKBC_NONPCSTYLE, |
4718 |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
0x7c000000, 0x80000000, 32, 48); |
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
|
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
|
|
|
|
|
device_add(machine, "pccmos addr=0x7c000070"); |
|
4719 |
|
|
4720 |
if (machine->use_x11) { |
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4721 |
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
mem, 0xc0, 8, 0, "s3_virge"); |
|
mem, 0xc0, 8, 0, pci_s3_virge_init, pci_s3_virge_rr); |
|
|
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
|
|
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
|
|
32 + 1, 32 + 12, machine->use_x11, 0); |
|
|
machine->main_console_handle = j; |
|
|
} |
|
|
|
|
|
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0 in_use=0"); |
|
|
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1 in_use=0"); |
|
|
|
|
|
device_add(machine, "lpt irq=39 addr=0x7c000378 name2=lpt in_use=0"); |
|
4722 |
|
|
4723 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
4724 |
struct ebsaboot ebsaboot; |
struct ebsaboot ebsaboot; |
4757 |
store_buf(cpu, cpu->cd.arm.r[0], |
store_buf(cpu, cpu->cd.arm.r[0], |
4758 |
(char *)&ebsaboot, sizeof(struct ebsaboot)); |
(char *)&ebsaboot, sizeof(struct ebsaboot)); |
4759 |
|
|
4760 |
snprintf(bs, sizeof(bs), "(hd%i)%s%s%s", |
snprintf(bs, sizeof(bs), "(hd%i)%s root=/dev/wd%i%s%s", |
4761 |
boot_id, machine->boot_kernel_filename, |
boot_id, machine->boot_kernel_filename, boot_id, |
4762 |
(machine->boot_string_argument[0])? " " : "", |
(machine->boot_string_argument[0])? " " : "", |
4763 |
machine->boot_string_argument); |
machine->boot_string_argument); |
4764 |
|
|
4889 |
machine->machine_name = "Zaurus"; |
machine->machine_name = "Zaurus"; |
4890 |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
4891 |
DEV_RAM_MIRROR, 0x0); |
DEV_RAM_MIRROR, 0x0); |
4892 |
|
dev_ram_init(machine, 0xc0000000, 0x20000000, |
4893 |
|
DEV_RAM_MIRROR, 0x0); |
4894 |
|
|
4895 |
|
/* TODO: replace this with the correct device */ |
4896 |
|
dev_ram_init(machine, 0x40d00000, 0x1000, DEV_RAM_RAM, 0); |
4897 |
|
|
4898 |
device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4"); |
device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4"); |
4899 |
|
device_add(machine, "ns16550 irq=0 addr=0xfd400000 addr_mult=4"); |
4900 |
|
|
4901 |
/* TODO */ |
/* TODO */ |
4902 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
4903 |
arm_setup_initial_translation_table(cpu, 0x4000); |
arm_setup_initial_translation_table(cpu, 0x4000); |
4913 |
|
|
4914 |
machine->md_int.footbridge_data = |
machine->md_int.footbridge_data = |
4915 |
device_add(machine, "footbridge addr=0x42000000"); |
device_add(machine, "footbridge addr=0x42000000"); |
4916 |
machine->md_interrupt = footbridge_interrupt; |
machine->md_interrupt = isa32_interrupt; |
4917 |
|
machine->isa_pic_data.native_irq = 11; |
4918 |
|
|
4919 |
|
bus_isa(machine, 0, 0x7c000000, 0x80000000, 32, 48); |
4920 |
|
#if 0 |
4921 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); |
4922 |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
4923 |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); |
4926 |
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0"); |
device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0"); |
4927 |
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1"); |
device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1"); |
4928 |
|
|
|
if (machine->use_x11) { |
|
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
|
|
mem, 0xc0, 8, 0, pci_igsfb_init, pci_igsfb_rr); |
|
4929 |
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
dev_vga_init(machine, mem, 0x800a0000ULL, 0x7c0003c0, machine->machine_name); |
4930 |
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
j = dev_pckbc_init(machine, mem, 0x7c000060, PCKBC_8042, |
4931 |
32 + 1, 32 + 12, machine->use_x11, 0); |
32 + 1, 32 + 12, machine->use_x11, 0); |
4932 |
machine->main_console_handle = j; |
machine->main_console_handle = j; |
4933 |
|
#endif |
4934 |
|
if (machine->use_x11) { |
4935 |
|
bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, |
4936 |
|
mem, 0xc0, 8, 0, "igsfb"); |
4937 |
} |
} |
4938 |
|
|
4939 |
if (machine->prom_emulation) { |
if (machine->prom_emulation) { |
4965 |
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4966 |
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
4967 |
|
|
4968 |
|
/* Used by "Redboot": */ |
4969 |
|
dev_ram_init(machine, 0xa800024, 4, DEV_RAM_RAM, 0); |
4970 |
|
store_32bit_word(cpu, 0xa800024, 0x7fff); |
4971 |
|
device_add(machine, "ns16550 irq=0 addr=0x0d800000 addr_mult=4"); |
4972 |
|
device_add(machine, "ns16550 irq=0 addr=0x0d800020 addr_mult=4"); |
4973 |
|
|
4974 |
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
4975 |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
4976 |
DEV_RAM_MIRROR, 0x0); |
DEV_RAM_MIRROR, 0x0); |
4998 |
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; |
4999 |
|
|
5000 |
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
device_add(machine, "ns16550 irq=0 addr=0xfe800000"); |
5001 |
|
device_add(machine, "ns16550 irq=0 addr=0x900003f8"); |
5002 |
|
device_add(machine, "ns16550 irq=0 addr=0x900002f8"); |
5003 |
|
|
5004 |
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
/* 0xa0000000 = physical ram, 0xc0000000 = uncached */ |
5005 |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
dev_ram_init(machine, 0xa0000000, 0x20000000, |
5006 |
DEV_RAM_MIRROR, 0x0); |
DEV_RAM_MIRROR, 0x0); |
5007 |
dev_ram_init(machine, 0xc0000000, 0x20000000, |
dev_ram_init(machine, 0xc0000000, 0x20000000, |
5008 |
DEV_RAM_MIRROR, 0x0); |
DEV_RAM_MIRROR, 0x0); |
5009 |
|
dev_ram_init(machine, 0xf0000000, 0x08000000, |
5010 |
|
DEV_RAM_MIRROR, 0x0); |
5011 |
|
|
5012 |
device_add(machine, "i80321 addr=0xffffe000"); |
device_add(machine, "i80321 addr=0xffffe000"); |
5013 |
|
|
5101 |
else |
else |
5102 |
machine->machine_name = "Generic x86 PC"; |
machine->machine_name = "Generic x86 PC"; |
5103 |
|
|
|
/* Interrupt controllers: */ |
|
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx", |
|
|
(long long)(X86_IO_BASE + 0x20)); |
|
|
machine->isa_pic_data.pic1 = device_add(machine, tmpstr); |
|
|
if (machine->machine_subtype != MACHINE_X86_XT) { |
|
|
snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx irq=2", |
|
|
(long long)(X86_IO_BASE + 0xa0)); |
|
|
machine->isa_pic_data.pic2 = device_add(machine, tmpstr); |
|
|
} |
|
|
|
|
5104 |
machine->md_interrupt = x86_pc_interrupt; |
machine->md_interrupt = x86_pc_interrupt; |
5105 |
|
|
5106 |
/* Timer: */ |
bus_isa(machine, BUS_ISA_IDE0 | BUS_ISA_IDE1 | BUS_ISA_VGA | |
5107 |
snprintf(tmpstr, sizeof(tmpstr), "8253 addr=0x%llx irq=0", |
BUS_ISA_PCKBC_FORCE_USE | |
5108 |
(long long)(X86_IO_BASE + 0x40)); |
(machine->machine_subtype == MACHINE_X86_XT? |
5109 |
device_add(machine, tmpstr); |
BUS_ISA_NO_SECOND_PIC : 0) | BUS_ISA_FDC, |
5110 |
|
X86_IO_BASE, 0x00000000, 0, 16); |
|
snprintf(tmpstr, sizeof(tmpstr), "pccmos addr=0x%llx", |
|
|
(long long)(X86_IO_BASE + 0x70)); |
|
|
device_add(machine, tmpstr); |
|
|
|
|
|
/* TODO: IRQ when emulating a PC XT? */ |
|
|
|
|
|
/* IDE controllers: */ |
|
|
if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || |
|
|
diskimage_exist(machine, 1, DISKIMAGE_IDE)) { |
|
|
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
|
|
X86_IO_BASE + 0x1f0, 14); |
|
|
device_add(machine, tmpstr); |
|
|
} |
|
|
if (diskimage_exist(machine, 2, DISKIMAGE_IDE) || |
|
|
diskimage_exist(machine, 3, DISKIMAGE_IDE)) { |
|
|
snprintf(tmpstr, sizeof(tmpstr), "wdc addr=0x%llx irq=%i", |
|
|
X86_IO_BASE + 0x170, 15); |
|
|
device_add(machine, tmpstr); |
|
|
} |
|
|
|
|
|
/* Floppy controller at irq 6 */ |
|
|
snprintf(tmpstr, sizeof(tmpstr), "fdc addr=0x%llx irq=6", |
|
|
(long long)(X86_IO_BASE + 0x3f0)); |
|
|
device_add(machine, tmpstr); |
|
|
|
|
|
/* TODO: sound blaster (eventually) at irq 7? */ |
|
|
|
|
|
/* TODO: parallel port */ |
|
|
|
|
|
/* Serial ports: (TODO: 8250 for PC XT?) */ |
|
|
|
|
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%llx name2=com1 in_use=0", |
|
|
(long long)X86_IO_BASE + 0x3f8); |
|
|
device_add(machine, tmpstr); |
|
|
snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=3 addr=0x%llx name2=com2 in_use=0", |
|
|
(long long)X86_IO_BASE + 0x2f8); |
|
|
device_add(machine, tmpstr); |
|
|
|
|
|
/* VGA + keyboard: */ |
|
|
dev_vga_init(machine, mem, 0xa0000ULL, X86_IO_BASE + 0x3c0, |
|
|
"Generic x86 PC"); |
|
|
machine->main_console_handle = dev_pckbc_init(machine, |
|
|
mem, X86_IO_BASE + 0x60, PCKBC_8042, 1, 12, 1, 1); |
|
5111 |
|
|
5112 |
if (machine->prom_emulation) |
if (machine->prom_emulation) |
5113 |
pc_bios_init(cpu); |
pc_bios_init(cpu); |
5134 |
debug(" (%.2f MHz)", (float)machine->emulated_hz / 1000000); |
debug(" (%.2f MHz)", (float)machine->emulated_hz / 1000000); |
5135 |
debug("\n"); |
debug("\n"); |
5136 |
|
|
5137 |
|
/* Default fake speed: 5 MHz */ |
5138 |
if (machine->emulated_hz < 1) |
if (machine->emulated_hz < 1) |
5139 |
machine->emulated_hz = 1000000; |
machine->emulated_hz = 5000000; |
5140 |
|
|
5141 |
if (bootstr != NULL) { |
if (bootstr != NULL) { |
5142 |
debug("bootstring%s: %s", (bootarg!=NULL && |
debug("bootstring%s: %s", (bootarg!=NULL && |
5224 |
} |
} |
5225 |
break; |
break; |
5226 |
case MACHINE_ALPHA: |
case MACHINE_ALPHA: |
|
m->physical_ram_in_mb = 64; |
|
|
break; |
|
5227 |
case MACHINE_BEBOX: |
case MACHINE_BEBOX: |
5228 |
m->physical_ram_in_mb = 64; |
case MACHINE_PREP: |
|
break; |
|
5229 |
case MACHINE_CATS: |
case MACHINE_CATS: |
|
m->physical_ram_in_mb = 64; |
|
|
break; |
|
5230 |
case MACHINE_ZAURUS: |
case MACHINE_ZAURUS: |
5231 |
m->physical_ram_in_mb = 64; |
m->physical_ram_in_mb = 64; |
5232 |
break; |
break; |
5387 |
case MACHINE_PSP: |
case MACHINE_PSP: |
5388 |
m->cpu_name = strdup("Allegrex"); |
m->cpu_name = strdup("Allegrex"); |
5389 |
break; |
break; |
5390 |
|
case MACHINE_ALGOR: |
5391 |
|
m->cpu_name = strdup("RM5200"); |
5392 |
|
break; |
5393 |
|
|
5394 |
/* PowerPC: */ |
/* PowerPC: */ |
5395 |
case MACHINE_BAREPPC: |
case MACHINE_BAREPPC: |
5418 |
m->cpu_name = strdup("PPC603e"); |
m->cpu_name = strdup("PPC603e"); |
5419 |
break; |
break; |
5420 |
case MACHINE_PREP: |
case MACHINE_PREP: |
5421 |
/* For NetBSD/prep. TODO */ |
/* For NetBSD/prep. TODO: Differs between models! */ |
5422 |
m->cpu_name = strdup("PPC603e"); |
m->cpu_name = strdup("PPC604"); |
5423 |
break; |
break; |
5424 |
case MACHINE_MACPPC: |
case MACHINE_MACPPC: |
5425 |
switch (m->machine_subtype) { |
switch (m->machine_subtype) { |
5582 |
debug("Using X11"); |
debug("Using X11"); |
5583 |
if (m->x11_scaledown > 1) |
if (m->x11_scaledown > 1) |
5584 |
debug(", scaledown %i", m->x11_scaledown); |
debug(", scaledown %i", m->x11_scaledown); |
5585 |
|
if (m->x11_scaleup > 1) |
5586 |
|
debug(", scaleup %i", m->x11_scaleup); |
5587 |
if (m->x11_n_display_names > 0) { |
if (m->x11_n_display_names > 0) { |
5588 |
for (i=0; i<m->x11_n_display_names; i++) { |
for (i=0; i<m->x11_n_display_names; i++) { |
5589 |
debug(i? ", " : " ("); |
debug(i? ", " : " ("); |
5739 |
debug_indentation(-iadd); |
debug_indentation(-iadd); |
5740 |
|
|
5741 |
debug("\nMost of the machine types are bogus too. Please read the " |
debug("\nMost of the machine types are bogus too. Please read the " |
5742 |
"GXemul\ndocumentation for information about which machine" |
"GXemul documentation\nfor information about which machine types " |
5743 |
" types that actually\nwork. Use the alias when selecting a " |
"that actually work. Use the alias\nwhen selecting a machine type " |
5744 |
"machine type or subtype, not the\nreal name.\n"); |
"or subtype, not the real name.\n"); |
5745 |
|
|
5746 |
debug("\n"); |
debug("\n"); |
5747 |
|
|
5780 |
me->aliases[0] = "pc"; |
me->aliases[0] = "pc"; |
5781 |
me->aliases[1] = "x86"; |
me->aliases[1] = "x86"; |
5782 |
me->subtype[0] = machine_entry_subtype_new("Generic PC", |
me->subtype[0] = machine_entry_subtype_new("Generic PC", |
5783 |
MACHINE_X86_GENERIC, 1); |
MACHINE_X86_GENERIC, 2); |
5784 |
me->subtype[0]->aliases[0] = "generic"; |
me->subtype[0]->aliases[0] = "pc"; |
5785 |
|
me->subtype[0]->aliases[1] = "generic"; |
5786 |
me->subtype[1] = machine_entry_subtype_new("PC XT", MACHINE_X86_XT, 1); |
me->subtype[1] = machine_entry_subtype_new("PC XT", MACHINE_X86_XT, 1); |
5787 |
me->subtype[1]->aliases[0] = "xt"; |
me->subtype[1]->aliases[0] = "xt"; |
5788 |
if (cpu_family_ptr_by_number(ARCH_X86) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_X86) != NULL) { |
6351 |
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { |
6352 |
me->next = first_machine_entry; first_machine_entry = me; |
me->next = first_machine_entry; first_machine_entry = me; |
6353 |
} |
} |
6354 |
|
|
6355 |
|
/* Algor evaluation board: */ |
6356 |
|
me = machine_entry_new("Algor", ARCH_MIPS, MACHINE_ALGOR, 1, 2); |
6357 |
|
me->aliases[0] = "algor"; |
6358 |
|
me->subtype[0] = machine_entry_subtype_new("P4032", |
6359 |
|
MACHINE_ALGOR_P4032, 1); |
6360 |
|
me->subtype[0]->aliases[0] = "p4032"; |
6361 |
|
me->subtype[1] = machine_entry_subtype_new("P5064", |
6362 |
|
MACHINE_ALGOR_P5064, 1); |
6363 |
|
me->subtype[1]->aliases[0] = "p5064"; |
6364 |
|
if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { |
6365 |
|
me->next = first_machine_entry; first_machine_entry = me; |
6366 |
|
} |
6367 |
} |
} |
6368 |
|
|