1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Definitions for loongarch board emulation.
5 * Copyright (C) 2021 Loongson Technology Corporation Limited
11 #include "target/loongarch/cpu.h"
12 #include "hw/boards.h"
13 #include "qemu/queue.h"
14 #include "hw/intc/loongson_ipi.h"
15 #include "hw/block/flash.h"
16 #include "hw/loongarch/boot.h"
18 #define LOONGARCH_MAX_CPUS 256
20 #define VIRT_FWCFG_BASE 0x1e020000UL
21 #define VIRT_BIOS_BASE 0x1c000000UL
22 #define VIRT_BIOS_SIZE (16 * MiB)
23 #define VIRT_FLASH_SECTOR_SIZE (256 * KiB)
24 #define VIRT_FLASH0_BASE VIRT_BIOS_BASE
25 #define VIRT_FLASH0_SIZE VIRT_BIOS_SIZE
26 #define VIRT_FLASH1_BASE 0x1d000000UL
27 #define VIRT_FLASH1_SIZE (16 * MiB)
29 #define VIRT_LOWMEM_BASE 0
30 #define VIRT_LOWMEM_SIZE 0x10000000
31 #define VIRT_HIGHMEM_BASE 0x80000000
32 #define VIRT_GED_EVT_ADDR 0x100e0000
33 #define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN)
34 #define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN)
36 #define COMMAND_LINE_SIZE 512
38 #define FDT_BASE 0x100000
40 struct LoongArchVirtMachineState
{
42 MachineState parent_obj
;
48 /* State for other subsystems/APIs: */
50 Notifier machine_done
;
51 Notifier powerdown_notifier
;
56 DeviceState
*acpi_ged
;
58 DeviceState
*platform_bus_dev
;
60 PFlashCFI01
*flash
[2];
61 MemoryRegion system_iocsr
;
62 MemoryRegion iocsr_mem
;
63 AddressSpace as_iocsr
;
64 struct loongarch_boot_info bootinfo
;
67 #define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
68 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchVirtMachineState
, LOONGARCH_VIRT_MACHINE
)
69 void loongarch_acpi_setup(LoongArchVirtMachineState
*lvms
);