[PATCH 31] LEON3: added IRQAMP support

Daniel Hellstrom daniel at gaisler.com
Fri Apr 6 07:20:29 UTC 2012


Hello,


On 04/05/2012 05:32 PM, Joel Sherrill wrote:
> I am confused by the hardware description of
> "IRQ Controller has support for multiple IRQ Controllers".
> Do you mean a hierarchy of controllers?
I agree, a bit confusing.
>
> 1) master controller with sub controllers?
> 2) one controller per core?
>
> I think the patch is OK. But the comment might
> need to be clearer.

Normally LEON3 systems have one IRQMP controller, however some newer multi-core systems (with say N cores) have the IRQAMP controller which is backwards compatible to IRQMP and has the "new AMP" 
option to appear as N IRQMP controllers. Some new registers in the IRQAMP tells us how the bootloader has routed all the output IRQs to the CPU, for example it might tell us that CPU0, CPU1 and CPU2 
is connected to IRQMP[0] and CPU3 is connected to IRQMP[1]. In SMP systems all CPUs share one IRQ controller.

The IRQAMP is discovered in AMBA Plug&Play information as one single core.

>
> On 04/05/2012 10:23 AM, Daniel Hellstrom wrote:
>> ---
>>   c/src/lib/libbsp/sparc/leon3/amba/amba.c       |   14 ++++++++++++++
>>   c/src/lib/libbsp/sparc/shared/include/ambapp.h |    7 ++++---
>>   2 files changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
>> index e334aec..56ff57f 100644
>> --- a/c/src/lib/libbsp/sparc/leon3/amba/amba.c
>> +++ b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
>> @@ -39,6 +39,7 @@ extern int scan_uarts(void);
>>   void amba_initialize(void)
>>   {
>>     int i;
>> +  int icsel;
>>     amba_apb_device dev;
>>
>>     /* Scan the AMBA Plug&Play info at the default LEON3 area */
>> @@ -55,6 +56,19 @@ void amba_initialize(void)
>>     }
>>
>>     LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
>> +  if ((LEON3_IrqCtrl_Regs->ampctrl>>  28)>  0) {
>> +    /* IRQ Controller has support for multiple IRQ Controllers, each
>> +     * CPU can be routed to different Controllers, we find out which
>> +     * controller by looking at the IRQCTRL Select Register for this CPU.
>> +     * Each Controller is located at a 4KByte offset.
>> +     */
>> +    icsel = LEON3_IrqCtrl_Regs->icsel[LEON3_Cpu_Index/8];
>> +    icsel = (icsel>>  ((7 - (LEON3_Cpu_Index&  0x7)) * 4))&  0xf;
>> +    LEON3_IrqCtrl_Regs += icsel;
>> +    LEON3_IrqCtrl_Regs->mask[LEON3_Cpu_Index] = 0;
>> +    LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index] = 0;
>> +    LEON3_IrqCtrl_Regs->iclear = 0xffffffff;
>> +  }
>>
>>     /* Init Extended IRQ controller if available */
>>     leon3_ext_irq_init();
>> diff --git a/c/src/lib/libbsp/sparc/shared/include/ambapp.h b/c/src/lib/libbsp/sparc/shared/include/ambapp.h
>> index cc8e120..7ca2d13 100644
>> --- a/c/src/lib/libbsp/sparc/shared/include/ambapp.h
>> +++ b/c/src/lib/libbsp/sparc/shared/include/ambapp.h
>> @@ -262,9 +262,8 @@ typedef struct {
>>     volatile unsigned int notused01;
>>     volatile unsigned int notused02;
>>     volatile unsigned int notused03;
>> -  volatile unsigned int notused10;
>> -  volatile unsigned int notused11;
>> -  volatile unsigned int notused12;
>> +  volatile unsigned int ampctrl;
>> +  volatile unsigned int icsel[2];
>>     volatile unsigned int notused13;
>>     volatile unsigned int notused20;
>>     volatile unsigned int notused21;
>> @@ -274,6 +273,8 @@ typedef struct {
>>     volatile unsigned int force[16];
>>     /* Extended IRQ registers */
>>     volatile unsigned int intid[16];
>> +  /* 0x100, align to 4Kb boundary */
>> +  volatile unsigned int resv1[(0x1000-0x100)/4];
>>   } LEON3_IrqCtrl_Regs_Map;
>>
>>   /*****************************/
>
>




More information about the devel mailing list