raspi.c (01e02f5aa74315f81b62872a50fe1b3e96dd00df) raspi.c (926dcdf073a2f9cf8f8d4d71b35110544dae2b40)
1/*
2 * Raspberry Pi emulation (c) 2012 Gregory Estrade
3 * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous
4 *
5 * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
6 * Written by Andrew Baumann
7 *
8 * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti

--- 18 unchanged lines hidden (view full) ---

27#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
28#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
29#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
30
31/* Table of Linux board IDs for different Pi versions */
32static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
33
34typedef struct RasPiState {
1/*
2 * Raspberry Pi emulation (c) 2012 Gregory Estrade
3 * Upstreaming code cleanup [including bcm2835_*] (c) 2013 Jan Petrous
4 *
5 * Rasperry Pi 2 emulation Copyright (c) 2015, Microsoft
6 * Written by Andrew Baumann
7 *
8 * Raspberry Pi 3 emulation Copyright (c) 2018 Zoltán Baldaszti

--- 18 unchanged lines hidden (view full) ---

27#define BOARDSETUP_ADDR (MVBAR_ADDR + 0x20) /* board setup code */
28#define FIRMWARE_ADDR_2 0x8000 /* Pi 2 loads kernel.img here by default */
29#define FIRMWARE_ADDR_3 0x80000 /* Pi 3 loads kernel.img here by default */
30
31/* Table of Linux board IDs for different Pi versions */
32static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
33
34typedef struct RasPiState {
35 BCM2836State soc;
35 BCM283XState soc;
36 MemoryRegion ram;
37} RasPiState;
38
39static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
40{
41 static const uint32_t smpboot[] = {
42 0xe1a0e00f, /* mov lr, pc */
43 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4), /* mov pc, BOARDSETUP_ADDR */

--- 87 unchanged lines hidden (view full) ---

131{
132 RasPiState *s = g_new0(RasPiState, 1);
133 uint32_t vcram_size;
134 DriveInfo *di;
135 BlockBackend *blk;
136 BusState *bus;
137 DeviceState *carddev;
138
36 MemoryRegion ram;
37} RasPiState;
38
39static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
40{
41 static const uint32_t smpboot[] = {
42 0xe1a0e00f, /* mov lr, pc */
43 0xe3a0fe00 + (BOARDSETUP_ADDR >> 4), /* mov pc, BOARDSETUP_ADDR */

--- 87 unchanged lines hidden (view full) ---

131{
132 RasPiState *s = g_new0(RasPiState, 1);
133 uint32_t vcram_size;
134 DriveInfo *di;
135 BlockBackend *blk;
136 BusState *bus;
137 DeviceState *carddev;
138
139 object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM2836);
139 object_initialize(&s->soc, sizeof(s->soc), TYPE_BCM283X);
140 object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
141 &error_abort);
142
143 /* Allocate and map RAM */
144 memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram",
145 machine->ram_size);
146 /* FIXME: Remove when we have custom CPU address space support */
147 memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0);

--- 36 unchanged lines hidden (view full) ---

184{
185 mc->desc = "Raspberry Pi 2";
186 mc->init = raspi2_init;
187 mc->block_default_type = IF_SD;
188 mc->no_parallel = 1;
189 mc->no_floppy = 1;
190 mc->no_cdrom = 1;
191 mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
140 object_property_add_child(OBJECT(machine), "soc", OBJECT(&s->soc),
141 &error_abort);
142
143 /* Allocate and map RAM */
144 memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram",
145 machine->ram_size);
146 /* FIXME: Remove when we have custom CPU address space support */
147 memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0);

--- 36 unchanged lines hidden (view full) ---

184{
185 mc->desc = "Raspberry Pi 2";
186 mc->init = raspi2_init;
187 mc->block_default_type = IF_SD;
188 mc->no_parallel = 1;
189 mc->no_floppy = 1;
190 mc->no_cdrom = 1;
191 mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a15");
192 mc->max_cpus = BCM2836_NCPUS;
193 mc->min_cpus = BCM2836_NCPUS;
194 mc->default_cpus = BCM2836_NCPUS;
192 mc->max_cpus = BCM283X_NCPUS;
193 mc->min_cpus = BCM283X_NCPUS;
194 mc->default_cpus = BCM283X_NCPUS;
195 mc->default_ram_size = 1024 * 1024 * 1024;
196 mc->ignore_memory_transaction_failures = true;
197};
198DEFINE_MACHINE("raspi2", raspi2_machine_init)
199
200#ifdef TARGET_AARCH64
201static void raspi3_init(MachineState *machine)
202{

--- 4 unchanged lines hidden (view full) ---

207{
208 mc->desc = "Raspberry Pi 3";
209 mc->init = raspi3_init;
210 mc->block_default_type = IF_SD;
211 mc->no_parallel = 1;
212 mc->no_floppy = 1;
213 mc->no_cdrom = 1;
214 mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
195 mc->default_ram_size = 1024 * 1024 * 1024;
196 mc->ignore_memory_transaction_failures = true;
197};
198DEFINE_MACHINE("raspi2", raspi2_machine_init)
199
200#ifdef TARGET_AARCH64
201static void raspi3_init(MachineState *machine)
202{

--- 4 unchanged lines hidden (view full) ---

207{
208 mc->desc = "Raspberry Pi 3";
209 mc->init = raspi3_init;
210 mc->block_default_type = IF_SD;
211 mc->no_parallel = 1;
212 mc->no_floppy = 1;
213 mc->no_cdrom = 1;
214 mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53");
215 mc->max_cpus = BCM2836_NCPUS;
216 mc->min_cpus = BCM2836_NCPUS;
217 mc->default_cpus = BCM2836_NCPUS;
215 mc->max_cpus = BCM283X_NCPUS;
216 mc->min_cpus = BCM283X_NCPUS;
217 mc->default_cpus = BCM283X_NCPUS;
218 mc->default_ram_size = 1024 * 1024 * 1024;
219}
220DEFINE_MACHINE("raspi3", raspi3_machine_init)
221#endif
218 mc->default_ram_size = 1024 * 1024 * 1024;
219}
220DEFINE_MACHINE("raspi3", raspi3_machine_init)
221#endif