* AMD CPUs with TOPOEXT can just use CPUID(0x8000001d)
*/
+#define AMD_CPUID4_FULLY_ASSOCIATIVE 0xffff
+
union l1_cache {
struct {
unsigned line_size :8;
unsigned int val;
};
+/* L2/L3 associativity mapping */
static const unsigned short assocs[] = {
[1] = 1,
[2] = 2,
[0xc] = 64,
[0xd] = 96,
[0xe] = 128,
- [0xf] = 0xffff /* Fully associative */
+ [0xf] = AMD_CPUID4_FULLY_ASSOCIATIVE
};
static const unsigned char levels[] = { 1, 1, 2, 3 };
if (!l1->val)
return;
- assoc = assocs[l1->assoc];
+ assoc = (l1->assoc == 0xff) ? AMD_CPUID4_FULLY_ASSOCIATIVE : l1->assoc;
line_size = l1->line_size;
lines_per_tag = l1->lines_per_tag;
size_in_kb = l1->size_in_kb;
eax->split.num_threads_sharing = 0;
eax->split.num_cores_on_die = topology_num_cores_per_package();
- if (assoc == 0xffff)
+ if (assoc == AMD_CPUID4_FULLY_ASSOCIATIVE)
eax->split.is_fully_associative = 1;
ebx->split.coherency_line_size = line_size - 1;