diff mbox

[v6,04/10] acpi: Add some basic struct and functions in GTDT driver

Message ID 1467224153-22873-5-git-send-email-fu.wei@linaro.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

fu.wei@linaro.org June 29, 2016, 6:15 p.m. UTC
From: Fu Wei <fu.wei@linaro.org>

Signed-off-by: Fu Wei <fu.wei@linaro.org>
---
 drivers/acpi/acpi_gtdt.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

Comments

Rafael J. Wysocki June 29, 2016, 9:24 p.m. UTC | #1
On Wed, Jun 29, 2016 at 8:15 PM,  <fu.wei@linaro.org> wrote:
> From: Fu Wei <fu.wei@linaro.org>

No changelog?

> Signed-off-by: Fu Wei <fu.wei@linaro.org>

Please combine this one with the [5-6/10].  Splitting them the way you
did it is not very useful.

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
fu.wei@linaro.org June 30, 2016, 1:17 a.m. UTC | #2
Hi Rafael,

Great thanks for your review :-)

On 30 June 2016 at 05:24, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Wed, Jun 29, 2016 at 8:15 PM,  <fu.wei@linaro.org> wrote:
>> From: Fu Wei <fu.wei@linaro.org>
>
> No changelog?

it's on [0/10]

>
>> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>
> Please combine this one with the [5-6/10].  Splitting them the way you
> did it is not very useful.

OK , NP, will do , thanks :-)

>
> Thanks,
> Rafael
Rafael J. Wysocki June 30, 2016, 1:26 a.m. UTC | #3
On Thursday, June 30, 2016 09:17:56 AM Fu Wei wrote:
> Hi Rafael,
> 
> Great thanks for your review :-)
> 
> On 30 June 2016 at 05:24, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Wed, Jun 29, 2016 at 8:15 PM,  <fu.wei@linaro.org> wrote:
> >> From: Fu Wei <fu.wei@linaro.org>
> >
> > No changelog?
> 
> it's on [0/10]

That's not enough.  The [0/10] will not go into the git log, mind you.

Thanks,
Rafael

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
fu.wei@linaro.org June 30, 2016, 1:32 a.m. UTC | #4
Hi Rafael,

On 30 June 2016 at 09:26, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Thursday, June 30, 2016 09:17:56 AM Fu Wei wrote:
>> Hi Rafael,
>>
>> Great thanks for your review :-)
>>
>> On 30 June 2016 at 05:24, Rafael J. Wysocki <rafael@kernel.org> wrote:
>> > On Wed, Jun 29, 2016 at 8:15 PM,  <fu.wei@linaro.org> wrote:
>> >> From: Fu Wei <fu.wei@linaro.org>
>> >
>> > No changelog?
>>
>> it's on [0/10]
>
> That's not enough.  The [0/10] will not go into the git log, mind you.

OK, thanks for your reminding, will add changelog for this driver in
this patch[4+5+6].

>
> Thanks,
> Rafael
>
Timur Tabi June 30, 2016, 4:13 a.m. UTC | #5
Rafael J. Wysocki wrote:
> That's not enough.  The [0/10] will not go into the git log, mind you.

The changelog is placed under the "---", so it wouldn't go into the git 
log anyway.
diff mbox

Patch

diff --git a/drivers/acpi/acpi_gtdt.c b/drivers/acpi/acpi_gtdt.c
new file mode 100644
index 0000000..54d7644e
--- /dev/null
+++ b/drivers/acpi/acpi_gtdt.c
@@ -0,0 +1,85 @@ 
+/*
+ * ARM Specific GTDT table Support
+ *
+ * Copyright (C) 2015, Linaro Ltd.
+ * Author: Daniel Lezcano <daniel.lezcano@linaro.org>
+ *         Fu Wei <fu.wei@linaro.org>
+ *         Hanjun Guo <hanjun.guo@linaro.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#undef pr_fmt
+#define pr_fmt(fmt) "GTDT: " fmt
+
+typedef struct {
+	struct acpi_table_gtdt *gtdt;
+	void *platform_timer_start;
+	void *gtdt_end;
+} acpi_gtdt_desc_t;
+
+static acpi_gtdt_desc_t acpi_gtdt_desc __initdata;
+
+static inline void *gtdt_next(void *platform_timer, void *end, int type)
+{
+	struct acpi_gtdt_header *gh = platform_timer;
+
+	while ((void *)(gh += gh->length) < end)
+		if (gh->type == type)
+			return (void *)gh;
+	return NULL;
+}
+
+#define for_each_gtdt_type(_g, _t)				\
+	for (_g = acpi_gtdt_desc.platform_timer_start; _g;	\
+	     _g = gtdt_next(_g, acpi_gtdt_desc.gtdt_end, _t))
+
+#define for_each_gtdt_timer(_g)				\
+	for_each_gtdt_type(_g, ACPI_GTDT_TYPE_TIMER_BLOCK)
+
+#define for_each_gtdt_watchdog(_g)			\
+	for_each_gtdt_type(_g, ACPI_GTDT_TYPE_WATCHDOG)
+
+/*
+ * Get some basic info from GTDT table, and init the global variables above
+ * for all timers initialization of Generic Timer.
+ * This function does some validation on GTDT table.
+ */
+static int __init acpi_gtdt_desc_init(struct acpi_table_header *table)
+{
+	struct acpi_table_gtdt *gtdt = container_of(table,
+						    struct acpi_table_gtdt,
+						    header);
+
+	acpi_gtdt_desc.gtdt = gtdt;
+	acpi_gtdt_desc.gtdt_end = (void *)table + table->length;
+
+	if (table->revision < 2) {
+		pr_info("Revision:%d doesn't support Platform Timers.\n",
+			table->revision);
+		return 0;
+	}
+
+	if (!gtdt->platform_timer_count) {
+		pr_info("No Platform Timer.\n");
+		return 0;
+	}
+
+	acpi_gtdt_desc.platform_timer_start = (void *)gtdt +
+					      gtdt->platform_timer_offset;
+	if (acpi_gtdt_desc.platform_timer_start <
+	    (void *)table + sizeof(struct acpi_table_gtdt)) {
+		pr_err(FW_BUG "Platform Timer pointer error.\n");
+		acpi_gtdt_desc.platform_timer_start = NULL;
+		return -EINVAL;
+	}
+
+	return gtdt->platform_timer_count;
+}