X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=arch%2Fx86%2Flib%2Fpirq_routing.c;h=ba4116908c92017b9267215bf090e1ea30dce220;hb=bffeed0158bc5114a9542ff83c716e352841dcfb;hp=5a2591a26cd49df3f6c030a2748185389fd1ada2;hpb=b5b6b0196017da0c2b4d483a2cd59be7810c1d7a;p=oweals%2Fu-boot.git diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c index 5a2591a26c..ba4116908c 100644 --- a/arch/x86/lib/pirq_routing.c +++ b/arch/x86/lib/pirq_routing.c @@ -98,8 +98,7 @@ void pirq_route_irqs(struct irq_info *irq, int num) } /* Bus, device, slots IRQs for {A,B,C,D} */ - pci_assign_irqs(irq->bus, irq->devfn >> 3, irq->devfn & 7, - irq_slot); + pci_assign_irqs(irq->bus, irq->devfn >> 3, irq_slot); irq++; } @@ -110,11 +109,7 @@ void pirq_route_irqs(struct irq_info *irq, int num) u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt) { - if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION || - rt->size % 16) { - debug("Interrupt Routing Table not valid\n"); - return addr; - } + struct irq_routing_table *rom_rt; /* Fix up the table checksum */ rt->checksum = table_compute_checksum(rt, rt->size); @@ -125,5 +120,17 @@ u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt) debug("Copying Interrupt Routing Table to 0x%x\n", addr); memcpy((void *)addr, rt, rt->size); + /* + * We do the sanity check here against the copied table after memcpy, + * as something might go wrong after the memcpy, which is normally + * due to the F segment decode is not turned on to systeam RAM. + */ + rom_rt = (struct irq_routing_table *)addr; + if (rom_rt->signature != PIRQ_SIGNATURE || + rom_rt->version != PIRQ_VERSION || rom_rt->size % 16) { + printf("Interrupt Routing Table not valid\n"); + return addr; + } + return addr + rt->size; }