2009-04-06 17:51:23

by Brian Maly

[permalink] [raw]
Subject: [PATCH] rtc: add x86 support for rtc-efi

This patch adds support for rtc-efi (RTC Class Driver for EFI-based
systems) to x86.

This patch is based on dann frazier patch [add rtc platform driver for
EFI -> http://lkml.org/lkml/2009/1/8/434], and also depends on dann's
patch. Dann's patch was in the mm tree, though I think its been merged
already.

This patch has been tested and works perfectly on every x86 EFI system I
could find, though all have been EL64 systems. I would appreciate any
testing feedback from EL32 systems from anyone that has one and can test.

Signed-off-by: Brian Maly <[email protected]>





Attachments:
2.6.29-add-x86-support-for-efi-rtc.patch (1.93 kB)

2009-04-06 19:30:44

by dann frazier

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

[Adding rtc list to the CC]

On Mon, Apr 06, 2009 at 01:49:45PM -0400, Brian Maly wrote:
> This patch adds support for rtc-efi (RTC Class Driver for EFI-based
> systems) to x86.
>
> This patch is based on dann frazier patch [add rtc platform driver for
> EFI -> http://lkml.org/lkml/2009/1/8/434], and also depends on dann's
> patch. Dann's patch was in the mm tree, though I think its been merged
> already.
>
> This patch has been tested and works perfectly on every x86 EFI system I
> could find, though all have been EL64 systems. I would appreciate any
> testing feedback from EL32 systems from anyone that has one and can test.
>
> Signed-off-by: Brian Maly <[email protected]>

hey Brian,
Thanks for working on this. You might want to resubmit with the patch
inlined instead of as an attachment to make it easier to review.

--
dann frazier

2009-04-06 22:27:23

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

Brian Maly wrote:
> This patch adds support for rtc-efi (RTC Class Driver for EFI-based
> systems) to x86.
>
> This patch is based on dann frazier patch [add rtc platform driver for
> EFI -> http://lkml.org/lkml/2009/1/8/434], and also depends on dann's
> patch. Dann's patch was in the mm tree, though I think its been merged
> already.
>
> This patch has been tested and works perfectly on every x86 EFI system I
> could find, though all have been EL64 systems. I would appreciate any
> testing feedback from EL32 systems from anyone that has one and can test.
>
> Signed-off-by: Brian Maly <[email protected]>
>
>
>
>

- depends on IA64
+ depends on IA64 || (X86 && EFI) || (X86_64 && EFI)

"depends on EFI"?

-hpa

2009-04-06 22:56:42

by Brian Maly

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

re-post of the patch, both as inline and as an attachment (which
hopefully wont cause confusion).


--- a/drivers/rtc/Kconfig 2009-03-26 12:39:59.000000000 -0400
+++ b/drivers/rtc/Kconfig 2009-04-06 18:46:58.000000000 -0400
@@ -442,7 +442,7 @@ config RTC_DRV_DS1742

config RTC_DRV_EFI
tristate "EFI RTC"
- depends on IA64
+ depends on EFI
help
If you say yes here you will get support for the EFI
Real Time Clock.
--- a/arch/x86/kernel/time_32.c 2009-03-12 22:39:28.000000000 -0400
+++ b/arch/x86/kernel/time_32.c 2009-03-26 13:06:10.000000000 -0400
@@ -32,6 +32,7 @@
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/mca.h>
+#include <linux/platform_device.h>

#include <asm/arch_hooks.h>
#include <asm/hpet.h>
@@ -135,3 +136,21 @@ void __init time_init(void)
tsc_init();
late_time_init = choose_time_init();
}
+
+
+#ifdef CONFIG_RTC_DRV_EFI
+static struct platform_device rtc_efi_dev = {
+ .name = "rtc-efi",
+ .id = -1,
+};
+
+static int __init rtc_init(void)
+{
+ if (platform_device_register(&rtc_efi_dev) < 0)
+ printk(KERN_ERR "unable to register rtc device...\n");
+
+ /* not necessarily an error */
+ return 0;
+}
+module_init(rtc_init);
+#endif
--- a/arch/x86/kernel/time_64.c 2009-03-12 22:39:28.000000000 -0400
+++ b/arch/x86/kernel/time_64.c 2009-03-26 13:06:19.000000000 -0400
@@ -18,6 +18,7 @@
#include <linux/time.h>
#include <linux/mca.h>
#include <linux/nmi.h>
+#include <linux/platform_device.h>

#include <asm/i8253.h>
#include <asm/hpet.h>
@@ -135,3 +136,20 @@ void __init time_init(void)

late_time_init = choose_time_init();
}
+
+#ifdef CONFIG_RTC_DRV_EFI
+static struct platform_device rtc_efi_dev = {
+ .name = "rtc-efi",
+ .id = -1,
+};
+
+static int __init rtc_init(void)
+{
+ if (platform_device_register(&rtc_efi_dev) < 0)
+ printk(KERN_ERR "unable to register rtc device...\n");
+
+ /* not necessarily an error */
+ return 0;
+}
+module_init(rtc_init);
+#endif

--------------------------------------------------------------------------------------------


Attachments:
2.6.29-add-x86-support-for-efi-rtc.patch (1.80 kB)

2009-04-08 16:22:43

by dann frazier

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

Acked-by: dann frazier <[email protected]>

On Mon, Apr 06, 2009 at 06:55:49PM -0400, Brian Maly wrote:
> re-post of the patch, both as inline and as an attachment (which
> hopefully wont cause confusion).
>
>
> --- a/drivers/rtc/Kconfig 2009-03-26 12:39:59.000000000 -0400
> +++ b/drivers/rtc/Kconfig 2009-04-06 18:46:58.000000000 -0400
> @@ -442,7 +442,7 @@ config RTC_DRV_DS1742
>
> config RTC_DRV_EFI
> tristate "EFI RTC"
> - depends on IA64
> + depends on EFI
> help
> If you say yes here you will get support for the EFI
> Real Time Clock.
> --- a/arch/x86/kernel/time_32.c 2009-03-12 22:39:28.000000000 -0400
> +++ b/arch/x86/kernel/time_32.c 2009-03-26 13:06:10.000000000 -0400
> @@ -32,6 +32,7 @@
> #include <linux/interrupt.h>
> #include <linux/time.h>
> #include <linux/mca.h>
> +#include <linux/platform_device.h>
>
> #include <asm/arch_hooks.h>
> #include <asm/hpet.h>
> @@ -135,3 +136,21 @@ void __init time_init(void)
> tsc_init();
> late_time_init = choose_time_init();
> }
> +
> +
> +#ifdef CONFIG_RTC_DRV_EFI
> +static struct platform_device rtc_efi_dev = {
> + .name = "rtc-efi",
> + .id = -1,
> +};
> +
> +static int __init rtc_init(void)
> +{
> + if (platform_device_register(&rtc_efi_dev) < 0)
> + printk(KERN_ERR "unable to register rtc device...\n");
> +
> + /* not necessarily an error */
> + return 0;
> +}
> +module_init(rtc_init);
> +#endif
> --- a/arch/x86/kernel/time_64.c 2009-03-12 22:39:28.000000000 -0400
> +++ b/arch/x86/kernel/time_64.c 2009-03-26 13:06:19.000000000 -0400
> @@ -18,6 +18,7 @@
> #include <linux/time.h>
> #include <linux/mca.h>
> #include <linux/nmi.h>
> +#include <linux/platform_device.h>
>
> #include <asm/i8253.h>
> #include <asm/hpet.h>
> @@ -135,3 +136,20 @@ void __init time_init(void)
>
> late_time_init = choose_time_init();
> }
> +
> +#ifdef CONFIG_RTC_DRV_EFI
> +static struct platform_device rtc_efi_dev = {
> + .name = "rtc-efi",
> + .id = -1,
> +};
> +
> +static int __init rtc_init(void)
> +{
> + if (platform_device_register(&rtc_efi_dev) < 0)
> + printk(KERN_ERR "unable to register rtc device...\n");
> +
> + /* not necessarily an error */
> + return 0;
> +}
> +module_init(rtc_init);
> +#endif
>
> --------------------------------------------------------------------------------------------
>



--
dann frazier

2009-04-09 23:22:51

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

On Mon, 06 Apr 2009 18:55:49 -0400
Brian Maly <[email protected]> wrote:

> re-post of the patch, both as inline and as an attachment (which
> hopefully wont cause confusion).
>

Normally it does confuse me horridly because I get two copies of the
same patch, which applies happily with `patch --dry-run', but dies
horridly with `patch --for-real'. But I was warned...

In future, please include a full copy of the (possibly modified)
changelog with each iteration of a patch.

As this patch is mostly-x86 I tossed it onto my for-Ingo pile.


From: Brian Maly <[email protected]>

Add support for rtc-efi (RTC Class Driver for EFI-based systems) to x86.

This patch has been tested and works perfectly on every x86 EFI system I
could find, though all have been EL64 systems. I would appreciate any
testing feedback from EL32 systems from anyone that has one and can test.

Signed-off-by: Brian Maly <[email protected]>
Acked-by: dann frazier <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: David Brownell <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

arch/x86/kernel/time_32.c | 19 +++++++++++++++++++
arch/x86/kernel/time_64.c | 18 ++++++++++++++++++
drivers/rtc/Kconfig | 2 +-
3 files changed, 38 insertions(+), 1 deletion(-)

diff -puN arch/x86/kernel/time_32.c~rtc-add-x86-support-for-rtc-efi arch/x86/kernel/time_32.c
--- a/arch/x86/kernel/time_32.c~rtc-add-x86-support-for-rtc-efi
+++ a/arch/x86/kernel/time_32.c
@@ -32,6 +32,7 @@
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/mca.h>
+#include <linux/platform_device.h>

#include <asm/setup.h>
#include <asm/hpet.h>
@@ -135,3 +136,21 @@ void __init time_init(void)
tsc_init();
late_time_init = choose_time_init();
}
+
+
+#ifdef CONFIG_RTC_DRV_EFI
+static struct platform_device rtc_efi_dev = {
+ .name = "rtc-efi",
+ .id = -1,
+};
+
+static int __init rtc_init(void)
+{
+ if (platform_device_register(&rtc_efi_dev) < 0)
+ printk(KERN_ERR "unable to register rtc device...\n");
+
+ /* not necessarily an error */
+ return 0;
+}
+module_init(rtc_init);
+#endif
diff -puN arch/x86/kernel/time_64.c~rtc-add-x86-support-for-rtc-efi arch/x86/kernel/time_64.c
--- a/arch/x86/kernel/time_64.c~rtc-add-x86-support-for-rtc-efi
+++ a/arch/x86/kernel/time_64.c
@@ -18,6 +18,7 @@
#include <linux/time.h>
#include <linux/mca.h>
#include <linux/nmi.h>
+#include <linux/platform_device.h>

#include <asm/i8253.h>
#include <asm/hpet.h>
@@ -133,3 +134,20 @@ void __init time_init(void)

late_time_init = choose_time_init();
}
+
+#ifdef CONFIG_RTC_DRV_EFI
+static struct platform_device rtc_efi_dev = {
+ .name = "rtc-efi",
+ .id = -1,
+};
+
+static int __init rtc_init(void)
+{
+ if (platform_device_register(&rtc_efi_dev) < 0)
+ printk(KERN_ERR "unable to register rtc device...\n");
+
+ /* not necessarily an error */
+ return 0;
+}
+module_init(rtc_init);
+#endif
diff -puN drivers/rtc/Kconfig~rtc-add-x86-support-for-rtc-efi drivers/rtc/Kconfig
--- a/drivers/rtc/Kconfig~rtc-add-x86-support-for-rtc-efi
+++ a/drivers/rtc/Kconfig
@@ -455,7 +455,7 @@ config RTC_DRV_DS1742

config RTC_DRV_EFI
tristate "EFI RTC"
- depends on IA64
+ depends on EFI
help
If you say yes here you will get support for the EFI
Real Time Clock.
_

2009-04-10 01:08:27

by Huang, Ying

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

Hi, Brian,

Sorry for late.

1. Why not put these code into arch/x86/kernel/rtc.c? I think that is
more approriate.

2. It seems that you use both CMOS RTC and EFI RTC. In code path of
read_persistent_clock() and update_persistent_clock(), CMOS RTC is used
for x86_64. I think you should change that too. I have tried to do that
in http://lkml.org/lkml/2007/8/13/602.

Best Regards,
Huang Ying

On Tue, 2009-04-07 at 01:49 +0800, Brian Maly wrote:
> This patch adds support for rtc-efi (RTC Class Driver for EFI-based
> systems) to x86.
>
> This patch is based on dann frazier patch [add rtc platform driver for
> EFI -> http://lkml.org/lkml/2009/1/8/434], and also depends on dann's
> patch. Dann's patch was in the mm tree, though I think its been merged
> already.
>
> This patch has been tested and works perfectly on every x86 EFI system I
> could find, though all have been EL64 systems. I would appreciate any
> testing feedback from EL32 systems from anyone that has one and can test.
>
> Signed-off-by: Brian Maly <[email protected]>
>
>
>
>


Attachments:
signature.asc (197.00 B)
This is a digitally signed message part

2009-04-10 13:51:43

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi


* Andrew Morton <[email protected]> wrote:

> On Mon, 06 Apr 2009 18:55:49 -0400
> Brian Maly <[email protected]> wrote:
>
> > re-post of the patch, both as inline and as an attachment (which
> > hopefully wont cause confusion).
> >
>
> Normally it does confuse me horridly because I get two copies of the
> same patch, which applies happily with `patch --dry-run', but dies
> horridly with `patch --for-real'. But I was warned...
>
> In future, please include a full copy of the (possibly modified)
> changelog with each iteration of a patch.
>
> As this patch is mostly-x86 I tossed it onto my for-Ingo pile.
>
>
> From: Brian Maly <[email protected]>
>
> Add support for rtc-efi (RTC Class Driver for EFI-based systems) to x86.
>
> This patch has been tested and works perfectly on every x86 EFI system I
> could find, though all have been EL64 systems. I would appreciate any
> testing feedback from EL32 systems from anyone that has one and can test.
>
> Signed-off-by: Brian Maly <[email protected]>
> Acked-by: dann frazier <[email protected]>
> Cc: Alessandro Zummo <[email protected]>
> Cc: David Brownell <[email protected]>
> Cc: Ingo Molnar <[email protected]>
> Cc: Thomas Gleixner <[email protected]>
> Cc: "H. Peter Anvin" <[email protected]>
> Signed-off-by: Andrew Morton <[email protected]>
> ---
>
> arch/x86/kernel/time_32.c | 19 +++++++++++++++++++
> arch/x86/kernel/time_64.c | 18 ++++++++++++++++++
> drivers/rtc/Kconfig | 2 +-
> 3 files changed, 38 insertions(+), 1 deletion(-)

Hm, it would be nice to first unify the relevant bits of
arch/x86/kernel/time_{32|64}.c into arch/x86/kernel/time.c, and then
we can apply such patches without duplicative effects.

Ingo

2009-04-20 17:17:27

by Brian Maly

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi


>Hm, it would be nice to first unify the relevant bits of
>arch/x86/kernel/time_{32|64}.c into arch/x86/kernel/time.c, and then
>we can apply such patches without duplicative effects.

> Ingo


Ingo,

Are you OK with consolidating this into arch/x86/kernel/rtc.c as Huang
Ying had suggested? This seems like the most logical place for the
rtc-efi init to happen, but your suggestion to consolidate this into
arch/x86/kernel.time.c may have advantages that I am not aware of.
Anyway, I would appreciate any insight/opinions on this if you have any.
Thanks.

Brian

2009-04-20 17:21:27

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi


* Brian Maly <[email protected]> wrote:

>> Hm, it would be nice to first unify the relevant bits of
>> arch/x86/kernel/time_{32|64}.c into arch/x86/kernel/time.c, and
>> then we can apply such patches without duplicative effects.
>
> Ingo,
>
> Are you OK with consolidating this into arch/x86/kernel/rtc.c as
> Huang Ying had suggested? This seems like the most logical place
> for the rtc-efi init to happen, but your suggestion to consolidate
> this into arch/x86/kernel.time.c may have advantages that I am not
> aware of. Anyway, I would appreciate any insight/opinions on this
> if you have any. Thanks.

Yes, that indeed sounds like an even better place for it.

Thanks,

Ingo

2009-04-20 18:22:01

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [PATCH] rtc: add x86 support for rtc-efi

Ingo Molnar wrote:
> * Brian Maly <[email protected]> wrote:
>
>>> Hm, it would be nice to first unify the relevant bits of
>>> arch/x86/kernel/time_{32|64}.c into arch/x86/kernel/time.c, and
>>> then we can apply such patches without duplicative effects.
>> Ingo,
>>
>> Are you OK with consolidating this into arch/x86/kernel/rtc.c as
>> Huang Ying had suggested? This seems like the most logical place
>> for the rtc-efi init to happen, but your suggestion to consolidate
>> this into arch/x86/kernel.time.c may have advantages that I am not
>> aware of. Anyway, I would appreciate any insight/opinions on this
>> if you have any. Thanks.
>
> Yes, that indeed sounds like an even better place for it.
>

Furthermore, the EFI RTC code probably should be in its own file.

In fact, arch/x86/kernel really could use more subdirectories; at least
the EFI and UV-specific code should be be moved out.

-hpa