Skip to contentSkip to conversation

versatile AB board support

PATCH New Jason Wessel 1 participant 1 message Apr 27, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 versatile AB board support

Paul Brook did all the hard work for the Versatile PB.

The Versatile AB is quite similar to the PB but has a different expansion bus and flash. This patch adds Versatile AB support so you can boot an unmodified ARM Versatile AB kernel.

Signed-off-by [email protected]

Thanks,
Jason.

hw/versatilepb.c +31 -0
Index: qemu/hw/versatilepb.c
===================================================================
@@ -314,8 +314,39 @@ static void vpb_init(int ram_size, int v
     set_kernel_args(ram_size, initrd_size, kernel_cmdline);
 }
 
+static void vab_init(int ram_size, int vga_ram_size, int boot_device,
+                     DisplayState *ds, const char **fd_filename, int snapshot,
+                     const char *kernel_filename, const char *kernel_cmdline,
+                     const char *initrd_filename)
+{
+	/* The versatile AB is mostly the same board as the versatile PB
+	 * but with a different machine number.  IE: 926ejs core with the
+	 * same core perpheriphals (ethernet/serial/vga/keyboard/mouse).
+	 * Later the flash and the different I/O devices could be added
+	 * here.  For now, this allows an unmodified versatile AB kernel
+	 * to boot.
+	 */
+	int n;
+	vpb_init(ram_size, vga_ram_size, boot_device,
+			 ds, fd_filename, snapshot,
+			 kernel_filename, kernel_cmdline,
+			 initrd_filename);
+	/* The versatile/AB needs 0x25e for the machine number */
+	bootloader[1] = 0xe3a0105e; /* mov     r1, #0x5e */
+	bootloader[2] = 0xe3811c02; /* orr     r1, r1, #0x200 */
+    for (n = 0; n < sizeof(bootloader) / 4; n++)
+        stl_raw(phys_ram_base + (n * 4), bootloader[n]);
+
+}
+
 QEMUMachine versatilepb_machine = {
     "versatilepb",
     "ARM Versatile/PB (ARM926EJ-S)",
     vpb_init,
 };
+
+QEMUMachine versatileab_machine = {
+    "versatileab",
+    "ARM Versatile/AB (ARM926EJ-S)",
+    vab_init,
+};
vl.c +1 -0
Index: qemu/vl.c
===================================================================
@@ -4863,6 +4863,7 @@ void register_machines(void)
     qemu_register_machine(&integratorcp926_machine);
     qemu_register_machine(&integratorcp1026_machine);
     qemu_register_machine(&versatilepb_machine);
+    qemu_register_machine(&versatileab_machine);
 #else
 #error unsupported CPU
 #endif
vl.h +1 -0
Index: qemu/vl.h
===================================================================
@@ -984,6 +984,7 @@ extern QEMUMachine integratorcp1026_mach
 
 /* versatilepb.c */
 extern QEMUMachine versatilepb_machine;
+extern QEMUMachine versatileab_machine;
 
 /* ps2.c */
 void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg);