xref: /qemu/hw/sh4/shix.c (revision 322b038c)
153018216SPaolo Bonzini /*
253018216SPaolo Bonzini  * SHIX 2.0 board description
353018216SPaolo Bonzini  *
453018216SPaolo Bonzini  * Copyright (c) 2005 Samuel Tardieu
553018216SPaolo Bonzini  *
653018216SPaolo Bonzini  * Permission is hereby granted, free of charge, to any person obtaining a copy
753018216SPaolo Bonzini  * of this software and associated documentation files (the "Software"), to deal
853018216SPaolo Bonzini  * in the Software without restriction, including without limitation the rights
953018216SPaolo Bonzini  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1053018216SPaolo Bonzini  * copies of the Software, and to permit persons to whom the Software is
1153018216SPaolo Bonzini  * furnished to do so, subject to the following conditions:
1253018216SPaolo Bonzini  *
1353018216SPaolo Bonzini  * The above copyright notice and this permission notice shall be included in
1453018216SPaolo Bonzini  * all copies or substantial portions of the Software.
1553018216SPaolo Bonzini  *
1653018216SPaolo Bonzini  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1753018216SPaolo Bonzini  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1853018216SPaolo Bonzini  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
1953018216SPaolo Bonzini  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2053018216SPaolo Bonzini  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2153018216SPaolo Bonzini  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2253018216SPaolo Bonzini  * THE SOFTWARE.
2353018216SPaolo Bonzini  */
2453018216SPaolo Bonzini /*
2522138965SBALATON Zoltan  * Shix 2.0 board by Alexis Polti, described at
2622138965SBALATON Zoltan  * https://web.archive.org/web/20070917001736/perso.enst.fr/~polti/realisations/shix20
2722138965SBALATON Zoltan  *
2822138965SBALATON Zoltan  * More information in target/sh4/README.sh4
2953018216SPaolo Bonzini  */
309d4c9946SPeter Maydell #include "qemu/osdep.h"
31da34e65cSMarkus Armbruster #include "qapi/error.h"
324771d756SPaolo Bonzini #include "cpu.h"
330d09e41aSPaolo Bonzini #include "hw/sh4/sh.h"
34d32f7d25SAndreas Färber #include "sysemu/qtest.h"
3553018216SPaolo Bonzini #include "hw/boards.h"
3653018216SPaolo Bonzini #include "hw/loader.h"
37d32f7d25SAndreas Färber #include "qemu/error-report.h"
3853018216SPaolo Bonzini 
3953018216SPaolo Bonzini #define BIOS_FILENAME "shix_bios.bin"
4053018216SPaolo Bonzini #define BIOS_ADDRESS 0xA0000000
4153018216SPaolo Bonzini 
shix_init(MachineState * machine)423ef96221SMarcel Apfelbaum static void shix_init(MachineState *machine)
4353018216SPaolo Bonzini {
4453018216SPaolo Bonzini     int ret;
452f493feeSAndreas Färber     SuperHCPU *cpu;
4653018216SPaolo Bonzini     struct SH7750State *s;
4753018216SPaolo Bonzini     MemoryRegion *sysmem = get_system_memory();
4853018216SPaolo Bonzini     MemoryRegion *rom = g_new(MemoryRegion, 1);
4953018216SPaolo Bonzini     MemoryRegion *sdram = g_new(MemoryRegion, 2);
502893cad6SPaolo Bonzini     const char *bios_name = machine->firmware ?: BIOS_FILENAME;
5153018216SPaolo Bonzini 
52b0224788SIgor Mammedov     cpu = SUPERH_CPU(cpu_create(machine->cpu_type));
5353018216SPaolo Bonzini 
5453018216SPaolo Bonzini     /* Allocate memory space */
555ccc751eSPhilippe Mathieu-Daudé     memory_region_init_rom(rom, NULL, "shix.rom", 0x4000, &error_fatal);
5653018216SPaolo Bonzini     memory_region_add_subregion(sysmem, 0x00000000, rom);
5798a99ce0SPeter Maydell     memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000,
58f8ed85acSMarkus Armbruster                            &error_fatal);
5953018216SPaolo Bonzini     memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);
6098a99ce0SPeter Maydell     memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000,
61f8ed85acSMarkus Armbruster                            &error_fatal);
6253018216SPaolo Bonzini     memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
6353018216SPaolo Bonzini 
6453018216SPaolo Bonzini     /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
6553018216SPaolo Bonzini     ret = load_image_targphys(bios_name, 0, 0x4000);
66d32f7d25SAndreas Färber     if (ret < 0 && !qtest_enabled()) {
67d32f7d25SAndreas Färber         error_report("Could not load SHIX bios '%s'", bios_name);
6853018216SPaolo Bonzini         exit(1);
6953018216SPaolo Bonzini     }
7053018216SPaolo Bonzini 
7153018216SPaolo Bonzini     /* Register peripherals */
722f493feeSAndreas Färber     s = sh7750_init(cpu, sysmem);
7353018216SPaolo Bonzini     /* XXXXX Check success */
7453018216SPaolo Bonzini     tc58128_init(s, "shix_linux_nand.bin", NULL);
7553018216SPaolo Bonzini }
7653018216SPaolo Bonzini 
shix_machine_init(MachineClass * mc)77e264d29dSEduardo Habkost static void shix_machine_init(MachineClass *mc)
7853018216SPaolo Bonzini {
79e264d29dSEduardo Habkost     mc->desc = "shix card";
80e264d29dSEduardo Habkost     mc->init = shix_init;
81ea0ac7f6SPhilippe Mathieu-Daudé     mc->is_default = true;
82b0224788SIgor Mammedov     mc->default_cpu_type = TYPE_SH7750R_CPU;
83*322b038cSSamuel Tardieu     mc->deprecation_reason = "old and unmaintained";
8453018216SPaolo Bonzini }
8553018216SPaolo Bonzini 
86e264d29dSEduardo Habkost DEFINE_MACHINE("shix", shix_machine_init)
87