aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSiddha, Suresh B <suresh.b.siddha@intel.com>2005-10-30 17:59:30 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:11 -0500
commitd16aafff2570abb557a5cb18c98027aabd602e22 (patch)
treeb2ce02548c87f162cbae7071b0195505d355bbb1 /arch
parentd5cd4aadd3d220afac8e3e6d922e333592551f7d (diff)
[PATCH] intel_cacheinfo: remove MAX_CACHE_LEAVES limit
Initial internal version of Venki's cpuid(4) deterministic cache parameter identification patch used static arrays of size MAX_CACHE_LEAVES. Final patch which made to the base used dynamic array allocation, with this MAX_CACHE_LEAVES limit hunk still in place. cpuid(4) already has a mechanism to find out the number of cache levels implemented and there is no need for this hardcoded MAX_CACHE_LEAVES limit. So remove the MAX_CACHE_LEAVES limit from the routine which calculates the number of cache levels using cpuid(4) Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com> Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index 9e0d5f83cb9f..c802206274c2 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -117,7 +117,6 @@ struct _cpuid4_info {
117 cpumask_t shared_cpu_map; 117 cpumask_t shared_cpu_map;
118}; 118};
119 119
120#define MAX_CACHE_LEAVES 4
121static unsigned short num_cache_leaves; 120static unsigned short num_cache_leaves;
122 121
123static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) 122static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
@@ -144,20 +143,15 @@ static int __init find_num_cache_leaves(void)
144{ 143{
145 unsigned int eax, ebx, ecx, edx; 144 unsigned int eax, ebx, ecx, edx;
146 union _cpuid4_leaf_eax cache_eax; 145 union _cpuid4_leaf_eax cache_eax;
147 int i; 146 int i = -1;
148 int retval;
149 147
150 retval = MAX_CACHE_LEAVES; 148 do {
151 /* Do cpuid(4) loop to find out num_cache_leaves */ 149 ++i;
152 for (i = 0; i < MAX_CACHE_LEAVES; i++) { 150 /* Do cpuid(4) loop to find out num_cache_leaves */
153 cpuid_count(4, i, &eax, &ebx, &ecx, &edx); 151 cpuid_count(4, i, &eax, &ebx, &ecx, &edx);
154 cache_eax.full = eax; 152 cache_eax.full = eax;
155 if (cache_eax.split.type == CACHE_TYPE_NULL) { 153 } while (cache_eax.split.type != CACHE_TYPE_NULL);
156 retval = i; 154 return i;
157 break;
158 }
159 }
160 return retval;
161} 155}
162 156
163unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c) 157unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c)