qdev scsi bus infrastructure
[qemu] / hw / realview.c
index acf3b9e..74fd9d8 100644 (file)
 
 static struct arm_boot_info realview_binfo = {
     .loader_start = 0x0,
+    .smp_loader_start = 0x80000000,
     .board_id = 0x33b,
 };
 
-static void realview_init(int ram_size, int vga_ram_size,
-                     const char *boot_device, DisplayState *ds,
+static void realview_init(ram_addr_t ram_size,
+                     const char *boot_device,
                      const char *kernel_filename, const char *kernel_cmdline,
                      const char *initrd_filename, const char *cpu_model)
 {
     CPUState *env;
+    ram_addr_t ram_offset;
     qemu_irq *pic;
     void *scsi_hba;
     PCIBus *pci_bus;
@@ -64,9 +66,10 @@ static void realview_init(int ram_size, int vga_ram_size,
         }
     }
 
-    /* ??? RAM shoud repeat to fill physical memory space.  */
+    ram_offset = qemu_ram_alloc(ram_size);
+    /* ??? RAM should repeat to fill physical memory space.  */
     /* SDRAM at address zero.  */
-    cpu_register_physical_memory(0, ram_size, IO_MEM_RAM);
+    cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM);
 
     arm_sysctl_init(0x10000000, 0xc1400400);
 
@@ -93,7 +96,7 @@ static void realview_init(int ram_size, int vga_ram_size,
     sp804_init(0x10011000, pic[4]);
     sp804_init(0x10012000, pic[5]);
 
-    pl110_init(ds, 0x10020000, pic[23], 1);
+    pl110_init(0x10020000, pic[23], 1);
 
     index = drive_get_index(IF_SD, 0, 0);
     if (index == -1) {
@@ -121,12 +124,12 @@ static void realview_init(int ram_size, int vga_ram_size,
     }
     for(n = 0; n < nb_nics; n++) {
         nd = &nd_table[n];
-        if (!nd->model)
-            nd->model = done_smc ? "rtl8139" : "smc91c111";
-        if (strcmp(nd->model, "smc91c111") == 0) {
+
+        if ((!nd->model && !done_smc) || strcmp(nd->model, "smc91c111") == 0) {
             smc91c111_init(nd, 0x4e000000, pic[28]);
+            done_smc = 1;
         } else {
-            pci_nic_init(pci_bus, nd, -1);
+            pci_nic_init(pci_bus, nd, -1, "rtl8139");
         }
     }
 
@@ -182,22 +185,24 @@ static void realview_init(int ram_size, int vga_ram_size,
     /* 0x68000000 PCI mem 1.  */
     /* 0x6c000000 PCI mem 2.  */
 
+    /* ??? Hack to map an additional page of ram for the secondary CPU
+       startup code.  I guess this works on real hardware because the
+       BootROM happens to be in ROM/flash or in memory that isn't clobbered
+       until after Linux boots the secondary CPUs.  */
+    ram_offset = qemu_ram_alloc(0x1000);
+    cpu_register_physical_memory(0x80000000, 0x1000, ram_offset | IO_MEM_RAM);
+
     realview_binfo.ram_size = ram_size;
     realview_binfo.kernel_filename = kernel_filename;
     realview_binfo.kernel_cmdline = kernel_cmdline;
     realview_binfo.initrd_filename = initrd_filename;
     realview_binfo.nb_cpus = ncpu;
     arm_load_kernel(first_cpu, &realview_binfo);
-
-    /* ??? Hack to map an additional page of ram for the secondary CPU
-       startup code.  I guess this works on real hardware because the
-       BootROM happens to be in ROM/flash or in memory that isn't clobbered
-       until after Linux boots the secondary CPUs.  */
-    cpu_register_physical_memory(0x80000000, 0x1000, IO_MEM_RAM + ram_size);
 }
 
 QEMUMachine realview_machine = {
-    "realview",
-    "ARM RealView Emulation Baseboard (ARM926EJ-S)",
-    realview_init
+    .name = "realview",
+    .desc = "ARM RealView Emulation Baseboard (ARM926EJ-S)",
+    .init = realview_init,
+    .use_scsi = 1,
 };