1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2021 Western Digital Corporation or its affiliates.
4 * Copyright (C) 2022 Ventana Micro Systems Inc.
5 */
6#ifndef __KVM_RISCV_AIA_IMSIC_H
7#define __KVM_RISCV_AIA_IMSIC_H
8
9#include <linux/types.h>
10#include <asm/csr.h>
11
12#define IMSIC_MMIO_PAGE_SHIFT		12
13#define IMSIC_MMIO_PAGE_SZ		(1UL << IMSIC_MMIO_PAGE_SHIFT)
14#define IMSIC_MMIO_PAGE_LE		0x00
15#define IMSIC_MMIO_PAGE_BE		0x04
16
17#define IMSIC_MIN_ID			63
18#define IMSIC_MAX_ID			2048
19
20#define IMSIC_EIDELIVERY		0x70
21
22#define IMSIC_EITHRESHOLD		0x72
23
24#define IMSIC_EIP0			0x80
25#define IMSIC_EIP63			0xbf
26#define IMSIC_EIPx_BITS			32
27
28#define IMSIC_EIE0			0xc0
29#define IMSIC_EIE63			0xff
30#define IMSIC_EIEx_BITS			32
31
32#define IMSIC_FIRST			IMSIC_EIDELIVERY
33#define IMSIC_LAST			IMSIC_EIE63
34
35#define IMSIC_MMIO_SETIPNUM_LE		0x00
36#define IMSIC_MMIO_SETIPNUM_BE		0x04
37
38#endif
39