Add MIPS Magnum R4000 machine
PATCH 2/6 Add MIPS Magnum R4000 machine
Attached patch adds support for a 'magnum' machine. Firmware can start and show POST screen.
Index: Makefile.target
===================================================================
RCS file: /sources/qemu/qemu/Makefile.target,v
retrieving revision 1.247
Makefile.target +5 -5
@@ -554,14 +554,14 @@ OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc405_uc.o ppc405_boards.o endif ifeq ($(TARGET_BASE_ARCH), mips) -OBJS+= mips_r4k.o mips_malta.o mips_pica61.o mips_mipssim.o -OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o -OBJS+= jazz_led.o +OBJS+= mips_r4k.o mips_jazz.o mips_malta.o mips_pica61.o mips_mipssim.o +OBJS+= mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o +OBJS+= g364fb.o jazz_led.o OBJS+= ide.o gt64xxx.o pckbd.o ps2.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o -OBJS+= piix_pci.o parallel.o cirrus_vga.o $(SOUND_HW) +OBJS+= piix_pci.o parallel.o cirrus_vga.o pcspk.o $(SOUND_HW) OBJS+= mipsnet.o OBJS+= pflash_cfi01.o -CPPFLAGS += -DHAS_AUDIO +CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE endif ifeq ($(TARGET_BASE_ARCH), cris) OBJS+= etraxfs.o
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.406
vl.c +2 -2
@@ -26,7 +26,6 @@#include "hw/usb.h" #include "hw/pcmcia.h" #include "hw/pc.h" -#include "hw/fdc.h" #include "hw/audiodev.h" #include "hw/isa.h" #include "net.h"
@@ -7976,6 +7975,7 @@qemu_register_machine (&taihu_machine);#elif defined(TARGET_MIPS )qemu_register_machine (&mips_machine); +qemu_register_machine (&mips_magnum_machine);qemu_register_machine (&mips_malta_machine);qemu_register_machine (&mips_pica61_machine);qemu_register_machine (&mips_mipssim_machine);
@@ -8025,7 +8025,7 @@ #ifdef HAS_AUDIO struct soundhw soundhw[] = { #ifdef HAS_AUDIO_CHOICE -#ifdef TARGET_I386 +#if defined(TARGET_I386) || defined(TARGET_MIPS) { "pcspk", "PC speaker",
Index: hw/boards.h
===================================================================
RCS file: /sources/qemu/qemu/hw/boards.h,v
retrieving revision 1.7
boards.h +4 -3
@@ -36,12 +36,13 @@/* mips_r4k.c */ extern QEMUMachine mips_machine; +/* mips_jazz.c */ +extern QEMUMachine mips_magnum_machine; +extern QEMUMachine mips_pica61_machine; +/* mips_malta.c */ extern QEMUMachine mips_malta_machine; -/* mips_pica61.c */ -extern QEMUMachine mips_pica61_machine; -/* mips_mipssim.c */ extern QEMUMachine mips_mipssim_machine;
Index: hw/mips.h
===================================================================
RCS file: /sources/qemu/qemu/hw/mips.h,v
retrieving revision 1.1
mips.h +8 -0
@@ -9,6 +9,11 @@typedef struct ds1225y_t ds1225y_t ;ds1225y_t *ds1225y_init (target_phys_addr_t mem_base,const char *filename); +/* g364fb.c */ +int g364fb_mm_init (DisplayState *ds,uint8_t *vga_vram_base, +int vram_size,int it_shift, +target_phys_addr_t vram_base,target_phys_addr_t ctrl_base); +/* mipsnet.c */ void mipsnet_init (int base,qemu_irq irq,NICInfo *nd);
@@ -22,4 +27,7 @@extern void cpu_mips_clock_init (CPUState *);extern void cpu_mips_irqctrl_init (void ); +/* rc4030.c */ +qemu_irq *rc4030_init (qemu_irq timer,qemu_irq jazz_bus); +#endif
mips_jazz.c +288 -0
288 lines not on this page · raw message
rc4030.c +570 -0
570 lines not on this page · raw message
pit = pit_init(0x40, i8259[0]);
+ pcspk_init(pit);
+
+ /* ISA IO space at 0x90000000 */ + isa_mmio_init(0x90000000, 0x01000000); + isa_mem_base = 0x11000000;
+
+ /* Video card */
+ if (!nographic) {
+ switch (jazz_model) {
+ case JAZZ_MAGNUM:
+ g364fb_mm_init(ds, phys_ram_base + ram_size, vga_ram_size, 0, 0x40000000, 0x60000000);
+ break;
+ default: break;
+ }
+ }
+
+ /* Floppy */
+ if (drive_get_max_bus(IF_FLOPPY) >= MAX_FD) {
+ fprintf(stderr, "qemu: too many floppy drives\n");
+ exit(1);
+ }
+ for (n = 0; n < MAX_FD; n++) {
+ int fd = drive_get_index(IF_FLOPPY, 0, n);
+ if (fd != -1)
+ fds[n] = drives_table[fd].bdrv;
+ else
+ fds[n] = NULL;
+ }
+ fdctrl_init(rc4030[1], 0, 1, 0x80003000, fds);
+
+ /* Real time clock */ + rtc_init(0x70, i8259[8]); + s_rtc = cpu_register_io_memory(0, rtc_read, rtc_write, env); + cpu_register_physical_memory(0x80004000, 0x00001000, s_rtc);
+
+ /* Keyboard (i8042) */
+ i8042_mm_init(rc4030[6], rc4030[7], 0x80005000, 0);
+
+ /* Serial ports */ + if (serial_hds[0]) serial_mm_init(0x80006000, 0, rc4030[8], serial_hds[0], 1); + if (serial_hds[1]) serial_mm_init(0x80007000, 0, rc4030[9], serial_hds[1], 1);
+
+ /* Parallel port */
+ if (parallel_hds[0]) parallel_mm_init(0x80008000, 0, rc4030[0], parallel_hds[0]);
+
+ /* Sound card */
+ /* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */
+#ifdef HAS_AUDIO
+ audio_init(i8259);
+#endif
+
+ /* NVRAM: Unprotected at 0x9000, Protected at 0xa000, Read only at 0xb000 */
+ ds1225y_init(0x80009000, "nvram");
+
+ /* LED indicator */
+ jazz_led_init(ds, 0x8000f000);
+}
+
+static
+void mips_magnum_init (int ram_size, int vga_ram_size,
+ const char *boot_device, DisplayState *ds, + const char *kernel_filename, const char *kernel_cmdline, + const char *initrd_filename, const char *cpu_model)
+{
+ mips_jazz_init(ram_size, vga_ram_size, ds, cpu_model, JAZZ_MAGNUM);
+}
+
+QEMUMachine mips_magnum_machine = {
+ "magnum", + "MIPS Magnum", + mips_magnum_init,
+};