host/include/generic/host/atomic128: Fix compilation problem with Clang 17
[qemu/kevin.git] / hw / arm / collie.c
bloba0ad1b8dc7e32385b0a0aba896ae12fa5aabd1e8
1 /*
2 * SA-1110-based Sharp Zaurus SL-5500 platform.
4 * Copyright (C) 2011 Dmitry Eremin-Solenikov
6 * This code is licensed under GNU GPL v2.
8 * Contributions after 2012-01-13 are licensed under the terms of the
9 * GNU GPL, version 2 or (at your option) any later version.
11 #include "qemu/osdep.h"
12 #include "qemu/units.h"
13 #include "qemu/cutils.h"
14 #include "hw/sysbus.h"
15 #include "hw/boards.h"
16 #include "strongarm.h"
17 #include "hw/arm/boot.h"
18 #include "hw/block/flash.h"
19 #include "exec/address-spaces.h"
20 #include "cpu.h"
21 #include "qom/object.h"
22 #include "qemu/error-report.h"
25 #define RAM_SIZE (512 * MiB)
26 #define FLASH_SIZE (32 * MiB)
27 #define FLASH_SECTOR_SIZE (64 * KiB)
29 struct CollieMachineState {
30 MachineState parent;
32 StrongARMState *sa1110;
35 #define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie")
36 OBJECT_DECLARE_SIMPLE_TYPE(CollieMachineState, COLLIE_MACHINE)
38 static struct arm_boot_info collie_binfo = {
39 .loader_start = SA_SDCS0,
40 .ram_size = RAM_SIZE,
43 static void collie_init(MachineState *machine)
45 MachineClass *mc = MACHINE_GET_CLASS(machine);
46 CollieMachineState *cms = COLLIE_MACHINE(machine);
48 if (machine->ram_size != mc->default_ram_size) {
49 char *sz = size_to_str(mc->default_ram_size);
50 error_report("Invalid RAM size, should be %s", sz);
51 g_free(sz);
52 exit(EXIT_FAILURE);
55 cms->sa1110 = sa1110_init(machine->cpu_type);
57 memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram);
59 for (unsigned i = 0; i < 2; i++) {
60 DriveInfo *dinfo = drive_get(IF_PFLASH, 0, i);
61 pflash_cfi01_register(i ? SA_CS1 : SA_CS0,
62 i ? "collie.fl2" : "collie.fl1", FLASH_SIZE,
63 dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
64 FLASH_SECTOR_SIZE, 4, 0x00, 0x00, 0x00, 0x00, 0);
67 sysbus_create_simple("scoop", 0x40800000, NULL);
69 collie_binfo.board_id = 0x208;
70 arm_load_kernel(cms->sa1110->cpu, machine, &collie_binfo);
73 static void collie_machine_class_init(ObjectClass *oc, void *data)
75 MachineClass *mc = MACHINE_CLASS(oc);
77 mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)";
78 mc->init = collie_init;
79 mc->ignore_memory_transaction_failures = true;
80 mc->default_cpu_type = ARM_CPU_TYPE_NAME("sa1110");
81 mc->default_ram_size = RAM_SIZE;
82 mc->default_ram_id = "strongarm.sdram";
85 static const TypeInfo collie_machine_typeinfo = {
86 .name = TYPE_COLLIE_MACHINE,
87 .parent = TYPE_MACHINE,
88 .class_init = collie_machine_class_init,
89 .instance_size = sizeof(CollieMachineState),
92 static void collie_machine_register_types(void)
94 type_register_static(&collie_machine_typeinfo);
96 type_init(collie_machine_register_types);