qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liu Yu <yu.liu@freescale.com>
To: qemu-devel@nongnu.org
Cc: Liu Yu <yu.liu@freescale.com>, kvm-ppc@vger.kernel.org
Subject: [Qemu-devel] [PATCH 7/9] powerpc/kvm: Add E500 core emulation
Date: Thu, 15 Jan 2009 20:34:15 +0800	[thread overview]
Message-ID: <1232022857-2315-8-git-send-email-yu.liu@freescale.com> (raw)
In-Reply-To: <1232022857-2315-7-git-send-email-yu.liu@freescale.com>

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 Makefile.target |    1 +
 hw/ppce500.c    |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 hw/ppce500.h    |   44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 hw/ppce500.c
 create mode 100644 hw/ppce500.h

diff --git a/Makefile.target b/Makefile.target
index 2079fcb..223d294 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -651,6 +651,7 @@ OBJS+= pflash_cfi02.o ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o
 OBJS+= ppc440.o ppc440_bamboo.o
 # PowerPC E500 boards
 OBJS+= ppce500_pci.o
+OBJS+= ppce500.o
 ifdef FDT_LIBS
 OBJS+= device_tree.o
 LIBS+= $(FDT_LIBS)
diff --git a/hw/ppce500.c b/hw/ppce500.c
new file mode 100644
index 0000000..856cce2
--- /dev/null
+++ b/hw/ppce500.c
@@ -0,0 +1,49 @@
+/*
+ * Qemu PowerPC E500 core emualtion
+ *
+ * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Yu Liu,     <yu.liu@freescale.com>
+ *
+ * This file is derived from hw/ppc440.c
+ * the copyright for that material belongs to the original owners.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of  the GNU General  Public License as published by
+ * the Free Software Foundation;  either version 2 of the  License, or
+ * (at your option) any later version.
+ */
+
+#include "hw.h"
+#include "pc.h"
+#include "hw/isa.h"
+#include "ppce500.h"
+#include "sysemu.h"
+
+#define bytes_to_mb(a) (a>>20)
+
+CPUState *ppce500_init(ram_addr_t *ram_size)
+{
+    int i;
+    ram_addr_t tmp_ram_size;
+    CPUState *env;
+    int ram_stick_sizes[] = {512<<20, 256<<20, 128<<20, 64<<20}; /* in bytes */
+
+    /* Setup Memory */
+    tmp_ram_size = *ram_size;
+
+    for (i=0; i<(sizeof(ram_stick_sizes)/sizeof(ram_stick_sizes[0])); i++)
+	while ((tmp_ram_size/ram_stick_sizes[i]) > 0)
+	    tmp_ram_size -= ram_stick_sizes[i];
+
+    if (tmp_ram_size)
+	*ram_size -= tmp_ram_size;
+
+    env = cpu_ppc_init("e500v2_v30");
+    if (!env) {
+	fprintf(stderr, "Unable to initilize CPU!\n");
+	exit(1);
+    }
+
+    return env;
+}
diff --git a/hw/ppce500.h b/hw/ppce500.h
new file mode 100644
index 0000000..37c4375
--- /dev/null
+++ b/hw/ppce500.h
@@ -0,0 +1,44 @@
+/*
+ * QEMU PowerPC E500 emulation shared definitions
+ *
+ * Copyright (C) 2009 Freescale Semiconductor, Inc. All rights reserved.
+ *
+ * Author: Yu Liu,     <yu.liu@freescale.com>
+ *
+ * This file is derived from hw/ppc440.h
+ * the copyright for that material belongs to the original owners.
+ *
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of  the GNU General  Public License as published by
+ * the Free Software Foundation;  either version 2 of the  License, or
+ * (at your option) any later version.
+ */
+
+#if !defined(PPC_E500_H)
+#define PPC_E500_H
+
+#include "hw.h"
+#include "pc.h"
+#include "qemu-timer.h"
+#include "sysemu.h"
+#include "exec-all.h"
+#include "boards.h"
+
+/* PowerPC E500 XXX  initialization */
+extern CPUState *ppce500_init(ram_addr_t *ram_size);
+
+PCIBus *ppce500_pci_init(qemu_irq *pic, target_phys_addr_t registers);
+
+/* mpic.c */
+/* MPIC have 5 outputs per CPU connected and one IRQ out single output */
+enum {
+    MPIC_OUTPUT_INT = 0, /* IRQ                       */
+    MPIC_OUTPUT_CINT,    /* critical IRQ              */
+    MPIC_OUTPUT_MCK,     /* Machine check event       */
+    MPIC_OUTPUT_DEBUG,   /* Inconditional debug event */
+    MPIC_OUTPUT_RESET,   /* Core reset event          */
+    MPIC_OUTPUT_NB,
+};
+qemu_irq *mpic_init (target_phys_addr_t base, int nb_cpus,
+                        qemu_irq **irqs, qemu_irq irq_out);
+#endif /* !defined(PPC_E500_H) */
-- 
1.5.4

  reply	other threads:[~2009-01-15 12:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15 12:34 [Qemu-devel] [PATCH 0/9] powerpc/kvm: Add MPC85xx platform support Liu Yu
2009-01-15 12:34 ` [Qemu-devel] [PATCH 1/9] powerpc/kvm: Fix a uninitialized bug Liu Yu
2009-01-15 12:34   ` [Qemu-devel] [PATCH 2/9] powerpc/kvm: fix a openpic bug Liu Yu
2009-01-15 12:34     ` [Qemu-devel] [PATCH 3/9] powerpc/kvm: Enable mpic for E500 platform Liu Yu
2009-01-15 12:34       ` [Qemu-devel] [PATCH 4/9] powerpc/kvm: enable POWERPC_MMU_BOOKE_FSL when kvm is enabled Liu Yu
2009-01-15 12:34         ` [Qemu-devel] [PATCH 5/9] powerpc/kvm: Add freescale pci controller's support Liu Yu
2009-01-15 12:34           ` [Qemu-devel] [PATCH 6/9] powerpc/kvm: Add E500 irq support Liu Yu
2009-01-15 12:34             ` Liu Yu [this message]
2009-01-15 12:34               ` [Qemu-devel] [PATCH 8/9] powerpc/kvm: extern one function for E500 code use Liu Yu
     [not found]                 ` <1232022857-2315-10-git-send-email-yu.liu@freescale.com>
2009-01-16  8:22                   ` [Qemu-devel] RE: [PATCH 9/9] powerpc/kvm: Add MPC85xx board support Liu Yu
2009-01-16 18:09                     ` Hollis Blanchard
2009-01-20  3:09                       ` Liu Yu
2009-01-20 17:23                         ` Hollis Blanchard
2009-01-15 19:53               ` [Qemu-devel] Re: [PATCH 7/9] powerpc/kvm: Add E500 core emulation Hollis Blanchard
2009-01-16  7:51                 ` [Qemu-devel] " Liu Yu
2009-01-16 18:02                   ` Hollis Blanchard
2009-01-19 10:54                     ` Liu Yu
2009-01-19 10:59                       ` Liu Yu
2009-01-15 20:02           ` [Qemu-devel] Re: [PATCH 5/9] powerpc/kvm: Add freescale pci controller's support Hollis Blanchard
2009-01-16  7:37             ` [Qemu-devel] " Liu Yu
2009-01-15 21:22       ` [Qemu-devel] [PATCH 3/9] powerpc/kvm: Enable mpic for E500 platform Anthony Liguori
2009-01-16  5:34         ` Liu Yu
2009-01-16 18:17           ` Hollis Blanchard
2009-01-16 21:20             ` Aurelien Jarno
2009-01-15 20:06 ` [Qemu-devel] Re: [PATCH 0/9] powerpc/kvm: Add MPC85xx platform support Hollis Blanchard
2009-01-15 21:26 ` [Qemu-devel] " Anthony Liguori

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=1232022857-2315-8-git-send-email-yu.liu@freescale.com \
    --to=yu.liu@freescale.com \
    --cc=kvm-ppc@vger.kernel.org \
    --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).