aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2010-02-12 06:37:38 -0500
committerH. Peter Anvin <hpa@zytor.com>2010-02-24 02:15:19 -0500
commitcf089455966e21aeb8e4cd2669e0c1885667b04e (patch)
tree83c1922684029e9b71b41db6aff804ab0d68353e
parent16ab5395856d8953ae3d81e81bd6a8c269a1bfd6 (diff)
x86, mrst: Add vrtc platform data setup code
vRTC information is obtained from SFI tables on Moorestown, this patch parses these tables and assign the information. Signed-off-by: Feng Tang <feng.tang@intel.com> LKML-Reference: <43F901BD926A4E43B106BF17856F07559FB80D0D@orsmsx508.amr.corp.intel.com> Signed-off-by: Jacob Pan <jacob.jun.pan@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--arch/x86/include/asm/mrst.h2
-rw-r--r--arch/x86/kernel/mrst.c45
2 files changed, 47 insertions, 0 deletions
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h
index fa144f2dd25..451d30e7f62 100644
--- a/arch/x86/include/asm/mrst.h
+++ b/arch/x86/include/asm/mrst.h
@@ -11,7 +11,9 @@
11#ifndef _ASM_X86_MRST_H 11#ifndef _ASM_X86_MRST_H
12#define _ASM_X86_MRST_H 12#define _ASM_X86_MRST_H
13extern int pci_mrst_init(void); 13extern int pci_mrst_init(void);
14int __init sfi_parse_mrtc(struct sfi_table_header *table);
14 15
15#define SFI_MTMR_MAX_NUM 8 16#define SFI_MTMR_MAX_NUM 8
17#define SFI_MRTC_MAX 8
16 18
17#endif /* _ASM_X86_MRST_H */ 19#endif /* _ASM_X86_MRST_H */
diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c
index bb6e45c71dd..b7fa049c826 100644
--- a/arch/x86/kernel/mrst.c
+++ b/arch/x86/kernel/mrst.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/sfi.h> 14#include <linux/sfi.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/module.h>
16 17
17#include <asm/setup.h> 18#include <asm/setup.h>
18#include <asm/mpspec_def.h> 19#include <asm/mpspec_def.h>
@@ -27,6 +28,10 @@ static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
27static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM]; 28static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
28int sfi_mtimer_num; 29int sfi_mtimer_num;
29 30
31struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
32EXPORT_SYMBOL_GPL(sfi_mrtc_array);
33int sfi_mrtc_num;
34
30static inline void assign_to_mp_irq(struct mpc_intsrc *m, 35static inline void assign_to_mp_irq(struct mpc_intsrc *m,
31 struct mpc_intsrc *mp_irq) 36 struct mpc_intsrc *mp_irq)
32{ 37{
@@ -126,6 +131,46 @@ void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr)
126 } 131 }
127} 132}
128 133
134/* parse all the mrtc info to a global mrtc array */
135int __init sfi_parse_mrtc(struct sfi_table_header *table)
136{
137 struct sfi_table_simple *sb;
138 struct sfi_rtc_table_entry *pentry;
139 struct mpc_intsrc mp_irq;
140
141 int totallen;
142
143 sb = (struct sfi_table_simple *)table;
144 if (!sfi_mrtc_num) {
145 sfi_mrtc_num = SFI_GET_NUM_ENTRIES(sb,
146 struct sfi_rtc_table_entry);
147 pentry = (struct sfi_rtc_table_entry *)sb->pentry;
148 totallen = sfi_mrtc_num * sizeof(*pentry);
149 memcpy(sfi_mrtc_array, pentry, totallen);
150 }
151
152 printk(KERN_INFO "SFI: RTC info (num = %d):\n", sfi_mrtc_num);
153 pentry = sfi_mrtc_array;
154 for (totallen = 0; totallen < sfi_mrtc_num; totallen++, pentry++) {
155 printk(KERN_INFO "RTC[%d]: paddr = 0x%08x, irq = %d\n",
156 totallen, (u32)pentry->phys_addr, pentry->irq);
157 mp_irq.type = MP_IOAPIC;
158 mp_irq.irqtype = mp_INT;
159 mp_irq.irqflag = 0;
160 mp_irq.srcbus = 0;
161 mp_irq.srcbusirq = pentry->irq; /* IRQ */
162 mp_irq.dstapic = MP_APIC_ALL;
163 mp_irq.dstirq = pentry->irq;
164 save_mp_irq(&mp_irq);
165 }
166 return 0;
167}
168
169void __init mrst_rtc_init(void)
170{
171 sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc);
172}
173
129/* 174/*
130 * Moorestown specific x86_init function overrides and early setup 175 * Moorestown specific x86_init function overrides and early setup
131 * calls. 176 * calls.