ARM 特定的 IRQ 初始化 [英] ARM specific IRQ initialization

查看:17
本文介绍了ARM 特定的 IRQ 初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解 ARM 架构特定的 IRQ 初始化(向量表和第一级中断处理程序).

I am trying to understand architecture specific IRQ initialization(vector table and first level interrupt hadlers) for ARM.

我检查了 start_kernel() init/main.c ----->setup_arch() arch/arm/kernel/setup.c, 但找不到与 IRQ 初始化相关的源.我认为在 start_kernel() 内部调用的 init_IRQ() 是设置内核 IRQ 处理基础设施.

I checked start_kernel() init/main.c -----> setup_arch() arch/arm/kernel/setup.c, but couldn't find the source related to IRQ initialization. I think init_IRQ() which called inside start_kernel() is to set up kernel IRQ handling infrastructure.

我指的是 3.14 内核.你能帮助理解 ARM 特定的 IRQ 初始化(ARM GIC 初始化).我指的是 CortexA15 的 3.14 内核.

I am refering 3.14 kernel. Can you help to understand ARM specific IRQ initialization(ARM GIC initialization).I am refering 3.14 kernel for CortexA15.

推荐答案

这很难跟踪,因为某些代码是通过 section magic 调用的,而其他代码是通过回调和其他机制调用的.此外,我们还有历史机制和设备树初始化Note1.

This is difficult to track as some code is called through section magic and others via call backs and other mechanisms. Also, we have historic mechanisms and device tree initializationNote1.

机器结构init_irq;这些通常在板文件中定义.例如,imx6sl_init_irq() 通过imx6sl_init_irq() 从机器描述中调用irqchip_init()code>DT_MACHINE_START 宏,它是一个 machine_desc.这段代码在启动时很早就被调用,是让 IRQ 硬件工作所必需的;它通常包括时钟机制.

There is a call back in init_irq of the machine structure; these are typically defined in a board file. For example, imx6sl_init_irq() calls irqchip_init() from the machine description via the DT_MACHINE_START macro which is a machine_desc in the .arch.info.init section. This code is called very early in boot and is required to get the IRQ hardware working; it typically include clocking mechanisms.

Linux 支持多个 irqchip 控制器.例如,在一些 ARM 系统上有多个 GIC 芯片.如果有超过 1020 个中断源,则需要这样做.同样,GPIO 硬件通常是一种辅助 IRQ 芯片,用于启用/禁用 GPIO 中断.

Linux supports several irqchip controllers. For instance, on some ARM systems there are multiple GIC chips. This is needed if there are more than ~1020 interrupt sources. As well, the GPIO hardware is often a sort of secondary IRQ chip that enables/disables GPIO interrupts.

机器必须在设备树中声明 GIC.这与 irq-gic.c 中的一个表条目,它调用 gic_of_init().这些表由 of_irq_init() 使用硬件地址和中断编号初始化 GIC 控制器.即,这需要 irq-gic 驱动程序并提供一个具体的设备Note2.

A machine must declare the GIC in a device tree. This is matched versus a table entry in irq-gic.c which calls gic_of_init(). The tables are use by the of_irq_init() to initialize a GIC controller with hardware addresses and interrupt numbering. Ie, this takes the irq-gic driver and gives a concrete deviceNote2.

现在你在 start_kernel() 中找到的代码,它调用了 init_IRQ() 应该有意义吗?它看起来像,

So now the code you found in start_kernel(), which calls init_IRQ() should make sense? It will look like,

 start_kernel     ->
  init_IRQ        ->
   machine_desc->init_irq (machine version)
    irqchip_init  ->
     of_irq_init  -> via *device tree* for address data
      gic_of_init -> actual controller initialization.

结构无处不在因为Linux被组织成子系统,所以你有驱动基础设施(都需要中断)、设备树(获取数据)、初始化和中断代码(irqchip).DT 或设备树功能旨在减少 Linux 中板特定代码的数量.一个例子 imx6 solo-lite 设备树包含显示了数据是如何编码的.这段文本被编译成一个扁平的设备树二进制文件,它从引导加载程序(或附加到映像)传递过来.

The structure is all over the place because Linux is organized as sub-systems, so you have driver infrastructure (all need interrupts), device tree (to get the data), initialization and interrupt code (irqchip). The DT or device tree functionality is aimed at reducing the amount of board specific code in Linux. An example imx6 solo-lite device tree include shows how the data is coded. This text gets compiled to a flattened device tree binary which is passed from a boot loader (or attached to the image).

注意 1: 设备树有多个名称.OF 用于根据原始 PowerPC 规范开放固件.作为扁平设备树"的FDT,主要由 u-boot 人员使用.也只是DT.因此,当您看到以下前缀 OF、DT、FDT 之一时,通常是关于设备树".

Note 1: Device tree is called by several names. OF for open firmware as per the original PowerPC spec. As FDT for 'flattened device tree', mostly by u-boot people. Also as just DT. So when you see one of the following prefixes, OF, DT, FDT it is often about 'device tree'.

注意 2: 设备是具体的硬件.驱动程序是处理设备的代码.Linux 分配内存并将其提供给驱动程序代码.通过这种方式,一段代码可以处理多个设备(在这种情况下是中断控制器).这是一个面向对象的概念,ARM 将通过 address+offset 使用加载/存储单元来很好地处理它.

Note 2: A device is a concrete piece of hardware. A driver is the code to handle the device. Linux allocates memory and provides this to driver code. In this way one piece of code can handle multiple devices (interrupt controllers in this case). It is an object oriented concept and ARM will handle it well with address+offset use of the load/store unit.

这篇关于ARM 特定的 IRQ 初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆