diff options
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/arch/amd64/cpu/cpu_conf.c | 30 | ||||
-rw-r--r-- | src/sys/include/arch/amd64/mdcpu.h | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/sys/arch/amd64/cpu/cpu_conf.c b/src/sys/arch/amd64/cpu/cpu_conf.c index 16bd57d..f844cf7 100644 --- a/src/sys/arch/amd64/cpu/cpu_conf.c +++ b/src/sys/arch/amd64/cpu/cpu_conf.c @@ -132,6 +132,35 @@ cpu_vendor(struct mdcore *mdcore) } /* + * Acquire the CPU family ID - used by cpu_identify() + */ +static void +cpu_family(struct mdcore *mdcore) +{ + uint32_t eax, dmmy; + uint32_t family, ext_family; + + if (mdcore == NULL) { + return; + } + + CPUID(0x01, eax, dmmy, dmmy, dmmy); + + /* + * If the family ID is 15 then the actual result + * is the sum of the family ID and extended family + * ID. + */ + family = (eax >> 8) & 0xF; + if (family == 15) { + ext_family = (eax >> 20) & 0xFF; + family += ext_family; + } + + mdcore->family = family; +} + +/* * Identify the CPU via a CPUID */ static void @@ -142,6 +171,7 @@ cpu_identify(struct mdcore *mdcore) } cpu_vendor(mdcore); + cpu_family(mdcore); } void diff --git a/src/sys/include/arch/amd64/mdcpu.h b/src/sys/include/arch/amd64/mdcpu.h index 8701a61..a7336bd 100644 --- a/src/sys/include/arch/amd64/mdcpu.h +++ b/src/sys/include/arch/amd64/mdcpu.h @@ -53,6 +53,7 @@ * @apic_id: Local APIC ID * @cr3: CR3 register value (PML<n> phys) * @vendor: Processor vendor (CPU_VENDOR_*) + * @family: Processor family ID * @lapic_base: LAPIC register interface base * @x2apic: Has the x2APIC? Is 1 if true * @tss: Task state segment for this core @@ -64,6 +65,7 @@ struct mdcore { uint32_t apic_id; uint64_t cr3; uint8_t vendor; + uint32_t family; void *lapic_base; uint8_t x2apic : 1; struct tss_entry tss; |