blob: 801e889bff02fc77eaba0d5cedbf378c311515c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-02-17 GuEe-GUI the first version
*/
#ifndef VIRT_H__
#define VIRT_H__
#include <rtdef.h>
#include <ioremap.h>
#ifdef RT_USING_SMART
#include <mmu.h>
#endif
#define __REG32(x) (*((volatile unsigned int *)(x)))
#define __REG16(x) (*((volatile unsigned short *)(x)))
/* UART */
#define PL011_UART0_BASE 0x09000000
#define PL011_UART0_SIZE 0x00001000
#define PL011_UART0_IRQNUM (32 + 1)
/* RTC */
#define PL031_RTC_BASE 0x9010000
#define PL031_RTC_SIZE 0x00001000
#define PL031_RTC_IRQNUM (32 + 2)
/* GPIO */
#define PL061_GPIO_BASE 0x09030000
#define PL061_GPIO_SIZE 0x00001000
#define PL061_GPIO_IRQNUM (32 + 7)
/* VirtIO */
#define VIRTIO_MMIO_BASE 0x0a000000
#define VIRTIO_MMIO_SIZE 0x00000200
#define VIRTIO_MAX_NR 32
#define VIRTIO_IRQ_BASE (32 + 16)
#define VIRTIO_VENDOR_ID 0x554d4551 /* "QEMU" */
/* GIC */
#define MAX_HANDLERS 96
#define GIC_IRQ_START 0
#define ARM_GIC_NR_IRQS 96
#define ARM_GIC_MAX_NR 1
#define IRQ_ARM_IPI_KICK 0
#define IRQ_ARM_IPI_CALL 1
/* GICv2 */
#define GIC_PL390_DISTRIBUTOR_PPTR 0x08000000
#define GIC_PL390_CONTROLLER_PPTR 0x08010000
#define GIC_PL390_HYPERVISOR_BASE 0x08030000
#define GIC_PL390_VIRTUAL_CPU_BASE 0x08040000
/* GICv3 */
#define GIC_PL500_DISTRIBUTOR_PPTR GIC_PL390_DISTRIBUTOR_PPTR
#define GIC_PL500_REDISTRIBUTOR_PPTR 0x080a0000
#define GIC_PL500_CONTROLLER_PPTR GIC_PL390_CONTROLLER_PPTR
#define GIC_PL500_ITS_PPTR 0x08080000
/* the basic constants and interfaces needed by gic */
rt_inline rt_ubase_t platform_get_gic_dist_base(void)
{
#ifdef BSP_USING_GICV2
return GIC_PL390_DISTRIBUTOR_PPTR;
#else
return GIC_PL500_DISTRIBUTOR_PPTR;
#endif
}
rt_inline rt_ubase_t platform_get_gic_redist_base(void)
{
return GIC_PL500_REDISTRIBUTOR_PPTR;
}
rt_inline rt_ubase_t platform_get_gic_cpu_base(void)
{
#ifdef BSP_USING_GICV2
return GIC_PL390_CONTROLLER_PPTR;
#else
return GIC_PL500_CONTROLLER_PPTR;
#endif
}
rt_inline rt_ubase_t platform_get_gic_its_base(void)
{
return GIC_PL500_ITS_PPTR;
}
#endif
|