@@ -91,12 +91,9 @@ static inline enum cache_type get_cache_type(struct cache_info *ci, int level)
9191{
9292 if (level >= CACHE_MAX_LEVEL )
9393 return CACHE_TYPE_NOCACHE ;
94-
9594 ci += level ;
96-
9795 if (ci -> scope != CACHE_SCOPE_SHARED && ci -> scope != CACHE_SCOPE_PRIVATE )
9896 return CACHE_TYPE_NOCACHE ;
99-
10097 return cache_type_map [ci -> type ];
10198}
10299
@@ -119,14 +116,11 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, int private,
119116 ti = CACHE_TI_INSTRUCTION ;
120117 else
121118 ti = CACHE_TI_UNIFIED ;
122-
123119 this_leaf -> level = level + 1 ;
124120 this_leaf -> type = type ;
125121 this_leaf -> coherency_line_size = ecag (EXTRACT_LINE_SIZE , level , ti );
126- this_leaf -> ways_of_associativity = ecag (EXTRACT_ASSOCIATIVITY ,
127- level , ti );
122+ this_leaf -> ways_of_associativity = ecag (EXTRACT_ASSOCIATIVITY , level , ti );
128123 this_leaf -> size = ecag (EXTRACT_SIZE , level , ti );
129-
130124 num_sets = this_leaf -> size / this_leaf -> coherency_line_size ;
131125 num_sets /= this_leaf -> ways_of_associativity ;
132126 this_leaf -> number_of_sets = num_sets ;
@@ -144,7 +138,6 @@ int init_cache_level(unsigned int cpu)
144138
145139 if (!this_cpu_ci )
146140 return - EINVAL ;
147-
148141 ct .raw = ecag (EXTRACT_TOPOLOGY , 0 , 0 );
149142 do {
150143 ctype = get_cache_type (& ct .ci [0 ], level );
@@ -153,27 +146,24 @@ int init_cache_level(unsigned int cpu)
153146 /* Separate instruction and data caches */
154147 leaves += (ctype == CACHE_TYPE_SEPARATE ) ? 2 : 1 ;
155148 } while (++ level < CACHE_MAX_LEVEL );
156-
157149 this_cpu_ci -> num_levels = level ;
158150 this_cpu_ci -> num_leaves = leaves ;
159-
160151 return 0 ;
161152}
162153
163154int populate_cache_leaves (unsigned int cpu )
164155{
156+ struct cpu_cacheinfo * this_cpu_ci = get_cpu_cacheinfo (cpu );
157+ struct cacheinfo * this_leaf = this_cpu_ci -> info_list ;
165158 unsigned int level , idx , pvt ;
166159 union cache_topology ct ;
167160 enum cache_type ctype ;
168- struct cpu_cacheinfo * this_cpu_ci = get_cpu_cacheinfo (cpu );
169- struct cacheinfo * this_leaf = this_cpu_ci -> info_list ;
170161
171162 ct .raw = ecag (EXTRACT_TOPOLOGY , 0 , 0 );
172163 for (idx = 0 , level = 0 ; level < this_cpu_ci -> num_levels &&
173164 idx < this_cpu_ci -> num_leaves ; idx ++ , level ++ ) {
174165 if (!this_leaf )
175166 return - EINVAL ;
176-
177167 pvt = (ct .ci [level ].scope == CACHE_SCOPE_PRIVATE ) ? 1 : 0 ;
178168 ctype = get_cache_type (& ct .ci [0 ], level );
179169 if (ctype == CACHE_TYPE_SEPARATE ) {
0 commit comments