2 * Shakti C-class SoC emulation
4 * Copyright (c) 2021 Vijai Kumar K <vijai@behindbytes.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2 or later, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "hw/riscv/riscv_hart.h"
23 #include "hw/boards.h"
24 #include "hw/char/shakti_uart.h"
26 #define TYPE_RISCV_SHAKTI_SOC "riscv.shakti.cclass.soc"
27 #define RISCV_SHAKTI_SOC(obj) \
28 OBJECT_CHECK(ShaktiCSoCState, (obj), TYPE_RISCV_SHAKTI_SOC)
30 typedef struct ShaktiCSoCState
{
32 DeviceState parent_obj
;
35 RISCVHartArrayState cpus
;
42 #define TYPE_RISCV_SHAKTI_MACHINE MACHINE_TYPE_NAME("shakti_c")
43 #define RISCV_SHAKTI_MACHINE(obj) \
44 OBJECT_CHECK(ShaktiCMachineState, (obj), TYPE_RISCV_SHAKTI_MACHINE)
45 typedef struct ShaktiCMachineState
{
47 MachineState parent_obj
;
51 } ShaktiCMachineState
;
63 #define SHAKTI_C_PLIC_HART_CONFIG "MS"
64 /* Including Interrupt ID 0 (no interrupt)*/
65 #define SHAKTI_C_PLIC_NUM_SOURCES 28
66 /* Excluding Priority 0 */
67 #define SHAKTI_C_PLIC_NUM_PRIORITIES 2
68 #define SHAKTI_C_PLIC_PRIORITY_BASE 0x00
69 #define SHAKTI_C_PLIC_PENDING_BASE 0x1000
70 #define SHAKTI_C_PLIC_ENABLE_BASE 0x2000
71 #define SHAKTI_C_PLIC_ENABLE_STRIDE 0x80
72 #define SHAKTI_C_PLIC_CONTEXT_BASE 0x200000
73 #define SHAKTI_C_PLIC_CONTEXT_STRIDE 0x1000