源码:rk3568_2GIC.zip · 野人锋/ARMv8-A bare-metal - Gitee.com
rk3568 中的 GIC-600,实现的是 GICv3 标准,
但又与其它的GICv3芯片有所不同,
其它的GICv3芯片不需要对 ReDistributor 做 power-on 的动作,
GIC-600要!并且是要先 pwr-on redist -> 再 pwr-on cpuif,
不然 cpuif 唤不醒。
上面的代码,实现了一份小驱动,因为 rockchip、firefly 没有都没把 rk3568 的GIC驱动放出来,
所以是参考 arm-trusted-firmware 源码 + 自己阅读手册整理出来的。
代码里面实现了以下功能:
读取GIC相关信息,如GIC版本,distributor 下挂有几个 redistributor,等等。。。
然后初始化 dist、redist、cpuif,
然后通过 GICv3_InterruptConfig() 函数配置 secure timer0 中断分组、优先级、开关,
然后初始化 secure timer0,让其每两秒钟触发一次中断。
void InitTestTimer()
{
GICv3Interrupt TeeTimerInt;
#ifdef PLAT_QEMU
Init_qemu_Timer();
// 29号中断(29号中断是 TEE 环境的 timer 中断,根据中断号划分,29号属于 PPI 中断,即独享的中断号)
TeeTimerInt.intr_num = 29;
#else
Init_qemu_Timer();
//Init_rk3568_Timer();
// 29号中断(29号中断是 TEE 环境的 timer 中断,根据中断号划分,29号属于 PPI 中断,即独享的中断号)
TeeTimerInt.intr_num = 29;
//TeeTimerInt.intr_num = 139;
#endif
TeeTimerInt.intr_grp = IntGroupG0;
TeeTimerInt.intr_pri = 0;
TeeTimerInt.intr_cfg = 0;
TeeTimerInt.isEnable = 1;
GICv3_InterruptConfig(&TeeTimerInt);
}
没写LPI、ITS部分的代码。