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/block/flash.h" 15 #include "hw/loongarch/boot.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 (16 * MiB) 22 #define VIRT_FLASH_SECTOR_SIZE (256 * KiB) 23 #define VIRT_FLASH0_BASE VIRT_BIOS_BASE 24 #define VIRT_FLASH0_SIZE VIRT_BIOS_SIZE 25 #define VIRT_FLASH1_BASE 0x1d000000UL 26 #define VIRT_FLASH1_SIZE (16 * MiB) 27 28 #define VIRT_LOWMEM_BASE 0 29 #define VIRT_LOWMEM_SIZE 0x10000000 30 #define VIRT_HIGHMEM_BASE 0x80000000 31 #define VIRT_GED_EVT_ADDR 0x100e0000 32 #define VIRT_GED_MEM_ADDR (VIRT_GED_EVT_ADDR + ACPI_GED_EVT_SEL_LEN) 33 #define VIRT_GED_REG_ADDR (VIRT_GED_MEM_ADDR + MEMORY_HOTPLUG_IO_LEN) 34 35 #define COMMAND_LINE_SIZE 512 36 37 #define FDT_BASE 0x100000 38 39 struct LoongArchVirtMachineState { 40 /*< private >*/ 41 MachineState parent_obj; 42 43 MemoryRegion lowmem; 44 MemoryRegion highmem; 45 MemoryRegion bios; 46 bool bios_loaded; 47 /* State for other subsystems/APIs: */ 48 FWCfgState *fw_cfg; 49 Notifier machine_done; 50 Notifier powerdown_notifier; 51 OnOffAuto acpi; 52 OnOffAuto veiointc; 53 char *oem_id; 54 char *oem_table_id; 55 DeviceState *acpi_ged; 56 int fdt_size; 57 DeviceState *platform_bus_dev; 58 PCIBus *pci_bus; 59 PFlashCFI01 *flash[2]; 60 MemoryRegion system_iocsr; 61 MemoryRegion iocsr_mem; 62 AddressSpace as_iocsr; 63 struct loongarch_boot_info bootinfo; 64 }; 65 66 #define TYPE_LOONGARCH_VIRT_MACHINE MACHINE_TYPE_NAME("virt") 67 OBJECT_DECLARE_SIMPLE_TYPE(LoongArchVirtMachineState, LOONGARCH_VIRT_MACHINE) 68 void loongarch_acpi_setup(LoongArchVirtMachineState *lvms); 69 #endif 70