From: guohanjun@huawei.com (Hanjun Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] arm64: arch_timer: acpi: Introduce a generic aquirk framework for erratum
Date: Tue, 24 Jan 2017 18:39:50 +0800 [thread overview]
Message-ID: <1485254391-51551-2-git-send-email-guohanjun@huawei.com> (raw)
In-Reply-To: <1485254391-51551-1-git-send-email-guohanjun@huawei.com>
From: Hanjun Guo <hanjun.guo@linaro.org>
Introduce a general quirk framework for arch timer erratum in ACPI,
which use the oem information in GTDT table for platform specific
erratums. The struct gtdt_arch_timer_fixup is introduced to record
the oem information to match the quirk and handle the erratum.
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
drivers/clocksource/arm_arch_timer.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index 2dc571d..80d6f76 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1146,6 +1146,39 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
arch_timer_mem_of_init);
#ifdef CONFIG_ACPI_GTDT
+struct gtdt_arch_timer_fixup {
+ char oem_id[ACPI_OEM_ID_SIZE + 1];
+ char oem_table_id[ACPI_OEM_TABLE_ID_SIZE + 1];
+ u32 oem_revision;
+
+ /* quirk handler for arch timer erratum */
+ void (*handler)(void *context);
+ void *context;
+};
+
+/* note: this needs to be updated according to the doc of OEM ID
+ * and TABLE ID for different board.
+ */
+static struct gtdt_arch_timer_fixup arch_timer_quirks[] __initdata = {
+};
+
+static void __init arch_timer_acpi_quirks_handler(char *oem_id,
+ char *oem_table_id,
+ u32 oem_revision)
+{
+ struct gtdt_arch_timer_fixup *quirks = arch_timer_quirks;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(arch_timer_quirks); i++, quirks++) {
+ if (!memcmp(quirks->oem_id, oem_id, ACPI_OEM_ID_SIZE) &&
+ !memcmp(quirks->oem_table_id, oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
+ quirks->oem_revision == oem_revision) {
+ if (quirks->handler && quirks->context)
+ quirks->handler(quirks->context);
+ }
+ }
+}
+
static int __init arch_timer_mem_acpi_init(int platform_timer_count)
{
struct arch_timer_mem *timer_mem;
@@ -1182,6 +1215,9 @@ static int __init arch_timer_acpi_init(struct acpi_table_header *table)
return -EINVAL;
}
+ arch_timer_acpi_quirks_handler(table->oem_id, table->oem_table_id,
+ table->oem_revision);
+
arch_timers_present |= ARCH_TIMER_TYPE_CP15;
ret = acpi_gtdt_init(table, &platform_timer_count);
--
1.7.12.4
next prev parent reply other threads:[~2017-01-24 10:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 10:39 [PATCH 0/2] arch_timer: acpi: Add workaround for hisilicon-161010101 erratum Hanjun Guo
2017-01-24 10:39 ` Hanjun Guo [this message]
2017-01-24 10:39 ` [PATCH 2/2] arch_timer: acpi: add hisi timer erratum data Hanjun Guo
2017-01-24 10:57 ` Mark Rutland
2017-01-24 11:32 ` Marc Zyngier
2017-01-24 12:35 ` John Garry
2017-01-24 13:08 ` Marc Zyngier
2017-01-24 13:28 ` Shameerali Kolothum Thodi
2017-01-24 13:22 ` Hanjun Guo
2017-02-10 7:10 ` Hanjun Guo
2017-02-16 8:42 ` Alexander Graf
2017-02-16 9:14 ` Daniel Lezcano
2017-02-16 9:32 ` Alexander Graf
2017-02-16 9:41 ` Ding Tianhong
2017-02-16 9:46 ` Sanil Kumar
2017-02-16 9:49 ` Daniel Lezcano
2017-02-16 9:42 ` Hanjun Guo
2017-02-16 10:04 ` Marc Zyngier
2017-02-20 19:00 ` Marc Zyngier
2017-02-21 11:56 ` Hanjun Guo
2017-02-21 15:22 ` Marc Zyngier
2017-02-22 4:08 ` Alexander Graf
2017-02-22 9:29 ` Marc Zyngier
2017-02-22 7:41 ` Hanjun Guo
2017-02-21 12:46 ` Ding Tianhong
2017-01-24 13:50 ` Hanjun Guo
2017-01-24 10:49 ` [PATCH 0/2] arch_timer: acpi: Add workaround for hisilicon-161010101 erratum Hanjun Guo
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=1485254391-51551-2-git-send-email-guohanjun@huawei.com \
--to=guohanjun@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).