}
const struct cpu_dev amd_cpu_dev = {
- .c_vendor = "AMD",
.c_early_init = early_init_amd,
.c_init = init_amd,
};
}
const struct cpu_dev centaur_cpu_dev = {
- .c_vendor = "Centaur",
.c_init = init_centaur,
};
static const struct cpu_dev default_cpu = {
.c_init = default_init,
- .c_vendor = "Unknown",
};
static const struct cpu_dev *this_cpu = &default_cpu;
printk(XENLOG_INFO
"CPU Vendor: %s, Family %u (%#x), Model %u (%#x), Stepping %u (raw %08x)\n",
- this_cpu->c_vendor, c->x86, c->x86,
+ x86_cpuid_vendor_to_str(c->x86_vendor), c->x86, c->x86,
c->x86_model, c->x86_model, c->x86_mask, eax);
eax = cpuid_eax(0x80000000);
printk("CPU%u: ", cpu);
- if (c->x86_vendor < X86_VENDOR_NUM)
- vendor = this_cpu->c_vendor;
- else
- vendor = c->x86_vendor_id;
-
- if (vendor && strncmp(c->x86_model_id, vendor, strlen(vendor)))
+ vendor = x86_cpuid_vendor_to_str(c->x86_vendor);
+ if (strncmp(c->x86_model_id, vendor, strlen(vendor)))
printk("%s ", vendor);
if (!c->x86_model_id[0])
/* attempt to consolidate cpu attributes */
struct cpu_dev {
- char c_vendor[8];
-
void (*c_early_init)(struct cpuinfo_x86 *c);
void (*c_init)(struct cpuinfo_x86 * c);
};
}
const struct cpu_dev intel_cpu_dev = {
- .c_vendor = "Intel",
.c_early_init = early_init_intel,
.c_init = init_intel,
};
}
const struct cpu_dev shanghai_cpu_dev = {
- .c_vendor = " Shang",
.c_init = init_shanghai,
};
#define X86_VENDOR_SHANGHAI_ECX 0x20206961U
#define X86_VENDOR_SHANGHAI_EDX 0x68676e61U
-#define X86_VENDOR_NUM 5
-
#endif /* __XEN_X86_VENDORS_H__ */
*/
unsigned int x86_cpuid_lookup_vendor(uint32_t ebx, uint32_t ecx, uint32_t edx);
+/**
+ * Given Xen's internal vendor ID, return a string suitable for printing.
+ * Returns "Unknown" for any unrecognised ID.
+ */
+const char *x86_cpuid_vendor_to_str(unsigned int vendor);
+
#define CPUID_GUEST_NR_BASIC (0xdu + 1)
#define CPUID_GUEST_NR_CACHE (5u + 1)
#define CPUID_GUEST_NR_FEAT (0u + 1)
return X86_VENDOR_UNKNOWN;
}
+const char *x86_cpuid_vendor_to_str(unsigned int vendor)
+{
+ switch ( vendor )
+ {
+ case X86_VENDOR_INTEL: return "Intel";
+ case X86_VENDOR_AMD: return "AMD";
+ case X86_VENDOR_CENTAUR: return "Centaur";
+ case X86_VENDOR_SHANGHAI: return "Shanghai";
+ default: return "Unknown";
+ }
+}
+
/* Recalculate the content in a CPUID policy which is derived from raw data. */
static void recalculate_synth(struct cpuid_policy *p)
{