Path: blob/master/arch/mips/include/asm/cpu-features.h
17281 views
/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*5* Copyright (C) 2003, 2004 Ralf Baechle6* Copyright (C) 2004 Maciej W. Rozycki7*/8#ifndef __ASM_CPU_FEATURES_H9#define __ASM_CPU_FEATURES_H1011#include <asm/cpu.h>12#include <asm/cpu-info.h>13#include <cpu-feature-overrides.h>1415#ifndef current_cpu_type16#define current_cpu_type() current_cpu_data.cputype17#endif1819/*20* SMP assumption: Options of CPU 0 are a superset of all processors.21* This is true for all known MIPS systems.22*/23#ifndef cpu_has_tlb24#define cpu_has_tlb (cpu_data[0].options & MIPS_CPU_TLB)25#endif26#ifndef cpu_has_4kex27#define cpu_has_4kex (cpu_data[0].options & MIPS_CPU_4KEX)28#endif29#ifndef cpu_has_3k_cache30#define cpu_has_3k_cache (cpu_data[0].options & MIPS_CPU_3K_CACHE)31#endif32#define cpu_has_6k_cache 033#define cpu_has_8k_cache 034#ifndef cpu_has_4k_cache35#define cpu_has_4k_cache (cpu_data[0].options & MIPS_CPU_4K_CACHE)36#endif37#ifndef cpu_has_tx39_cache38#define cpu_has_tx39_cache (cpu_data[0].options & MIPS_CPU_TX39_CACHE)39#endif40#ifndef cpu_has_octeon_cache41#define cpu_has_octeon_cache 042#endif43#ifndef cpu_has_fpu44#define cpu_has_fpu (current_cpu_data.options & MIPS_CPU_FPU)45#define raw_cpu_has_fpu (raw_current_cpu_data.options & MIPS_CPU_FPU)46#else47#define raw_cpu_has_fpu cpu_has_fpu48#endif49#ifndef cpu_has_32fpr50#define cpu_has_32fpr (cpu_data[0].options & MIPS_CPU_32FPR)51#endif52#ifndef cpu_has_counter53#define cpu_has_counter (cpu_data[0].options & MIPS_CPU_COUNTER)54#endif55#ifndef cpu_has_watch56#define cpu_has_watch (cpu_data[0].options & MIPS_CPU_WATCH)57#endif58#ifndef cpu_has_divec59#define cpu_has_divec (cpu_data[0].options & MIPS_CPU_DIVEC)60#endif61#ifndef cpu_has_vce62#define cpu_has_vce (cpu_data[0].options & MIPS_CPU_VCE)63#endif64#ifndef cpu_has_cache_cdex_p65#define cpu_has_cache_cdex_p (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_P)66#endif67#ifndef cpu_has_cache_cdex_s68#define cpu_has_cache_cdex_s (cpu_data[0].options & MIPS_CPU_CACHE_CDEX_S)69#endif70#ifndef cpu_has_prefetch71#define cpu_has_prefetch (cpu_data[0].options & MIPS_CPU_PREFETCH)72#endif73#ifndef cpu_has_mcheck74#define cpu_has_mcheck (cpu_data[0].options & MIPS_CPU_MCHECK)75#endif76#ifndef cpu_has_ejtag77#define cpu_has_ejtag (cpu_data[0].options & MIPS_CPU_EJTAG)78#endif79#ifndef cpu_has_llsc80#define cpu_has_llsc (cpu_data[0].options & MIPS_CPU_LLSC)81#endif82#ifndef kernel_uses_llsc83#define kernel_uses_llsc cpu_has_llsc84#endif85#ifndef cpu_has_mips1686#define cpu_has_mips16 (cpu_data[0].ases & MIPS_ASE_MIPS16)87#endif88#ifndef cpu_has_mdmx89#define cpu_has_mdmx (cpu_data[0].ases & MIPS_ASE_MDMX)90#endif91#ifndef cpu_has_mips3d92#define cpu_has_mips3d (cpu_data[0].ases & MIPS_ASE_MIPS3D)93#endif94#ifndef cpu_has_smartmips95#define cpu_has_smartmips (cpu_data[0].ases & MIPS_ASE_SMARTMIPS)96#endif97#ifndef kernel_uses_smartmips_rixi98#define kernel_uses_smartmips_rixi 099#endif100#ifndef cpu_has_vtag_icache101#define cpu_has_vtag_icache (cpu_data[0].icache.flags & MIPS_CACHE_VTAG)102#endif103#ifndef cpu_has_dc_aliases104#define cpu_has_dc_aliases (cpu_data[0].dcache.flags & MIPS_CACHE_ALIASES)105#endif106#ifndef cpu_has_ic_fills_f_dc107#define cpu_has_ic_fills_f_dc (cpu_data[0].icache.flags & MIPS_CACHE_IC_F_DC)108#endif109#ifndef cpu_has_pindexed_dcache110#define cpu_has_pindexed_dcache (cpu_data[0].dcache.flags & MIPS_CACHE_PINDEX)111#endif112113/*114* I-Cache snoops remote store. This only matters on SMP. Some multiprocessors115* such as the R10000 have I-Caches that snoop local stores; the embedded ones116* don't. For maintaining I-cache coherency this means we need to flush the117* D-cache all the way back to whever the I-cache does refills from, so the118* I-cache has a chance to see the new data at all. Then we have to flush the119* I-cache also.120* Note we may have been rescheduled and may no longer be running on the CPU121* that did the store so we can't optimize this into only doing the flush on122* the local CPU.123*/124#ifndef cpu_icache_snoops_remote_store125#ifdef CONFIG_SMP126#define cpu_icache_snoops_remote_store (cpu_data[0].icache.flags & MIPS_IC_SNOOPS_REMOTE)127#else128#define cpu_icache_snoops_remote_store 1129#endif130#endif131132# ifndef cpu_has_mips32r1133# define cpu_has_mips32r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R1)134# endif135# ifndef cpu_has_mips32r2136# define cpu_has_mips32r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M32R2)137# endif138# ifndef cpu_has_mips64r1139# define cpu_has_mips64r1 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R1)140# endif141# ifndef cpu_has_mips64r2142# define cpu_has_mips64r2 (cpu_data[0].isa_level & MIPS_CPU_ISA_M64R2)143# endif144145/*146* Shortcuts ...147*/148#define cpu_has_mips32 (cpu_has_mips32r1 | cpu_has_mips32r2)149#define cpu_has_mips64 (cpu_has_mips64r1 | cpu_has_mips64r2)150#define cpu_has_mips_r1 (cpu_has_mips32r1 | cpu_has_mips64r1)151#define cpu_has_mips_r2 (cpu_has_mips32r2 | cpu_has_mips64r2)152#define cpu_has_mips_r (cpu_has_mips32r1 | cpu_has_mips32r2 | \153cpu_has_mips64r1 | cpu_has_mips64r2)154155#ifndef cpu_has_mips_r2_exec_hazard156#define cpu_has_mips_r2_exec_hazard cpu_has_mips_r2157#endif158159/*160* MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other161* pre-MIPS32/MIPS53 processors have CLO, CLZ. The IDT RC64574 is 64-bit and162* has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels163* cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.164*/165# ifndef cpu_has_clo_clz166# define cpu_has_clo_clz cpu_has_mips_r167# endif168169#ifndef cpu_has_dsp170#define cpu_has_dsp (cpu_data[0].ases & MIPS_ASE_DSP)171#endif172173#ifndef cpu_has_mipsmt174#define cpu_has_mipsmt (cpu_data[0].ases & MIPS_ASE_MIPSMT)175#endif176177#ifndef cpu_has_userlocal178#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI)179#endif180181#ifdef CONFIG_32BIT182# ifndef cpu_has_nofpuex183# define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)184# endif185# ifndef cpu_has_64bits186# define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)187# endif188# ifndef cpu_has_64bit_zero_reg189# define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)190# endif191# ifndef cpu_has_64bit_gp_regs192# define cpu_has_64bit_gp_regs 0193# endif194# ifndef cpu_has_64bit_addresses195# define cpu_has_64bit_addresses 0196# endif197# ifndef cpu_vmbits198# define cpu_vmbits 31199# endif200#endif201202#ifdef CONFIG_64BIT203# ifndef cpu_has_nofpuex204# define cpu_has_nofpuex 0205# endif206# ifndef cpu_has_64bits207# define cpu_has_64bits 1208# endif209# ifndef cpu_has_64bit_zero_reg210# define cpu_has_64bit_zero_reg 1211# endif212# ifndef cpu_has_64bit_gp_regs213# define cpu_has_64bit_gp_regs 1214# endif215# ifndef cpu_has_64bit_addresses216# define cpu_has_64bit_addresses 1217# endif218# ifndef cpu_vmbits219# define cpu_vmbits cpu_data[0].vmbits220# define __NEED_VMBITS_PROBE221# endif222#endif223224#if defined(CONFIG_CPU_MIPSR2_IRQ_VI) && !defined(cpu_has_vint)225# define cpu_has_vint (cpu_data[0].options & MIPS_CPU_VINT)226#elif !defined(cpu_has_vint)227# define cpu_has_vint 0228#endif229230#if defined(CONFIG_CPU_MIPSR2_IRQ_EI) && !defined(cpu_has_veic)231# define cpu_has_veic (cpu_data[0].options & MIPS_CPU_VEIC)232#elif !defined(cpu_has_veic)233# define cpu_has_veic 0234#endif235236#ifndef cpu_has_inclusive_pcaches237#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)238#endif239240#ifndef cpu_dcache_line_size241#define cpu_dcache_line_size() cpu_data[0].dcache.linesz242#endif243#ifndef cpu_icache_line_size244#define cpu_icache_line_size() cpu_data[0].icache.linesz245#endif246#ifndef cpu_scache_line_size247#define cpu_scache_line_size() cpu_data[0].scache.linesz248#endif249250#ifndef cpu_hwrena_impl_bits251#define cpu_hwrena_impl_bits 0252#endif253254#endif /* __ASM_CPU_FEATURES_H */255256257