diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2015-04-27 14:16:01 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-29 18:51:50 -0600 |
commit | 283a08e52a0d3f5fe8ac3139c632f32a03fc44f0 (patch) | |
tree | 9b26cfc3250cb8dad3c979b5e9016a7b70217a61 /arch/x86/lib/pirq_routing.c | |
parent | 8827227889848433d464f31c76c8be9d13567623 (diff) | |
download | u-boot-imx-283a08e52a0d3f5fe8ac3139c632f32a03fc44f0.zip u-boot-imx-283a08e52a0d3f5fe8ac3139c632f32a03fc44f0.tar.gz u-boot-imx-283a08e52a0d3f5fe8ac3139c632f32a03fc44f0.tar.bz2 |
x86: Check PIRQ routing table sanity in the F segment
Previously the PIRQ routing table sanity check was performed against
the original table provided by the platform codes. Now we switch to
check its sanity on the final table in the F segment as this one is
the one seen by the OS.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86/lib/pirq_routing.c')
-rw-r--r-- | arch/x86/lib/pirq_routing.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c index 5a2591a..7a34dcf 100644 --- a/arch/x86/lib/pirq_routing.c +++ b/arch/x86/lib/pirq_routing.c @@ -110,11 +110,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 +121,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; } |