1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30#include "qemu/osdep.h"
31#include "qapi/error.h"
32#include "cpu.h"
33#include "hw/sh4/sh.h"
34#include "sysemu/qtest.h"
35#include "hw/boards.h"
36#include "hw/loader.h"
37#include "qemu/error-report.h"
38
39#define BIOS_FILENAME "shix_bios.bin"
40#define BIOS_ADDRESS 0xA0000000
41
42static void shix_init(MachineState *machine)
43{
44 int ret;
45 SuperHCPU *cpu;
46 struct SH7750State *s;
47 MemoryRegion *sysmem = get_system_memory();
48 MemoryRegion *rom = g_new(MemoryRegion, 1);
49 MemoryRegion *sdram = g_new(MemoryRegion, 2);
50 const char *bios_name = machine->firmware ?: BIOS_FILENAME;
51
52 cpu = SUPERH_CPU(cpu_create(machine->cpu_type));
53
54
55 memory_region_init_rom(rom, NULL, "shix.rom", 0x4000, &error_fatal);
56 memory_region_add_subregion(sysmem, 0x00000000, rom);
57 memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000,
58 &error_fatal);
59 memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);
60 memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000,
61 &error_fatal);
62 memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
63
64
65 ret = load_image_targphys(bios_name, 0, 0x4000);
66 if (ret < 0 && !qtest_enabled()) {
67 error_report("Could not load SHIX bios '%s'", bios_name);
68 exit(1);
69 }
70
71
72 s = sh7750_init(cpu, sysmem);
73
74 tc58128_init(s, "shix_linux_nand.bin", NULL);
75}
76
77static void shix_machine_init(MachineClass *mc)
78{
79 mc->desc = "shix card";
80 mc->init = shix_init;
81 mc->is_default = true;
82 mc->default_cpu_type = TYPE_SH7750R_CPU;
83}
84
85DEFINE_MACHINE("shix", shix_machine_init)
86