qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] Integrator machine config
Date: Wed, 10 Jun 2009 18:38:37 +0100	[thread overview]
Message-ID: <20090610173837.4674.9252.stgit@wren.home> (raw)
In-Reply-To: <20090610173803.4674.82538.stgit@wren.home>

Replace integrator board with machine config

Signed-off-by: Paul Brook <paul@codesourcery.com>
---

 Makefile                         |    2 -
 hw/arm_timer.c                   |    2 -
 hw/integratorcp.c                |   97 ++++------------------------------
 pc-bios/boards/integrator-cp.dts |  110 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 124 insertions(+), 87 deletions(-)
 create mode 100644 pc-bios/boards/integrator-cp.dts

diff --git a/Makefile b/Makefile
index 48a3ec3..5cc346e 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ endif
 #######################################################################
 # Board descriptions
 
-BOARDS = syborg lm3s811evb lm3s6965evb
+BOARDS = syborg lm3s811evb lm3s6965evb integrator-cp
 
 ifdef DTC
 BOARDS_BIN = $(BOARDS:%=pc-bios/boards/%.dtb)
diff --git a/hw/arm_timer.c b/hw/arm_timer.c
index 226ecc4..6570929 100644
--- a/hw/arm_timer.c
+++ b/hw/arm_timer.c
@@ -347,7 +347,7 @@ static void icp_pit_init(SysBusDevice *dev)
 
 static void arm_timer_register_devices(void)
 {
-    sysbus_register_dev("integrator_pit", sizeof(icp_pit_state), icp_pit_init);
+    sysbus_register_dev("integrator-pit", sizeof(icp_pit_state), icp_pit_init);
     sysbus_register_dev("sp804", sizeof(sp804_state), sp804_init);
 }
 
diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index b6fbe15..849f0b4 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -429,104 +429,31 @@ static CPUWriteMemoryFunc *icp_control_writefn[] = {
    icp_control_write
 };
 
-static void icp_control_init(uint32_t base)
+static void icp_control_init(SysBusDevice *dev)
 {
     int iomemtype;
 
     iomemtype = cpu_register_io_memory(0, icp_control_readfn,
                                        icp_control_writefn, NULL);
-    cpu_register_physical_memory(base, 0x00800000, iomemtype);
+    sysbus_init_mmio(dev, 0x00800000, iomemtype);
     /* ??? Save/restore.  */
 }
 
-
-/* Board init.  */
-
-static struct arm_boot_info integrator_binfo = {
-    .loader_start = 0x0,
-    .board_id = 0x113,
-};
-
-static void integratorcp_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[32];
-    qemu_irq *cpu_pic;
-    DeviceState *dev;
-    int i;
-
-    if (!cpu_model)
-        cpu_model = "arm926";
-    env = cpu_init(cpu_model);
-    if (!env) {
-        fprintf(stderr, "Unable to find CPU definition\n");
-        exit(1);
-    }
-    ram_offset = qemu_ram_alloc(ram_size);
-    /* ??? On a real system the first 1Mb is mapped as SSRAM or boot flash.  */
-    /* ??? RAM should repeat to fill physical memory space.  */
-    /* SDRAM at address zero*/
-    cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM);
-    /* And again at address 0x80000000 */
-    cpu_register_physical_memory(0x80000000, ram_size, ram_offset | IO_MEM_RAM);
-
-    dev = qdev_create(NULL, "integrator_core");
-    qdev_set_prop_int(dev, "memsz", ram_size >> 20);
-    qdev_init(dev);
-    sysbus_mmio_map((SysBusDevice *)dev, 0, 0x10000000);
-
-    cpu_pic = arm_pic_init_cpu(env);
-    dev = sysbus_create_varargs("integrator_pic", 0x14000000,
-                                cpu_pic[ARM_PIC_CPU_IRQ],
-                                cpu_pic[ARM_PIC_CPU_FIQ], NULL);
-    for (i = 0; i < 32; i++) {
-        pic[i] = qdev_get_gpio_in(dev, i);
+static SysBusDeviceInfo integratorcm_info = {
+    .init = integratorcm_init,
+    .qdev.props = (DevicePropList[]) {
+        {.name = "memsz", .type = PROP_TYPE_INT},
+        {.name = NULL}
     }
-    sysbus_create_simple("integrator_pic", 0xca000000, pic[26]);
-    sysbus_create_varargs("integrator_pit", 0x13000000,
-                          pic[5], pic[6], pic[7], NULL);
-    sysbus_create_simple("pl031", 0x15000000, pic[8]);
-    sysbus_create_simple("pl011", 0x16000000, pic[1]);
-    sysbus_create_simple("pl011", 0x17000000, pic[2]);
-    icp_control_init(0xcb000000);
-    sysbus_create_simple("pl050_keyboard", 0x18000000, pic[3]);
-    sysbus_create_simple("pl050_mouse", 0x19000000, pic[4]);
-    sysbus_create_varargs("pl181", 0x1c000000, pic[23], pic[24], NULL);
-    if (nd_table[0].vlan)
-        smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
-
-    sysbus_create_simple("pl110", 0xc0000000, pic[22]);
-
-    integrator_binfo.ram_size = ram_size;
-    integrator_binfo.kernel_filename = kernel_filename;
-    integrator_binfo.kernel_cmdline = kernel_cmdline;
-    integrator_binfo.initrd_filename = initrd_filename;
-    arm_load_kernel(env, &integrator_binfo);
-}
-
-static QEMUMachine integratorcp_machine = {
-    .name = "integratorcp",
-    .desc = "ARM Integrator/CP (ARM926EJ-S)",
-    .init = integratorcp_init,
-    .is_default = 1,
 };
 
-static void integratorcp_machine_init(void)
-{
-    qemu_register_machine(&integratorcp_machine);
-}
-
-machine_init(integratorcp_machine_init);
-
 static void integratorcp_register_devices(void)
 {
-    sysbus_register_dev("integrator_pic", sizeof(icp_pic_state), icp_pic_init);
-    sysbus_register_dev("integrator_core", sizeof(integratorcm_state),
-                        integratorcm_init);
+    sysbus_register_dev("integrator-pic", sizeof(icp_pic_state), icp_pic_init);
+    sysbus_register_dev("integrator-control", sizeof(SysBusDevice),
+                        icp_control_init);
+    sysbus_register_withprop("integrator-core", sizeof(integratorcm_state),
+                             &integratorcm_info);
 }
 
 device_init(integratorcp_register_devices)
diff --git a/pc-bios/boards/integrator-cp.dts b/pc-bios/boards/integrator-cp.dts
new file mode 100644
index 0000000..6ff27b4
--- /dev/null
+++ b/pc-bios/boards/integrator-cp.dts
@@ -0,0 +1,110 @@
+/ {
+    #address-cells = <1>;
+    #size-cells  = <1>;
+
+    cpus {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        cpu0: ARM,ARM926EJ-S@0 {
+            device_type = "cpu";
+            reg = <0>;
+            #interrupt-cells = <1>;
+        };
+    };
+    memory@0 {
+        device_type = "memory";
+        reg = <0 08000000>;
+        qemu,alias = <80000000>;
+    };
+    integrator-cp@0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        qemu,fold-bus;
+        core-module@0 {
+            model = "integrator-core";
+            memsz = <d#128>;
+            reg = <10000000>;
+        };
+        pic: intc@0 {
+            model = "integrator-pic";
+            #interrupt-cells = <1>;
+            reg = <14000000>;
+            interrupt-controller;
+            interrupt-parent = <&cpu0>;
+            interrupts = <0 1>;
+        };
+        intc@1 {
+            model = "integrator-pic";
+            #interrupt-cells = <1>;
+            reg = <ca000000>;
+            interrupt-controller;
+            interrupt-parent = <&pic>;
+            interrupts = <d#26 ffffffff>;
+        };
+        timer@0 {
+            model = "integrator-pit";
+            reg = <13000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#5 d#6 d#7>;
+        };
+        rtc@0 {
+            model = "pl031";
+            reg = <15000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#8>;
+        };
+        uart@0 {
+            model = "pl011";
+            reg = <16000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#1>;
+        };
+        uart@1 {
+            model = "pl011";
+            reg = <17000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#2>;
+        };
+        keyboard@0 {
+            model = "pl050_keyboard";
+            reg = <18000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#3>;
+        };
+        mouse@0 {
+            model = "pl050_mouse";
+            reg = <19000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#4>;
+        };
+        sd@0 {
+            model = "pl181";
+            reg = <1c000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#23 d#24>;
+        };
+        lcd@0 {
+            model = "pl110";
+            reg = <c0000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#22>;
+        };
+        nic@0 {
+            model = "smc91c111";
+            reg = <c8000000>;
+            interrupt-parent = <&pic>;
+            interrupts = <d#27>;
+        };
+        control@0 {
+            model = "integrator-control";
+            reg = <cb000000>;
+        };
+    };
+    chosen {
+        qemu {
+            bootstrap = "arm-linux";
+            board-id = <113>;
+        };
+    };
+};
+

  parent reply	other threads:[~2009-06-10 17:38 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-10 17:38 [Qemu-devel] [PATCH 0/4] Machine config files Paul Brook
2009-06-10 17:38 ` [Qemu-devel] [PATCH 1/4] Include and build libfdt Paul Brook
2009-06-10 19:08   ` Glauber Costa
2009-06-10 19:23     ` Anthony Liguori
2009-06-10 19:27     ` Paul Brook
2009-06-10 19:41       ` Glauber Costa
2009-06-10 20:38         ` Paul Brook
2009-06-10 22:32       ` Edgar E. Iglesias
2009-06-10 19:34     ` Blue Swirl
2009-06-10 17:38 ` [Qemu-devel] [PATCH 2/4] Add device tree machine Paul Brook
2009-06-10 18:30   ` Blue Swirl
2009-06-10 19:10     ` Paul Brook
2009-06-11 13:22   ` Gerd Hoffmann
2009-06-11 13:33   ` Gerd Hoffmann
2009-06-11 13:39     ` Paul Brook
2009-06-11 14:22       ` Gerd Hoffmann
2009-06-12 16:25   ` Markus Armbruster
2009-06-10 17:38 ` [Qemu-devel] [PATCH 3/4] Stellaris machine config Paul Brook
2009-06-11  8:21   ` M P
2009-06-11 16:32     ` Jamie Lokier
2009-06-12  8:29       ` Gerd Hoffmann
2009-06-12 13:56         ` Markus Armbruster
2009-06-12 13:53       ` Markus Armbruster
2009-06-12 15:25         ` Jamie Lokier
2009-06-10 17:38 ` Paul Brook [this message]
2009-06-11  9:54 ` [Qemu-devel] [PATCH 0/4] Machine config files Gerd Hoffmann
2009-06-11 12:53 ` Gerd Hoffmann
2009-06-11 13:18   ` Paul Brook
2009-06-11 14:35     ` Gerd Hoffmann
2009-06-12  7:51     ` Kevin Wolf
2009-06-12 13:49       ` Markus Armbruster
2009-06-12 14:22         ` Kevin Wolf
2009-06-12 14:40           ` Markus Armbruster
2009-06-12 15:02           ` Anthony Liguori
2009-06-12 15:29             ` Kevin Wolf
2009-06-12 16:35             ` Blue Swirl
2009-06-12 13:37 ` Markus Armbruster
2009-06-12 14:44   ` Gerd Hoffmann
2009-06-12 15:58     ` Markus Armbruster
2009-06-12 16:11     ` [Qemu-devel] " Jan Kiszka
2009-07-06 12:49       ` Michael S. Tsirkin
2009-07-06 13:43         ` Gerd Hoffmann
2009-07-06 13:56           ` Michael S. Tsirkin
2009-07-06 14:01             ` Michael S. Tsirkin
2009-07-06 14:40               ` Gerd Hoffmann
2009-07-06 16:12                 ` Avi Kivity
2009-07-06 16:27                   ` Gerd Hoffmann
2009-07-06 16:37                     ` Avi Kivity
2009-07-06 16:44                       ` Michael S. Tsirkin
2009-07-07  4:47                         ` Avi Kivity
2009-07-06 16:47                       ` Paul Brook
2009-07-07  5:01                         ` Avi Kivity
2009-07-06 17:28                       ` Anthony Liguori
2009-07-06 22:39                         ` Paul Brook
2009-07-06 23:13                           ` Anthony Liguori
2009-07-07  5:00                             ` Avi Kivity
2009-07-07  5:23                             ` Avi Kivity
2009-07-07  4:56                         ` Avi Kivity
2009-07-07  6:19                         ` Michael S. Tsirkin
2009-07-06 14:24             ` Gerd Hoffmann
2009-07-06 14:31               ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090610173837.4674.9252.stgit@wren.home \
    --to=paul@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).