diff mbox

[U-Boot,04/26] x86: irq: Reserve IRQ9 for ACPI in PIC mode

Message ID 1462174426-3470-5-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng May 2, 2016, 7:33 a.m. UTC
Reserve IRQ9 which is to be used as SCI interrupt number
for ACPI in PIC mode.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/cpu/irq.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Stefan Roese May 3, 2016, 12:29 p.m. UTC | #1
Hi Bin,

On 02.05.2016 09:33, Bin Meng wrote:
> Reserve IRQ9 which is to be used as SCI interrupt number
> for ACPI in PIC mode.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>   arch/x86/cpu/irq.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
> index 2950783..ae90b0c 100644
> --- a/arch/x86/cpu/irq.c
> +++ b/arch/x86/cpu/irq.c
> @@ -120,6 +120,10 @@ static int create_pirq_routing_table(struct udevice *dev)
>
>   	priv->irq_mask = fdtdec_get_int(blob, node,
>   					"intel,pirq-mask", PIRQ_BITMAP);
> +#ifdef CONFIG_GENERATE_ACPI_TABLE
> +	/* Reserve IRQ9 for SCI */
> +	priv->irq_mask &= ~(1 << 9);
> +#endif

Does it make sense to change this into using IS_ENABLED()?

	if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
		/* Reserve IRQ9 for SCI */
		priv->irq_mask &= ~(1 << 9);
	}

To drop the #ifdef here?

Thanks,
Stefan
Bin Meng May 3, 2016, 12:46 p.m. UTC | #2
Hi Stefan,

On Tue, May 3, 2016 at 8:29 PM, Stefan Roese <sr@denx.de> wrote:
> Hi Bin,
>
> On 02.05.2016 09:33, Bin Meng wrote:
>>
>> Reserve IRQ9 which is to be used as SCI interrupt number
>> for ACPI in PIC mode.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>   arch/x86/cpu/irq.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
>> index 2950783..ae90b0c 100644
>> --- a/arch/x86/cpu/irq.c
>> +++ b/arch/x86/cpu/irq.c
>> @@ -120,6 +120,10 @@ static int create_pirq_routing_table(struct udevice
>> *dev)
>>
>>         priv->irq_mask = fdtdec_get_int(blob, node,
>>                                         "intel,pirq-mask", PIRQ_BITMAP);
>> +#ifdef CONFIG_GENERATE_ACPI_TABLE
>> +       /* Reserve IRQ9 for SCI */
>> +       priv->irq_mask &= ~(1 << 9);
>> +#endif
>
>
> Does it make sense to change this into using IS_ENABLED()?
>
>         if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
>                 /* Reserve IRQ9 for SCI */
>                 priv->irq_mask &= ~(1 << 9);
>         }
>
> To drop the #ifdef here?
>

Ah, this bothers me sometimes. I see some places in U-Boot uses #ifdef
but IS_ENABLED somewhere else.  I am not sure what the recommended
guideline of U-Boot with regard to this?

Regards,
Bin
Stefan Roese May 3, 2016, 1:04 p.m. UTC | #3
Hi Bin,

On 03.05.2016 14:46, Bin Meng wrote:
> On Tue, May 3, 2016 at 8:29 PM, Stefan Roese <sr@denx.de> wrote:
>> Hi Bin,
>>
>> On 02.05.2016 09:33, Bin Meng wrote:
>>>
>>> Reserve IRQ9 which is to be used as SCI interrupt number
>>> for ACPI in PIC mode.
>>>
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>> ---
>>>
>>>    arch/x86/cpu/irq.c | 4 ++++
>>>    1 file changed, 4 insertions(+)
>>>
>>> diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
>>> index 2950783..ae90b0c 100644
>>> --- a/arch/x86/cpu/irq.c
>>> +++ b/arch/x86/cpu/irq.c
>>> @@ -120,6 +120,10 @@ static int create_pirq_routing_table(struct udevice
>>> *dev)
>>>
>>>          priv->irq_mask = fdtdec_get_int(blob, node,
>>>                                          "intel,pirq-mask", PIRQ_BITMAP);
>>> +#ifdef CONFIG_GENERATE_ACPI_TABLE
>>> +       /* Reserve IRQ9 for SCI */
>>> +       priv->irq_mask &= ~(1 << 9);
>>> +#endif
>>
>>
>> Does it make sense to change this into using IS_ENABLED()?
>>
>>          if (IS_ENABLED(CONFIG_GENERATE_ACPI_TABLE)) {
>>                  /* Reserve IRQ9 for SCI */
>>                  priv->irq_mask &= ~(1 << 9);
>>          }
>>
>> To drop the #ifdef here?
>>
>
> Ah, this bothers me sometimes. I see some places in U-Boot uses #ifdef
> but IS_ENABLED somewhere else.  I am not sure what the recommended
> guideline of U-Boot with regard to this?

We definitely strive to remove (or at least not add new) #ifdef's
from the U-Boot code base. And IS_ENABLED() is a good way to
achieve this. But it can only be used with config options available
via Kconfig. And since CONFIG_GENERATE_ACPI_TABLE is a Kconfig
symbol, my recommendation is to use it.

Thanks,
Stefan
diff mbox

Patch

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index 2950783..ae90b0c 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -120,6 +120,10 @@  static int create_pirq_routing_table(struct udevice *dev)
 
 	priv->irq_mask = fdtdec_get_int(blob, node,
 					"intel,pirq-mask", PIRQ_BITMAP);
+#ifdef CONFIG_GENERATE_ACPI_TABLE
+	/* Reserve IRQ9 for SCI */
+	priv->irq_mask &= ~(1 << 9);
+#endif
 
 	if (priv->config == PIRQ_VIA_IBASE) {
 		int ibase_off;