cputable.c

来自「linux 内核源代码」· C语言 代码 · 共 1,417 行 · 第 1/3 页

C
1,417
字号
/* *  Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org) * *  Modifications for ppc64: *      Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> * *  This program is free software; you can redistribute it and/or *  modify it under the terms of the GNU General Public License *  as published by the Free Software Foundation; either version *  2 of the License, or (at your option) any later version. */#include <linux/string.h>#include <linux/sched.h>#include <linux/threads.h>#include <linux/init.h>#include <linux/module.h>#include <asm/oprofile_impl.h>#include <asm/cputable.h>#include <asm/prom.h>		/* for PTRRELOC on ARCH=ppc */struct cpu_spec* cur_cpu_spec = NULL;EXPORT_SYMBOL(cur_cpu_spec);/* NOTE: * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's * the responsibility of the appropriate CPU save/restore functions to * eventually copy these settings over. Those save/restore aren't yet * part of the cputable though. That has to be fixed for both ppc32 * and ppc64 */#ifdef CONFIG_PPC32extern void __setup_cpu_440ep(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_440epx(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_440grx(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_603(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_604(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_750(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_750cx(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_750fx(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_7400(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec);#endif /* CONFIG_PPC32 */#ifdef CONFIG_PPC64extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_ppc970MP(unsigned long offset, struct cpu_spec* spec);extern void __setup_cpu_pa6t(unsigned long offset, struct cpu_spec* spec);extern void __restore_cpu_pa6t(void);extern void __restore_cpu_ppc970(void);#endif /* CONFIG_PPC64 *//* This table only contains "desktop" CPUs, it need to be filled with embedded * ones as well... */#define COMMON_USER		(PPC_FEATURE_32 | PPC_FEATURE_HAS_FPU | \				 PPC_FEATURE_HAS_MMU)#define COMMON_USER_PPC64	(COMMON_USER | PPC_FEATURE_64)#define COMMON_USER_POWER4	(COMMON_USER_PPC64 | PPC_FEATURE_POWER4)#define COMMON_USER_POWER5	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5 |\				 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)#define COMMON_USER_POWER5_PLUS	(COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS|\				 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP)#define COMMON_USER_POWER6	(COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\				 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \				 PPC_FEATURE_TRUE_LE)#define COMMON_USER_PA6T	(COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\				 PPC_FEATURE_TRUE_LE | \				 PPC_FEATURE_HAS_ALTIVEC_COMP)#define COMMON_USER_BOOKE	(PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \				 PPC_FEATURE_BOOKE)static struct cpu_spec __initdata cpu_specs[] = {#ifdef CONFIG_PPC64	{	/* Power3 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00400000,		.cpu_name		= "POWER3 (630)",		.cpu_features		= CPU_FTRS_POWER3,		.cpu_user_features	= COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power3",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "power3",	},	{	/* Power3+ */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00410000,		.cpu_name		= "POWER3 (630+)",		.cpu_features		= CPU_FTRS_POWER3,		.cpu_user_features	= COMMON_USER_PPC64|PPC_FEATURE_PPC_LE,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power3",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "power3",	},	{	/* Northstar */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00330000,		.cpu_name		= "RS64-II (northstar)",		.cpu_features		= CPU_FTRS_RS64,		.cpu_user_features	= COMMON_USER_PPC64,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/rs64",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "rs64",	},	{	/* Pulsar */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00340000,		.cpu_name		= "RS64-III (pulsar)",		.cpu_features		= CPU_FTRS_RS64,		.cpu_user_features	= COMMON_USER_PPC64,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/rs64",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "rs64",	},	{	/* I-star */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00360000,		.cpu_name		= "RS64-III (icestar)",		.cpu_features		= CPU_FTRS_RS64,		.cpu_user_features	= COMMON_USER_PPC64,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/rs64",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "rs64",	},	{	/* S-star */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00370000,		.cpu_name		= "RS64-IV (sstar)",		.cpu_features		= CPU_FTRS_RS64,		.cpu_user_features	= COMMON_USER_PPC64,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/rs64",		.oprofile_type		= PPC_OPROFILE_RS64,		.platform		= "rs64",	},	{	/* Power4 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00350000,		.cpu_name		= "POWER4 (gp)",		.cpu_features		= CPU_FTRS_POWER4,		.cpu_user_features	= COMMON_USER_POWER4,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power4",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "power4",	},	{	/* Power4+ */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00380000,		.cpu_name		= "POWER4+ (gq)",		.cpu_features		= CPU_FTRS_POWER4,		.cpu_user_features	= COMMON_USER_POWER4,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power4",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "power4",	},	{	/* PPC970 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00390000,		.cpu_name		= "PPC970",		.cpu_features		= CPU_FTRS_PPC970,		.cpu_user_features	= COMMON_USER_POWER4 |			PPC_FEATURE_HAS_ALTIVEC_COMP,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.cpu_setup		= __setup_cpu_ppc970,		.cpu_restore		= __restore_cpu_ppc970,		.oprofile_cpu_type	= "ppc64/970",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "ppc970",	},	{	/* PPC970FX */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x003c0000,		.cpu_name		= "PPC970FX",		.cpu_features		= CPU_FTRS_PPC970,		.cpu_user_features	= COMMON_USER_POWER4 |			PPC_FEATURE_HAS_ALTIVEC_COMP,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.cpu_setup		= __setup_cpu_ppc970,		.cpu_restore		= __restore_cpu_ppc970,		.oprofile_cpu_type	= "ppc64/970",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "ppc970",	},	{	/* PPC970MP DD1.0 - no DEEPNAP, use regular 970 init */		.pvr_mask		= 0xffffffff,		.pvr_value		= 0x00440100,		.cpu_name		= "PPC970MP",		.cpu_features		= CPU_FTRS_PPC970,		.cpu_user_features	= COMMON_USER_POWER4 |			PPC_FEATURE_HAS_ALTIVEC_COMP,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.cpu_setup		= __setup_cpu_ppc970,		.cpu_restore		= __restore_cpu_ppc970,		.oprofile_cpu_type	= "ppc64/970MP",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "ppc970",	},	{	/* PPC970MP */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00440000,		.cpu_name		= "PPC970MP",		.cpu_features		= CPU_FTRS_PPC970,		.cpu_user_features	= COMMON_USER_POWER4 |			PPC_FEATURE_HAS_ALTIVEC_COMP,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.cpu_setup		= __setup_cpu_ppc970MP,		.cpu_restore		= __restore_cpu_ppc970,		.oprofile_cpu_type	= "ppc64/970MP",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "ppc970",	},	{	/* PPC970GX */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00450000,		.cpu_name		= "PPC970GX",		.cpu_features		= CPU_FTRS_PPC970,		.cpu_user_features	= COMMON_USER_POWER4 |			PPC_FEATURE_HAS_ALTIVEC_COMP,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 8,		.pmc_type		= PPC_PMC_IBM,		.cpu_setup		= __setup_cpu_ppc970,		.oprofile_cpu_type	= "ppc64/970",		.oprofile_type		= PPC_OPROFILE_POWER4,		.platform		= "ppc970",	},	{	/* Power5 GR */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x003a0000,		.cpu_name		= "POWER5 (gr)",		.cpu_features		= CPU_FTRS_POWER5,		.cpu_user_features	= COMMON_USER_POWER5,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 6,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power5",		.oprofile_type		= PPC_OPROFILE_POWER4,		/* SIHV / SIPR bits are implemented on POWER4+ (GQ)		 * and above but only works on POWER5 and above		 */		.oprofile_mmcra_sihv	= MMCRA_SIHV,		.oprofile_mmcra_sipr	= MMCRA_SIPR,		.platform		= "power5",	},	{	/* Power5++ */		.pvr_mask		= 0xffffff00,		.pvr_value		= 0x003b0300,		.cpu_name		= "POWER5+ (gs)",		.cpu_features		= CPU_FTRS_POWER5,		.cpu_user_features	= COMMON_USER_POWER5_PLUS,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 6,		.oprofile_cpu_type	= "ppc64/power5++",		.oprofile_type		= PPC_OPROFILE_POWER4,		.oprofile_mmcra_sihv	= MMCRA_SIHV,		.oprofile_mmcra_sipr	= MMCRA_SIPR,		.platform		= "power5+",	},	{	/* Power5 GS */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x003b0000,		.cpu_name		= "POWER5+ (gs)",		.cpu_features		= CPU_FTRS_POWER5,		.cpu_user_features	= COMMON_USER_POWER5_PLUS,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 6,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power5+",		.oprofile_type		= PPC_OPROFILE_POWER4,		.oprofile_mmcra_sihv	= MMCRA_SIHV,		.oprofile_mmcra_sipr	= MMCRA_SIPR,		.platform		= "power5+",	},	{	/* POWER6 in P5+ mode; 2.04-compliant processor */		.pvr_mask		= 0xffffffff,		.pvr_value		= 0x0f000001,		.cpu_name		= "POWER5+",		.cpu_features		= CPU_FTRS_POWER5,		.cpu_user_features	= COMMON_USER_POWER5_PLUS,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.platform		= "power5+",	},	{	/* Power6 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x003e0000,		.cpu_name		= "POWER6 (raw)",		.cpu_features		= CPU_FTRS_POWER6,		.cpu_user_features	= COMMON_USER_POWER6 |			PPC_FEATURE_POWER6_EXT,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 6,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/power6",		.oprofile_type		= PPC_OPROFILE_POWER4,		.oprofile_mmcra_sihv	= POWER6_MMCRA_SIHV,		.oprofile_mmcra_sipr	= POWER6_MMCRA_SIPR,		.oprofile_mmcra_clear	= POWER6_MMCRA_THRM |			POWER6_MMCRA_OTHER,		.platform		= "power6x",	},	{	/* 2.05-compliant processor, i.e. Power6 "architected" mode */		.pvr_mask		= 0xffffffff,		.pvr_value		= 0x0f000002,		.cpu_name		= "POWER6 (architected)",		.cpu_features		= CPU_FTRS_POWER6,		.cpu_user_features	= COMMON_USER_POWER6,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.platform		= "power6",	},	{	/* Cell Broadband Engine */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00700000,		.cpu_name		= "Cell Broadband Engine",		.cpu_features		= CPU_FTRS_CELL,		.cpu_user_features	= COMMON_USER_PPC64 |			PPC_FEATURE_CELL | PPC_FEATURE_HAS_ALTIVEC_COMP |			PPC_FEATURE_SMT,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 4,		.pmc_type		= PPC_PMC_IBM,		.oprofile_cpu_type	= "ppc64/cell-be",		.oprofile_type		= PPC_OPROFILE_CELL,		.platform		= "ppc-cell-be",	},	{	/* PA Semi PA6T */		.pvr_mask		= 0x7fff0000,		.pvr_value		= 0x00900000,		.cpu_name		= "PA6T",		.cpu_features		= CPU_FTRS_PA6T,		.cpu_user_features	= COMMON_USER_PA6T,		.icache_bsize		= 64,		.dcache_bsize		= 64,		.num_pmcs		= 6,		.pmc_type		= PPC_PMC_PA6T,		.cpu_setup		= __setup_cpu_pa6t,		.cpu_restore		= __restore_cpu_pa6t,		.oprofile_cpu_type	= "ppc64/pa6t",		.oprofile_type		= PPC_OPROFILE_PA6T,		.platform		= "pa6t",	},	{	/* default match */		.pvr_mask		= 0x00000000,		.pvr_value		= 0x00000000,		.cpu_name		= "POWER4 (compatible)",		.cpu_features		= CPU_FTRS_COMPATIBLE,		.cpu_user_features	= COMMON_USER_PPC64,		.icache_bsize		= 128,		.dcache_bsize		= 128,		.num_pmcs		= 6,		.pmc_type		= PPC_PMC_IBM,		.platform		= "power4",	}#endif	/* CONFIG_PPC64 */#ifdef CONFIG_PPC32#if CLASSIC_PPC	{	/* 601 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00010000,		.cpu_name		= "601",		.cpu_features		= CPU_FTRS_PPC601,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_601_INSTR |			PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.platform		= "ppc601",	},	{	/* 603 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00030000,		.cpu_name		= "603",		.cpu_features		= CPU_FTRS_603,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.cpu_setup		= __setup_cpu_603,		.platform		= "ppc603",	},	{	/* 603e */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00060000,		.cpu_name		= "603e",		.cpu_features		= CPU_FTRS_603,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.cpu_setup		= __setup_cpu_603,		.platform		= "ppc603",	},	{	/* 603ev */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00070000,		.cpu_name		= "603ev",		.cpu_features		= CPU_FTRS_603,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.cpu_setup		= __setup_cpu_603,		.platform		= "ppc603",	},	{	/* 604 */		.pvr_mask		= 0xffff0000,		.pvr_value		= 0x00040000,		.cpu_name		= "604",		.cpu_features		= CPU_FTRS_604,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.num_pmcs		= 2,		.cpu_setup		= __setup_cpu_604,		.platform		= "ppc604",	},	{	/* 604e */		.pvr_mask		= 0xfffff000,		.pvr_value		= 0x00090000,		.cpu_name		= "604e",		.cpu_features		= CPU_FTRS_604,		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,		.icache_bsize		= 32,		.dcache_bsize		= 32,		.num_pmcs		= 4,		.cpu_setup		= __setup_cpu_604,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?