From a47bd91ccaf14626cab51a74b998d93f3d8af18c Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Thu, 15 Nov 2012 15:15:15 -0800 Subject: Fix PIRQ routing abstraction intel_irq_routing_table is a local structure that should not be used globally, because it might not be there on all mainboards. Instead, the API has to be corrected to allow passing a PIRQ table in where needed. Change-Id: Icf08928b67727a366639b648bf6aac8e1a87e765 Signed-off-by: Stefan Reinauer Reviewed-on: http://review.coreboot.org/1862 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/arch/x86/boot/pirq_routing.c | 17 ++++++++--------- src/arch/x86/include/arch/pirq_routing.h | 4 +--- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'src/arch/x86') diff --git a/src/arch/x86/boot/pirq_routing.c b/src/arch/x86/boot/pirq_routing.c index 357500c07e..55deac100a 100644 --- a/src/arch/x86/boot/pirq_routing.c +++ b/src/arch/x86/boot/pirq_routing.c @@ -76,15 +76,15 @@ static void check_pirq_routing_table(struct irq_routing_table *rt) printk(BIOS_INFO, "done.\n"); } -static int verify_copy_pirq_routing_table(unsigned long addr) +static int verify_copy_pirq_routing_table(unsigned long addr, const struct irq_routing_table *routing_table) { int i; uint8_t *rt_orig, *rt_curr; rt_curr = (uint8_t*)addr; - rt_orig = (uint8_t*)&intel_irq_routing_table; + rt_orig = (uint8_t*)routing_table; printk(BIOS_INFO, "Verifying copy of Interrupt Routing Table at 0x%08lx... ", addr); - for (i = 0; i < intel_irq_routing_table.size; i++) { + for (i = 0; i < routing_table->size; i++) { if (*(rt_curr + i) != *(rt_orig + i)) { printk(BIOS_INFO, "failed\n"); return -1; @@ -98,21 +98,20 @@ static int verify_copy_pirq_routing_table(unsigned long addr) } #endif -unsigned long copy_pirq_routing_table(unsigned long addr) +unsigned long copy_pirq_routing_table(unsigned long addr, const struct irq_routing_table *routing_table) { /* Align the table to be 16 byte aligned. */ - addr += 15; - addr &= ~15; + addr = ALIGN(addr, 16); /* This table must be betweeen 0xf0000 & 0x100000 */ printk(BIOS_INFO, "Copying Interrupt Routing Table to 0x%08lx... ", addr); - memcpy((void *)addr, &intel_irq_routing_table, intel_irq_routing_table.size); + memcpy((void *)addr, routing_table, routing_table->size); printk(BIOS_INFO, "done.\n"); #if CONFIG_DEBUG_PIRQ - verify_copy_pirq_routing_table(addr); + verify_copy_pirq_routing_table(addr, routing_table); #endif pirq_route_irqs(addr); - return addr + intel_irq_routing_table.size; + return addr + routing_table->size; } #if CONFIG_PIRQ_ROUTE diff --git a/src/arch/x86/include/arch/pirq_routing.h b/src/arch/x86/include/arch/pirq_routing.h index c5be5f49ae..94884732ba 100644 --- a/src/arch/x86/include/arch/pirq_routing.h +++ b/src/arch/x86/include/arch/pirq_routing.h @@ -63,9 +63,7 @@ struct irq_routing_table { struct irq_info slots[CONFIG_IRQ_SLOT_COUNT]; } __attribute__((packed)); -extern const struct irq_routing_table intel_irq_routing_table; - -unsigned long copy_pirq_routing_table(unsigned long start); +unsigned long copy_pirq_routing_table(unsigned long addr, const struct irq_routing_table *routing_table); unsigned long write_pirq_routing_table(unsigned long start); #if CONFIG_PIRQ_ROUTE -- cgit v1.2.3