| 1 | /* |
| 2 | * Axiado Boards |
| 3 | * |
| 4 | * Author: Kuan-Jui Chiu <kchiu@axiado.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | #include "qemu/osdep.h" |
| 10 | #include "hw/arm/ax3000-boards.h" |
| 11 | #include "hw/arm/boot.h" |
| 12 | #include "hw/arm/machines-qom.h" |
| 13 | #include "qemu/error-report.h" |
| 14 | #include "qom/object.h" |
| 15 | |
| 16 | static struct arm_boot_info ax3000_binfo = { |
| 17 | .loader_start = AX3000_DRAM0_BASE, |
| 18 | .board_id = -1, |
| 19 | }; |
| 20 | |
| 21 | static void ax3000_machine_init(MachineState *machine) |
| 22 | { |
| 23 | Ax3000MachineState *ams = AX3000_MACHINE(machine); |
| 24 | |
| 25 | ams->soc = AX3000_SOC(object_new(TYPE_AX3000_SOC)); |
| 26 | object_property_add_child(OBJECT(machine), "soc", OBJECT(ams->soc)); |
| 27 | sysbus_realize_and_unref(SYS_BUS_DEVICE(ams->soc), &error_fatal); |
| 28 | |
| 29 | ax3000_binfo.ram_size = machine->ram_size; |
| 30 | arm_load_kernel(&ams->soc->cpu[0], machine, &ax3000_binfo); |
| 31 | } |
| 32 | |
| 33 | static void ax3000_machine_class_init(ObjectClass *oc, const void *data) |
| 34 | { |
| 35 | MachineClass *mc = MACHINE_CLASS(oc); |
| 36 | |
| 37 | mc->init = ax3000_machine_init; |
| 38 | mc->default_cpus = AX3000_NUM_CPUS; |
| 39 | mc->min_cpus = AX3000_NUM_CPUS; |
| 40 | mc->max_cpus = AX3000_NUM_CPUS; |
| 41 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); |
| 42 | } |
| 43 | |
| 44 | static const TypeInfo ax3000_machine_types[] = { |
| 45 | { |
| 46 | .name = TYPE_AX3000_MACHINE, |
| 47 | .parent = TYPE_MACHINE, |
| 48 | .instance_size = sizeof(Ax3000MachineState), |
| 49 | .class_size = sizeof(Ax3000MachineClass), |
| 50 | .class_init = ax3000_machine_class_init, |
| 51 | .interfaces = aarch64_machine_interfaces, |
| 52 | .abstract = true, |
| 53 | } |
| 54 | }; |
| 55 | |
| 56 | DEFINE_TYPES(ax3000_machine_types) |