2 * Samsung exynos4 SoC based boards emulation
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd. All rights reserved.
5 * Maksim Kozlov <m.kozlov@samsung.com>
6 * Evgeny Voevodin <e.voevodin@samsung.com>
7 * Igor Mitsyanko <i.mitsyanko@samsung.com>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <http://www.gnu.org/licenses/>.
27 #include "exec-memory.h"
28 #include "exynos4210.h"
37 #define PRINT_DEBUG(fmt, args...) \
39 fprintf(stderr, " [%s:%d] "fmt, __func__, __LINE__, ##args); \
42 #define PRINT_DEBUG(fmt, args...) do {} while (0)
45 typedef enum Exynos4BoardType
{
47 EXYNOS4_BOARD_SMDKC210
,
51 static int exynos4_board_id
[EXYNOS4_NUM_OF_BOARDS
] = {
52 [EXYNOS4_BOARD_NURI
] = 0xD33,
53 [EXYNOS4_BOARD_SMDKC210
] = 0xB16,
56 static int exynos4_board_smp_bootreg_addr
[EXYNOS4_NUM_OF_BOARDS
] = {
57 [EXYNOS4_BOARD_NURI
] = EXYNOS4210_SECOND_CPU_BOOTREG
,
58 [EXYNOS4_BOARD_SMDKC210
] = EXYNOS4210_SECOND_CPU_BOOTREG
,
61 static unsigned long exynos4_board_ram_size
[EXYNOS4_NUM_OF_BOARDS
] = {
62 [EXYNOS4_BOARD_NURI
] = 0x40000000,
63 [EXYNOS4_BOARD_SMDKC210
] = 0x40000000,
66 static struct arm_boot_info exynos4_board_binfo
= {
67 .loader_start
= EXYNOS4210_BASE_BOOT_ADDR
,
68 .smp_loader_start
= EXYNOS4210_SMP_BOOT_ADDR
,
69 .nb_cpus
= EXYNOS4210_NCPUS
,
72 static QEMUMachine exynos4_machines
[EXYNOS4_NUM_OF_BOARDS
];
74 static Exynos4210State
*exynos4_boards_init_common(
75 const char *kernel_filename
,
76 const char *kernel_cmdline
,
77 const char *initrd_filename
,
78 Exynos4BoardType board_type
)
80 if (smp_cpus
!= EXYNOS4210_NCPUS
) {
81 fprintf(stderr
, "%s board supports only %d CPU cores. Ignoring smp_cpus"
83 exynos4_machines
[board_type
].name
,
84 exynos4_machines
[board_type
].max_cpus
);
87 exynos4_board_binfo
.ram_size
= exynos4_board_ram_size
[board_type
];
88 exynos4_board_binfo
.board_id
= exynos4_board_id
[board_type
];
89 exynos4_board_binfo
.smp_bootreg_addr
=
90 exynos4_board_smp_bootreg_addr
[board_type
];
91 exynos4_board_binfo
.kernel_filename
= kernel_filename
;
92 exynos4_board_binfo
.initrd_filename
= initrd_filename
;
93 exynos4_board_binfo
.kernel_cmdline
= kernel_cmdline
;
94 exynos4_board_binfo
.smp_priv_base
= EXYNOS4210_SMP_PRIVATE_BASE_ADDR
;
96 PRINT_DEBUG("\n ram_size: %luMiB [0x%08lx]\n"
97 " kernel_filename: %s\n"
98 " kernel_cmdline: %s\n"
99 " initrd_filename: %s\n",
100 exynos4_board_ram_size
[board_type
] / 1048576,
101 exynos4_board_ram_size
[board_type
],
106 return exynos4210_init(get_system_memory(),
107 exynos4_board_ram_size
[board_type
]);
110 static void nuri_init(ram_addr_t ram_size
,
111 const char *boot_device
,
112 const char *kernel_filename
, const char *kernel_cmdline
,
113 const char *initrd_filename
, const char *cpu_model
)
115 exynos4_boards_init_common(kernel_filename
, kernel_cmdline
,
116 initrd_filename
, EXYNOS4_BOARD_NURI
);
118 arm_load_kernel(first_cpu
, &exynos4_board_binfo
);
121 static void smdkc210_init(ram_addr_t ram_size
,
122 const char *boot_device
,
123 const char *kernel_filename
, const char *kernel_cmdline
,
124 const char *initrd_filename
, const char *cpu_model
)
126 exynos4_boards_init_common(kernel_filename
, kernel_cmdline
,
127 initrd_filename
, EXYNOS4_BOARD_SMDKC210
);
129 arm_load_kernel(first_cpu
, &exynos4_board_binfo
);
132 static QEMUMachine exynos4_machines
[EXYNOS4_NUM_OF_BOARDS
] = {
133 [EXYNOS4_BOARD_NURI
] = {
135 .desc
= "Samsung NURI board (Exynos4210)",
137 .max_cpus
= EXYNOS4210_NCPUS
,
139 [EXYNOS4_BOARD_SMDKC210
] = {
141 .desc
= "Samsung SMDKC210 board (Exynos4210)",
142 .init
= smdkc210_init
,
143 .max_cpus
= EXYNOS4210_NCPUS
,
147 static void exynos4_machine_init(void)
149 qemu_register_machine(&exynos4_machines
[EXYNOS4_BOARD_NURI
]);
150 qemu_register_machine(&exynos4_machines
[EXYNOS4_BOARD_SMDKC210
]);
153 machine_init(exynos4_machine_init
);