Commit ad6fe1d2d96699e82d0b8b4f6fa4326c198a1d1a
1 parent
2ca9d013
Acer Pica 61 machine, by Herve Poussineau.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2687 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
182 additions
and
2 deletions
Makefile.target
| ... | ... | @@ -425,7 +425,8 @@ VL_OBJS+= grackle_pci.o prep_pci.o unin_pci.o |
| 425 | 425 | CPPFLAGS += -DHAS_AUDIO |
| 426 | 426 | endif |
| 427 | 427 | ifeq ($(TARGET_BASE_ARCH), mips) |
| 428 | -VL_OBJS+= mips_r4k.o mips_malta.o mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o | |
| 428 | +VL_OBJS+= mips_r4k.o mips_malta.o mips_pica61.o | |
| 429 | +VL_OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o | |
| 429 | 430 | VL_OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o |
| 430 | 431 | VL_OBJS+= piix_pci.o parallel.o mixeng.o cirrus_vga.o $(SOUND_HW) $(AUDIODRV) |
| 431 | 432 | CPPFLAGS += -DHAS_AUDIO | ... | ... |
hw/mips_pica61.c
0 → 100644
| 1 | +/* | |
| 2 | + * QEMU Malta board support | |
| 3 | + * | |
| 4 | + * Copyright (c) 2007 Hervé Poussineau | |
| 5 | + * | |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| 7 | + * of this software and associated documentation files (the "Software"), to deal | |
| 8 | + * in the Software without restriction, including without limitation the rights | |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| 10 | + * copies of the Software, and to permit persons to whom the Software is | |
| 11 | + * furnished to do so, subject to the following conditions: | |
| 12 | + * | |
| 13 | + * The above copyright notice and this permission notice shall be included in | |
| 14 | + * all copies or substantial portions of the Software. | |
| 15 | + * | |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | |
| 19 | + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
| 22 | + * THE SOFTWARE. | |
| 23 | + */ | |
| 24 | + | |
| 25 | +#include "vl.h" | |
| 26 | + | |
| 27 | +#ifdef TARGET_WORDS_BIGENDIAN | |
| 28 | +#define BIOS_FILENAME "mips_bios.bin" | |
| 29 | +#else | |
| 30 | +#define BIOS_FILENAME "mipsel_bios.bin" | |
| 31 | +#endif | |
| 32 | + | |
| 33 | +#ifdef TARGET_MIPS64 | |
| 34 | +#define PHYS_TO_VIRT(x) ((x) | ~0x7fffffffULL) | |
| 35 | +#else | |
| 36 | +#define PHYS_TO_VIRT(x) ((x) | ~0x7fffffffU) | |
| 37 | +#endif | |
| 38 | + | |
| 39 | +#define VIRT_TO_PHYS_ADDEND (-((int64_t)(int32_t)0x80000000)) | |
| 40 | + | |
| 41 | +static const int ide_iobase[2] = { 0x1f0, 0x170 }; | |
| 42 | +static const int ide_iobase2[2] = { 0x3f6, 0x376 }; | |
| 43 | +static const int ide_irq[2] = { 14, 15 }; | |
| 44 | + | |
| 45 | +static uint32_t serial_base[MAX_SERIAL_PORTS] = { 0x80006000, 0x80007000 }; | |
| 46 | +static int serial_irq[MAX_SERIAL_PORTS] = { 8, 9 }; | |
| 47 | + | |
| 48 | +extern FILE *logfile; | |
| 49 | + | |
| 50 | +static void main_cpu_reset(void *opaque) | |
| 51 | +{ | |
| 52 | + CPUState *env = opaque; | |
| 53 | + cpu_reset(env); | |
| 54 | +} | |
| 55 | + | |
| 56 | +static | |
| 57 | +void mips_pica61_init (int ram_size, int vga_ram_size, int boot_device, | |
| 58 | + DisplayState *ds, const char **fd_filename, int snapshot, | |
| 59 | + const char *kernel_filename, const char *kernel_cmdline, | |
| 60 | + const char *initrd_filename, const char *cpu_model) | |
| 61 | +{ | |
| 62 | + char buf[1024]; | |
| 63 | + unsigned long bios_offset; | |
| 64 | + int bios_size; | |
| 65 | + CPUState *env; | |
| 66 | + int i; | |
| 67 | + mips_def_t *def; | |
| 68 | + int available_ram; | |
| 69 | + qemu_irq *i8259; | |
| 70 | + | |
| 71 | + /* init CPUs */ | |
| 72 | + if (cpu_model == NULL) { | |
| 73 | +#ifdef TARGET_MIPS64 | |
| 74 | + cpu_model = "R4000"; | |
| 75 | +#else | |
| 76 | + cpu_model = "4KEc"; | |
| 77 | +#endif | |
| 78 | + } | |
| 79 | + if (mips_find_by_name(cpu_model, &def) != 0) | |
| 80 | + def = NULL; | |
| 81 | + env = cpu_init(); | |
| 82 | + cpu_mips_register(env, def); | |
| 83 | + register_savevm("cpu", 0, 3, cpu_save, cpu_load, env); | |
| 84 | + qemu_register_reset(main_cpu_reset, env); | |
| 85 | + | |
| 86 | + /* allocate RAM (limited to 256 MB) */ | |
| 87 | + if (ram_size < 256 * 1024 * 1024) | |
| 88 | + available_ram = ram_size; | |
| 89 | + else | |
| 90 | + available_ram = 256 * 1024 * 1024; | |
| 91 | + cpu_register_physical_memory(0, available_ram, IO_MEM_RAM); | |
| 92 | + | |
| 93 | + /* load a BIOS image */ | |
| 94 | + bios_offset = ram_size + vga_ram_size; | |
| 95 | + snprintf(buf, sizeof(buf), "%s/%s", bios_dir, BIOS_FILENAME); | |
| 96 | + bios_size = load_image(buf, phys_ram_base + bios_offset); | |
| 97 | + if ((bios_size <= 0) || (bios_size > BIOS_SIZE)) { | |
| 98 | + /* fatal */ | |
| 99 | + fprintf(stderr, "qemu: Error, could not load MIPS bios '%s'\n", | |
| 100 | + buf); | |
| 101 | + exit(1); | |
| 102 | + } | |
| 103 | + cpu_register_physical_memory(0x1fc00000, | |
| 104 | + BIOS_SIZE, bios_offset | IO_MEM_ROM); | |
| 105 | + | |
| 106 | + /* Device map | |
| 107 | + * | |
| 108 | + * addr 0xe0004000: mc146818 | |
| 109 | + * addr 0xe0005000 intr 6: ps2 keyboard | |
| 110 | + * addr 0xe0005000 intr 7: ps2 mouse | |
| 111 | + * addr 0xe0006000 intr 8: ns16550a, | |
| 112 | + * addr 0xe0007000 intr 9: ns16550a | |
| 113 | + * isa_io_base 0xe2000000 isa_mem_base 0xe3000000 | |
| 114 | + */ | |
| 115 | + | |
| 116 | + /* Init CPU internal devices */ | |
| 117 | + cpu_mips_irq_init_cpu(env); | |
| 118 | + cpu_mips_clock_init(env); | |
| 119 | + cpu_mips_irqctrl_init(); | |
| 120 | + | |
| 121 | + /* Register 64 KB of ISA IO space at 0x10000000 */ | |
| 122 | + isa_mmio_init(0x10000000, 0x00010000); | |
| 123 | + isa_mem_base = 0x11000000; | |
| 124 | + | |
| 125 | + /* PC style IRQ (i8259/i8254) and DMA (i8257) */ | |
| 126 | + /* The PIC is attached to the MIPS CPU INT0 pin */ | |
| 127 | + i8259 = i8259_init(env->irq[2]); | |
| 128 | + rtc_mm_init(0x80004070, i8259[14]); | |
| 129 | + pit_init(0x40, 0); | |
| 130 | + | |
| 131 | + /* Keyboard (i8042) */ | |
| 132 | + i8042_mm_init(i8259[6], i8259[7], 0x80005060, 0); | |
| 133 | + | |
| 134 | + /* IDE controller */ | |
| 135 | + for(i = 0; i < 2; i++) | |
| 136 | + isa_ide_init(ide_iobase[i], ide_iobase2[i], i8259[ide_irq[i]], | |
| 137 | + bs_table[2 * i], bs_table[2 * i + 1]); | |
| 138 | + | |
| 139 | + /* Network controller */ | |
| 140 | + /* FIXME: missing NS SONIC DP83932 */ | |
| 141 | + | |
| 142 | + /* SCSI adapter */ | |
| 143 | + /* FIXME: missing NCR 53C94 */ | |
| 144 | + | |
| 145 | + /* ISA devices (floppy, serial, parallel) */ | |
| 146 | + fdctrl_init(i8259[1], 1, 1, 0x80003000, fd_table); | |
| 147 | + for(i = 0; i < MAX_SERIAL_PORTS; i++) { | |
| 148 | + if (serial_hds[i]) { | |
| 149 | + serial_mm_init(serial_base[i], 0, i8259[serial_irq[i]], serial_hds[i], 1); | |
| 150 | + } | |
| 151 | + } | |
| 152 | + for (i = 0; i < MAX_PARALLEL_PORTS; i++) { | |
| 153 | + if (parallel_hds[i]) { | |
| 154 | + /* FIXME: memory mapped! parallel_init(0x80008000, i8259[17], parallel_hds[i]); */ | |
| 155 | + } | |
| 156 | + } | |
| 157 | + | |
| 158 | + /* Sound card */ | |
| 159 | + /* FIXME: missing Jazz sound, IRQ 18 */ | |
| 160 | + | |
| 161 | + /* LED indicator */ | |
| 162 | + /* FIXME: missing LED indicator */ | |
| 163 | + | |
| 164 | + /* NVRAM */ | |
| 165 | + ds1225y_init(0x80009000, "nvram"); | |
| 166 | + | |
| 167 | + /* Video card */ | |
| 168 | + //isa_vga_init(ds, phys_ram_base + ram_size, ram_size, vga_ram_size); | |
| 169 | +} | |
| 170 | + | |
| 171 | +QEMUMachine mips_pica61_machine = { | |
| 172 | + "pica61", | |
| 173 | + "Acer Pica 61", | |
| 174 | + mips_pica61_init, | |
| 175 | +}; | ... | ... |
vl.c
| ... | ... | @@ -6697,6 +6697,7 @@ void register_machines(void) |
| 6697 | 6697 | #elif defined(TARGET_MIPS) |
| 6698 | 6698 | qemu_register_machine(&mips_machine); |
| 6699 | 6699 | qemu_register_machine(&mips_malta_machine); |
| 6700 | + qemu_register_machine(&mips_pica61_machine); | |
| 6700 | 6701 | #elif defined(TARGET_SPARC) |
| 6701 | 6702 | #ifdef TARGET_SPARC64 |
| 6702 | 6703 | qemu_register_machine(&sun4u_machine); | ... | ... |
vl.h
| ... | ... | @@ -1136,9 +1136,12 @@ extern QEMUMachine mips_machine; |
| 1136 | 1136 | /* mips_malta.c */ |
| 1137 | 1137 | extern QEMUMachine mips_malta_machine; |
| 1138 | 1138 | |
| 1139 | -/* mips_int */ | |
| 1139 | +/* mips_int.c */ | |
| 1140 | 1140 | extern void cpu_mips_irq_init_cpu(CPUState *env); |
| 1141 | 1141 | |
| 1142 | +/* mips_pica61.c */ | |
| 1143 | +extern QEMUMachine mips_pica61_machine; | |
| 1144 | + | |
| 1142 | 1145 | /* mips_timer.c */ |
| 1143 | 1146 | extern void cpu_mips_clock_init(CPUState *); |
| 1144 | 1147 | extern void cpu_mips_irqctrl_init (void); | ... | ... |