2 * Copyright 2003-2011 Netlogic Microsystems (Netlogic). All rights
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * THIS SOFTWARE IS PROVIDED BY Netlogic Microsystems ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NETLOGIC OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26 * THE POSSIBILITY OF SUCH DAMAGE.
35 #include <mips/nlm/hal/mips-extns.h>
37 static __inline__ uint32_t
38 nlm_read_c0_config6(void)
42 __asm__ __volatile__ (
52 static __inline__ void
53 nlm_write_c0_config6(uint32_t value)
55 __asm__ __volatile__ (
63 static __inline__ uint32_t
64 nlm_read_c0_config7(void)
68 __asm__ __volatile__ (
78 static __inline__ void
79 nlm_write_c0_config7(uint32_t value)
81 __asm__ __volatile__ (
89 * On power on reset, XLP comes up with 64 TLBs.
90 * Large-variable-tlb's (ELVT) and extended TLB is disabled.
91 * Enabling large-variable-tlb's sets up the standard
92 * TLB size from 64 to 128 TLBs.
93 * Enabling fixed TLB (EFT) sets up an additional 2048 tlbs.
94 * ELVT + EFT = 128 + 2048 = 2176 TLB entries.
95 * threads 64-entry-standard-tlb 128-entry-standard-tlb
96 * per std-tlb-only| std+EFT | std-tlb-only| std+EFT
98 * --------------------------------------------------------
99 * 1 64 64+2048 128 128+2048
100 * 2 64 64+1024 64 64+1024
101 * 4 32 32+512 32 32+512
103 * 1(G) 64 64+2048 128 128+2048
104 * 2(G) 128 128+2048 128 128+2048
105 * 4(G) 128 128+2048 128 128+2048
113 static __inline__ void nlm_large_variable_tlb_en (int en)
117 val = nlm_read_c0_config6();
119 nlm_write_c0_config6(val);
126 static __inline__ void nlm_pagewalker_en(int en)
130 val = nlm_read_c0_config6();
132 nlm_write_c0_config6(val);
139 static __inline__ void nlm_extended_tlb_en(int en)
143 val = nlm_read_c0_config6();
145 nlm_write_c0_config6(val);
149 static __inline__ int nlm_get_num_combined_tlbs(void)
151 return (((nlm_read_c0_config6() >> 16) & 0xffff) + 1);
154 /* get number of variable TLB entries */
155 static __inline__ int nlm_get_num_vtlbs(void)
157 return (((nlm_read_c0_config6() >> 6) & 0x3ff) + 1);
160 static __inline__ void nlm_setup_extended_pagemask(int mask)
162 nlm_write_c0_config7(mask);