--- trunk/src/machine.c 2007/10/08 16:18:38 12 +++ trunk/src/machine.c 2007/10/08 16:18:51 14 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: machine.c,v 1.515 2005/08/16 09:16:26 debug Exp $ + * $Id: machine.c,v 1.565 2005/10/07 22:10:50 debug Exp $ * * Emulation of specific machines. * @@ -67,6 +67,9 @@ /* For Alpha emulation: */ #include "alpha_rpb.h" +/* For CATS emulation: */ +#include "cyclone_boot.h" + /* For SGI and ARC emulation: */ #include "sgi_arcbios.h" #include "crimereg.h" @@ -456,7 +459,7 @@ int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32) { unsigned char data[4]; - if ((addr >> 32) == 0) + if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) addr = (int64_t)(int32_t)addr; data[0] = (data32 >> 24) & 255; data[1] = (data32 >> 16) & 255; @@ -481,7 +484,7 @@ int store_16bit_word(struct cpu *cpu, uint64_t addr, uint64_t data16) { unsigned char data[2]; - if ((addr >> 32) == 0) + if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) addr = (int64_t)(int32_t)addr; data[0] = (data16 >> 8) & 255; data[1] = (data16) & 255; @@ -502,7 +505,7 @@ { int psize = 1024; /* 1024 256 64 16 4 1 */ - if ((addr >> 32) == 0) + if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) addr = (int64_t)(int32_t)addr; while (len != 0) { @@ -555,7 +558,7 @@ { unsigned char data[4]; - if ((addr >> 32) == 0) + if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) addr = (int64_t)(int32_t)addr; cpu->memory_rw(cpu, cpu->mem, addr, data, sizeof(data), MEM_READ, CACHE_DATA); @@ -579,7 +582,7 @@ { unsigned char data[2]; - if ((addr >> 32) == 0) + if (cpu->machine->arch == ARCH_MIPS && (addr >> 32) == 0) addr = (int64_t)(int32_t)addr; cpu->memory_rw(cpu, cpu->mem, addr, data, sizeof(data), MEM_READ, CACHE_DATA); @@ -1305,36 +1308,36 @@ if (irq_nr < 8) { if (assrt) - m->md_int.isa_pic_data.pic1->irr |= mask; + m->isa_pic_data.pic1->irr |= mask; else - m->md_int.isa_pic_data.pic1->irr &= ~mask; + m->isa_pic_data.pic1->irr &= ~mask; } else if (irq_nr < 16) { if (assrt) - m->md_int.isa_pic_data.pic2->irr |= mask; + m->isa_pic_data.pic2->irr |= mask; else - m->md_int.isa_pic_data.pic2->irr &= ~mask; + m->isa_pic_data.pic2->irr &= ~mask; } /* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ /* (TODO: don't hardcode this here) */ - if (m->md_int.isa_pic_data.pic2->irr & - ~m->md_int.isa_pic_data.pic2->ier) - m->md_int.isa_pic_data.pic1->irr |= 0x04; + if (m->isa_pic_data.pic2->irr & + ~m->isa_pic_data.pic2->ier) + m->isa_pic_data.pic1->irr |= 0x04; else - m->md_int.isa_pic_data.pic1->irr &= ~0x04; + m->isa_pic_data.pic1->irr &= ~0x04; /* Now, PIC1: */ - if (m->md_int.isa_pic_data.pic1->irr & - ~m->md_int.isa_pic_data.pic1->ier) + if (m->isa_pic_data.pic1->irr & + ~m->isa_pic_data.pic1->ier) cpu_interrupt(cpu, 2); else cpu_interrupt_ack(cpu, 2); /* printf("MALTA: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " - "ier=0x%02x\n", m->md_int.isa_pic_data.pic1->irr, - m->md_int.isa_pic_data.pic1->ier, - m->md_int.isa_pic_data.pic2->irr, - m->md_int.isa_pic_data.pic2->ier); */ + "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); */ } @@ -1352,36 +1355,36 @@ if (irq_nr < 8) { if (assrt) - m->md_int.isa_pic_data.pic1->irr |= mask; + m->isa_pic_data.pic1->irr |= mask; else - m->md_int.isa_pic_data.pic1->irr &= ~mask; + m->isa_pic_data.pic1->irr &= ~mask; } else if (irq_nr < 16) { if (assrt) - m->md_int.isa_pic_data.pic2->irr |= mask; + m->isa_pic_data.pic2->irr |= mask; else - m->md_int.isa_pic_data.pic2->irr &= ~mask; + m->isa_pic_data.pic2->irr &= ~mask; } /* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ /* (TODO: don't hardcode this here) */ - if (m->md_int.isa_pic_data.pic2->irr & - ~m->md_int.isa_pic_data.pic2->ier) - m->md_int.isa_pic_data.pic1->irr |= 0x04; + if (m->isa_pic_data.pic2->irr & + ~m->isa_pic_data.pic2->ier) + m->isa_pic_data.pic1->irr |= 0x04; else - m->md_int.isa_pic_data.pic1->irr &= ~0x04; + m->isa_pic_data.pic1->irr &= ~0x04; /* Now, PIC1: */ - if (m->md_int.isa_pic_data.pic1->irr & - ~m->md_int.isa_pic_data.pic1->ier) + if (m->isa_pic_data.pic1->irr & + ~m->isa_pic_data.pic1->ier) cpu_interrupt(cpu, 6); else cpu_interrupt_ack(cpu, 6); /* printf("COBALT: pic1.irr=0x%02x ier=0x%02x pic2.irr=0x%02x " - "ier=0x%02x\n", m->md_int.isa_pic_data.pic1->irr, - m->md_int.isa_pic_data.pic1->ier, - m->md_int.isa_pic_data.pic2->irr, - m->md_int.isa_pic_data.pic2->ier); */ + "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); */ } @@ -1396,38 +1399,100 @@ if (irq_nr < 8) { if (assrt) - m->md.pc.pic1->irr |= mask; + m->isa_pic_data.pic1->irr |= mask; else - m->md.pc.pic1->irr &= ~mask; + m->isa_pic_data.pic1->irr &= ~mask; } else if (irq_nr < 16) { - if (m->md.pc.pic2 == NULL) { + if (m->isa_pic_data.pic2 == NULL) { fatal("x86_pc_interrupt(): pic2 used (irq_nr = %i), " "but we are emulating an XT?\n", irq_nr); return; } if (assrt) - m->md.pc.pic2->irr |= mask; + m->isa_pic_data.pic2->irr |= mask; else - m->md.pc.pic2->irr &= ~mask; + m->isa_pic_data.pic2->irr &= ~mask; } - if (m->md.pc.pic2 != NULL) { + if (m->isa_pic_data.pic2 != NULL) { /* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ /* (TODO: don't hardcode this here) */ - if (m->md.pc.pic2->irr & ~m->md.pc.pic2->ier) - m->md.pc.pic1->irr |= 0x04; + if (m->isa_pic_data.pic2->irr & ~m->isa_pic_data.pic2->ier) + m->isa_pic_data.pic1->irr |= 0x04; else - m->md.pc.pic1->irr &= ~0x04; + m->isa_pic_data.pic1->irr &= ~0x04; } /* Now, PIC1: */ - if (m->md.pc.pic1->irr & ~m->md.pc.pic1->ier) + if (m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier) cpu->cd.x86.interrupt_asserted = 1; else cpu->cd.x86.interrupt_asserted = 0; } +/* + * Footbridge interrupts: + * + * 0..31 = footbridge interrupt + * 32..47 = ISA (connected to IRQ_IN_L2 on CATS, L3 on NetWinder) + * 64 = reassert + */ +void footbridge_interrupt(struct machine *m, struct cpu *cpu, int irq_nr, + int assrt) +{ + uint32_t mask = 1 << (irq_nr & 31); + int old_isa_assert, new_isa_assert; + int isa_int = m->machine_type == MACHINE_CATS? 10 : 11; + + old_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; + + if (irq_nr >= 32 && irq_nr < 32 + 8) { + int mm = 1 << (irq_nr & 7); + if (assrt) + m->isa_pic_data.pic1->irr |= mm; + else + m->isa_pic_data.pic1->irr &= ~mm; + } else if (irq_nr >= 32+8 && irq_nr < 32+16) { + int mm = 1 << (irq_nr & 7); + if (assrt) + m->isa_pic_data.pic2->irr |= mm; + else + m->isa_pic_data.pic2->irr &= ~mm; + } + + /* Any interrupt assertions on PIC2 go to irq 2 on PIC1 */ + /* (TODO: don't hardcode this here) */ + 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: */ + new_isa_assert = m->isa_pic_data.pic1->irr & ~m->isa_pic_data.pic1->ier; + if (old_isa_assert != new_isa_assert) { + if (new_isa_assert) + cpu_interrupt(cpu, isa_int); + else + cpu_interrupt_ack(cpu, isa_int); + return; + } + + if (irq_nr < 32) { + if (assrt) + m->md_int.footbridge_data->irq_status |= mask; + else + m->md_int.footbridge_data->irq_status &= ~mask; + } + + 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); +} + + /**************************************************************************** * * * Machine dependant Initialization routines * @@ -1484,10 +1549,10 @@ char *init_bootpath; /* PCI stuff: */ - struct pci_data *pci_data; + struct pci_data *pci_data = NULL; /* Framebuffer stuff: */ - struct vfb_data *fb; + struct vfb_data *fb = NULL; /* Abreviation: :-) */ struct cpu *cpu = machine->cpus[machine->bootstrap_cpu]; @@ -2058,67 +2123,67 @@ */ dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); - /* DECstation PROM stuff: (TODO: endianness) */ - for (i=0; i<100; i++) - store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, - DEC_PROM_EMULATION + i*8); - - /* Fill PROM with dummy return instructions: (TODO: make this nicer) */ - for (i=0; i<100; i++) { - store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, - 0x03e00008); /* return */ - store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, - 0x00000000); /* nop */ - } + if (machine->prom_emulation) { + /* DECstation PROM stuff: (TODO: endianness) */ + for (i=0; i<100; i++) + store_32bit_word(cpu, DEC_PROM_CALLBACK_STRUCT + i*4, + DEC_PROM_EMULATION + i*8); + + /* Fill PROM with dummy return instructions: (TODO: make this nicer) */ + for (i=0; i<100; i++) { + store_32bit_word(cpu, DEC_PROM_EMULATION + i*8, + 0x03e00008); /* return */ + store_32bit_word(cpu, DEC_PROM_EMULATION + i*8 + 4, + 0x00000000); /* nop */ + } - /* - * According to dec_prom.h from NetBSD: - * - * "Programs loaded by the new PROMs pass the following arguments: - * a0 argc - * a1 argv - * a2 DEC_PROM_MAGIC - * a3 The callback vector defined below" - * - * So we try to emulate a PROM, even though no such thing has been - * loaded. - */ + /* + * According to dec_prom.h from NetBSD: + * + * "Programs loaded by the new PROMs pass the following arguments: + * a0 argc + * a1 argv + * a2 DEC_PROM_MAGIC + * a3 The callback vector defined below" + * + * So we try to emulate a PROM, even though no such thing has been + * loaded. + */ - cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; - cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; - cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; - cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; - - store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, - BOOTINFO_MAGIC); - store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, - BOOTINFO_ADDR); - - store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, - (DEC_PROM_INITIAL_ARGV + 0x10)); - store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, - (DEC_PROM_INITIAL_ARGV + 0x70)); - store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, - (DEC_PROM_INITIAL_ARGV + 0xe0)); - store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); + cpu->cd.mips.gpr[MIPS_GPR_A0] = 3; + cpu->cd.mips.gpr[MIPS_GPR_A1] = DEC_PROM_INITIAL_ARGV; + cpu->cd.mips.gpr[MIPS_GPR_A2] = DEC_PROM_MAGIC; + cpu->cd.mips.gpr[MIPS_GPR_A3] = DEC_PROM_CALLBACK_STRUCT; + + store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x10, + BOOTINFO_MAGIC); + store_32bit_word(cpu, INITIAL_STACK_POINTER + 0x14, + BOOTINFO_ADDR); + + store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV, + (DEC_PROM_INITIAL_ARGV + 0x10)); + store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+4, + (DEC_PROM_INITIAL_ARGV + 0x70)); + store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+8, + (DEC_PROM_INITIAL_ARGV + 0xe0)); + store_32bit_word(cpu, DEC_PROM_INITIAL_ARGV+12, 0); - /* - * NetBSD and Ultrix expect the boot args to be like this: - * - * "boot" "bootdev" [args?] - * - * where bootdev is supposed to be "rz(0,0,0)netbsd" for - * 3100/2100 (although that crashes Ultrix :-/), and - * "5/rz0a/netbsd" for all others. The number '5' is the - * slot number of the boot device. - * - * 'rz' for disks, 'tz' for tapes. - * - * TODO: Make this nicer. - */ - { + /* + * NetBSD and Ultrix expect the boot args to be like this: + * + * "boot" "bootdev" [args?] + * + * where bootdev is supposed to be "rz(0,0,0)netbsd" for + * 3100/2100 (although that crashes Ultrix :-/), and + * "5/rz0a/netbsd" for all others. The number '5' is the + * slot number of the boot device. + * + * 'rz' for disks, 'tz' for tapes. + * + * TODO: Make this nicer. + */ + { char bootpath[200]; - #if 0 if (machine->machine_subtype == MACHINE_DEC_PMAX_3100) strlcpy(bootpath, "rz(0,0,0)", sizeof(bootpath)); @@ -2140,129 +2205,130 @@ } init_bootpath = bootpath; - } + } - bootarg = malloc(BOOTARG_BUFLEN); - if (bootarg == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } - strlcpy(bootarg, init_bootpath, BOOTARG_BUFLEN); - if (strlcat(bootarg, machine->boot_kernel_filename, - BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { - fprintf(stderr, "bootarg truncated?\n"); - exit(1); - } + bootarg = malloc(BOOTARG_BUFLEN); + if (bootarg == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + strlcpy(bootarg, init_bootpath, BOOTARG_BUFLEN); + if (strlcat(bootarg, machine->boot_kernel_filename, + BOOTARG_BUFLEN) > BOOTARG_BUFLEN) { + fprintf(stderr, "bootarg truncated?\n"); + exit(1); + } - bootstr = "boot"; + bootstr = "boot"; - store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); - store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); - 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') { - strlcat(bootarg, " ", BOOTARG_BUFLEN); - if (strlcat(bootarg, machine->boot_string_argument, - BOOTARG_BUFLEN) >= BOOTARG_BUFLEN) { - fprintf(stderr, "bootstr truncated?\n"); - exit(1); + store_string(cpu, DEC_PROM_INITIAL_ARGV+0x10, bootstr); + store_string(cpu, DEC_PROM_INITIAL_ARGV+0x70, bootarg); + 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') { + strlcat(bootarg, " ", BOOTARG_BUFLEN); + if (strlcat(bootarg, machine->boot_string_argument, + BOOTARG_BUFLEN) >= BOOTARG_BUFLEN) { + fprintf(stderr, "bootstr truncated?\n"); + exit(1); + } } - } - 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; - strlcpy(xx.b.bootpath, bootstr, sizeof(xx.b.bootpath)); - - 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; + 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; + strlcpy(xx.b.bootpath, bootstr, sizeof(xx.b.bootpath)); + + 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; - store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); + store_buf(cpu, BOOTINFO_ADDR, (char *)&xx, sizeof(xx)); - /* - * The system's memmap: (memmap is a global variable, in - * dec_prom.h) - */ - store_32bit_word_in_host(cpu, - (unsigned char *)&memmap.pagesize, 4096); - { - unsigned int i; - for (i=0; iphysical_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); + /* + * The system's memmap: (memmap is a global variable, in + * dec_prom.h) + */ + store_32bit_word_in_host(cpu, + (unsigned char *)&memmap.pagesize, 4096); + { + unsigned int i; + for (i=0; iphysical_ram_in_mb)? + 0xff : 0x00; + } + store_buf(cpu, DEC_MEMMAP_ADDR, (char *)&memmap, sizeof(memmap)); - /* - * The KN5800 (SMP system) uses a CCA (console communications - * area): (See VAX 6000 documentation for details.) - */ - { - char tmps[300]; - snprintf(tmps, sizeof(tmps), "cca=%x", - (int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); - add_environment_string(cpu, tmps, &addr); - } + /* Environment variables: */ + addr = DEC_PROM_STRINGS; - /* These are needed for Sprite to boot: */ - { - char tmps[500]; + 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); + + /* + * The KN5800 (SMP system) uses a CCA (console communications + * area): (See VAX 6000 documentation for details.) + */ + { + char tmps[300]; + snprintf(tmps, sizeof(tmps), "cca=%x", + (int)(DEC_DECCCA_BASEADDR + 0xa0000000ULL)); + add_environment_string(cpu, tmps, &addr); + } + + /* These are needed for Sprite to boot: */ + { + char tmps[500]; + + snprintf(tmps, sizeof(tmps), "boot=%s", bootarg); + tmps[sizeof(tmps)-1] = '\0'; + add_environment_string(cpu, tmps, &addr); + + snprintf(tmps, sizeof(tmps), "bitmap=0x%x", (uint32_t)(( + DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) + & 0xffffffffULL)); + tmps[sizeof(tmps)-1] = '\0'; + add_environment_string(cpu, tmps, &addr); + + snprintf(tmps, sizeof(tmps), "bitmaplen=0x%x", + machine->physical_ram_in_mb * 1048576 / 4096 / 8); + tmps[sizeof(tmps)-1] = '\0'; + add_environment_string(cpu, tmps, &addr); + } - snprintf(tmps, sizeof(tmps), "boot=%s", bootarg); - tmps[sizeof(tmps)-1] = '\0'; - add_environment_string(cpu, tmps, &addr); - - snprintf(tmps, sizeof(tmps), "bitmap=0x%x", (uint32_t)(( - DEC_MEMMAP_ADDR + sizeof(memmap.pagesize)) - & 0xffffffffULL)); - tmps[sizeof(tmps)-1] = '\0'; - add_environment_string(cpu, tmps, &addr); - - snprintf(tmps, sizeof(tmps), "bitmaplen=0x%x", - machine->physical_ram_in_mb * 1048576 / 4096 / 8); - tmps[sizeof(tmps)-1] = '\0'; - add_environment_string(cpu, tmps, &addr); - } - - add_environment_string(cpu, "scsiid0=7", &addr); - add_environment_string(cpu, "bootmode=a", &addr); - add_environment_string(cpu, "testaction=q", &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); + add_environment_string(cpu, "scsiid0=7", &addr); + add_environment_string(cpu, "bootmode=a", &addr); + add_environment_string(cpu, "testaction=q", &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); - /* The end: */ - add_environment_string(cpu, "", &addr); + /* The end: */ + add_environment_string(cpu, "", &addr); + } break; @@ -2285,9 +2351,9 @@ /* ISA interrupt controllers: */ snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x10000020"); - machine->md_int.isa_pic_data.pic1 = device_add(machine, tmpstr); + machine->isa_pic_data.pic1 = device_add(machine, tmpstr); snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x100000a0"); - machine->md_int.isa_pic_data.pic2 = device_add(machine, tmpstr); + machine->isa_pic_data.pic2 = device_add(machine, tmpstr); machine->md_interrupt = cobalt_interrupt; dev_mc146818_init(machine, mem, 0x10000070, 0, MC146818_PC_CMOS, 4); @@ -2318,19 +2384,21 @@ 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, 12, 0, pci_dec21143_init, pci_dec21143_rr); */ - /* - * NetBSD/cobalt expects memsize in a0, but it seems that what - * it really wants is the end of memory + 0x80000000. - * - * The bootstring is stored 512 bytes before the end of - * physical ram. - */ - cpu->cd.mips.gpr[MIPS_GPR_A0] = - machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL; - bootstr = "root=/dev/hda1 ro"; - /* bootstr = "nfsroot=/usr/cobalt/"; */ - /* TODO: bootarg, and/or automagic boot device detection */ - store_string(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0] - 512, bootstr); + if (machine->prom_emulation) { + /* + * NetBSD/cobalt expects memsize in a0, but it seems that what + * it really wants is the end of memory + 0x80000000. + * + * The bootstring is stored 512 bytes before the end of + * physical ram. + */ + cpu->cd.mips.gpr[MIPS_GPR_A0] = + machine->physical_ram_in_mb * 1048576 + 0xffffffff80000000ULL; + bootstr = "root=/dev/hda1 ro"; + /* bootstr = "nfsroot=/usr/cobalt/"; */ + /* TODO: bootarg, and/or automagic boot device detection */ + store_string(cpu, cpu->cd.mips.gpr[MIPS_GPR_A0] - 512, bootstr); + } break; case MACHINE_HPCMIPS: @@ -2609,70 +2677,73 @@ machine->main_console_handle = machine->md_int.vr41xx_data->kiu_console_handle; - /* NetBSD/hpcmips and possibly others expects the following: */ - - cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ - cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 - + 0xffffffff80000000ULL - 512; /* argv */ - cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 - + 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ - - bootstr = machine->boot_kernel_filename; - store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16); - store_32bit_word(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); - store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); - - /* Special case for the Agenda VR3: */ - if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { - const int tmplen = 1000; - char *tmp = malloc(tmplen); - - cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ + if (machine->prom_emulation) { + /* NetBSD/hpcmips and possibly others expects the following: */ - 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 + 8, 0); + cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; /* argc */ + cpu->cd.mips.gpr[MIPS_GPR_A1] = machine->physical_ram_in_mb * 1048576 + + 0xffffffff80000000ULL - 512; /* argv */ + cpu->cd.mips.gpr[MIPS_GPR_A2] = machine->physical_ram_in_mb * 1048576 + + 0xffffffff80000000ULL - 256; /* ptr to hpc_bootinfo */ + + bootstr = machine->boot_kernel_filename; + store_32bit_word(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512, + 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16); + store_32bit_word(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 4, 0); + store_string(cpu, 0xffffffff80000000ULL + machine->physical_ram_in_mb * 1048576 - 512 + 16, bootstr); + + /* Special case for the Agenda VR3: */ + if (machine->machine_subtype == MACHINE_HPCMIPS_AGENDA_VR3) { + const int tmplen = 1000; + char *tmp = malloc(tmplen); + + cpu->cd.mips.gpr[MIPS_GPR_A0] = 2; /* argc */ + + 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 + 8, 0); + + snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," + "gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); + tmp[tmplen-1] = '\0'; - snprintf(tmp, tmplen, "root=/dev/rom video=vr4181fb:xres:160,yres:240,bpp:4," - "gray,hpck:3084,inv ether=0,0x03fe0300,eth0"); - tmp[tmplen-1] = '\0'; + if (!machine->use_x11) + snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); + tmp[tmplen-1] = '\0'; - if (!machine->use_x11) - snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " console=ttyS0,115200"); - tmp[tmplen-1] = '\0'; + if (machine->boot_string_argument[0]) + snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); + tmp[tmplen-1] = '\0'; - if (machine->boot_string_argument[0]) - snprintf(tmp+strlen(tmp), tmplen-strlen(tmp), " %s", machine->boot_string_argument); - tmp[tmplen-1] = '\0'; + 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); + bootarg = tmp; + } else if (machine->boot_string_argument[0]) { + cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ - bootarg = tmp; - } else if (machine->boot_string_argument[0]) { - cpu->cd.mips.gpr[MIPS_GPR_A0] ++; /* argc */ + 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 + 8, 0); - 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 + 8, 0); + store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, + machine->boot_string_argument); - store_string(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 512 + 64, - machine->boot_string_argument); + bootarg = machine->boot_string_argument; + } - bootarg = machine->boot_string_argument; + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); + store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); + store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8); + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize); + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize); + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding); + store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ + + /* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); + printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ + store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); + store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); } - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.length, sizeof(hpc_bootinfo)); - store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.magic, HPC_BOOTINFO_MAGIC); - store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_addr, 0x80000000 + hpcmips_fb_addr); - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_line_bytes, hpcmips_fb_xsize_mem * (((hpcmips_fb_bits-1)|7)+1) / 8); - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_width, hpcmips_fb_xsize); - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_height, hpcmips_fb_ysize); - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.fb_type, hpcmips_fb_encoding); - store_16bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.bi_cnuse, BI_CNUSE_BUILTIN); /* _BUILTIN or _SERIAL */ - - /* printf("hpc_bootinfo.platid_cpu = 0x%08x\n", hpc_bootinfo.platid_cpu); - printf("hpc_bootinfo.platid_machine = 0x%08x\n", hpc_bootinfo.platid_machine); */ - store_32bit_word_in_host(cpu, (unsigned char *)&hpc_bootinfo.timezone, 0); - store_buf(cpu, 0x80000000 + machine->physical_ram_in_mb * 1048576 - 256, (char *)&hpc_bootinfo, sizeof(hpc_bootinfo)); - if (hpcmips_fb_addr != 0) { dev_fb_init(machine, mem, hpcmips_fb_addr, VFB_HPCMIPS, hpcmips_fb_xsize, hpcmips_fb_ysize, @@ -2716,23 +2787,27 @@ machine->md_interrupt = ps2_interrupt; - add_symbol_name(&machine->symbol_context, - PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0, 0); - store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); - store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); - /* Set the Harddisk controller present flag, if either disk 0 or 1 is present: */ if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || diskimage_exist(machine, 1, DISKIMAGE_IDE)) { - store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); + if (machine->prom_emulation) + store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x0, 0x100); dev_ps2_spd_init(machine, mem, 0x14000000); } - store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); - { + if (machine->prom_emulation) { int tmplen = 1000; char *tmp = malloc(tmplen); + time_t timet; + struct tm *tm_ptr; + + add_symbol_name(&machine->symbol_context, + PLAYSTATION2_SIFBIOS, 0x10000, "[SIFBIOS entry]", 0, 0); + store_32bit_word(cpu, PLAYSTATION2_BDA + 0, PLAYSTATION2_SIFBIOS); + store_buf(cpu, PLAYSTATION2_BDA + 4, "PS2b", 4); + + store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x4, PLAYSTATION2_OPTARGS); if (tmp == NULL) { fprintf(stderr, "out of memory\n"); exit(1); @@ -2747,27 +2822,23 @@ bootstr = tmp; store_string(cpu, PLAYSTATION2_OPTARGS, bootstr); - } - /* TODO: netbsd's bootinfo.h, for symbolic names */ - { - time_t timet; - struct tm *tmp; + /* TODO: netbsd's bootinfo.h, for symbolic names */ /* RTC data given by the BIOS: */ timet = time(NULL) + 9*3600; /* PS2 uses Japanese time */ - tmp = gmtime(&timet); + tm_ptr = gmtime(&timet); /* TODO: are these 0- or 1-based? */ - 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 + 2, int_to_bcd(tmp->tm_min)); - 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 + 5, int_to_bcd(tmp->tm_mday)); - 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 + 7, int_to_bcd(tmp->tm_year - 100)); - } + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 1, int_to_bcd(tm_ptr->tm_sec)); + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 2, int_to_bcd(tm_ptr->tm_min)); + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 3, int_to_bcd(tm_ptr->tm_hour)); + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 5, int_to_bcd(tm_ptr->tm_mday)); + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 6, int_to_bcd(tm_ptr->tm_mon + 1)); + store_byte(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x10 + 7, int_to_bcd(tm_ptr->tm_year - 100)); - /* "BOOTINFO_PCMCIA_TYPE" in NetBSD's bootinfo.h. This contains the sbus controller type. */ - store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x1c, 2); + /* "BOOTINFO_PCMCIA_TYPE" in NetBSD's bootinfo.h. This contains the sbus controller type. */ + store_32bit_word(cpu, 0xa0000000 + machine->physical_ram_in_mb*1048576 - 0x1000 + 0x1c, 2); + } break; @@ -3130,13 +3201,6 @@ * intr 7 = MACE_PCI_BRIDGE */ -#if 0 - 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) */ -#endif - net_generate_unique_mac(machine, macaddr); eaddr_string = malloc(ETHERNET_STRING_MAXLEN); if (eaddr_string == NULL) { @@ -3158,12 +3222,18 @@ snprintf(tmpstr, sizeof(tmpstr), "ns16550 irq=%i addr=0x1f398000 addr_mult=0x100 in_use=%i name2=tty1", (1<<26) + MACE_PERIPH_SERIAL, 0); device_add(machine, tmpstr); -#if 0 - if (machine->use_x11) + + machine->main_console_handle = j; + + /* TODO: Once this works, it should be enabled + always, not just when using X! */ + if (machine->use_x11) { + 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) */ machine->main_console_handle = i; - else -#endif - machine->main_console_handle = j; + } dev_mc146818_init(machine, mem, 0x1f3a0000, (1<<8) + MACE_PERIPH_MISC, MC146818_SGI, 0x40); /* mcclock0 */ dev_zs_init(machine, mem, 0x1fbd9830, 0, 1, "zs console"); @@ -3422,7 +3492,8 @@ #if 0 Not yet. - dev_wdc_init(machine, mem, 0x900001f0ULL, 8+16 + 14, 0); + /* irq = 8+16 + 14 */ + device_add(machine, "wdc addr=0x900001f0, irq=38"); #endif break; @@ -3489,8 +3560,9 @@ 0x900000070ULL, 2, MC146818_PC_CMOS, 1); #if 0 - dev_wdc_init(machine, mem, 0x9000001f0ULL, 0, 0); - dev_wdc_init(machine, mem, 0x900000170ULL, 0, 2); + /* TODO: irq, etc */ + device_add(machine, "wdc addr=0x9000001f0, irq=0"); + device_add(machine, "wdc addr=0x900000170, irq=0"); #endif /* PC kbd */ j = dev_pckbc_init(machine, mem, 0x900000060ULL, @@ -3524,218 +3596,215 @@ * point. */ - if (machine->prom_emulation) - arcbios_init(machine, arc_wordlen == sizeof(uint64_t), + if (machine->prom_emulation) { + arcbios_init(machine, arc_wordlen == sizeof(uint64_t), 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? - */ - /* - * Boot string in ARC format: - * - * 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'; + /* + * TODO: How to build the component tree intermixed with + * the rest of device initialization? + */ - if (bootdev_id < 0 || machine->force_netboot) { - snprintf(init_bootpath, 400, "tftp()"); - } else { - /* TODO: Make this nicer. */ - if (machine->machine_type == MACHINE_SGI) { - if (machine->machine_subtype == 30) - strlcat(init_bootpath, "xio(0)pci(15)", - MACHINE_NAME_MAXBUF); - if (machine->machine_subtype == 32) - strlcat(init_bootpath, "pci(0)", - MACHINE_NAME_MAXBUF); + /* + * Boot string in ARC format: + * + * 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'; - if (diskimage_is_a_cdrom(machine, bootdev_id, - bootdev_type)) - snprintf(init_bootpath + strlen(init_bootpath), - 400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); - else - snprintf(init_bootpath + strlen(init_bootpath), - 400,"scsi(0)disk(%i)rdisk(0)partition(1)", - bootdev_id); - } + if (bootdev_id < 0 || machine->force_netboot) { + snprintf(init_bootpath, 400, "tftp()"); + } else { + /* TODO: Make this nicer. */ + if (machine->machine_type == MACHINE_SGI) { + if (machine->machine_subtype == 30) + strlcat(init_bootpath, "xio(0)pci(15)", + MACHINE_NAME_MAXBUF); + if (machine->machine_subtype == 32) + strlcat(init_bootpath, "pci(0)", + MACHINE_NAME_MAXBUF); + } + + if (diskimage_is_a_cdrom(machine, bootdev_id, + bootdev_type)) + snprintf(init_bootpath + strlen(init_bootpath), + 400,"scsi(0)cdrom(%i)fdisk(0)", bootdev_id); + else + snprintf(init_bootpath + strlen(init_bootpath), + 400,"scsi(0)disk(%i)rdisk(0)partition(1)", + bootdev_id); + } - if (machine->machine_type == MACHINE_ARC) - strlcat(init_bootpath, "\\", MACHINE_NAME_MAXBUF); + if (machine->machine_type == MACHINE_ARC) + strlcat(init_bootpath, "\\", MACHINE_NAME_MAXBUF); - bootstr = malloc(BOOTSTR_BUFLEN); - if (bootstr == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } - strlcpy(bootstr, init_bootpath, BOOTSTR_BUFLEN); - if (strlcat(bootstr, machine->boot_kernel_filename, - BOOTSTR_BUFLEN) >= BOOTSTR_BUFLEN) { - fprintf(stderr, "boot string too long?\n"); - exit(1); - } + bootstr = malloc(BOOTSTR_BUFLEN); + if (bootstr == NULL) { + fprintf(stderr, "out of memory\n"); + exit(1); + } + strlcpy(bootstr, init_bootpath, BOOTSTR_BUFLEN); + if (strlcat(bootstr, machine->boot_kernel_filename, + BOOTSTR_BUFLEN) >= BOOTSTR_BUFLEN) { + fprintf(stderr, "boot string too long?\n"); + exit(1); + } - /* Boot args., eg "-a" */ - bootarg = machine->boot_string_argument; + /* Boot args., eg "-a" */ + bootarg = machine->boot_string_argument; - /* argc, argv, envp in a0, a1, a2: */ - cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ + /* argc, argv, envp in a0, a1, a2: */ + cpu->cd.mips.gpr[MIPS_GPR_A0] = 0; /* note: argc is increased later */ - /* TODO: not needed? */ - cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) - (machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); - - /* Set up argc/argv: */ - addr = ARC_ENV_STRINGS; - addr2 = ARC_ARGV_START; - cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; - - /* bootstr: */ - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, bootstr, &addr); - cpu->cd.mips.gpr[MIPS_GPR_A0] ++; + /* TODO: not needed? */ + cpu->cd.mips.gpr[MIPS_GPR_SP] = (int64_t)(int32_t) + (machine->physical_ram_in_mb * 1048576 + 0x80000000 - 0x2080); + + /* Set up argc/argv: */ + addr = ARC_ENV_STRINGS; + addr2 = ARC_ARGV_START; + cpu->cd.mips.gpr[MIPS_GPR_A1] = addr2; - /* bootarg: */ - if (bootarg[0] != '\0') { + /* bootstr: */ store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, bootarg, &addr); + add_environment_string(cpu, bootstr, &addr); cpu->cd.mips.gpr[MIPS_GPR_A0] ++; - } - cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; + /* bootarg: */ + if (bootarg[0] != '\0') { + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, bootarg, &addr); + cpu->cd.mips.gpr[MIPS_GPR_A0] ++; + } + + cpu->cd.mips.gpr[MIPS_GPR_A2] = addr2; - /* - * Add environment variables. For each variable, add it - * as a string using add_environment_string(), and add a - * pointer to it to the ARC_ENV_POINTERS array. - */ - if (machine->use_x11) { - if (machine->machine_type == MACHINE_ARC) { + /* + * Add environment variables. For each variable, add it + * as a string using add_environment_string(), and add a + * pointer to it to the ARC_ENV_POINTERS array. + */ + if (machine->use_x11) { + if (machine->machine_type == MACHINE_ARC) { + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); + } else { + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "ConsoleOut=video()", &addr); + + /* g for graphical mode. G for graphical mode + with SGI logo visible on Irix? */ + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "console=g", &addr); + } + } else { + if (machine->machine_type == MACHINE_ARC) { + /* TODO: serial console for ARC? */ + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); + } else { + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); + + /* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "console=d", &addr); /* d2 = serial? */ + } + } + + if (machine->machine_type == MACHINE_SGI) { store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "CONSOLEIN=multi()key()keyboard()console()", &addr); + add_environment_string(cpu, "AutoLoad=No", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "CONSOLEOUT=multi()video()monitor()console()", &addr); - } else { + add_environment_string(cpu, "diskless=0", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "ConsoleIn=keyboard()", &addr); + add_environment_string(cpu, "volume=80", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "ConsoleOut=video()", &addr); + add_environment_string(cpu, "sgilogo=y", &addr); - /* g for graphical mode. G for graphical mode - with SGI logo visible on Irix? */ store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "console=g", &addr); - } - } else { - if (machine->machine_type == MACHINE_ARC) { - /* TODO: serial console for ARC? */ + add_environment_string(cpu, "monitor=h", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "CONSOLEIN=multi()serial(0)", &addr); + add_environment_string(cpu, "TimeZone=GMT", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "CONSOLEOUT=multi()serial(0)", &addr); - } else { + add_environment_string(cpu, "nogfxkbd=1", &addr); + + /* 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)); - add_environment_string(cpu, "ConsoleIn=serial(0)", &addr); + add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &addr); store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "ConsoleOut=serial(0)", &addr); - - /* 'd' or 'd2' in Irix, 'ttyS0' in Linux? */ + 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, "console=d", &addr); /* d2 = serial? */ - } - } - - 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); + 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); - /* 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)); + add_environment_string(cpu, "rbaud=9600", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "rebound=y", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "crt_option=1", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "netaddr=10.0.0.1", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "SystemPartition=pci(0)scsi(0)disk(2)rdisk(0)partition(8)", &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); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "keybd=US", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "rbaud=9600", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "rebound=y", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "crt_option=1", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "netaddr=10.0.0.1", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "cpufreq=3", &addr); + 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; + size_t mlen = strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2; + tmp = malloc(mlen); + snprintf(tmp, mlen, "OSLOADOPTIONS=%s", bootarg); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, tmp, &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "keybd=US", &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "OSLOADPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "cpufreq=3", &addr); - 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; - size_t mlen = strlen(bootarg) + strlen("OSLOADOPTIONS=") + 2; - tmp = malloc(mlen); - snprintf(tmp, mlen, "OSLOADOPTIONS=%s", bootarg); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, tmp, &addr); + store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); + add_environment_string(cpu, "SYSTEMPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); + } - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "OSLOADPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); + /* 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)); - store_pointer_and_advance(cpu, &addr2, addr, arc_wordlen==sizeof(uint64_t)); - add_environment_string(cpu, "SYSTEMPARTITION=scsi(0)cdrom(6)fdisk(0);scsi(0)disk(0)rdisk(0)partition(1)", &addr); + /* Return address: (0x20 = ReturnFromMain()) */ + cpu->cd.mips.gpr[MIPS_GPR_RA] = ARC_FIRMWARE_ENTRIES + 0x20; } - /* 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; - break; case MACHINE_MESHCUBE: @@ -3765,29 +3834,29 @@ device_add(machine, "random addr=0x1017fffc len=4"); - /* - * TODO: A Linux kernel wants "memsize" from somewhere... I - * haven't found any docs on how it is used though. - */ - - cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; - cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; - store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], - 0xa0002000ULL); - store_string(cpu, 0xa0002000ULL, "something=somethingelse"); - - cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; - store_string(cpu, 0xa0002000ULL, "hello=world\n"); + if (machine->prom_emulation) { + /* + * TODO: A Linux kernel wants "memsize" from somewhere... I + * haven't found any docs on how it is used though. + */ + cpu->cd.mips.gpr[MIPS_GPR_A0] = 1; + cpu->cd.mips.gpr[MIPS_GPR_A1] = 0xa0001000ULL; + store_32bit_word(cpu, cpu->cd.mips.gpr[MIPS_GPR_A1], + 0xa0002000ULL); + store_string(cpu, 0xa0002000ULL, "something=somethingelse"); + cpu->cd.mips.gpr[MIPS_GPR_A2] = 0xa0003000ULL; + store_string(cpu, 0xa0002000ULL, "hello=world\n"); + } break; case MACHINE_NETGEAR: - machine->machine_name = "NetGear WG602"; + machine->machine_name = "NetGear WG602v1"; if (machine->use_x11) fprintf(stderr, "WARNING! NetGear with -X is meaningless. Continuing anyway.\n"); if (machine->physical_ram_in_mb != 16) - 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"); /* * Lots of info about the IDT 79RC 32334 @@ -3820,8 +3889,8 @@ cpu->byte_order = EMUL_BIG_ENDIAN; machine->machine_name = "Sony NeWS (NET WORK STATION)"; - /* This is just a test. TODO */ - { + if (machine->prom_emulation) { + /* This is just a test. TODO */ int i; for (i=0; i<32; i++) cpu->cd.mips.gpr[i] = @@ -3850,9 +3919,9 @@ /* ISA interrupt controllers: */ snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x18000020"); - machine->md_int.isa_pic_data.pic1 = device_add(machine, tmpstr); + machine->isa_pic_data.pic1 = device_add(machine, tmpstr); snprintf(tmpstr, sizeof(tmpstr), "8259 irq=24 addr=0x180000a0"); - machine->md_int.isa_pic_data.pic2 = device_add(machine, tmpstr); + 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); @@ -4083,44 +4152,46 @@ device_add(machine, "ns16550 irq=0 addr=0x800003f8 name2=tty0"); device_add(machine, "ns16550 irq=0 addr=0x800002f8 name2=tty1 in_use=0"); + dev_pckbc_init(machine, mem, 0x80000060, PCKBC_8042, + 1, 12, machine->use_x11, 1); + if (machine->use_x11) 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, - machine->use_x11? "vga" : "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); + if (machine->prom_emulation) { + 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, + machine->use_x11? "vga" : "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); + } break; case MACHINE_PREP: @@ -4129,21 +4200,14 @@ */ machine->machine_name = "PowerPC Reference Platform"; - { - int i; - for (i=0; i<32; i++) - cpu->cd.ppc.gpr[i] = - 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; + if (machine->prom_emulation) { + /* 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; + } break; case MACHINE_MACPPC: @@ -4153,18 +4217,62 @@ */ machine->machine_name = "Macintosh (PPC)"; - /* r5 = OpenFirmware entry point */ - cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; + if (machine->prom_emulation) { + uint64_t b = 8 * 1048576, a = b - 0x800; + int i; + /* + * r3 = pointer to boot_args (for the Mach kernel). + * See http://darwinsource.opendarwin.org/10.3/ + * BootX-59/bootx.tproj/include.subproj/boot_args.h + * for more info. + */ + cpu->cd.ppc.gpr[3] = a; + store_16bit_word(cpu, a + 0x0000, 1); /* revision */ + store_16bit_word(cpu, a + 0x0002, 2); /* version */ + store_buf(cpu, a + 0x0004, machine->boot_string_argument, 256); + /* 26 dram banks; "long base; long size" */ + store_32bit_word(cpu, a + 0x0104, 0); /* base */ + store_32bit_word(cpu, a + 0x0108, machine->physical_ram_in_mb + * 256); /* size (in pages) */ + for (i=8; i<26*8; i+= 4) + store_32bit_word(cpu, a + 0x0104 + i, 0); + a += (0x104 + 26 * 8); + /* Video info: */ + store_32bit_word(cpu, a+0, 0xd0000000); /* video base */ + store_32bit_word(cpu, a+4, 0); /* display code (?) */ + store_32bit_word(cpu, a+8, 800); /* bytes per pixel row */ + store_32bit_word(cpu, a+12, 800); /* width */ + store_32bit_word(cpu, a+16, 600); /* height */ + store_32bit_word(cpu, a+20, 8); /* pixel depth */ + a += 24; + store_32bit_word(cpu, a+0, 127); /* gestalt number (TODO) */ + store_32bit_word(cpu, a+4, 0); /* device tree pointer (TODO) */ + store_32bit_word(cpu, a+8, 0); /* device tree length */ + store_32bit_word(cpu, a+12, b); /* last address of kernel data area */ + + /* r4 = "MOSX" (0x4D4F5358) */ + cpu->cd.ppc.gpr[4] = 0x4D4F5358; + /* + * r5 = OpenFirmware entry point. NOTE: See + * cpu_ppc.c for the rest of this semi-ugly hack. + */ + dev_ram_init(cpu->mem, cpu->cd.ppc.of_emul_addr, + 0x1000, DEV_RAM_RAM, 0x0); + store_32bit_word(cpu, cpu->cd.ppc.of_emul_addr, + 0x44ee0002); + cpu->cd.ppc.gpr[5] = cpu->cd.ppc.of_emul_addr; + } break; case MACHINE_DB64360: /* For playing with PMON2000 for PPC: */ machine->machine_name = "DB64360"; - machine->main_console_handle = (size_t)device_add(machine, "ns16550 irq=0 addr=0x1d000020"); + machine->main_console_handle = (size_t)device_add(machine, + "ns16550 irq=0 addr=0x1d000020 addr_mult=4"); - { + if (machine->prom_emulation) { int i; for (i=0; i<32; i++) cpu->cd.ppc.gpr[i] = @@ -4174,6 +4282,110 @@ break; #endif /* ENABLE_PPC */ +#ifdef ENABLE_SH + case MACHINE_BARESH: + /* A bare SH machine, with no devices. */ + machine->machine_name = "\"Bare\" SH machine"; + break; + + case MACHINE_TESTSH: + machine->machine_name = "SH test machine"; + + snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", + (long long)DEV_CONS_ADDRESS); + cons_data = device_add(machine, tmpstr); + machine->main_console_handle = cons_data->console_handle; + + snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", + (long long)DEV_MP_ADDRESS); + device_add(machine, tmpstr); + + fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, + 640,480, 640,480, 24, "testsh generic"); + + snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", + (long long)DEV_DISK_ADDRESS); + device_add(machine, tmpstr); + + snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", + (long long)DEV_ETHER_ADDRESS); + device_add(machine, tmpstr); + + break; + + case MACHINE_HPCSH: + /* Handheld SH-based machines: */ + machine->machine_name = "HPCsh"; + + /* TODO */ + + break; +#endif /* ENABLE_SH */ + +#ifdef ENABLE_HPPA + case MACHINE_BAREHPPA: + /* A bare HPPA machine, with no devices. */ + machine->machine_name = "\"Bare\" HPPA machine"; + break; + + case MACHINE_TESTHPPA: + machine->machine_name = "HPPA test machine"; + + snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", + (long long)DEV_CONS_ADDRESS); + cons_data = device_add(machine, tmpstr); + machine->main_console_handle = cons_data->console_handle; + + snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", + (long long)DEV_MP_ADDRESS); + device_add(machine, tmpstr); + + fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, + 640,480, 640,480, 24, "testhppa generic"); + + snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", + (long long)DEV_DISK_ADDRESS); + device_add(machine, tmpstr); + + snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", + (long long)DEV_ETHER_ADDRESS); + device_add(machine, tmpstr); + + break; +#endif /* ENABLE_HPPA */ + +#ifdef ENABLE_I960 + case MACHINE_BAREI960: + /* A bare I960 machine, with no devices. */ + machine->machine_name = "\"Bare\" i960 machine"; + break; + + case MACHINE_TESTI960: + machine->machine_name = "i960 test machine"; + + snprintf(tmpstr, sizeof(tmpstr), "cons addr=0x%llx irq=0", + (long long)DEV_CONS_ADDRESS); + cons_data = device_add(machine, tmpstr); + machine->main_console_handle = cons_data->console_handle; + + snprintf(tmpstr, sizeof(tmpstr), "mp addr=0x%llx", + (long long)DEV_MP_ADDRESS); + device_add(machine, tmpstr); + + fb = dev_fb_init(machine, mem, DEV_FB_ADDRESS, VFB_GENERIC, + 640,480, 640,480, 24, "testi960 generic"); + + snprintf(tmpstr, sizeof(tmpstr), "disk addr=0x%llx", + (long long)DEV_DISK_ADDRESS); + device_add(machine, tmpstr); + + snprintf(tmpstr, sizeof(tmpstr), "ether addr=0x%llx irq=0", + (long long)DEV_ETHER_ADDRESS); + device_add(machine, tmpstr); + + break; +#endif /* ENABLE_I960 */ + #ifdef ENABLE_SPARC case MACHINE_BARESPARC: /* A bare SPARC machine, with no devices. */ @@ -4245,23 +4457,23 @@ break; case MACHINE_ALPHA: - /* TODO: Most of these... They are used by NetBSD/alpha: */ - /* a0 = First free Page Frame Number */ - /* a1 = PFN of current Level 1 page table */ - /* a2 = Bootinfo magic */ - /* a3 = Bootinfo pointer */ - /* a4 = Bootinfo version */ - cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; - cpu->cd.alpha.r[ALPHA_A1] = 0; - cpu->cd.alpha.r[ALPHA_A2] = 0; - cpu->cd.alpha.r[ALPHA_A3] = 0; - cpu->cd.alpha.r[ALPHA_A4] = 0; - if (machine->prom_emulation) { struct rpb rpb; struct crb crb; struct ctb ctb; + /* TODO: Most of these... They are used by NetBSD/alpha: */ + /* a0 = First free Page Frame Number */ + /* a1 = PFN of current Level 1 page table */ + /* a2 = Bootinfo magic */ + /* a3 = Bootinfo pointer */ + /* a4 = Bootinfo version */ + cpu->cd.alpha.r[ALPHA_A0] = 16*1024*1024 / 8192; + cpu->cd.alpha.r[ALPHA_A1] = 0; + cpu->cd.alpha.r[ALPHA_A2] = 0; + cpu->cd.alpha.r[ALPHA_A3] = 0; + cpu->cd.alpha.r[ALPHA_A4] = 0; + /* HWRPB: Hardware Restart Parameter Block */ memset(&rpb, 0, sizeof(struct rpb)); store_64bit_word_in_host(cpu, (unsigned char *) @@ -4306,6 +4518,12 @@ switch (machine->machine_subtype) { case ST_DEC_3000_300: machine->machine_name = "DEC 3000/300"; + machine->main_console_handle = + dev_zs_init(machine, mem, 0x1b0200000ULL, + 0, 4, "serial zs"); /* serial? netbsd? */ + break; + case ST_EB164: + machine->machine_name = "EB164"; break; default:fatal("Unimplemented Alpha machine type %i\n", machine->machine_subtype); @@ -4353,8 +4571,186 @@ store_32bit_word(cpu, cpu->cd.arm.r[ARM_LR] + 8, 0xeafffffe); break; + + case MACHINE_CATS: + machine->machine_name = "CATS evaluation board"; + + if (machine->physical_ram_in_mb > 256) + fprintf(stderr, "WARNING! Real CATS machines cannot" + " have more than 256 MB RAM. Continuing anyway.\n"); + + machine->md_int.footbridge_data = + device_add(machine, "footbridge addr=0x42000000"); + machine->md_interrupt = footbridge_interrupt; + + /* NetBSD and OpenBSD clean their caches here: */ + dev_ram_init(mem, 0x50000000, 0x4000, DEV_RAM_RAM, 0); + + snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); + machine->isa_pic_data.pic1 = device_add(machine, tmpstr); + snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); + machine->isa_pic_data.pic2 = device_add(machine, tmpstr); + + device_add(machine, "pccmos addr=0x7c000070"); + + if (machine->use_x11) { + bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, + 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"); + + if (machine->prom_emulation) { + struct ebsaboot ebsaboot; + + cpu->cd.arm.r[0] = /* machine->physical_ram_in_mb */ + 7 * 1048576 - 0x1000; + + memset(&ebsaboot, 0, sizeof(struct ebsaboot)); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_magic), BT_MAGIC_NUMBER_CATS); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_vargp), 0); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_pargp), 0); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_args), cpu->cd.arm.r[0] + + sizeof(struct ebsaboot)); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_l1), 7 * 1048576 - 32768); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_memstart), 0); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_memend), + machine->physical_ram_in_mb * 1048576); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_memavail), 7 * 1048576); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_fclk), 50 * 1000000); + store_32bit_word_in_host(cpu, (unsigned char *) + &(ebsaboot.bt_pciclk), 66 * 1000000); + /* TODO: bt_vers */ + /* TODO: bt_features */ + + store_buf(cpu, cpu->cd.arm.r[0], + (char *)&ebsaboot, sizeof(struct ebsaboot)); + store_string(cpu, cpu->cd.arm.r[0] + + sizeof(struct ebsaboot), + machine->boot_string_argument); + + arm_setup_initial_translation_table(cpu, + 7 * 1048576 - 32768); + } + break; + + case MACHINE_HPCARM: + machine->machine_name = "HPCarm"; + dev_ram_init(mem, 0xc0000000, 0x10000000, DEV_RAM_MIRROR, 0x0); + + /* TODO: Different models */ + + if (machine->prom_emulation) { + cpu->cd.arm.r[0] = 1; + cpu->cd.arm.r[ARM_SP] = 0xc000c000; + } + break; + + case MACHINE_ZAURUS: + machine->machine_name = "Zaurus"; + dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); + device_add(machine, "ns16550 irq=0 addr=0x40100000 addr_mult=4"); + /* TODO */ + if (machine->prom_emulation) { + arm_setup_initial_translation_table(cpu, 0x4000); + } + break; + + case MACHINE_NETWINDER: + machine->machine_name = "NetWinder"; + + if (machine->physical_ram_in_mb > 256) + fprintf(stderr, "WARNING! Real NetWinders cannot" + " have more than 256 MB RAM. Continuing anyway.\n"); + + machine->md_int.footbridge_data = + device_add(machine, "footbridge addr=0x42000000"); + machine->md_interrupt = footbridge_interrupt; + + snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c000020"); + machine->isa_pic_data.pic1 = device_add(machine, tmpstr); + snprintf(tmpstr, sizeof(tmpstr), "8259 irq=64 addr=0x7c0000a0"); + machine->isa_pic_data.pic2 = device_add(machine, tmpstr); + + device_add(machine, "ns16550 irq=36 addr=0x7c0003f8 name2=com0"); + device_add(machine, "ns16550 irq=35 addr=0x7c0002f8 name2=com1"); + + if (machine->use_x11) { + bus_pci_add(machine, machine->md_int.footbridge_data->pcibus, + mem, 0xc0, 8, 0, pci_igsfb_init, pci_igsfb_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; + } + + if (machine->prom_emulation) { + arm_setup_initial_translation_table(cpu, 0x4000); + } + break; + + case MACHINE_SHARK: + machine->machine_name = "Digital DNARD (\"Shark\")"; + if (machine->prom_emulation) { + arm_setup_initial_translation_table(cpu, + machine->physical_ram_in_mb * 1048576 - 65536); + + /* + * r0 = OpenFirmware entry point. NOTE: See + * cpu_arm.c for the rest of this semi-ugly hack. + */ + cpu->cd.arm.r[0] = cpu->cd.arm.of_emul_addr; + } + break; + + case MACHINE_IQ80321: + /* + * Intel IQ80321. See http://sources.redhat.com/ecos/docs-latest/redboot/iq80321.html + * for more details about the memory map. + */ + machine->machine_name = "Intel IQ80321 (ARM)"; + cpu->cd.arm.coproc[6] = arm_coproc_i80321; + cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; + device_add(machine, "ns16550 irq=0 addr=0xfe800000"); + dev_ram_init(mem, 0xa0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); + dev_ram_init(mem, 0xc0000000, 0x20000000, DEV_RAM_MIRROR, 0x0); + if (machine->prom_emulation) { + arm_setup_initial_translation_table(cpu, 0x8000); + } + break; + + case MACHINE_IYONIX: + machine->machine_name = "Iyonix"; + cpu->cd.arm.coproc[6] = arm_coproc_i80321; + cpu->cd.arm.coproc[14] = arm_coproc_i80321_14; + if (machine->prom_emulation) { + arm_setup_initial_translation_table(cpu, + machine->physical_ram_in_mb * 1048576 - 65536); + } + break; #endif /* ENABLE_ARM */ +#ifdef ENABLE_AVR + case MACHINE_BAREAVR: + /* A bare Atmel AVR machine, with no devices. */ + machine->machine_name = "\"Bare\" Atmel AVR machine"; + break; +#endif /* ENABLE_AVR */ + #ifdef ENABLE_IA64 case MACHINE_BAREIA64: machine->machine_name = "\"Bare\" IA64 machine"; @@ -4431,11 +4827,11 @@ /* Interrupt controllers: */ snprintf(tmpstr, sizeof(tmpstr), "8259 irq=16 addr=0x%llx", (long long)(X86_IO_BASE + 0x20)); - machine->md.pc.pic1 = device_add(machine, tmpstr); + 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->md.pc.pic2 = device_add(machine, tmpstr); + machine->isa_pic_data.pic2 = device_add(machine, tmpstr); } machine->md_interrupt = x86_pc_interrupt; @@ -4453,11 +4849,17 @@ /* IDE controllers: */ if (diskimage_exist(machine, 0, DISKIMAGE_IDE) || - diskimage_exist(machine, 1, DISKIMAGE_IDE)) - dev_wdc_init(machine, mem, X86_IO_BASE + 0x1f0, 14, 0); + 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)) - dev_wdc_init(machine, mem, X86_IO_BASE + 0x170, 15, 2); + 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", @@ -4602,6 +5004,18 @@ case MACHINE_BEBOX: m->physical_ram_in_mb = 64; break; + case MACHINE_CATS: + m->physical_ram_in_mb = 64; + break; + case MACHINE_ZAURUS: + m->physical_ram_in_mb = 64; + break; + case MACHINE_HPCARM: + m->physical_ram_in_mb = 32; + break; + case MACHINE_NETWINDER: + m->physical_ram_in_mb = 16; + break; case MACHINE_X86: if (m->machine_subtype == MACHINE_X86_XT) m->physical_ram_in_mb = 1; @@ -4787,7 +5201,7 @@ case MACHINE_MACPPC: switch (m->machine_subtype) { case MACHINE_MACPPC_G4: - m->cpu_name = strdup("G4e"); + m->cpu_name = strdup("PPC750"); break; case MACHINE_MACPPC_G5: m->cpu_name = strdup("PPC970"); @@ -4798,6 +5212,25 @@ m->cpu_name = strdup("PPC750"); break; + /* SH: */ + case MACHINE_BARESH: + case MACHINE_TESTSH: + case MACHINE_HPCSH: + m->cpu_name = strdup("SH"); + break; + + /* HPPA: */ + case MACHINE_BAREHPPA: + case MACHINE_TESTHPPA: + m->cpu_name = strdup("HPPA"); + break; + + /* i960: */ + case MACHINE_BAREI960: + case MACHINE_TESTI960: + m->cpu_name = strdup("i960"); + break; + /* SPARC: */ case MACHINE_BARESPARC: case MACHINE_TESTSPARC: @@ -4815,7 +5248,25 @@ /* ARM: */ case MACHINE_BAREARM: case MACHINE_TESTARM: - m->cpu_name = strdup("ARM"); + case MACHINE_HPCARM: + m->cpu_name = strdup("SA1110"); + break; + case MACHINE_IQ80321: + case MACHINE_IYONIX: + m->cpu_name = strdup("80321_600_B0"); + break; + case MACHINE_CATS: + case MACHINE_NETWINDER: + case MACHINE_SHARK: + m->cpu_name = strdup("SA110"); + break; + case MACHINE_ZAURUS: + m->cpu_name = strdup("PXA210"); + break; + + /* AVR: */ + case MACHINE_BAREAVR: + m->cpu_name = strdup("AVR"); break; /* IA64: */ @@ -5090,6 +5541,14 @@ * entries will appear in normal order when listed. :-) */ + /* Zaurus: */ + me = machine_entry_new("Zaurus (ARM)", + ARCH_ARM, MACHINE_ZAURUS, 1, 0); + me->aliases[0] = "zaurus"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* X86 machine: */ me = machine_entry_new("x86-based PC", ARCH_X86, MACHINE_X86, 2, 2); @@ -5121,6 +5580,14 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Test-machine for SH: */ + me = machine_entry_new("Test-machine for SH", ARCH_SH, + MACHINE_TESTSH, 1, 0); + me->aliases[0] = "testsh"; + if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* Test-machine for PPC: */ me = machine_entry_new("Test-machine for PPC", ARCH_PPC, MACHINE_TESTPPC, 1, 0); @@ -5153,6 +5620,22 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Test-machine for i960: */ + me = machine_entry_new("Test-machine for i960", ARCH_I960, + MACHINE_TESTI960, 1, 0); + me->aliases[0] = "testi960"; + if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + + /* Test-machine for HPPA: */ + me = machine_entry_new("Test-machine for HPPA", ARCH_HPPA, + MACHINE_TESTHPPA, 1, 0); + me->aliases[0] = "testhppa"; + if (cpu_family_ptr_by_number(ARCH_HPPA) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* Test-machine for ARM: */ me = machine_entry_new("Test-machine for ARM", ARCH_ARM, MACHINE_TESTARM, 1, 0); @@ -5243,11 +5726,18 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* NetWinder: */ + me = machine_entry_new("NetWinder", ARCH_ARM, MACHINE_NETWINDER, 1, 0); + me->aliases[0] = "netwinder"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* NetGear: */ - me = machine_entry_new("NetGear WG602", ARCH_MIPS, + me = machine_entry_new("NetGear WG602v1", ARCH_MIPS, MACHINE_NETGEAR, 2, 0); me->aliases[0] = "netgear"; - me->aliases[1] = "wg602"; + me->aliases[1] = "wg602v1"; if (cpu_family_ptr_by_number(ARCH_MIPS) != NULL) { me->next = first_machine_entry; first_machine_entry = me; } @@ -5281,6 +5771,36 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Iyonix: */ + me = machine_entry_new("Iyonix", ARCH_ARM, + MACHINE_IYONIX, 1, 0); + me->aliases[0] = "iyonix"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + + /* Intel IQ80321 (ARM): */ + me = machine_entry_new("Intel IQ80321 (ARM)", ARCH_ARM, + MACHINE_IQ80321, 1, 0); + me->aliases[0] = "iq80321"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + + /* HPCarm: */ + me = machine_entry_new("Handheld SH (HPCsh)", + ARCH_SH, MACHINE_HPCSH, 1, 2); + me->aliases[0] = "hpcsh"; + me->subtype[0] = machine_entry_subtype_new("Jornada 680", + MACHINE_HPCSH_JORNADA680, 1); + me->subtype[0]->aliases[0] = "jornada680"; + me->subtype[1] = machine_entry_subtype_new( + "Jornada 690", MACHINE_HPCSH_JORNADA690, 1); + me->subtype[1]->aliases[0] = "jornada690"; + if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* HPCmips: */ me = machine_entry_new("Handheld MIPS (HPCmips)", ARCH_MIPS, MACHINE_HPCMIPS, 1, 8); @@ -5317,6 +5837,20 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* HPCarm: */ + me = machine_entry_new("Handheld ARM (HPCarm)", + ARCH_ARM, MACHINE_HPCARM, 1, 2); + me->aliases[0] = "hpcarm"; + me->subtype[0] = machine_entry_subtype_new("Ipaq", + MACHINE_HPCARM_IPAQ, 1); + me->subtype[0]->aliases[0] = "ipaq"; + me->subtype[1] = machine_entry_subtype_new( + "Jornada 720", MACHINE_HPCARM_JORNADA720, 1); + me->subtype[1]->aliases[0] = "jornada720"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* Generic "bare" X86 machine: */ me = machine_entry_new("Generic \"bare\" X86 machine", ARCH_X86, MACHINE_BAREX86, 1, 0); @@ -5333,6 +5867,14 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Generic "bare" SH machine: */ + me = machine_entry_new("Generic \"bare\" SH machine", ARCH_SH, + MACHINE_BARESH, 1, 0); + me->aliases[0] = "baresh"; + if (cpu_family_ptr_by_number(ARCH_SH) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* Generic "bare" PPC machine: */ me = machine_entry_new("Generic \"bare\" PPC machine", ARCH_PPC, MACHINE_BAREPPC, 1, 0); @@ -5365,6 +5907,30 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Generic "bare" i960 machine: */ + me = machine_entry_new("Generic \"bare\" i960 machine", ARCH_I960, + MACHINE_BAREI960, 1, 0); + me->aliases[0] = "barei960"; + if (cpu_family_ptr_by_number(ARCH_I960) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + + /* Generic "bare" HPPA machine: */ + me = machine_entry_new("Generic \"bare\" HPPA machine", ARCH_HPPA, + MACHINE_BAREHPPA, 1, 0); + me->aliases[0] = "barehppa"; + if (cpu_family_ptr_by_number(ARCH_HPPA) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + + /* Generic "bare" Atmel AVR machine: */ + me = machine_entry_new("Generic \"bare\" Atmel AVR machine", ARCH_AVR, + MACHINE_BAREAVR, 1, 0); + me->aliases[0] = "bareavr"; + if (cpu_family_ptr_by_number(ARCH_AVR) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* Generic "bare" ARM machine: */ me = machine_entry_new("Generic \"bare\" ARM machine", ARCH_ARM, MACHINE_BAREARM, 1, 0); @@ -5398,6 +5964,15 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* Digital DNARD ("Shark"): */ + me = machine_entry_new("Digital DNARD (\"Shark\")", ARCH_ARM, + MACHINE_SHARK, 2, 0); + me->aliases[0] = "shark"; + me->aliases[1] = "dnard"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* DECstation: */ me = machine_entry_new("DECstation/DECsystem", ARCH_MIPS, MACHINE_DEC, 3, 9); @@ -5465,6 +6040,14 @@ me->next = first_machine_entry; first_machine_entry = me; } + /* CATS (ARM) evaluation board: */ + me = machine_entry_new("CATS evaluation board (ARM)", ARCH_ARM, + MACHINE_CATS, 1, 0); + me->aliases[0] = "cats"; + if (cpu_family_ptr_by_number(ARCH_ARM) != NULL) { + me->next = first_machine_entry; first_machine_entry = me; + } + /* BeBox: (NetBSD/bebox) */ me = machine_entry_new("BeBox", ARCH_PPC, MACHINE_BEBOX, 1, 0); me->aliases[0] = "bebox"; @@ -5531,11 +6114,14 @@ } /* Alpha: */ - me = machine_entry_new("Alpha", ARCH_ALPHA, MACHINE_ALPHA, 1, 1); + me = machine_entry_new("Alpha", ARCH_ALPHA, MACHINE_ALPHA, 1, 2); me->aliases[0] = "alpha"; me->subtype[0] = machine_entry_subtype_new( "DEC 3000/300", ST_DEC_3000_300, 1); me->subtype[0]->aliases[0] = "3000/300"; + me->subtype[1] = machine_entry_subtype_new( + "EB164", ST_EB164, 1); + me->subtype[1]->aliases[0] = "eb164"; if (cpu_family_ptr_by_number(ARCH_ALPHA) != NULL) { me->next = first_machine_entry; first_machine_entry = me; }