18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * mxcc.h: Definitions of the Viking MXCC registers 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _SPARC_MXCC_H 98c2ecf20Sopenharmony_ci#define _SPARC_MXCC_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* These registers are accessed through ASI 0x2. */ 128c2ecf20Sopenharmony_ci#define MXCC_DATSTREAM 0x1C00000 /* Data stream register */ 138c2ecf20Sopenharmony_ci#define MXCC_SRCSTREAM 0x1C00100 /* Source stream register */ 148c2ecf20Sopenharmony_ci#define MXCC_DESSTREAM 0x1C00200 /* Destination stream register */ 158c2ecf20Sopenharmony_ci#define MXCC_RMCOUNT 0x1C00300 /* Count of references and misses */ 168c2ecf20Sopenharmony_ci#define MXCC_STEST 0x1C00804 /* Internal self-test */ 178c2ecf20Sopenharmony_ci#define MXCC_CREG 0x1C00A04 /* Control register */ 188c2ecf20Sopenharmony_ci#define MXCC_SREG 0x1C00B00 /* Status register */ 198c2ecf20Sopenharmony_ci#define MXCC_RREG 0x1C00C04 /* Reset register */ 208c2ecf20Sopenharmony_ci#define MXCC_EREG 0x1C00E00 /* Error code register */ 218c2ecf20Sopenharmony_ci#define MXCC_PREG 0x1C00F04 /* Address port register */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci/* Some MXCC constants. */ 248c2ecf20Sopenharmony_ci#define MXCC_STREAM_SIZE 0x20 /* Size in bytes of one stream r/w */ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* The MXCC Control Register: 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * ---------------------------------------------------------------------- 298c2ecf20Sopenharmony_ci * | | RRC | RSV |PRE|MCE|PARE|ECE|RSV| 308c2ecf20Sopenharmony_ci * ---------------------------------------------------------------------- 318c2ecf20Sopenharmony_ci * 31 10 9 8-6 5 4 3 2 1-0 328c2ecf20Sopenharmony_ci * 338c2ecf20Sopenharmony_ci * RRC: Controls what you read from MXCC_RMCOUNT reg. 348c2ecf20Sopenharmony_ci * 0=Misses 1=References 358c2ecf20Sopenharmony_ci * PRE: Prefetch enable 368c2ecf20Sopenharmony_ci * MCE: Multiple Command Enable 378c2ecf20Sopenharmony_ci * PARE: Parity enable 388c2ecf20Sopenharmony_ci * ECE: External cache enable 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define MXCC_CTL_RRC 0x00000200 428c2ecf20Sopenharmony_ci#define MXCC_CTL_PRE 0x00000020 438c2ecf20Sopenharmony_ci#define MXCC_CTL_MCE 0x00000010 448c2ecf20Sopenharmony_ci#define MXCC_CTL_PARE 0x00000008 458c2ecf20Sopenharmony_ci#define MXCC_CTL_ECE 0x00000004 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* The MXCC Error Register: 488c2ecf20Sopenharmony_ci * 498c2ecf20Sopenharmony_ci * -------------------------------------------------------- 508c2ecf20Sopenharmony_ci * |ME| RSV|CE|PEW|PEE|ASE|EIV| MOPC|ECODE|PRIV|RSV|HPADDR| 518c2ecf20Sopenharmony_ci * -------------------------------------------------------- 528c2ecf20Sopenharmony_ci * 31 30 29 28 27 26 25 24-15 14-7 6 5-3 2-0 538c2ecf20Sopenharmony_ci * 548c2ecf20Sopenharmony_ci * ME: Multiple Errors have occurred 558c2ecf20Sopenharmony_ci * CE: Cache consistency Error 568c2ecf20Sopenharmony_ci * PEW: Parity Error during a Write operation 578c2ecf20Sopenharmony_ci * PEE: Parity Error involving the External cache 588c2ecf20Sopenharmony_ci * ASE: ASynchronous Error 598c2ecf20Sopenharmony_ci * EIV: This register is toast 608c2ecf20Sopenharmony_ci * MOPC: MXCC Operation Code for instance causing error 618c2ecf20Sopenharmony_ci * ECODE: The Error CODE 628c2ecf20Sopenharmony_ci * PRIV: A privileged mode error? 0=no 1=yes 638c2ecf20Sopenharmony_ci * HPADDR: High PhysicalADDRess bits (35-32) 648c2ecf20Sopenharmony_ci */ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define MXCC_ERR_ME 0x80000000 678c2ecf20Sopenharmony_ci#define MXCC_ERR_CE 0x20000000 688c2ecf20Sopenharmony_ci#define MXCC_ERR_PEW 0x10000000 698c2ecf20Sopenharmony_ci#define MXCC_ERR_PEE 0x08000000 708c2ecf20Sopenharmony_ci#define MXCC_ERR_ASE 0x04000000 718c2ecf20Sopenharmony_ci#define MXCC_ERR_EIV 0x02000000 728c2ecf20Sopenharmony_ci#define MXCC_ERR_MOPC 0x01FF8000 738c2ecf20Sopenharmony_ci#define MXCC_ERR_ECODE 0x00007F80 748c2ecf20Sopenharmony_ci#define MXCC_ERR_PRIV 0x00000040 758c2ecf20Sopenharmony_ci#define MXCC_ERR_HPADDR 0x0000000f 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* The MXCC Port register: 788c2ecf20Sopenharmony_ci * 798c2ecf20Sopenharmony_ci * ----------------------------------------------------- 808c2ecf20Sopenharmony_ci * | | MID | | 818c2ecf20Sopenharmony_ci * ----------------------------------------------------- 828c2ecf20Sopenharmony_ci * 31 21 20-18 17 0 838c2ecf20Sopenharmony_ci * 848c2ecf20Sopenharmony_ci * MID: The moduleID of the cpu your read this from. 858c2ecf20Sopenharmony_ci */ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_cistatic inline void mxcc_set_stream_src(unsigned long *paddr) 908c2ecf20Sopenharmony_ci{ 918c2ecf20Sopenharmony_ci unsigned long data0 = paddr[0]; 928c2ecf20Sopenharmony_ci unsigned long data1 = paddr[1]; 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t" 958c2ecf20Sopenharmony_ci "or %%g0, %1, %%g3\n\t" 968c2ecf20Sopenharmony_ci "stda %%g2, [%2] %3\n\t" : : 978c2ecf20Sopenharmony_ci "r" (data0), "r" (data1), 988c2ecf20Sopenharmony_ci "r" (MXCC_SRCSTREAM), 998c2ecf20Sopenharmony_ci "i" (ASI_M_MXCC) : "g2", "g3"); 1008c2ecf20Sopenharmony_ci} 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic inline void mxcc_set_stream_dst(unsigned long *paddr) 1038c2ecf20Sopenharmony_ci{ 1048c2ecf20Sopenharmony_ci unsigned long data0 = paddr[0]; 1058c2ecf20Sopenharmony_ci unsigned long data1 = paddr[1]; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci __asm__ __volatile__ ("or %%g0, %0, %%g2\n\t" 1088c2ecf20Sopenharmony_ci "or %%g0, %1, %%g3\n\t" 1098c2ecf20Sopenharmony_ci "stda %%g2, [%2] %3\n\t" : : 1108c2ecf20Sopenharmony_ci "r" (data0), "r" (data1), 1118c2ecf20Sopenharmony_ci "r" (MXCC_DESSTREAM), 1128c2ecf20Sopenharmony_ci "i" (ASI_M_MXCC) : "g2", "g3"); 1138c2ecf20Sopenharmony_ci} 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_cistatic inline unsigned long mxcc_get_creg(void) 1168c2ecf20Sopenharmony_ci{ 1178c2ecf20Sopenharmony_ci unsigned long mxcc_control; 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci __asm__ __volatile__("set 0xffffffff, %%g2\n\t" 1208c2ecf20Sopenharmony_ci "set 0xffffffff, %%g3\n\t" 1218c2ecf20Sopenharmony_ci "stda %%g2, [%1] %2\n\t" 1228c2ecf20Sopenharmony_ci "lda [%3] %2, %0\n\t" : 1238c2ecf20Sopenharmony_ci "=r" (mxcc_control) : 1248c2ecf20Sopenharmony_ci "r" (MXCC_EREG), "i" (ASI_M_MXCC), 1258c2ecf20Sopenharmony_ci "r" (MXCC_CREG) : "g2", "g3"); 1268c2ecf20Sopenharmony_ci return mxcc_control; 1278c2ecf20Sopenharmony_ci} 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistatic inline void mxcc_set_creg(unsigned long mxcc_control) 1308c2ecf20Sopenharmony_ci{ 1318c2ecf20Sopenharmony_ci __asm__ __volatile__("sta %0, [%1] %2\n\t" : : 1328c2ecf20Sopenharmony_ci "r" (mxcc_control), "r" (MXCC_CREG), 1338c2ecf20Sopenharmony_ci "i" (ASI_M_MXCC)); 1348c2ecf20Sopenharmony_ci} 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci#endif /* !(_SPARC_MXCC_H) */ 139