]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
x86: Fix up PIRQ routing table checksum earlier
authorBin Meng <bmeng.cn@gmail.com>
Wed, 11 May 2016 14:44:57 +0000 (07:44 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 23 May 2016 07:18:00 +0000 (15:18 +0800)
PIRQ routing table checksum is fixed up in copy_pirq_routing_table(),
which is fine if we only write the configuration table once. But with
the SeaBIOS case, when we write the table for the second time, the
checksum will be fixed up to zero per the checksum algorithm, which
is caused by the checksum field not being zero before fix up, since
the checksum has already been calculated in the first run.

To fix this, move the checksum fixup to create_pirq_routing_table(),
so that copy_pirq_routing_table() only does what its function name
suggests: copy the table to somewhere else.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/irq.c
arch/x86/lib/pirq_routing.c

index 86183b034ecfdf009e2643ad994d418a84e49444..df3cd0abc7771bef450f70c458ad13613d2162e4 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/irq.h>
 #include <asm/pci.h>
 #include <asm/pirq_routing.h>
+#include <asm/tables.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -214,6 +215,9 @@ static int create_pirq_routing_table(struct udevice *dev)
 
        rt->size = irq_entries * sizeof(struct irq_info) + 32;
 
+       /* Fix up the table checksum */
+       rt->checksum = table_compute_checksum(rt, rt->size);
+
        pirq_routing_table = rt;
 
        return 0;
index 3cc6adbbbbb9714bbdc4f51911d66d63d371fa32..a93d355d8a2457e3e049db8b07d1986a6c98a56e 100644 (file)
@@ -10,7 +10,6 @@
 #include <pci.h>
 #include <asm/pci.h>
 #include <asm/pirq_routing.h>
-#include <asm/tables.h>
 
 static bool irq_already_routed[16];
 
@@ -111,9 +110,6 @@ u32 copy_pirq_routing_table(u32 addr, struct irq_routing_table *rt)
 {
        struct irq_routing_table *rom_rt;
 
-       /* Fix up the table checksum */
-       rt->checksum = table_compute_checksum(rt, rt->size);
-
        /* Align the table to be 16 byte aligned */
        addr = ALIGN(addr, 16);