rtc: add x86 support for rtc-efi
Subsystems (2)
PATCH 1/1 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.
drivers/rtc/Kconfig +1 -1
@@ -442,7 +442,7 @@ config RTC_DRV_DS1742 config RTC_DRV_EFI tristate "EFI RTC" - depends on IA64 + depends on IA64 || (X86 && EFI) || (X86_64 && EFI) help If you say yes here you will get support for the EFI Real Time Clock.
arch/x86/kernel/time_32.c +22 -0
@@ -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,24 @@ void __init time_init(void)tsc_init (); late_time_init =choose_time_init (); } + +#ifdef CONFIG_EFI +extern int efi_enabled; + +static struct platform_device rtc_efi_dev = { + .name ="rtc-efi" , + .id =-1 , +}; + +static int __init rtc_init (void ) +{ +if (efi_enabled) { +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 +
arch/x86/kernel/time_64.c +22 -0
@@ -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,24 @@ void __init time_init(void) late_time_init =choose_time_init (); } + +#ifdef CONFIG_EFI +extern int efi_enabled; + +static struct platform_device rtc_efi_dev = { + .name ="rtc-efi" , + .id =-1 , +}; + +static int __init rtc_init (void ) +{ +if (efi_enabled) { +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 +
[Adding rtc list to the CC]
Quoted 8 lines · Brian Maly
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.
Quoted 5 lines
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.
Signature · 1 line
dann frazier
Quoted 8 lines · Brian Maly
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.
Quoted 9 lines
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
re-post of the patch, both as inline and as an attachment (which hopefully wont cause confusion).
drivers/rtc/Kconfig 2009-04-06 18:46:58.000000000 -0400 renamed from drivers/rtc/Kconfig 2009-03-26 12:39:59.000000000 -0400 +0 -0
@@ -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.
arch/x86/kernel/time_32.c 2009-03-26 13:06:10.000000000 -0400 renamed from arch/x86/kernel/time_32.c 2009-03-12 22:39:28.000000000 -0400 +0 -0
@@ -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
arch/x86/kernel/time_64.c 2009-03-26 13:06:19.000000000 -0400 renamed from arch/x86/kernel/time_64.c 2009-03-12 22:39:28.000000000 -0400 +0 -0
@@ -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
--------------------------------------------------------------------------------------------
drivers/rtc/Kconfig +1 -1
@@ -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.
arch/x86/kernel/time_32.c +19 -0
@@ -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
arch/x86/kernel/time_64.c +18 -0
@@ -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
Acked-byQuoted 81 lines · Brian Maly
re-post of the patch, both as inline and as an attachment (which hopefully wont cause confusion).
drivers/rtc/Kconfig 2009-04-06 18:46:58.000000000 -0400 renamed from drivers/rtc/Kconfig 2009-03-26 12:39:59.000000000 -0400 +0
-0@@ -442,7 +442,7 @@ config RTC_DRV_DS1742config
RTC_DRV_EFI
tristate "EFI RTC"drivers/rtc/Kconfig 2009-04-06 18:46:58.000000000 -0400 renamed from drivers/rtc/Kconfig 2009-03-26 12:39:59.000000000 -0400 +1
-1- depends on IA64 + depends on EFI help If you say yes here you will get support for the EFI Real Time Clock.arch/x86/kernel/time_32.c 2009-03-26 13:06:10.000000000 -0400 renamed from arch/x86/kernel/time_32.c 2009-03-12 22:39:28.000000000 -0400 +19
-0@@ -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); +#endifarch/x86/kernel/time_64.c 2009-03-26 13:06:19.000000000 -0400 renamed from arch/x86/kernel/time_64.c 2009-03-12 22:39:28.000000000 -0400 +18
-1@@ -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 --------------------------------------------------------------------------------------------
Signature · 1 line
dann frazier
Andrew Morton
Acked-by dann frazierQuoted 3 lines · 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.
---
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(-)
arch/x86/kernel/time_32.c renamed from arch/x86/kernel/time_32.c~rtc-add-x86-support-for-rtc-efi +19 -0
@@ -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
arch/x86/kernel/time_64.c renamed from arch/x86/kernel/time_64.c~rtc-add-x86-support-for-rtc-efi +18 -0
@@ -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
drivers/rtc/Kconfig renamed from drivers/rtc/Kconfig~rtc-add-x86-support-for-rtc-efi +1 -1
@@ -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.
_
Quoted 33 lines · Andrew Morton
Quoted 3 lines · 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 withpatch --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]>
Quoted 6 lines
---
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
Quoted 4 lines
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
Quoted 4 lines · Brian Maly
Quoted 3 lines
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.
Quoted 8 lines
Ingo,
Are you OK with consolidating this into
arch/x86/kernel/rtc.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay 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
Quoted 9 lines · Ingo Molnar
Quoted 4 lines · Brian Maly
Quoted 1 line
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.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay 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
Quoted 8 lines · H. Peter Anvin
Quoted 7 lines · Ingo Molnar
Quoted 4 lines · Brian Maly
Quoted 1 line
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.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay have advantages that I am not aware of. Anyway, I would appreciate any insight/opinions on this if you have any. Thanks.
Quoted 9 lines
Quoted 2 lines
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/kernelreally could use more subdirectories; at least the EFI and UV-specific code should be be moved out.-hpa
Peter,
How do you think this should be restructured (ideally)?
Maybe create a sub-directory (arch/x86/kernel/rtc) and in this sub-directory split the existing rtc.c code into:
(1) rtc.c for common code used by all RTC, (2) efi_rtc.c for EFI specific code
(3) cmos_rtc.c for cmos/legacy specific code
Anyone have any objections/concerns with this or perhaps have a better way?
Brian
Quoted 15 lines · H Peter
Quoted 14 lines · Ingo Molnar
Quoted 11 lines · Brian Maly
Quoted 3 lines
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.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay have advantages that I am not aware of. Anyway, I would appreciate any insight/opinions on this if you have any. Thanks.
Quoted 7 lines
Quoted 2 lines
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/kernelreally could use more subdirectories; at least the EFI and UV-specific code should be be moved out.
Or, do you think it is appropriate to re-organize EFI related code into a sub-architecture?
Best Regards,
Huang Ying
Quoted 8 lines · Ying
Quoted 7 lines · H Peter
Quoted 6 lines · Ingo Molnar
Quoted 4 lines · Brian Maly
Quoted 1 line
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.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay have advantages that I am not aware of. Anyway, I would appreciate any insight/opinions on this if you have any. Thanks.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
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/kernelreally could use more subdirectories; at least the EFI and UV-specific code should be be moved out.Or, do you think it is appropriate to re-organize EFI related code into a sub-architecture?
No, we're been trying to get rid of subarchitectures in the x86 kernel.
The reason is that the notion of subarchitectures matches reality in
x86-land poorly. Most variants of x86 share considerable code: UV has EFI, PC has EFI or BIOS, Voyager has BIOS and a standard RTC, and so on.
-hpa
Quoted 27 lines · H. Peter Anvin
Quoted 17 lines · Ying
Quoted 16 lines · H Peter
Quoted 15 lines · Ingo Molnar
Quoted 11 lines · Brian Maly
Quoted 3 lines
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.cas Huang Ying had suggested? This seems like the most logical place for the rtc-efi init to happen, but your suggestion to consolidate this intoarch/x86/kernel.time.cmay 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.
Quoted 8 lines
Quoted 4 lines
Furthermore, the EFI RTC code probably should be in its own file.
In fact,
arch/x86/kernelreally could use more subdirectories; at least the EFI and UV-specific code should be be moved out.Or, do you think it is appropriate to re-organize EFI related code into a sub-architecture?
Quoted 5 lines
No, we're been trying to get rid of subarchitectures in the x86 kernel. The reason is that the notion of subarchitectures matches reality in x86-land poorly. Most variants of x86 share considerable code: UV has EFI, PC has EFI or BIOS, Voyager has BIOS and a standard RTC, and so on.
Yeah - we essentially got rid of the ex subarchitecture code in 2.6.30. We still have config options that turn on various sorts of behavior - but most of them are runtime. We definitely dont want to reintroduce anything subarchitecture-ish.
Ingo
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
Quoted 17 lines · Brian Maly
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]>