qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] sh: SE7750 board definition
Date: Sun, 11 Jan 2009 18:10:22 +0900	[thread overview]
Message-ID: <4969B77E.7050206@juno.dti.ne.jp> (raw)

This patch simply provides basic SE7750 board definition.


Signed-off-by: Shin-ichiro KAWASAKI <kawasaki@juno.dti.ne.jp>

Index: trunk/target-sh4/machine.c
===================================================================
--- trunk/target-sh4/machine.c	(revision 6133)
+++ trunk/target-sh4/machine.c	(working copy)
@@ -5,4 +5,5 @@
 {
     qemu_register_machine(&shix_machine);
     qemu_register_machine(&r2d_machine);
+    qemu_register_machine(&se7750_machine);
 }
Index: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	(revision 6133)
+++ trunk/target-sh4/translate.c	(working copy)
@@ -212,6 +212,12 @@
 
 static sh4_def_t sh4_defs[] = {
     {
+	.name = "SH7750",
+	.id = SH_CPU_SH7750,
+	.pvr = 0x04020500,
+	.prr = 0x00000000,
+	.cvr = 0x00000000,
+    }, {
 	.name = "SH7750R",
 	.id = SH_CPU_SH7750R,
 	.pvr = 0x00050000,
Index: trunk/Makefile.target
===================================================================
--- trunk/Makefile.target	(revision 6133)
+++ trunk/Makefile.target	(working copy)
@@ -719,7 +719,7 @@
 CPPFLAGS += -DHAS_AUDIO
 endif
 ifeq ($(TARGET_BASE_ARCH), sh4)
-OBJS+= shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
+OBJS+= shix.o r2d.o se.o sh7750.o sh7750_regnames.o tc58128.o
 OBJS+= sh_timer.o ptimer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
 OBJS+= ide.o
 endif
Index: trunk/hw/se.c
===================================================================
--- trunk/hw/se.c	(revision 0)
+++ trunk/hw/se.c	(revision 0)
@@ -0,0 +1,94 @@
+/*
+ * Hitachi ULSI Systems' evaludation boards, Solution Engine emulation.
+ *
+ * Copyright (c) 2008 Shin-ichiro KAWASAKI
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "hw.h"
+#include "sh.h"
+#include "sysemu.h"
+#include "boards.h"
+#include "sh7750_regs.h"
+
+#define SDRAM_BASE   0x0c000000 /* Physical location of SDRAM: Area 3 */
+#define SDRAM_SIZE   0x02000000
+#define ENTRY_OFFSET 0x00001000
+#define COMMAND_LINE_OFFSET 0x0000100
+
+static void se7750_init(ram_addr_t ram_size, int vga_ram_size,
+                    const char *boot_device, DisplayState * ds,
+                    const char *kernel_filename, const char *kernel_cmdline,
+                    const char *initrd_filename, const char *cpu_model)
+{
+    CPUState *env;
+    struct SH7750State *s;
+    ram_addr_t sdram_addr;
+    int kernel_size;
+    uint8 * phys_load_addr = phys_ram_base;
+
+    /* initialize CPU */
+    if (!cpu_model)
+        cpu_model = "SH7750";
+
+    env = cpu_init(cpu_model);
+    if (!env) {
+        fprintf(stderr, "Unable to find CPU definition\n");
+        exit(1);
+    }
+
+    /* Allocate memory space */
+    sdram_addr = qemu_ram_alloc(SDRAM_SIZE);
+    cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, sdram_addr);
+
+    /* Register peripherals */
+    s = sh7750_init(env);
+
+    /* initialization which should be done by firmware */
+    uint32_t bcr1 = 1 << 3; /* cs3 SDRAM */
+    uint16_t bcr2 = 3 << (3 * 2); /* cs3 32-bit */
+    cpu_physical_memory_write(SH7750_BCR1_A7, (uint8_t *)&bcr1, 4);
+    cpu_physical_memory_write(SH7750_BCR2_A7, (uint8_t *)&bcr2, 2);
+
+    /* Start from P2 area */
+    env->pc = SDRAM_BASE | 0xa0000000;
+
+    /* pass kernel cmdline */
+    if (kernel_cmdline) {
+        pstrcpy((char *)phys_load_addr + ENTRY_OFFSET + COMMAND_LINE_OFFSET,
+                strlen(kernel_cmdline) + 1, kernel_cmdline);
+        env->pc += 0x80000;
+        phys_load_addr += 0x80000;
+    }
+
+    /* load kernel image */
+    kernel_size = load_image(kernel_filename, phys_load_addr);
+    if (kernel_size < 0) {
+        fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename);
+        exit(1);
+    }
+}
+
+QEMUMachine se7750_machine = {
+    .name = "se7750",
+    .desc = "Solution Engine SH7750 board",
+    .init = se7750_init,
+    .ram_require = SDRAM_SIZE | RAMSIZE_FIXED,
+};
Index: trunk/hw/boards.h
===================================================================
--- trunk/hw/boards.h	(revision 6133)
+++ trunk/hw/boards.h	(working copy)
@@ -60,6 +60,9 @@
 /* r2d.c */
 extern QEMUMachine r2d_machine;
 
+/* se.c */
+extern QEMUMachine se7750_machine;
+
 /* sun4m.c */
 extern QEMUMachine ss5_machine, ss10_machine, ss600mp_machine, ss20_machine;
 extern QEMUMachine voyager_machine, ss_lx_machine, ss4_machine, scls_machine;

             reply	other threads:[~2009-01-11  9:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-11  9:10 Shin-ichiro KAWASAKI [this message]
2009-01-11 12:57 ` [Qemu-devel] [PATCH 1/3] sh: SE7750 board definition Edgar E. Iglesias
2009-01-11 13:04 ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-12  3:48   ` Shin-ichiro KAWASAKI
2009-01-12 12:49     ` Paul Mundt
2009-01-13  2:32       ` Nobuhiro Iwamatsu
2009-01-13  6:28         ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-15  1:25           ` Nobuhiro Iwamatsu
2009-01-13  7:46         ` Laurent Desnogues
2009-01-24 17:59           ` Shin-ichiro KAWASAKI
2009-01-13 13:36         ` Shin-ichiro KAWASAKI
2009-01-15  1:46           ` Nobuhiro Iwamatsu
2009-01-17 10:45             ` Shin-ichiro KAWASAKI
2009-01-17 11:16               ` Jean-Christophe PLAGNIOL-VILLARD
2009-01-21  9:04           ` Paul Mundt
2009-01-21 16:51             ` Shin-ichiro KAWASAKI
2009-01-21 17:06               ` Paul Brook
2009-01-24  5:46                 ` sh: Virtual Board or Real board? (was Re: [Qemu-devel] [PATCH 1/3] sh: SE7750 board definition) Shin-ichiro KAWASAKI
2009-01-27  0:43                   ` Paul Mundt
2009-02-01 13:50                     ` Shin-ichiro KAWASAKI
2009-01-21 19:01               ` [Qemu-devel] [PATCH 1/3] sh: SE7750 board definition Jean-Christophe PLAGNIOL-VILLARD

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=4969B77E.7050206@juno.dti.ne.jp \
    --to=kawasaki@juno.dti.ne.jp \
    --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).