1633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
2633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * This file is subject to the terms and conditions of the GNU General Public
3633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * License.  See the file "COPYING" in the main directory of this archive
4633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * for more details.
5633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *
6633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1994 Waldorf GMBH
7633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 Ralf Baechle
8633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1996 Paul M. Antoine
9633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
10633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 2004  Maciej W. Rozycki
11633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
12633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef __ASM_CPU_INFO_H
13633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define __ASM_CPU_INFO_H
14633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
15633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/cache.h>
16633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
17633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
18633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Descriptor for a cache
19633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
20633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamstruct cache_desc {
21633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned int waysize;	/* Bytes per way */
22633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned short sets;	/* Number of lines per set */
23633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned char ways;	/* Number of ways */
24633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned char linesz;	/* Size of line in bytes */
25633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned char waybit;	/* Bits to select in a cache set */
26633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned char flags;	/* Flags describing cache properties */
27633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham};
28633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
29633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
30633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Flag definitions
31633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
32633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_CACHE_NOT_PRESENT	0x00000001
33633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_CACHE_VTAG		0x00000002	/* Virtually tagged cache */
34633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_CACHE_ALIASES	0x00000004	/* Cache could have aliases */
35633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_CACHE_IC_F_DC	0x00000008	/* Ic can refill from D-cache */
36633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_IC_SNOOPS_REMOTE	0x00000010	/* Ic snoops remote stores */
37633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define MIPS_CACHE_PINDEX	0x00000020	/* Physically indexed cache */
38633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
39633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamstruct cpuinfo_mips {
40633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long		udelay_val;
41633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long		asid_cache;
42633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
43633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	/*
44633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 * Capability and feature descriptor structure for MIPS CPU
45633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 */
46633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long		options;
47633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long		ases;
48633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned int		processor_id;
49633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned int		fpu_id;
50633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned int		cputype;
51633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			isa_level;
52633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			tlbsize;
53633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	struct cache_desc	icache;	/* Primary I-cache */
54633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	struct cache_desc	dcache;	/* Primary D or combined I/D cache */
55633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	struct cache_desc	scache;	/* Secondary cache */
56633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	struct cache_desc	tcache;	/* Tertiary/split secondary cache */
57633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			srsets;	/* Shadow register sets */
58633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			core;	/* physical core number */
59633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#if defined(CONFIG_MIPS_MT_SMP) || defined(CONFIG_MIPS_MT_SMTC)
60633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	/*
61633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 * In the MIPS MT "SMTC" model, each TC is considered
62633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 * to be a "CPU" for the purposes of scheduling, but
63633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 * exception resources, ASID spaces, etc, are common
64633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 * to all TCs within the same VPE.
65633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	 */
66633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			vpe_id;  /* Virtual Processor number */
67633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif
68633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifdef CONFIG_MIPS_MT_SMTC
69633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	int			tc_id;   /* Thread Context number */
70633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif
71633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	void 			*data;	/* Additional data */
72633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham} __attribute__((aligned(SMP_CACHE_BYTES)));
73633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
74633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern struct cpuinfo_mips cpu_data[];
75633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define current_cpu_data cpu_data[smp_processor_id()]
76633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define raw_current_cpu_data cpu_data[raw_smp_processor_id()]
77633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
78633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern void cpu_probe(void);
79633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern void cpu_report(void);
80633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
81633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamextern const char *__cpu_name[];
82633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define cpu_name_string()	__cpu_name[smp_processor_id()]
83633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
84633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* __ASM_CPU_INFO_H */
85