qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board em


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 6/6] IBM PowerPC 440EP Bamboo reference board emulation
Date: Thu, 11 Dec 2008 15:39:46 -0600
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Hollis Blanchard wrote:
Since most IO devices are integrated into the 440EP chip, "Bamboo support"
mostly entails implementing the -kernel, -initrd, and -append options.

These options are implemented by loading the guest as if u-boot had done it,
i.e. loading a flat device tree, updating it to hold initrd addresses, ram
size, and command line, and passing the FDT address in r3.

Since we use it with KVM, we enable the virtio block driver and include hooks
necessary for KVM support.

Signed-off-by: Hollis Blanchard <address@hidden>
---
 Makefile             |    2 +-
 Makefile.target      |    2 +-
 hw/boards.h          |    1 +
 hw/ppc440_bamboo.c   |  190 ++++++++++++++++++++++++++++++++++++++++
 pc-bios/bamboo.dtb   |  Bin 0 -> 3163 bytes
 pc-bios/bamboo.dts   |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++
 target-ppc/machine.c |    2 +
 7 files changed, 429 insertions(+), 2 deletions(-)
 create mode 100644 hw/ppc440_bamboo.c
 create mode 100644 pc-bios/bamboo.dtb
 create mode 100644 pc-bios/bamboo.dts

diff --git a/Makefile b/Makefile
index a2a03ec..f9496fe 100644
--- a/Makefile
+++ b/Makefile
@@ -219,7 +219,7 @@ common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      
pt  sl     tr
 ifdef INSTALL_BLOBS
 BLOBS=bios.bin vgabios.bin vgabios-cirrus.bin ppc_rom.bin \
 video.x openbios-sparc32 openbios-sparc64 pxe-ne2k_pci.bin \
-pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin
+pxe-rtl8139.bin pxe-pcnet.bin pxe-e1000.bin bamboo.dtb
 else
 BLOBS=
 endif
diff --git a/Makefile.target b/Makefile.target
index 6032af0..82bc746 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -652,7 +652,7 @@ OBJS+= heathrow_pic.o grackle_pci.o ppc_oldworld.o
 OBJS+= unin_pci.o ppc_chrp.o
 # PowerPC 4xx boards
 OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
-OBJS+= ppc440.o
+OBJS+= ppc440.o ppc440_bamboo.o
 ifdef CONFIG_KVM
 OBJS+= kvm_ppc.o
 endif
diff --git a/hw/boards.h b/hw/boards.h
index d30c0fc..debe9a6 100644
--- a/hw/boards.h
+++ b/hw/boards.h
@@ -38,6 +38,7 @@ extern QEMUMachine core99_machine;
 extern QEMUMachine heathrow_machine;
 extern QEMUMachine ref405ep_machine;
 extern QEMUMachine taihu_machine;
+extern QEMUMachine bamboo_machine;
/* mips_r4k.c */
 extern QEMUMachine mips_machine;
diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
new file mode 100644
index 0000000..b0e3106
--- /dev/null
+++ b/hw/ppc440_bamboo.c
@@ -0,0 +1,190 @@
+/*
+ * Qemu PowerPC 440 board emulation
+ *
+ * Copyright 2007 IBM Corporation.
+ * Authors:
+ *     Jerone Young <address@hidden>
+ *     Christian Ehrhardt <address@hidden>
+ *     Hollis Blanchard <address@hidden>
+ *
+ * This work is licensed under the GNU GPL license version 2 or later.
+ *
+ */
+
+#include "config.h"
+#include "qemu-common.h"
+#include "net.h"
+#include "hw.h"
+#include "pci.h"
+#include "virtio-blk.h"
+#include "boards.h"
+#include "sysemu.h"
+#include "ppc440.h"
+#include "kvm.h"
+#include "kvm_ppc.h"
+#include "device_tree.h"
+
+#define BINARY_DEVICE_TREE_FILE "bamboo.dtb"
+
+static void *bamboo_load_device_tree(void *addr,
+                                     uint32_t ramsize,
+                                     target_phys_addr_t initrd_base,
+                                     target_phys_addr_t initrd_size,
+                                     const char *kernel_cmdline)
+{
+    void *fdt = NULL;
+#ifdef HAVE_FDT

Is this at all usable without libfdt? If not, just don't compile this board in unless libfdt is present.

+    uint32_t mem_reg_property[] = { 0, 0, ramsize };
+    char *path = NULL;
+    int len;
+    int ret;
+
+    len = asprintf(&path, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);

asprintf() is a GNU-ism and won't compile on Win32.

diff --git a/target-ppc/machine.c b/target-ppc/machine.c
index be0cbe1..72f67d0 100644
--- a/target-ppc/machine.c
+++ b/target-ppc/machine.c
@@ -1,5 +1,6 @@
 #include "hw/hw.h"
 #include "hw/boards.h"
+#include "kvm.h"

Is this necessary?

void register_machines(void)
 {
@@ -8,6 +9,7 @@ void register_machines(void)
     qemu_register_machine(&prep_machine);
     qemu_register_machine(&ref405ep_machine);
     qemu_register_machine(&taihu_machine);
+    qemu_register_machine(&bamboo_machine);
 }
void cpu_save(QEMUFile *f, void *opaque)


Regards,

Anthony Liguori




reply via email to

[Prev in Thread] Current Thread [Next in Thread]