xref: /openbmc/qemu/include/hw/loongarch/virt.h (revision 5ae3ec63)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Definitions for loongarch board emulation.
4  *
5  * Copyright (C) 2021 Loongson Technology Corporation Limited
6  */
7 
8 #ifndef HW_LOONGARCH_H
9 #define HW_LOONGARCH_H
10 
11 #include "hw/boards.h"
12 #include "qemu/queue.h"
13 #include "hw/block/flash.h"
14 #include "hw/loongarch/boot.h"
15 
16 #define LOONGARCH_MAX_CPUS      256
17 
18 #define VIRT_FWCFG_BASE         0x1e020000UL
19 #define VIRT_BIOS_BASE          0x1c000000UL
20 #define VIRT_BIOS_SIZE          (16 * MiB)
21 #define VIRT_FLASH_SECTOR_SIZE  (256 * KiB)
22 #define VIRT_FLASH0_BASE        VIRT_BIOS_BASE
23 #define VIRT_FLASH0_SIZE        VIRT_BIOS_SIZE
24 #define VIRT_FLASH1_BASE        0x1d000000UL
25 #define VIRT_FLASH1_SIZE        (16 * MiB)
26 
27 #define VIRT_LOWMEM_BASE        0
28 #define VIRT_LOWMEM_SIZE        0x10000000
29 #define VIRT_HIGHMEM_BASE       0x80000000
30 #define VIRT_GED_EVT_ADDR       0x100e0000
31 #define VIRT_GED_MEM_ADDR       (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN)
32 #define VIRT_GED_REG_ADDR       (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN)
33 
34 #define COMMAND_LINE_SIZE       512
35 
36 #define FDT_BASE                0x100000
37 
38 struct LoongArchVirtMachineState {
39     /*< private >*/
40     MachineState parent_obj;
41 
42     MemoryRegion lowmem;
43     MemoryRegion highmem;
44     MemoryRegion bios;
45     bool         bios_loaded;
46     /* State for other subsystems/APIs: */
47     FWCfgState  *fw_cfg;
48     Notifier     machine_done;
49     Notifier     powerdown_notifier;
50     OnOffAuto    acpi;
51     OnOffAuto    veiointc;
52     char         *oem_id;
53     char         *oem_table_id;
54     DeviceState  *acpi_ged;
55     int          fdt_size;
56     DeviceState *platform_bus_dev;
57     PCIBus       *pci_bus;
58     PFlashCFI01  *flash[2];
59     MemoryRegion system_iocsr;
60     MemoryRegion iocsr_mem;
61     AddressSpace as_iocsr;
62     struct loongarch_boot_info bootinfo;
63 };
64 
65 #define TYPE_LOONGARCH_VIRT_MACHINE  MACHINE_TYPE_NAME("virt")
66 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchVirtMachineState, LOONGARCH_VIRT_MACHINE)
67 void loongarch_acpi_setup(LoongArchVirtMachineState *lvms);
68 #endif
69