2022-06-06 15:43:21 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
/*
|
2024-05-08 16:06:47 +03:00
|
|
|
* Loongson ipi interrupt header files
|
2022-06-06 15:43:21 +03:00
|
|
|
*
|
|
|
|
* Copyright (C) 2021 Loongson Technology Corporation Limited
|
|
|
|
*/
|
|
|
|
|
2024-05-08 16:06:47 +03:00
|
|
|
#ifndef HW_LOONGSON_IPI_H
|
|
|
|
#define HW_LOONGSON_IPI_H
|
2022-06-06 15:43:21 +03:00
|
|
|
|
2024-07-23 12:25:53 +03:00
|
|
|
#include "qom/object.h"
|
|
|
|
#include "hw/intc/loongson_ipi_common.h"
|
2022-06-06 15:43:21 +03:00
|
|
|
#include "hw/sysbus.h"
|
|
|
|
|
2023-05-21 13:23:04 +03:00
|
|
|
#define IPI_MBX_NUM 4
|
|
|
|
|
2024-05-08 16:06:47 +03:00
|
|
|
#define TYPE_LOONGSON_IPI "loongson_ipi"
|
2024-07-23 12:25:53 +03:00
|
|
|
OBJECT_DECLARE_TYPE(LoongsonIPIState, LoongsonIPIClass, LOONGSON_IPI)
|
2022-06-06 15:43:21 +03:00
|
|
|
|
|
|
|
typedef struct IPICore {
|
2024-07-15 17:50:51 +03:00
|
|
|
LoongsonIPIState *ipi;
|
2022-06-06 15:43:21 +03:00
|
|
|
uint32_t status;
|
|
|
|
uint32_t en;
|
|
|
|
uint32_t set;
|
|
|
|
uint32_t clear;
|
|
|
|
/* 64bit buf divide into 2 32bit buf */
|
2023-05-21 13:23:04 +03:00
|
|
|
uint32_t buf[IPI_MBX_NUM * 2];
|
2022-06-06 15:43:21 +03:00
|
|
|
qemu_irq irq;
|
|
|
|
} IPICore;
|
|
|
|
|
2024-07-23 12:25:53 +03:00
|
|
|
struct LoongsonIPIClass {
|
|
|
|
LoongsonIPICommonClass parent_class;
|
|
|
|
|
|
|
|
DeviceRealize parent_realize;
|
|
|
|
DeviceUnrealize parent_unrealize;
|
|
|
|
};
|
|
|
|
|
2024-07-15 17:50:51 +03:00
|
|
|
struct LoongsonIPIState {
|
2024-07-23 12:25:53 +03:00
|
|
|
LoongsonIPICommonState parent_obj;
|
|
|
|
|
2024-07-15 17:58:55 +03:00
|
|
|
MemoryRegion *ipi_mmio_mem;
|
2023-04-06 09:57:27 +03:00
|
|
|
MemoryRegion ipi_iocsr_mem;
|
|
|
|
MemoryRegion ipi64_iocsr_mem;
|
2023-12-13 07:13:14 +03:00
|
|
|
uint32_t num_cpu;
|
|
|
|
IPICore *cpu;
|
2022-06-06 15:43:21 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|