diff mbox

[U-Boot,v3,09/10] x86: Add a simple interrupt script to the README

Message ID 1439211912-10085-10-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Aug. 10, 2015, 1:05 p.m. UTC
It is a bit tedious to figure out the interrupt configuration for a new
x86 platform. Add a script which can do this, based on the output of
'pci long'. This may be helpful in some cases.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Add new patch to add a simple interrupt script to the README

Changes in v2: None

 doc/README.x86 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Bin Meng Aug. 11, 2015, 5:49 a.m. UTC | #1
Hi Simon,

On Mon, Aug 10, 2015 at 9:05 PM, Simon Glass <sjg@chromium.org> wrote:
> It is a bit tedious to figure out the interrupt configuration for a new
> x86 platform. Add a script which can do this, based on the output of
> 'pci long'. This may be helpful in some cases.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3:
> - Add new patch to add a simple interrupt script to the README
>
> Changes in v2: None
>
>  doc/README.x86 | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/doc/README.x86 b/doc/README.x86
> index af2459c..1e8be8f 100644
> --- a/doc/README.x86
> +++ b/doc/README.x86
> @@ -708,6 +708,20 @@ allocation and assignment will be done by U-Boot automatically. Now you can
>  enable CONFIG_GENERATE_PIRQ_TABLE for testing Linux kernel using i8259 PIC and
>  CONFIG_GENERATE_MP_TABLE for testing Linux kernel using local APIC and I/O APIC.
>
> +This script might be useful. If you feed it the output of 'pci long' from
> +U-Boot then it will generate a device tree fragment with the interrupt
> +configuration for each device:
> +
> +   $ cat console_output |awk '/PCI/ {device=$4} /interrupt line/ {line=$4} \
> +       /interrupt pin/ {pin = $4; if (pin != "0x00") \

&& pin != "0xff"

> +       {printf "PCI_BDF(%s) INT%c PIRQ%c\n", device, strtonum(pin) + 64, 64 + \
> +       strtonum(pin)}}' | sed 's/\(..\)\.\(..\)\.\(..\):/0x\1, 0x\2, 0x\3/'
> +
> +Example output:
> +   PCI_BDF(0x00, 0x02, 0x00) INTA PIRQA
> +   PCI_BDF(0x00, 0x11, 0x00) INTA PIRQA

Nits: can we avoid using hex numbers here?

> +...
> +
>  TODO List
>  ---------
>  - Audio
> --

Regards,
Bin
diff mbox

Patch

diff --git a/doc/README.x86 b/doc/README.x86
index af2459c..1e8be8f 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -708,6 +708,20 @@  allocation and assignment will be done by U-Boot automatically. Now you can
 enable CONFIG_GENERATE_PIRQ_TABLE for testing Linux kernel using i8259 PIC and
 CONFIG_GENERATE_MP_TABLE for testing Linux kernel using local APIC and I/O APIC.
 
+This script might be useful. If you feed it the output of 'pci long' from
+U-Boot then it will generate a device tree fragment with the interrupt
+configuration for each device:
+
+   $ cat console_output |awk '/PCI/ {device=$4} /interrupt line/ {line=$4} \
+	/interrupt pin/ {pin = $4; if (pin != "0x00") \
+	{printf "PCI_BDF(%s) INT%c PIRQ%c\n", device, strtonum(pin) + 64, 64 + \
+	strtonum(pin)}}' | sed 's/\(..\)\.\(..\)\.\(..\):/0x\1, 0x\2, 0x\3/'
+
+Example output:
+   PCI_BDF(0x00, 0x02, 0x00) INTA PIRQA
+   PCI_BDF(0x00, 0x11, 0x00) INTA PIRQA
+...
+
 TODO List
 ---------
 - Audio