18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* spitfire.h: SpitFire/BlackBird/Cheetah inline MMU operations. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 1996 David S. Miller (davem@davemloft.net) 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _SPARC64_SPITFIRE_H 88c2ecf20Sopenharmony_ci#define _SPARC64_SPITFIRE_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifdef CONFIG_SPARC64 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include <asm/asi.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* The following register addresses are accessible via ASI_DMMU 158c2ecf20Sopenharmony_ci * and ASI_IMMU, that is there is a distinct and unique copy of 168c2ecf20Sopenharmony_ci * each these registers for each TLB. 178c2ecf20Sopenharmony_ci */ 188c2ecf20Sopenharmony_ci#define TSB_TAG_TARGET 0x0000000000000000 /* All chips */ 198c2ecf20Sopenharmony_ci#define TLB_SFSR 0x0000000000000018 /* All chips */ 208c2ecf20Sopenharmony_ci#define TSB_REG 0x0000000000000028 /* All chips */ 218c2ecf20Sopenharmony_ci#define TLB_TAG_ACCESS 0x0000000000000030 /* All chips */ 228c2ecf20Sopenharmony_ci#define VIRT_WATCHPOINT 0x0000000000000038 /* All chips */ 238c2ecf20Sopenharmony_ci#define PHYS_WATCHPOINT 0x0000000000000040 /* All chips */ 248c2ecf20Sopenharmony_ci#define TSB_EXTENSION_P 0x0000000000000048 /* Ultra-III and later */ 258c2ecf20Sopenharmony_ci#define TSB_EXTENSION_S 0x0000000000000050 /* Ultra-III and later, D-TLB only */ 268c2ecf20Sopenharmony_ci#define TSB_EXTENSION_N 0x0000000000000058 /* Ultra-III and later */ 278c2ecf20Sopenharmony_ci#define TLB_TAG_ACCESS_EXT 0x0000000000000060 /* Ultra-III+ and later */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* These registers only exist as one entity, and are accessed 308c2ecf20Sopenharmony_ci * via ASI_DMMU only. 318c2ecf20Sopenharmony_ci */ 328c2ecf20Sopenharmony_ci#define PRIMARY_CONTEXT 0x0000000000000008 338c2ecf20Sopenharmony_ci#define SECONDARY_CONTEXT 0x0000000000000010 348c2ecf20Sopenharmony_ci#define DMMU_SFAR 0x0000000000000020 358c2ecf20Sopenharmony_ci#define VIRT_WATCHPOINT 0x0000000000000038 368c2ecf20Sopenharmony_ci#define PHYS_WATCHPOINT 0x0000000000000040 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define SPITFIRE_HIGHEST_LOCKED_TLBENT (64 - 1) 398c2ecf20Sopenharmony_ci#define CHEETAH_HIGHEST_LOCKED_TLBENT (16 - 1) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define L1DCACHE_SIZE 0x4000 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define SUN4V_CHIP_INVALID 0x00 448c2ecf20Sopenharmony_ci#define SUN4V_CHIP_NIAGARA1 0x01 458c2ecf20Sopenharmony_ci#define SUN4V_CHIP_NIAGARA2 0x02 468c2ecf20Sopenharmony_ci#define SUN4V_CHIP_NIAGARA3 0x03 478c2ecf20Sopenharmony_ci#define SUN4V_CHIP_NIAGARA4 0x04 488c2ecf20Sopenharmony_ci#define SUN4V_CHIP_NIAGARA5 0x05 498c2ecf20Sopenharmony_ci#define SUN4V_CHIP_SPARC_M6 0x06 508c2ecf20Sopenharmony_ci#define SUN4V_CHIP_SPARC_M7 0x07 518c2ecf20Sopenharmony_ci#define SUN4V_CHIP_SPARC_M8 0x08 528c2ecf20Sopenharmony_ci#define SUN4V_CHIP_SPARC64X 0x8a 538c2ecf20Sopenharmony_ci#define SUN4V_CHIP_SPARC_SN 0x8b 548c2ecf20Sopenharmony_ci#define SUN4V_CHIP_UNKNOWN 0xff 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci/* 578c2ecf20Sopenharmony_ci * The following CPU_ID_xxx constants are used 588c2ecf20Sopenharmony_ci * to identify the CPU type in the setup phase 598c2ecf20Sopenharmony_ci * (see head_64.S) 608c2ecf20Sopenharmony_ci */ 618c2ecf20Sopenharmony_ci#define CPU_ID_NIAGARA1 ('1') 628c2ecf20Sopenharmony_ci#define CPU_ID_NIAGARA2 ('2') 638c2ecf20Sopenharmony_ci#define CPU_ID_NIAGARA3 ('3') 648c2ecf20Sopenharmony_ci#define CPU_ID_NIAGARA4 ('4') 658c2ecf20Sopenharmony_ci#define CPU_ID_NIAGARA5 ('5') 668c2ecf20Sopenharmony_ci#define CPU_ID_M6 ('6') 678c2ecf20Sopenharmony_ci#define CPU_ID_M7 ('7') 688c2ecf20Sopenharmony_ci#define CPU_ID_M8 ('8') 698c2ecf20Sopenharmony_ci#define CPU_ID_SONOMA1 ('N') 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cienum ultra_tlb_layout { 748c2ecf20Sopenharmony_ci spitfire = 0, 758c2ecf20Sopenharmony_ci cheetah = 1, 768c2ecf20Sopenharmony_ci cheetah_plus = 2, 778c2ecf20Sopenharmony_ci hypervisor = 3, 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciextern enum ultra_tlb_layout tlb_type; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciextern int sun4v_chip_type; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ciextern int cheetah_pcache_forced_on; 858c2ecf20Sopenharmony_civoid cheetah_enable_pcache(void); 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#define sparc64_highest_locked_tlbent() \ 888c2ecf20Sopenharmony_ci (tlb_type == spitfire ? \ 898c2ecf20Sopenharmony_ci SPITFIRE_HIGHEST_LOCKED_TLBENT : \ 908c2ecf20Sopenharmony_ci CHEETAH_HIGHEST_LOCKED_TLBENT) 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ciextern int num_kernel_image_mappings; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* The data cache is write through, so this just invalidates the 958c2ecf20Sopenharmony_ci * specified line. 968c2ecf20Sopenharmony_ci */ 978c2ecf20Sopenharmony_cistatic inline void spitfire_put_dcache_tag(unsigned long addr, unsigned long tag) 988c2ecf20Sopenharmony_ci{ 998c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 1008c2ecf20Sopenharmony_ci "membar #Sync" 1018c2ecf20Sopenharmony_ci : /* No outputs */ 1028c2ecf20Sopenharmony_ci : "r" (tag), "r" (addr), "i" (ASI_DCACHE_TAG)); 1038c2ecf20Sopenharmony_ci} 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci/* The instruction cache lines are flushed with this, but note that 1068c2ecf20Sopenharmony_ci * this does not flush the pipeline. It is possible for a line to 1078c2ecf20Sopenharmony_ci * get flushed but stale instructions to still be in the pipeline, 1088c2ecf20Sopenharmony_ci * a flush instruction (to any address) is sufficient to handle 1098c2ecf20Sopenharmony_ci * this issue after the line is invalidated. 1108c2ecf20Sopenharmony_ci */ 1118c2ecf20Sopenharmony_cistatic inline void spitfire_put_icache_tag(unsigned long addr, unsigned long tag) 1128c2ecf20Sopenharmony_ci{ 1138c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 1148c2ecf20Sopenharmony_ci "membar #Sync" 1158c2ecf20Sopenharmony_ci : /* No outputs */ 1168c2ecf20Sopenharmony_ci : "r" (tag), "r" (addr), "i" (ASI_IC_TAG)); 1178c2ecf20Sopenharmony_ci} 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_cistatic inline unsigned long spitfire_get_dtlb_data(int entry) 1208c2ecf20Sopenharmony_ci{ 1218c2ecf20Sopenharmony_ci unsigned long data; 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 1248c2ecf20Sopenharmony_ci : "=r" (data) 1258c2ecf20Sopenharmony_ci : "r" (entry << 3), "i" (ASI_DTLB_DATA_ACCESS)); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci /* Clear TTE diag bits. */ 1288c2ecf20Sopenharmony_ci data &= ~0x0003fe0000000000UL; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci return data; 1318c2ecf20Sopenharmony_ci} 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_cistatic inline unsigned long spitfire_get_dtlb_tag(int entry) 1348c2ecf20Sopenharmony_ci{ 1358c2ecf20Sopenharmony_ci unsigned long tag; 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 1388c2ecf20Sopenharmony_ci : "=r" (tag) 1398c2ecf20Sopenharmony_ci : "r" (entry << 3), "i" (ASI_DTLB_TAG_READ)); 1408c2ecf20Sopenharmony_ci return tag; 1418c2ecf20Sopenharmony_ci} 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cistatic inline void spitfire_put_dtlb_data(int entry, unsigned long data) 1448c2ecf20Sopenharmony_ci{ 1458c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 1468c2ecf20Sopenharmony_ci "membar #Sync" 1478c2ecf20Sopenharmony_ci : /* No outputs */ 1488c2ecf20Sopenharmony_ci : "r" (data), "r" (entry << 3), 1498c2ecf20Sopenharmony_ci "i" (ASI_DTLB_DATA_ACCESS)); 1508c2ecf20Sopenharmony_ci} 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_cistatic inline unsigned long spitfire_get_itlb_data(int entry) 1538c2ecf20Sopenharmony_ci{ 1548c2ecf20Sopenharmony_ci unsigned long data; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 1578c2ecf20Sopenharmony_ci : "=r" (data) 1588c2ecf20Sopenharmony_ci : "r" (entry << 3), "i" (ASI_ITLB_DATA_ACCESS)); 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci /* Clear TTE diag bits. */ 1618c2ecf20Sopenharmony_ci data &= ~0x0003fe0000000000UL; 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci return data; 1648c2ecf20Sopenharmony_ci} 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cistatic inline unsigned long spitfire_get_itlb_tag(int entry) 1678c2ecf20Sopenharmony_ci{ 1688c2ecf20Sopenharmony_ci unsigned long tag; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 1718c2ecf20Sopenharmony_ci : "=r" (tag) 1728c2ecf20Sopenharmony_ci : "r" (entry << 3), "i" (ASI_ITLB_TAG_READ)); 1738c2ecf20Sopenharmony_ci return tag; 1748c2ecf20Sopenharmony_ci} 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_cistatic inline void spitfire_put_itlb_data(int entry, unsigned long data) 1778c2ecf20Sopenharmony_ci{ 1788c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 1798c2ecf20Sopenharmony_ci "membar #Sync" 1808c2ecf20Sopenharmony_ci : /* No outputs */ 1818c2ecf20Sopenharmony_ci : "r" (data), "r" (entry << 3), 1828c2ecf20Sopenharmony_ci "i" (ASI_ITLB_DATA_ACCESS)); 1838c2ecf20Sopenharmony_ci} 1848c2ecf20Sopenharmony_ci 1858c2ecf20Sopenharmony_cistatic inline void spitfire_flush_dtlb_nucleus_page(unsigned long page) 1868c2ecf20Sopenharmony_ci{ 1878c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 1888c2ecf20Sopenharmony_ci "membar #Sync" 1898c2ecf20Sopenharmony_ci : /* No outputs */ 1908c2ecf20Sopenharmony_ci : "r" (page | 0x20), "i" (ASI_DMMU_DEMAP)); 1918c2ecf20Sopenharmony_ci} 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_cistatic inline void spitfire_flush_itlb_nucleus_page(unsigned long page) 1948c2ecf20Sopenharmony_ci{ 1958c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 1968c2ecf20Sopenharmony_ci "membar #Sync" 1978c2ecf20Sopenharmony_ci : /* No outputs */ 1988c2ecf20Sopenharmony_ci : "r" (page | 0x20), "i" (ASI_IMMU_DEMAP)); 1998c2ecf20Sopenharmony_ci} 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* Cheetah has "all non-locked" tlb flushes. */ 2028c2ecf20Sopenharmony_cistatic inline void cheetah_flush_dtlb_all(void) 2038c2ecf20Sopenharmony_ci{ 2048c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 2058c2ecf20Sopenharmony_ci "membar #Sync" 2068c2ecf20Sopenharmony_ci : /* No outputs */ 2078c2ecf20Sopenharmony_ci : "r" (0x80), "i" (ASI_DMMU_DEMAP)); 2088c2ecf20Sopenharmony_ci} 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_cistatic inline void cheetah_flush_itlb_all(void) 2118c2ecf20Sopenharmony_ci{ 2128c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %%g0, [%0] %1\n\t" 2138c2ecf20Sopenharmony_ci "membar #Sync" 2148c2ecf20Sopenharmony_ci : /* No outputs */ 2158c2ecf20Sopenharmony_ci : "r" (0x80), "i" (ASI_IMMU_DEMAP)); 2168c2ecf20Sopenharmony_ci} 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* Cheetah has a 4-tlb layout so direct access is a bit different. 2198c2ecf20Sopenharmony_ci * The first two TLBs are fully assosciative, hold 16 entries, and are 2208c2ecf20Sopenharmony_ci * used only for locked and >8K sized translations. One exists for 2218c2ecf20Sopenharmony_ci * data accesses and one for instruction accesses. 2228c2ecf20Sopenharmony_ci * 2238c2ecf20Sopenharmony_ci * The third TLB is for data accesses to 8K non-locked translations, is 2248c2ecf20Sopenharmony_ci * 2 way assosciative, and holds 512 entries. The fourth TLB is for 2258c2ecf20Sopenharmony_ci * instruction accesses to 8K non-locked translations, is 2 way 2268c2ecf20Sopenharmony_ci * assosciative, and holds 128 entries. 2278c2ecf20Sopenharmony_ci * 2288c2ecf20Sopenharmony_ci * Cheetah has some bug where bogus data can be returned from 2298c2ecf20Sopenharmony_ci * ASI_{D,I}TLB_DATA_ACCESS loads, doing the load twice fixes 2308c2ecf20Sopenharmony_ci * the problem for me. -DaveM 2318c2ecf20Sopenharmony_ci */ 2328c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_ldtlb_data(int entry) 2338c2ecf20Sopenharmony_ci{ 2348c2ecf20Sopenharmony_ci unsigned long data; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %%g0\n\t" 2378c2ecf20Sopenharmony_ci "ldxa [%1] %2, %0" 2388c2ecf20Sopenharmony_ci : "=r" (data) 2398c2ecf20Sopenharmony_ci : "r" ((0 << 16) | (entry << 3)), 2408c2ecf20Sopenharmony_ci "i" (ASI_DTLB_DATA_ACCESS)); 2418c2ecf20Sopenharmony_ci 2428c2ecf20Sopenharmony_ci return data; 2438c2ecf20Sopenharmony_ci} 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_litlb_data(int entry) 2468c2ecf20Sopenharmony_ci{ 2478c2ecf20Sopenharmony_ci unsigned long data; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %%g0\n\t" 2508c2ecf20Sopenharmony_ci "ldxa [%1] %2, %0" 2518c2ecf20Sopenharmony_ci : "=r" (data) 2528c2ecf20Sopenharmony_ci : "r" ((0 << 16) | (entry << 3)), 2538c2ecf20Sopenharmony_ci "i" (ASI_ITLB_DATA_ACCESS)); 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci return data; 2568c2ecf20Sopenharmony_ci} 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_ldtlb_tag(int entry) 2598c2ecf20Sopenharmony_ci{ 2608c2ecf20Sopenharmony_ci unsigned long tag; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 2638c2ecf20Sopenharmony_ci : "=r" (tag) 2648c2ecf20Sopenharmony_ci : "r" ((0 << 16) | (entry << 3)), 2658c2ecf20Sopenharmony_ci "i" (ASI_DTLB_TAG_READ)); 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci return tag; 2688c2ecf20Sopenharmony_ci} 2698c2ecf20Sopenharmony_ci 2708c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_litlb_tag(int entry) 2718c2ecf20Sopenharmony_ci{ 2728c2ecf20Sopenharmony_ci unsigned long tag; 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 2758c2ecf20Sopenharmony_ci : "=r" (tag) 2768c2ecf20Sopenharmony_ci : "r" ((0 << 16) | (entry << 3)), 2778c2ecf20Sopenharmony_ci "i" (ASI_ITLB_TAG_READ)); 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci return tag; 2808c2ecf20Sopenharmony_ci} 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_cistatic inline void cheetah_put_ldtlb_data(int entry, unsigned long data) 2838c2ecf20Sopenharmony_ci{ 2848c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 2858c2ecf20Sopenharmony_ci "membar #Sync" 2868c2ecf20Sopenharmony_ci : /* No outputs */ 2878c2ecf20Sopenharmony_ci : "r" (data), 2888c2ecf20Sopenharmony_ci "r" ((0 << 16) | (entry << 3)), 2898c2ecf20Sopenharmony_ci "i" (ASI_DTLB_DATA_ACCESS)); 2908c2ecf20Sopenharmony_ci} 2918c2ecf20Sopenharmony_ci 2928c2ecf20Sopenharmony_cistatic inline void cheetah_put_litlb_data(int entry, unsigned long data) 2938c2ecf20Sopenharmony_ci{ 2948c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 2958c2ecf20Sopenharmony_ci "membar #Sync" 2968c2ecf20Sopenharmony_ci : /* No outputs */ 2978c2ecf20Sopenharmony_ci : "r" (data), 2988c2ecf20Sopenharmony_ci "r" ((0 << 16) | (entry << 3)), 2998c2ecf20Sopenharmony_ci "i" (ASI_ITLB_DATA_ACCESS)); 3008c2ecf20Sopenharmony_ci} 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_dtlb_data(int entry, int tlb) 3038c2ecf20Sopenharmony_ci{ 3048c2ecf20Sopenharmony_ci unsigned long data; 3058c2ecf20Sopenharmony_ci 3068c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %%g0\n\t" 3078c2ecf20Sopenharmony_ci "ldxa [%1] %2, %0" 3088c2ecf20Sopenharmony_ci : "=r" (data) 3098c2ecf20Sopenharmony_ci : "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_DATA_ACCESS)); 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci return data; 3128c2ecf20Sopenharmony_ci} 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_dtlb_tag(int entry, int tlb) 3158c2ecf20Sopenharmony_ci{ 3168c2ecf20Sopenharmony_ci unsigned long tag; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 3198c2ecf20Sopenharmony_ci : "=r" (tag) 3208c2ecf20Sopenharmony_ci : "r" ((tlb << 16) | (entry << 3)), "i" (ASI_DTLB_TAG_READ)); 3218c2ecf20Sopenharmony_ci return tag; 3228c2ecf20Sopenharmony_ci} 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_cistatic inline void cheetah_put_dtlb_data(int entry, unsigned long data, int tlb) 3258c2ecf20Sopenharmony_ci{ 3268c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 3278c2ecf20Sopenharmony_ci "membar #Sync" 3288c2ecf20Sopenharmony_ci : /* No outputs */ 3298c2ecf20Sopenharmony_ci : "r" (data), 3308c2ecf20Sopenharmony_ci "r" ((tlb << 16) | (entry << 3)), 3318c2ecf20Sopenharmony_ci "i" (ASI_DTLB_DATA_ACCESS)); 3328c2ecf20Sopenharmony_ci} 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_itlb_data(int entry) 3358c2ecf20Sopenharmony_ci{ 3368c2ecf20Sopenharmony_ci unsigned long data; 3378c2ecf20Sopenharmony_ci 3388c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %%g0\n\t" 3398c2ecf20Sopenharmony_ci "ldxa [%1] %2, %0" 3408c2ecf20Sopenharmony_ci : "=r" (data) 3418c2ecf20Sopenharmony_ci : "r" ((2 << 16) | (entry << 3)), 3428c2ecf20Sopenharmony_ci "i" (ASI_ITLB_DATA_ACCESS)); 3438c2ecf20Sopenharmony_ci 3448c2ecf20Sopenharmony_ci return data; 3458c2ecf20Sopenharmony_ci} 3468c2ecf20Sopenharmony_ci 3478c2ecf20Sopenharmony_cistatic inline unsigned long cheetah_get_itlb_tag(int entry) 3488c2ecf20Sopenharmony_ci{ 3498c2ecf20Sopenharmony_ci unsigned long tag; 3508c2ecf20Sopenharmony_ci 3518c2ecf20Sopenharmony_ci __asm__ __volatile__("ldxa [%1] %2, %0" 3528c2ecf20Sopenharmony_ci : "=r" (tag) 3538c2ecf20Sopenharmony_ci : "r" ((2 << 16) | (entry << 3)), "i" (ASI_ITLB_TAG_READ)); 3548c2ecf20Sopenharmony_ci return tag; 3558c2ecf20Sopenharmony_ci} 3568c2ecf20Sopenharmony_ci 3578c2ecf20Sopenharmony_cistatic inline void cheetah_put_itlb_data(int entry, unsigned long data) 3588c2ecf20Sopenharmony_ci{ 3598c2ecf20Sopenharmony_ci __asm__ __volatile__("stxa %0, [%1] %2\n\t" 3608c2ecf20Sopenharmony_ci "membar #Sync" 3618c2ecf20Sopenharmony_ci : /* No outputs */ 3628c2ecf20Sopenharmony_ci : "r" (data), "r" ((2 << 16) | (entry << 3)), 3638c2ecf20Sopenharmony_ci "i" (ASI_ITLB_DATA_ACCESS)); 3648c2ecf20Sopenharmony_ci} 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#endif /* !(__ASSEMBLY__) */ 3678c2ecf20Sopenharmony_ci#endif /* CONFIG_SPARC64 */ 3688c2ecf20Sopenharmony_ci#endif /* !(_SPARC64_SPITFIRE_H) */ 369