函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:arch\x86\kernel\cpu\microcode\intel.c Create Date:2022-07-27 09:08:31
首页 Copyright©Brick

387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
static int collect_cpu_info_early(struct ucode_cpu_info *uci)
{
    unsigned int val[2];
    unsigned int family, model;
    struct cpu_signature csig = { 0 };
    unsigned int eax, ebx, ecx, edx;
 
    memset(uci, 0, sizeof(*uci));
 
    eax = 0x00000001;
    ecx = 0;
    native_cpuid(&eax, &ebx, &ecx, &edx);
    csig.sig = eax;
 
    family = x86_family(eax);
    model  = x86_model(eax);
 
    if ((model >= 5) || (family > 6)) {
        /* get processor flags from MSR 0x17 */
        native_rdmsr(MSR_IA32_PLATFORM_ID, val[0], val[1]);
        csig.pf = 1 << ((val[1] >> 18) & 7);
    }
 
    csig.rev = intel_get_microcode_revision();
 
    uci->cpu_sig = csig;
    uci->valid = 1;
 
    return 0;
}