1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright 2022-2023 NXP 4 * 5 * Brief Qemu Virt platform configuration. 6 */ 7 8 #ifndef PLATFORM_CONFIG_H 9 #define PLATFORM_CONFIG_H 10 11 #include <mm/generic_ram_layout.h> 12 #include <riscv.h> 13 14 /* DRAM */ 15 #ifndef DRAM_BASE 16 #define DRAM_BASE 0x80000000 17 #define DRAM_SIZE 0x10000000 18 #endif 19 20 /* CLINT */ 21 #ifndef CLINT_BASE 22 #define CLINT_BASE 0x02000000 23 #endif 24 25 /* PLIC */ 26 #ifndef PLIC_BASE 27 #define PLIC_BASE 0x0c000000 28 #define PLIC_REG_SIZE 0x600000 29 #define PLIC_NUM_SOURCES 0x5f 30 #endif 31 32 /* APLIC */ 33 #ifndef APLIC_BASE 34 #define APLIC_BASE 0x0d000000 35 #define APLIC_SIZE 0x8000 36 #define APLIC_NUM_SOURCE 0x60 37 #define APLIC_NUM_IDC CFG_TEE_CORE_NB_CORE 38 #endif 39 40 /* IMSIC */ 41 #ifndef IMSIC_BASE 42 #define IMSIC_BASE 0x28000000 43 #define IMSIC_SIZE 0x4000000 44 #define IMSIC_NUM_IDS 0xff 45 #define IMSIC_GUEST_INDEX_BITS 0x00 46 #define IMSIC_HART_INDEX_BITS 0x02 47 #define IMSIC_GROUP_INDEX_BITS 0x00 48 #define IMSIC_GROUP_INDEX_SHIFT 0x18 49 #endif 50 51 /* UART */ 52 #ifndef UART0_BASE 53 #define UART0_BASE 0x10000000 54 #endif 55 #define UART0_IRQ 0x0a 56 57 /* RTC */ 58 #ifndef RTC_BASE 59 #define RTC_BASE 0x101000 60 #endif 61 #define RTC_IRQ 0x0b 62 63 /* VIRTIO MMIOs */ 64 #define NUM_VIRTIO_MMIOS 8 65 66 #ifndef VIRTIO_MMIO1 67 #define VIRTIO_MMIO1 0x10001000 68 #define VIRTIO_MMIO1_IRQ 0x01 69 #endif 70 71 #ifndef VIRTIO_MMIO2 72 #define VIRTIO_MMIO2 0x10002000 73 #define VIRTIO_MMIO2_IRQ 0x02 74 #endif 75 76 #ifndef VIRTIO_MMIO3 77 #define VIRTIO_MMIO3 0x10003000 78 #define VIRTIO_MMIO3_IRQ 0x03 79 #endif 80 81 #ifndef VIRTIO_MMIO4 82 #define VIRTIO_MMIO4 0x10004000 83 #define VIRTIO_MMIO4_IRQ 0x04 84 #endif 85 86 #ifndef VIRTIO_MMIO5 87 #define VIRTIO_MMIO5 0x10005000 88 #define VIRTIO_MMIO5_IRQ 0x05 89 #endif 90 91 #ifndef VIRTIO_MMIO6 92 #define VIRTIO_MMIO6 0x10006000 93 #define VIRTIO_MMIO6_IRQ 0x06 94 #endif 95 96 #ifndef VIRTIO_MMIO7 97 #define VIRTIO_MMIO7 0x10007000 98 #define VIRTIO_MMIO7_IRQ 0x07 99 #endif 100 101 #ifndef VIRTIO_MMIO8 102 #define VIRTIO_MMIO8 0x10008000 103 #define VIRTIO_MMIO8_IRQ 0x08 104 #endif 105 106 #ifdef CFG_RISCV_MTIME_RATE 107 #define RISCV_MTIME_RATE CFG_RISCV_MTIME_RATE 108 #else 109 #define RISCV_MTIME_RATE 1000000 110 #endif 111 112 #define PLAT_THREAD_EXCP_FOREIGN_INTR \ 113 (CSR_XIE_EIE | CSR_XIE_TIE | CSR_XIE_SIE) 114 #define PLAT_THREAD_EXCP_NATIVE_INTR (0) 115 116 #endif /*PLATFORM_CONFIG_H*/ 117