xref: /qemu/include/hw/loongarch/virt.h (revision d4eb5038)
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 "target/loongarch/cpu.h"
12 #include "hw/boards.h"
13 #include "qemu/queue.h"
14 #include "hw/intc/loongarch_ipi.h"
15 #include "hw/block/flash.h"
16 
17 #define LOONGARCH_MAX_CPUS      256
18 
19 #define VIRT_FWCFG_BASE         0x1e020000UL
20 #define VIRT_BIOS_BASE          0x1c000000UL
21 #define VIRT_BIOS_SIZE          (4 * MiB)
22 #define VIRT_FLASH_SECTOR_SIZE  (128 * KiB)
23 #define VIRT_FLASH_BASE         0x1d000000UL
24 #define VIRT_FLASH_SIZE         (16 * MiB)
25 
26 #define VIRT_LOWMEM_BASE        0
27 #define VIRT_LOWMEM_SIZE        0x10000000
28 #define VIRT_HIGHMEM_BASE       0x90000000
29 #define VIRT_GED_EVT_ADDR       0x100e0000
30 #define VIRT_GED_MEM_ADDR       (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN)
31 #define VIRT_GED_REG_ADDR       (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN)
32 
33 struct LoongArchMachineState {
34     /*< private >*/
35     MachineState parent_obj;
36 
37     MemoryRegion lowmem;
38     MemoryRegion highmem;
39     MemoryRegion bios;
40     bool         bios_loaded;
41     /* State for other subsystems/APIs: */
42     FWCfgState  *fw_cfg;
43     Notifier     machine_done;
44     Notifier     powerdown_notifier;
45     OnOffAuto    acpi;
46     char         *oem_id;
47     char         *oem_table_id;
48     DeviceState  *acpi_ged;
49     int          fdt_size;
50     DeviceState *platform_bus_dev;
51     PCIBus       *pci_bus;
52     PFlashCFI01  *flash;
53 };
54 
55 #define TYPE_LOONGARCH_MACHINE  MACHINE_TYPE_NAME("virt")
56 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchMachineState, LOONGARCH_MACHINE)
57 bool loongarch_is_acpi_enabled(LoongArchMachineState *lams);
58 void loongarch_acpi_setup(LoongArchMachineState *lams);
59 #endif
60