[U-Boot] [PATCH v4 2/2] x86: Add a simple interrupt script to the README

Simon Glass sjg at chromium.org
Fri Aug 14 18:50:28 CEST 2015


On 14 August 2015 at 00:31, Bin Meng <bmeng.cn at gmail.com> wrote:
> On Fri, Aug 14, 2015 at 12:36 AM, Simon Glass <sjg at 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 at chromium.org>
>> ---
>
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
>
> Tested running the scripts with gawk 4.0.0
> Tested-by: Bin Meng <bmeng.cn at gmail.com>
>
> But please see comments below.
>
>>
>> Changes in v4:
>> - Adjust the PCI device output to decimal instead of hex
>>
>> Changes in v3:
>> - Add new patch to add a simple interrupt script to the README
>>
>> Changes in v2: None
>>
>>  doc/README.x86 | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>>
>> diff --git a/doc/README.x86 b/doc/README.x86
>> index af2459c..b2ca108 100644
>> --- a/doc/README.x86
>> +++ b/doc/README.x86
>> @@ -708,6 +708,21 @@ 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") \
>> +       {patsplit(device, bdf, "[0-9a-f]+"); \
>> +       printf "PCI_BDF(%d, %d, %d) INT%c PIRQ%c\n", strtonum("0x" bdf[1]), \
>> +       strtonum("0x" bdf[2]), bdf[3], strtonum(pin) + 64, 64 + strtonum(pin)}}'
>
> Please mention the scripts require gawk 4.0.0 or newer version, as
> patsplit is a new function introduced in 4.0.0. I compiled gawk from
> the source and the scripts works.

Updated.

Applied to u-boot-x86.


More information about the U-Boot mailing list