On 12/12/2012 05:38:32 PM, Alexander Graf wrote:

On 12.12.2012, at 19:40, Scott Wood wrote:

> On 12/12/2012 08:09:56 AM, Alexander Graf wrote:
>> +    for (slot = first_slot; slot < last_slot; slot++) {
>> +        for (pci_irq = 0; pci_irq < 4; pci_irq++) {
>> +            pci_map[i++] = cpu_to_be32(slot << 11);
>> +            pci_map[i++] = cpu_to_be32(0x0);
>> +            pci_map[i++] = cpu_to_be32(0x0);
>> +            pci_map[i++] = cpu_to_be32(pci_irq + 1);
>> +            pci_map[i++] = cpu_to_be32(mpic);
>> + pci_map[i++] = cpu_to_be32(((pci_irq + slot) % 4) + 1);
>> +            pci_map[i++] = cpu_to_be32(0x1);
>> +        }
>>     }
>
> It would be nice if the slot-to-IRQ calculation were done in only one place rather than duplicated here.

Sure, what exactly would you suggest to do? :)

Have a common function to calculate the IRQ given the slot number, and call that both from here and from mpc85xx_pci_map_irq().

We can move the whole function to ppce500_pci.c.
We could export the function(slot, pci_irq) through the header of ppce500_pci.c.

Either works, though I'd lean towards moving this function into ppce500_pci.c.

We could also try and traverse the pci bus to find the function that is actually called to convert irq numbers internally, so we potentially support other pci host controllers.

Not sure what you mean here.

-Scott

Reply via email to