Pass-Througt模式:硬件重启后的默认模式。在这个模式,中断不经过PIC而直接传给内核进行处理。通过(GCR[M] = 0)来允许Pass-Through模式。

datasheet这里是这样描述的:
The MPIC provides a mechanism to support alternate external interrupt controllers such as the PC/AT-compatible 8259 interrupt controller architecture. After a hard reset, the MPIC defaults to pass-through mode, in which active-high interrupts from external source IRQ0 are passed directly to core 0 as shown in Figure 31-2; all other external interrupt signals are ignored. Thus, the interrupt signal from an
external interrupt controller can be connected to IRQ0 and cause direct interrupts to the processor core 0.The MPIC does not perform a vector fetch from an 8259 interrupt controller.

When pass-through mode is enabled, the internally-generated interrupts shown in Table 31-3 are not forwarded to core 0. Instead, the MPIC passes the raw interrupts from the internal sources to the interrupt output signal, IRQ_OUT.
中断.PNG 

NOTES
In pass-through mode, interrupts generated within the MPIC (global timers,interprocessor, and message register interrupts) are disabled. If internal or MPIC-generated interrupts must be reported internally to the processor,
mixed mode must be used.
In pass-through mode, the target for each interrupt must be set to int (xILRn[INTTGT] = 0x00). This is the default setting of each register;
therefore, no programming should be necessary to comply with this requirement.

当是mixed 模式时,外部中断处理过程如下。
处理器的内部或外部中断源有效时,会将相应的中断信号传递到中断控制器PIC中,此时,中断控制器PIC会进行以下操作。
(1)        处理器首先使用IPR(Interrupt Pending Register)寄存器暂存所有有效的内部及外部中断源。该寄存器由54位组成,与处理器内部和外部中断源一一对应。当处理器内部或外部的中断源有效,IPR寄存器的相应位被置为有效。
(2)        随后中断控制器PIC会对暂存在IPR寄存器中的中断源进行处理,并将中断优先级别最高的中断源通过IS(Interrupt Selector)传递到IRR(Interrupt Request Register)寄存器中。此时IRR寄存器保存这个优先级别最高的中断源的硬件中断号(VECTOR)和中断优先级别(PRIORITY)。
(3)        如果在IRR寄存器中的存放中断源,其优先级高于CTPR和ISR(In-Service Register)寄存器中存放的中断源,中断控制器PIC将使用int#或者cint#信号向处理器发出中断请求。
(4)        当int#或者cint#信号有效时,CPU将跳转到外部中断向量,并开始执行外部中断处理程序。处理器进入中断服务程序后,将读取IACK(Interrupt Acknowledge)寄存器,启动中断响应周期。
(5)        在处理器进行中断响应时,处理器开始真正意义上的中断处理,同时由软件更新CTPR寄存器为当前中断源的优先级别,并由中断控制器PIC在ISR寄存器中标记当前中断源正在被处理。处理器使用ISR寄存器,记录所有正在被处理的中断源和当前最高的中断优先级别。
(6)        所有的中断源都有可能引发外部中断。此时中断处理程序必须通过存放在IACK寄存器中的硬件中断号,判断究竟是哪一个中断源引发的外部中断,随后调用相应的中断服务例程,处理相应的中断事件。
(7)        中断事件处理完毕后,处理器将对EOI寄存器进行写操作完成当前中断,并由中断寄存器PIC自动完成对ISR寄存器的维护,同时使用软件更新CTPR寄存器为一个较低的值,以便其他中断进入。
(8)        在程序员进行外部中断处理时,可以将CTPR寄存设为0,而由ISR寄存器维护中断源的级别,并判断是否允许中断重入。

在 external proxy模式时,不同的是e500mc内核的EPR寄存器检索到中断向量,并且不读IACK寄存器。具体如下:

在外部代理(external proxy)功能模式,e500mc内核自动为MPIC生成IACK周期。虽然从系统软件的角度看,直到有外部中断发生,e500mc内核才会响应中断。
在外部代理功能模式,中断处理程序应该从e500mc内核的EPR寄存器检索到中断向量,并且不读IACK寄存器。在在外部代理功能模式,读IACK寄存器会产生一个虚假的中断。

不明白的地方是,在Pass-Througt模式,中断不经过中断控制器直接传递给e500mc内核进行处理。那么,在外部中断处理过程中,是不是和MPIC相关的寄存器都不会进行操作?它的外部中断处理过程又是怎么样的呀?与mixed mode有不同?
还有,我读GCR寄存器里的值是0,说明是Pass-Througt模式。但是,我们用到了消息中断,能收到消息中断。按datasheet里描述,In pass-through mode, interrupts generated within the MPIC (global timers,interprocessor, and message register interrupts) are disabled. 消息中断应该是禁止的。
麻烦大家帮忙答疑一下,谢谢!


这里需要更正一下,读GCR寄存器里的值是0,说明是Pass-Througt模式。这句话是有问题的,读的GCR寄存器里的值是0x60000000,说明是 external proxy模式。因为p4080 cpu是大端,值的高位对应寄存器的低位,值的低位对应寄存器的高位,一开始弄反了,犯了一个低级错误,没有仔细看清各位的对应关系。
但是,还是不太明白Pass-Througt模式,中断不经过中断控制器直接传递给e500mc内核进行处理,使用外部中断控制器处理中断请求。外部中断处理过程也与p4080的MPIC外部中断处理过程类似,不同的是操作的是外部中断控制器的寄存器吗?
还有为什么复位的时候,MPIC就自定义为Pass-Througt模式,然后linux在初始化的时候,又把它设为external proxy模式。为什么要这样,而不是一开始就自定义为external proxy模式?