函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
                         size_t size)
{
    u8 *fw = (u8 *)data;
    size_t offset;
 
    offset = install_equiv_cpu_table(data, size);
    if (!offset)
        return UCODE_ERROR;
 
    fw   += offset;
    size -= offset;
 
    if (*(u32 *)fw != UCODE_UCODE_TYPE) {
        pr_err("invalid type field in container file section header\n");
        free_equiv_cpu_table();
        return UCODE_ERROR;
    }
 
    while (size > 0) {
        unsigned int crnt_size = 0;
        int ret;
 
        ret = verify_and_add_patch(family, fw, size, &crnt_size);
        if (ret < 0)
            return UCODE_ERROR;
 
        fw   +=  crnt_size + SECTION_HDR_SIZE;
        size -= (crnt_size + SECTION_HDR_SIZE);
    }
 
    return UCODE_OK;
}