--- trunk/src/machines/machine_evbmips.c 2007/10/08 16:19:56 24 +++ trunk/src/machines/machine_evbmips.c 2007/10/08 16:21:53 38 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2006 Anders Gavare. All rights reserved. + * Copyright (C) 2005-2007 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: machine_evbmips.c,v 1.6 2006/05/21 11:35:58 debug Exp $ + * $Id: machine_evbmips.c,v 1.20 2007/04/10 16:51:35 debug Exp $ */ #include @@ -38,7 +38,6 @@ #include "device.h" #include "devices.h" #include "machine.h" -#include "machine_interrupts.h" #include "memory.h" #include "misc.h" @@ -47,9 +46,7 @@ MACHINE_SETUP(evbmips) { - char tmpstr[1000]; - char tmps[50]; - uint64_t env, tmpptr; + char tmpstr[1000], tmpstr2[1000]; struct pci_data *pci_data; int i; @@ -58,6 +55,8 @@ switch (machine->machine_subtype) { case MACHINE_EVBMIPS_MALTA: case MACHINE_EVBMIPS_MALTA_BE: + if (machine->emulated_hz == 0) + machine->emulated_hz = 33000000; cpu->byte_order = EMUL_LITTLE_ENDIAN; machine->machine_name = "MALTA (evbmips, little endian)"; machine->stable = 1; @@ -67,17 +66,23 @@ cpu->byte_order = EMUL_BIG_ENDIAN; } - machine->md_interrupt = isa8_interrupt; - machine->isa_pic_data.native_irq = 2; - - bus_isa_init(machine, 0, 0x18000000, 0x10000000, 8, 24); - - snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=4 addr=0x%x" - " name2=tty2 in_use=0", MALTA_CBUSUART); + /* ISA bus at MIPS irq 2: */ + snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2", + machine->path, machine->bootstrap_cpu); + bus_isa_init(machine, tmpstr, 0, 0x18000000, 0x10000000); + + snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%s.cpu[%i].4 " + "addr=0x%x name2=tty2 in_use=0", machine->path, + machine->bootstrap_cpu, MALTA_CBUSUART); device_add(machine, tmpstr); + /* Add a GT controller; timer interrupts at ISA irq 9: */ + snprintf(tmpstr, sizeof(tmpstr), "%s.cpu[%i].2.isa.9", + machine->path, machine->bootstrap_cpu); + snprintf(tmpstr2, sizeof(tmpstr2), "%s.cpu[%i].2", + machine->path, machine->bootstrap_cpu); pci_data = dev_gt_init(machine, machine->memory, 0x1be00000, - 8+9, 8+9, 120); + tmpstr, tmpstr2, 120); if (machine->use_x11) { if (strlen(machine->boot_string_argument) < 3) { @@ -94,53 +99,11 @@ bus_pci_add(machine, pci_data, machine->memory, 0, 9, 1, "piix4_ide"); - device_add(machine, "malta_lcd addr=0x1f000400"); - break; - - case MACHINE_EVBMIPS_MESHCUBE: - machine->machine_name = "Meshcube"; - - /* See: http://mail-index.netbsd.org/port-evbmips/2006/ - 02/23/0000.html */ - - if (machine->physical_ram_in_mb != 64) - fprintf(stderr, "WARNING! MeshCubes are supposed to " - "have exactly 64 MB RAM. Continuing anyway.\n"); - if (machine->use_x11) - fprintf(stderr, "WARNING! MeshCube with -X is " - "meaningless. Continuing anyway.\n"); - - /* First of all, the MeshCube has an Au1500 in it: */ - machine->md_interrupt = au1x00_interrupt; - machine->md_int.au1x00_ic_data = dev_au1x00_init(machine, - machine->memory); - - /* - * TODO: Which non-Au1500 devices, and at what addresses? - * - * "4G Systems MTX-1 Board" at ? - * 1017fffc, 14005004, 11700000, 11700008, 11900014, - * 1190002c, 11900100, 11900108, 1190010c, - * 10400040 - 10400074, - * 14001000 (possibly LCD?) - * 11100028 (possibly ttySx?) - * - * "usb_ohci=base:0x10100000,len:0x100000,irq:26" - */ - - /* Linux reads this during startup... */ - device_add(machine, "random addr=0x1017fffc len=4"); - - break; + /* pcn: Not yet, since it is just a bogus device, so far. */ + /* bus_pci_add(machine, pci_data, machine->memory, + 0, 11, 0, "pcn"); */ - case MACHINE_EVBMIPS_PB1000: - machine->machine_name = "PB1000 (evbmips)"; - cpu->byte_order = EMUL_BIG_ENDIAN; - - machine->md_interrupt = au1x00_interrupt; - machine->md_int.au1x00_ic_data = dev_au1x00_init(machine, - machine->memory); - /* TODO */ + device_add(machine, "malta_lcd addr=0x1f000400"); break; default:fatal("Unimplemented EVBMIPS model.\n"); @@ -170,18 +133,7 @@ /* a2 = (yamon_env_var *)envp */ cpu->cd.mips.gpr[MIPS_GPR_A2] = (int32_t)0x9fc01800; - env = cpu->cd.mips.gpr[MIPS_GPR_A2]; - tmpptr = 0xffffffff9fc01c00ULL; - - snprintf(tmps, sizeof(tmps), "0x%08x", machine->physical_ram_in_mb<<20); - add_environment_string_dual(cpu, &env, &tmpptr, "memsize", tmps); - - add_environment_string_dual(cpu, &env, &tmpptr, "yamonrev", "02.06"); - - /* End of env: */ - tmpptr = 0; - add_environment_string_dual(cpu, - &env, &tmpptr, NULL, NULL); + yamon_machine_setup(machine, cpu->cd.mips.gpr[MIPS_GPR_A2]); /* a3 = memsize */ cpu->cd.mips.gpr[MIPS_GPR_A3] = machine->physical_ram_in_mb * 1048576; @@ -212,16 +164,12 @@ MACHINE_DEFAULT_CPU(evbmips) { switch (machine->machine_subtype) { + case MACHINE_EVBMIPS_MALTA: case MACHINE_EVBMIPS_MALTA_BE: machine->cpu_name = strdup("5Kc"); break; - case MACHINE_EVBMIPS_MESHCUBE: - machine->cpu_name = strdup("AU1500"); - break; - case MACHINE_EVBMIPS_PB1000: - machine->cpu_name = strdup("AU1000"); - break; + default:fatal("Unimplemented evbmips subtype.\n"); exit(1); } @@ -238,27 +186,16 @@ MACHINE_REGISTER(evbmips) { - MR_DEFAULT(evbmips, "MIPS evaluation boards (evbmips)", ARCH_MIPS, - MACHINE_EVBMIPS, 1, 4); - me->aliases[0] = "evbmips"; - - me->subtype[0] = machine_entry_subtype_new("Malta", - MACHINE_EVBMIPS_MALTA, 1); - me->subtype[0]->aliases[0] = "malta"; - - me->subtype[1] = machine_entry_subtype_new("Malta (Big-Endian)", - MACHINE_EVBMIPS_MALTA_BE, 1); - me->subtype[1]->aliases[0] = "maltabe"; - - me->subtype[2] = machine_entry_subtype_new("MeshCube", - MACHINE_EVBMIPS_MESHCUBE, 1); - me->subtype[2]->aliases[0] = "meshcube"; - - me->subtype[3] = machine_entry_subtype_new("PB1000", - MACHINE_EVBMIPS_PB1000, 1); - me->subtype[3]->aliases[0] = "pb1000"; + MR_DEFAULT(evbmips, "MIPS evaluation boards (evbmips)", + ARCH_MIPS, MACHINE_EVBMIPS); + + machine_entry_add_alias(me, "evbmips"); + + machine_entry_add_subtype(me, "Malta", MACHINE_EVBMIPS_MALTA, + "malta", NULL); - machine_entry_add(me, ARCH_MIPS); + machine_entry_add_subtype(me, "Malta (Big-Endian)", + MACHINE_EVBMIPS_MALTA_BE, "maltabe", NULL); me->set_default_ram = machine_default_ram_evbmips; }