Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* swift.h: Specific definitions for the _broken_ Swift SRMMU
0003  *          MMU module.
0004  *
0005  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
0006  */
0007 
0008 #ifndef _SPARC_SWIFT_H
0009 #define _SPARC_SWIFT_H
0010 
0011 /* Swift is so brain damaged, here is the mmu control register. */
0012 #define SWIFT_ST       0x00800000   /* SW tablewalk enable */
0013 #define SWIFT_WP       0x00400000   /* Watchpoint enable   */
0014 
0015 /* Branch folding (buggy, disable on production systems!)  */
0016 #define SWIFT_BF       0x00200000
0017 #define SWIFT_PMC      0x00180000   /* Page mode control   */
0018 #define SWIFT_PE       0x00040000   /* Parity enable       */
0019 #define SWIFT_PC       0x00020000   /* Parity control      */
0020 #define SWIFT_AP       0x00010000   /* Graphics page mode control (TCX/SX) */
0021 #define SWIFT_AC       0x00008000   /* Alternate Cacheability (see viking.h) */
0022 #define SWIFT_BM       0x00004000   /* Boot mode */
0023 #define SWIFT_RC       0x00003c00   /* DRAM refresh control */
0024 #define SWIFT_IE       0x00000200   /* Instruction cache enable */
0025 #define SWIFT_DE       0x00000100   /* Data cache enable */
0026 #define SWIFT_SA       0x00000080   /* Store Allocate */
0027 #define SWIFT_NF       0x00000002   /* No fault mode */
0028 #define SWIFT_EN       0x00000001   /* MMU enable */
0029 
0030 /* Bits [13:5] select one of 512 instruction cache tags */
0031 static inline void swift_inv_insn_tag(unsigned long addr)
0032 {
0033     __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
0034                  : /* no outputs */
0035                  : "r" (addr), "i" (ASI_M_TXTC_TAG)
0036                  : "memory");
0037 }
0038 
0039 /* Bits [12:4] select one of 512 data cache tags */
0040 static inline void swift_inv_data_tag(unsigned long addr)
0041 {
0042     __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
0043                  : /* no outputs */
0044                  : "r" (addr), "i" (ASI_M_DATAC_TAG)
0045                  : "memory");
0046 }
0047 
0048 static inline void swift_flush_dcache(void)
0049 {
0050     unsigned long addr;
0051 
0052     for (addr = 0; addr < 0x2000; addr += 0x10)
0053         swift_inv_data_tag(addr);
0054 }
0055 
0056 static inline void swift_flush_icache(void)
0057 {
0058     unsigned long addr;
0059 
0060     for (addr = 0; addr < 0x4000; addr += 0x20)
0061         swift_inv_insn_tag(addr);
0062 }
0063 
0064 static inline void swift_idflash_clear(void)
0065 {
0066     unsigned long addr;
0067 
0068     for (addr = 0; addr < 0x2000; addr += 0x10) {
0069         swift_inv_insn_tag(addr<<1);
0070         swift_inv_data_tag(addr);
0071     }
0072 }
0073 
0074 /* Swift is so broken, it isn't even safe to use the following. */
0075 static inline void swift_flush_page(unsigned long page)
0076 {
0077     __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
0078                  : /* no outputs */
0079                  : "r" (page), "i" (ASI_M_FLUSH_PAGE)
0080                  : "memory");
0081 }
0082 
0083 static inline void swift_flush_segment(unsigned long addr)
0084 {
0085     __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
0086                  : /* no outputs */
0087                  : "r" (addr), "i" (ASI_M_FLUSH_SEG)
0088                  : "memory");
0089 }
0090 
0091 static inline void swift_flush_region(unsigned long addr)
0092 {
0093     __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
0094                  : /* no outputs */
0095                  : "r" (addr), "i" (ASI_M_FLUSH_REGION)
0096                  : "memory");
0097 }
0098 
0099 static inline void swift_flush_context(void)
0100 {
0101     __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
0102                  : /* no outputs */
0103                  : "i" (ASI_M_FLUSH_CTX)
0104                  : "memory");
0105 }
0106 
0107 #endif /* !(_SPARC_SWIFT_H) */