Skip to content

Commit a0c173b

Browse files
Jacob PanH. Peter Anvin
authored andcommitted
x86, mrst: add cpu type detection
Medfield is the follow-up of Moorestown, it is treated under the same HW sub-architecture. However, we do need to know the CPU type in order for some of the driver to act accordingly. We also have different optimal clock configuration for each CPU type. Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com> LKML-Reference: <1274295685-6774-3-git-send-email-jacob.jun.pan@linux.intel.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 1dedefd commit a0c173b

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

‎arch/x86/include/asm/mrst.h‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,27 @@
1111
#ifndef _ASM_X86_MRST_H
1212
#define _ASM_X86_MRST_H
1313
extern int pci_mrst_init(void);
14+
extern int mrst_identify_cpu(void);
1415
int __init sfi_parse_mrtc(struct sfi_table_header *table);
1516

17+
/*
18+
* Medfield is the follow-up of Moorestown, it combines two chip solution into
19+
* one. Other than that it also added always-on and constant tsc and lapic
20+
* timers. Medfield is the platform name, and the chip name is called Penwell
21+
* we treat Medfield/Penwell as a variant of Moorestown. Penwell can be
22+
* identified via MSRs.
23+
*/
24+
enum mrst_cpu_type {
25+
MRST_CPU_CHIP_LINCROFT = 1,
26+
MRST_CPU_CHIP_PENWELL,
27+
};
28+
29+
enum mrst_timer_options {
30+
MRST_TIMER_DEFAULT,
31+
MRST_TIMER_APBT_ONLY,
32+
MRST_TIMER_LAPIC_APBT,
33+
};
34+
1635
#define SFI_MTMR_MAX_NUM 8
1736
#define SFI_MRTC_MAX 8
1837

‎arch/x86/kernel/mrst.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
2929
static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
30+
static int mrst_cpu_chip;
31+
3032
int sfi_mtimer_num;
3133

3234
struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
@@ -216,6 +218,28 @@ static void __init mrst_setup_boot_clock(void)
216218
setup_boot_APIC_clock();
217219
};
218220

221+
int mrst_identify_cpu(void)
222+
{
223+
return mrst_cpu_chip;
224+
}
225+
EXPORT_SYMBOL_GPL(mrst_identify_cpu);
226+
227+
void __cpuinit mrst_arch_setup(void)
228+
{
229+
if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
230+
mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
231+
else if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x26)
232+
mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT;
233+
else {
234+
pr_err("Unknown Moorestown CPU (%d:%d), default to Lincroft\n",
235+
boot_cpu_data.x86, boot_cpu_data.x86_model);
236+
mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT;
237+
}
238+
pr_debug("Moorestown CPU %s identified\n",
239+
(mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) ?
240+
"Lincroft" : "Penwell");
241+
}
242+
219243
/*
220244
* Moorestown specific x86_init function overrides and early setup
221245
* calls.
@@ -230,6 +254,8 @@ void __init x86_mrst_early_setup(void)
230254

231255
x86_init.irqs.pre_vector_init = x86_init_noop;
232256

257+
x86_init.oem.arch_setup = mrst_arch_setup;
258+
233259
x86_cpuinit.setup_percpu_clockev = mrst_setup_secondary_clock;
234260

235261
x86_platform.calibrate_tsc = mrst_calibrate_tsc;

0 commit comments

Comments
 (0)