2 * KZM Board System emulation.
4 * Copyright (c) 2008 OKL and 2011 NICTA
5 * Written by Hans at OK-Labs
6 * Updated by Peter Chubb.
8 * This code is licensed under the GPL, version 2 or later.
9 * See the file `COPYING' in the top level directory.
11 * It (partially) emulates a Kyoto Microcomputer
12 * KZM-ARM11-01 evaluation board, with a Freescale
17 #include "exec-memory.h"
27 /* Memory map for Kzm Emulation Baseboard:
28 * 0x00000000-0x00003fff 16k secure ROM IGNORED
29 * 0x00004000-0x00407fff Reserved IGNORED
30 * 0x00404000-0x00407fff ROM IGNORED
31 * 0x00408000-0x0fffffff Reserved IGNORED
32 * 0x10000000-0x1fffbfff RAM aliasing IGNORED
33 * 0x1fffc000-0x1fffffff RAM EMULATED
34 * 0x20000000-0x2fffffff Reserved IGNORED
35 * 0x30000000-0x7fffffff I.MX31 Internal Register Space
37 * 0x43f90000 UART1 EMULATED
38 * 0x43f94000 UART2 EMULATED
39 * 0x68000000 AVIC EMULATED
40 * 0x53f80000 CCM EMULATED
41 * 0x53f94000 PIT 1 EMULATED
42 * 0x53f98000 PIT 2 EMULATED
43 * 0x53f90000 GPT EMULATED
44 * 0x80000000-0x87ffffff RAM EMULATED
45 * 0x88000000-0x8fffffff RAM Aliasing EMULATED
46 * 0xa0000000-0xafffffff NAND Flash IGNORED
47 * 0xb0000000-0xb3ffffff Unavailable IGNORED
48 * 0xb4000000-0xb4000fff 8-bit free space IGNORED
49 * 0xb4001000-0xb400100f Board control IGNORED
50 * 0xb4001003 DIP switch
51 * 0xb4001010-0xb400101f 7-segment LED IGNORED
52 * 0xb4001020-0xb400102f LED IGNORED
53 * 0xb4001030-0xb400103f LED IGNORED
54 * 0xb4001040-0xb400104f FPGA, UART EMULATED
55 * 0xb4001050-0xb400105f FPGA, UART EMULATED
56 * 0xb4001060-0xb40fffff FPGA IGNORED
57 * 0xb6000000-0xb61fffff LAN controller EMULATED
58 * 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED
59 * 0xb6300000-0xb7ffffff Free IGNORED
60 * 0xb8000000-0xb8004fff Memory control registers IGNORED
61 * 0xc0000000-0xc3ffffff PCMCIA/CF IGNORED
62 * 0xc4000000-0xffffffff Reserved IGNORED
65 #define KZM_RAMADDRESS (0x80000000)
66 #define KZM_FPGA (0xb4001040)
68 static struct arm_boot_info kzm_binfo
= {
69 .loader_start
= KZM_RAMADDRESS
,
73 static void kzm_init(QEMUMachineInitArgs
*args
)
75 ram_addr_t ram_size
= args
->ram_size
;
76 const char *cpu_model
= args
->cpu_model
;
77 const char *kernel_filename
= args
->kernel_filename
;
78 const char *kernel_cmdline
= args
->kernel_cmdline
;
79 const char *initrd_filename
= args
->initrd_filename
;
81 MemoryRegion
*address_space_mem
= get_system_memory();
82 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
83 MemoryRegion
*sram
= g_new(MemoryRegion
, 1);
84 MemoryRegion
*ram_alias
= g_new(MemoryRegion
, 1);
90 cpu_model
= "arm1136";
93 cpu
= cpu_arm_init(cpu_model
);
95 fprintf(stderr
, "Unable to find CPU definition\n");
99 /* On a real system, the first 16k is a `secure boot rom' */
101 memory_region_init_ram(ram
, "kzm.ram", ram_size
);
102 vmstate_register_ram_global(ram
);
103 memory_region_add_subregion(address_space_mem
, KZM_RAMADDRESS
, ram
);
105 memory_region_init_alias(ram_alias
, "ram.alias", ram
, 0, ram_size
);
106 memory_region_add_subregion(address_space_mem
, 0x88000000, ram_alias
);
108 memory_region_init_ram(sram
, "kzm.sram", 0x4000);
109 memory_region_add_subregion(address_space_mem
, 0x1FFFC000, sram
);
111 cpu_pic
= arm_pic_init_cpu(cpu
);
112 dev
= sysbus_create_varargs("imx_avic", 0x68000000,
113 cpu_pic
[ARM_PIC_CPU_IRQ
],
114 cpu_pic
[ARM_PIC_CPU_FIQ
], NULL
);
117 imx_serial_create(0, 0x43f90000, qdev_get_gpio_in(dev
, 45));
118 imx_serial_create(1, 0x43f94000, qdev_get_gpio_in(dev
, 32));
120 ccm
= sysbus_create_simple("imx_ccm", 0x53f80000, NULL
);
122 imx_timerp_create(0x53f94000, qdev_get_gpio_in(dev
, 28), ccm
);
123 imx_timerp_create(0x53f98000, qdev_get_gpio_in(dev
, 27), ccm
);
124 imx_timerg_create(0x53f90000, qdev_get_gpio_in(dev
, 29), ccm
);
126 if (nd_table
[0].used
) {
127 lan9118_init(&nd_table
[0], 0xb6000000, qdev_get_gpio_in(dev
, 52));
130 if (serial_hds
[2]) { /* touchscreen */
131 serial_mm_init(address_space_mem
, KZM_FPGA
+0x10, 0,
132 qdev_get_gpio_in(dev
, 52),
133 14745600, serial_hds
[2],
134 DEVICE_NATIVE_ENDIAN
);
137 kzm_binfo
.ram_size
= ram_size
;
138 kzm_binfo
.kernel_filename
= kernel_filename
;
139 kzm_binfo
.kernel_cmdline
= kernel_cmdline
;
140 kzm_binfo
.initrd_filename
= initrd_filename
;
141 kzm_binfo
.nb_cpus
= 1;
142 arm_load_kernel(cpu
, &kzm_binfo
);
145 static QEMUMachine kzm_machine
= {
147 .desc
= "ARM KZM Emulation Baseboard (ARM1136)",
151 static void kzm_machine_init(void)
153 qemu_register_machine(&kzm_machine
);
156 machine_init(kzm_machine_init
)