xref: /openbmc/qemu/include/hw/intc/loongson_ipi.h (revision 2252e6c9)
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     MemoryRegion *ipi_mmio_mem;
23     uint32_t status;
24     uint32_t en;
25     uint32_t set;
26     uint32_t clear;
27     /* 64bit buf divide into 2 32bit buf */
28     uint32_t buf[IPI_MBX_NUM * 2];
29     qemu_irq irq;
30 } IPICore;
31 
32 struct LoongsonIPIClass {
33     LoongsonIPICommonClass parent_class;
34 
35     DeviceRealize parent_realize;
36     DeviceUnrealize parent_unrealize;
37 };
38 
39 struct LoongsonIPIState {
40     LoongsonIPICommonState parent_obj;
41 
42     MemoryRegion ipi_iocsr_mem;
43     MemoryRegion ipi64_iocsr_mem;
44     uint32_t num_cpu;
45     IPICore *cpu;
46 };
47 
48 #endif
49