1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * Loongson ipi interrupt header files 4 * 5 * Copyright (C) 2021 Loongson Technology Corporation Limited 6 */ 7 8 #ifndef HW_LOONGSON_IPI_H 9 #define HW_LOONGSON_IPI_H 10 11 #include "qom/object.h" 12 #include "hw/intc/loongson_ipi_common.h" 13 #include "hw/sysbus.h" 14 15 #define IPI_MBX_NUM 4 16 17 #define TYPE_LOONGSON_IPI "loongson_ipi" 18 OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI) 19 20 typedef struct IPICore { 21 LoongsonIPIState *ipi; 22 uint32_t status; 23 uint32_t en; 24 uint32_t set; 25 uint32_t clear; 26 /* 64bit buf divide into 2 32bit buf */ 27 uint32_t buf[IPI_MBX_NUM * 2]; 28 qemu_irq irq; 29 } IPICore; 30 31 struct LoongsonIPIClass { 32 LoongsonIPICommonClass parent_class; 33 34 DeviceRealize parent_realize; 35 DeviceUnrealize parent_unrealize; 36 }; 37 38 struct LoongsonIPIState { 39 LoongsonIPICommonState parent_obj; 40 41 MemoryRegion *ipi_mmio_mem; 42 MemoryRegion ipi_iocsr_mem; 43 MemoryRegion ipi64_iocsr_mem; 44 uint32_t num_cpu; 45 IPICore *cpu; 46 }; 47 48 #endif 49