From 8ee72dcc8ac311420261c24ba15d81c36dd9f507 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 19 Apr 2026 15:19:40 -0400 Subject: [PATCH] sp1/amd64: cpu: Obtain processor vendor information Signed-off-by: Ian Moffett --- usr/src/sp1/amd64/cpu/cpu_init.c | 43 +++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/usr/src/sp1/amd64/cpu/cpu_init.c b/usr/src/sp1/amd64/cpu/cpu_init.c index 8fa6b68..8ab8644 100644 --- a/usr/src/sp1/amd64/cpu/cpu_init.c +++ b/usr/src/sp1/amd64/cpu/cpu_init.c @@ -36,12 +36,48 @@ cpu_print_info(struct cpu_info *ci) } mcb = &ci->mcb; - pr_trace("pg.nx : yes\n"); - pr_trace("cpu.model : %x\n", mcb->model_id); - pr_trace("cpu.family : %x\n", mcb->family_id); + pr_trace("pg.nx : yes\n"); + pr_trace("cpu.model : %x\n", mcb->model_id); + pr_trace("cpu.family : %x\n", mcb->family_id); once = true; } +/* + * Obtain the processor vendor + */ +static void +cpu_get_vendor(void) +{ + uint32_t ebx, edx, ecx, unused; + char vendor[13]; + + /* Obtain the manufacturer ID */ + __cpuid(0x0, unused, ebx, ecx, edx); + + /* Dword 0 */ + vendor[0] = ebx & 0xFF; + vendor[1] = (ebx >> 8) & 0xFF; + vendor[2] = (ebx >> 16) & 0xFF; + vendor[3] = (ebx >> 24) & 0xFF; + + /* Dword 1 */ + vendor[4] = edx & 0xFF; + vendor[5] = (edx >> 8) & 0xFF; + vendor[6] = (edx >> 16) & 0xFF; + vendor[7] = (edx >> 24) & 0xFF; + + /* Dword 1 */ + vendor[8] = ecx & 0xFF; + vendor[9] = (ecx >> 8) & 0xFF; + vendor[10] = (ecx >> 16) & 0xFF; + vendor[11] = (ecx >> 24) & 0xFF; + vendor[12] = '\0'; + pr_trace("cpu.manufacturer : %s\n", vendor); +} + +/* + * Obtain processor specific information + */ static void cpu_get_info(struct cpu_info *ci) { @@ -55,6 +91,7 @@ cpu_get_info(struct cpu_info *ci) } mcb = &ci->mcb; + cpu_get_vendor(); /* Get processor info and feature bits */ __cpuid(0x01, eax, unused, unused, unused);