@@ -81,24 +81,24 @@ static unsigned int _gic_max_irq;
81
81
#define ICC_ASGI1R_EL1 "S3_0_C12_C11_6"
82
82
83
83
/* Macro to access the Distributor Control Register (GICD_CTLR) */
84
- #define GICD_CTLR_RWP (1 << 31)
85
- #define GICD_CTLR_E1NWF (1 << 7)
86
- #define GICD_CTLR_DS (1 << 6)
87
- #define GICD_CTLR_ARE_NS (1 << 5)
88
- #define GICD_CTLR_ARE_S (1 << 4)
89
- #define GICD_CTLR_ENGRP1S (1 << 2)
90
- #define GICD_CTLR_ENGRP1NS (1 << 1)
91
- #define GICD_CTLR_ENGRP0 (1 << 0)
84
+ #define GICD_CTLR_RWP (1U << 31)
85
+ #define GICD_CTLR_E1NWF (1U << 7)
86
+ #define GICD_CTLR_DS (1U << 6)
87
+ #define GICD_CTLR_ARE_NS (1U << 5)
88
+ #define GICD_CTLR_ARE_S (1U << 4)
89
+ #define GICD_CTLR_ENGRP1S (1U << 2)
90
+ #define GICD_CTLR_ENGRP1NS (1U << 1)
91
+ #define GICD_CTLR_ENGRP0 (1U << 0)
92
92
93
93
/* Macro to access the Redistributor Control Register (GICR_CTLR) */
94
- #define GICR_CTLR_UWP (1 << 31)
95
- #define GICR_CTLR_DPG1S (1 << 26)
96
- #define GICR_CTLR_DPG1NS (1 << 25)
97
- #define GICR_CTLR_DPG0 (1 << 24)
98
- #define GICR_CTLR_RWP (1 << 3)
99
- #define GICR_CTLR_IR (1 << 2)
100
- #define GICR_CTLR_CES (1 << 1)
101
- #define GICR_CTLR_EnableLPI (1 << 0)
94
+ #define GICR_CTLR_UWP (1U << 31)
95
+ #define GICR_CTLR_DPG1S (1U << 26)
96
+ #define GICR_CTLR_DPG1NS (1U << 25)
97
+ #define GICR_CTLR_DPG0 (1U << 24)
98
+ #define GICR_CTLR_RWP (1U << 3)
99
+ #define GICR_CTLR_IR (1U << 2)
100
+ #define GICR_CTLR_CES (1U << 1)
101
+ #define GICR_CTLR_EnableLPI (1U << 0)
102
102
103
103
/* Macro to access the Generic Interrupt Controller Interface (GICC) */
104
104
#define GIC_CPU_CTRL (hw_base ) HWREG32((hw_base) + 0x00U)
@@ -162,7 +162,7 @@ static unsigned int _gic_max_irq;
162
162
163
163
int arm_gic_get_active_irq (rt_uint64_t index )
164
164
{
165
- int irq ;
165
+ rt_base_t irq ;
166
166
167
167
RT_ASSERT (index < ARM_GIC_MAX_NR );
168
168
@@ -178,7 +178,7 @@ void arm_gic_ack(rt_uint64_t index, int irq)
178
178
RT_ASSERT (irq >= 0 );
179
179
180
180
__DSB ();
181
- SET_GICV3_REG (ICC_EOIR1_EL1 , irq );
181
+ SET_GICV3_REG (ICC_EOIR1_EL1 , ( rt_base_t ) irq );
182
182
}
183
183
184
184
void arm_gic_mask (rt_uint64_t index , int irq )
@@ -397,7 +397,7 @@ void arm_gic_set_priority(rt_uint64_t index, int irq, rt_uint64_t priority)
397
397
rt_int32_t cpu_id = rt_hw_cpu_id ();
398
398
399
399
mask = GIC_RDISTSGI_IPRIORITYR (_gic_table [index ].redist_hw_base [cpu_id ], irq );
400
- mask &= ~(0xff << ((irq % 4 ) * 8 ));
400
+ mask &= ~(0xffUL << ((irq % 4 ) * 8 ));
401
401
mask |= ((priority & 0xff ) << ((irq % 4 ) * 8 ));
402
402
GIC_RDISTSGI_IPRIORITYR (_gic_table [index ].redist_hw_base [cpu_id ], irq ) = mask ;
403
403
}
@@ -468,7 +468,7 @@ rt_uint64_t arm_gic_get_interface_prior_mask(rt_uint64_t index)
468
468
469
469
void arm_gic_set_binary_point (rt_uint64_t index , rt_uint64_t binary_point )
470
470
{
471
- index = index ;
471
+ RT_UNUSED ( index ) ;
472
472
binary_point &= 0x7 ;
473
473
474
474
SET_GICV3_REG (ICC_BPR1_EL1 , binary_point );
@@ -478,7 +478,7 @@ rt_uint64_t arm_gic_get_binary_point(rt_uint64_t index)
478
478
{
479
479
rt_uint64_t binary_point ;
480
480
481
- index = index ;
481
+ RT_UNUSED ( index ) ;
482
482
GET_GICV3_REG (ICC_BPR1_EL1 , binary_point );
483
483
return binary_point ;
484
484
}
@@ -616,7 +616,7 @@ rt_uint64_t arm_gic_get_high_pending_irq(rt_uint64_t index)
616
616
rt_uint64_t irq ;
617
617
RT_ASSERT (index < ARM_GIC_MAX_NR );
618
618
619
- index = index ;
619
+ RT_UNUSED ( index ) ;
620
620
GET_GICV3_REG (ICC_HPPIR1_EL1 , irq );
621
621
622
622
return irq ;
@@ -625,13 +625,18 @@ rt_uint64_t arm_gic_get_high_pending_irq(rt_uint64_t index)
625
625
rt_uint64_t arm_gic_get_interface_id (rt_uint64_t index )
626
626
{
627
627
rt_uint64_t ret = 0 ;
628
+ rt_base_t level ;
629
+ int cpuid ;
628
630
629
631
RT_ASSERT (index < ARM_GIC_MAX_NR );
630
632
631
- if (_gic_table [index ].cpu_hw_base != RT_NULL )
633
+ level = rt_hw_local_irq_disable ();
634
+ cpuid = rt_hw_cpu_id ();
635
+ if (_gic_table [index ].cpu_hw_base [cpuid ] != RT_NULL )
632
636
{
633
- ret = GIC_CPU_IIDR (_gic_table [index ].cpu_hw_base );
637
+ ret = GIC_CPU_IIDR (_gic_table [index ].cpu_hw_base [ cpuid ] );
634
638
}
639
+ rt_hw_local_irq_enable (level );
635
640
636
641
return ret ;
637
642
}
@@ -857,7 +862,7 @@ int arm_gic_cpu_init(rt_uint64_t index, rt_uint64_t cpu_base)
857
862
value = arm_gic_get_system_register_enable_mask (index );
858
863
value |= (1 << 0 );
859
864
arm_gic_set_system_register_enable_mask (index , value );
860
- SET_GICV3_REG (ICC_CTLR_EL1 , 0 );
865
+ SET_GICV3_REG (ICC_CTLR_EL1 , 0l );
861
866
862
867
arm_gic_set_interface_prior_mask (index , 0xff );
863
868
0 commit comments