All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 03/18] x86: Fix up PIRQ routing table checksum earlier
Date: Wed, 11 May 2016 07:44:57 -0700	[thread overview]
Message-ID: <1462977912-13666-4-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1462977912-13666-1-git-send-email-bmeng.cn@gmail.com>

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>
---

Changes in v2: None

 arch/x86/cpu/irq.c          | 4 ++++
 arch/x86/lib/pirq_routing.c | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index 86183b0..df3cd0a 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -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;
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
index 3cc6adb..a93d355 100644
--- a/arch/x86/lib/pirq_routing.c
+++ b/arch/x86/lib/pirq_routing.c
@@ -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);
 
-- 
1.8.2.1

  parent reply	other threads:[~2016-05-11 14:44 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 14:44 [U-Boot] [PATCH v2 00/18] x86: acpi: Support installation of Ubuntu/Windows and boot Windows Bin Meng
2016-05-11 14:44 ` [U-Boot] [PATCH v2 01/18] x86: minnowmax: Adjust U-Boot environment address in SPI flash Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:00     ` Bin Meng
2016-05-11 14:44 ` [U-Boot] [PATCH v2 02/18] x86: Call board_final_cleanup() in last_stage_init() Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:00     ` Bin Meng
2016-05-11 14:44 ` Bin Meng [this message]
2016-05-19  4:00   ` [U-Boot] [PATCH v2 03/18] x86: Fix up PIRQ routing table checksum earlier Simon Glass
2016-05-23  7:00     ` Bin Meng
2016-05-11 14:44 ` [U-Boot] [PATCH v2 04/18] x86: Compile coreboot_table.c only for SeaBIOS Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:00     ` Bin Meng
2016-05-11 14:44 ` [U-Boot] [PATCH v2 05/18] x86: Prepare configuration tables in dedicated high memory region Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 06/18] x86: Unify reserve_arch() for all x86 boards Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 07/18] x86: Reserve configuration tables in high memory Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 08/18] x86: Use high_table_malloc() for tables passing to SeaBIOS Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 09/18] x86: acpi: Switch to ACPI mode by ourselves instead of requested by OSPM Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 10/18] x86: acpi: Remove the unnecessary checksum calculation of DSDT Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 11/18] x86: acpi: Remove header length check when writing tables Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 12/18] x86: doc: Update information about IGD with SeaBIOS Bin Meng
2016-05-19  4:00   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 13/18] x86: baytrail: Enable SeaBIOS on all boards Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 14/18] x86: doc: Mention Ubuntu/Windows installation and boot support Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 15/18] acpi: Quieten IASL output when 'make -s' is used Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 16/18] x86: baytrail: Add internal UART ASL description Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 17/18] x86: baytrail: Add GPIO " Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:01     ` Bin Meng
2016-05-11 14:45 ` [U-Boot] [PATCH v2 18/18] x86: doc: Add porting hints for ACPI with Windows Bin Meng
2016-05-19  4:01   ` Simon Glass
2016-05-23  7:02     ` Bin Meng
2016-05-18  2:14 ` [U-Boot] [PATCH v2 00/18] x86: acpi: Support installation of Ubuntu/Windows and boot Windows Bin Meng
2016-05-19  4:02   ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462977912-13666-4-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.