Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\microcode\amd.c Create Date:2022-07-28 08:09:01
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Verify the patch in @buf.* Returns:* negative: on error* positive: patch is not for this family, skip it* 0: success

Proto:static int verify_patch(u8 family, const u8 *buf, size_t buf_size, unsigned int *patch_size, bool early)

Type:int

Parameter:

TypeParameterName
u8family
const u8 *buf
size_tbuf_size
unsigned int *patch_size
boolearly
244  If Not Check whether there is a valid, non-truncated microcode patch section at the* beginning of @buf of size @buf_size. Set @early to use this function in the* early path.* On success, @sh_psize returns the patch size according to the section header, Then Return -1
252  buf_size -= SECTION_HDR_SIZE
258  If buf_size < sh_psize Then
259  If Not early Then pr_debug("Patch of size %u truncated.\n", sh_psize)
262  Return -1
265  ret = Check whether the passed remaining file @buf_size is large enough to contain* a patch of the indicated @sh_psize (and also whether this size does not* exceed the per-family maximum). @sh_psize is the size read from the section* header.
266  If Not ret Then
267  If Not early Then pr_debug("Per-family patch size mismatch.\n")
269  Return -1
272  patch_size = sh_psize
274  mc_hdr = buf + SECTION_HDR_SIZE
275  If nb_dev_id || sb_dev_id Then
276  If Not early Then pr_err("Patch-ID 0x%08x: chipset-specific code unsupported.\n", patch_id)
278  Return -1
281  proc_id = processor_rev_id
282  patch_fam = 0xf + (proc_id >> 12)
283  If patch_fam != family Then Return 1
286  Return 0
Caller
NameDescribe
parse_containerThis scans the ucode blob for the proper container as we can have multiple* containers glued together. Returns the equivalence ID from the equivalence* table or 0 if none found.* Returns the amount of bytes consumed while scanning. @desc contains all the
verify_and_add_patchReturn a non-negative value even if some of the checks failed so that* we can skip over the next patch. If we return a negative value, we* signal a grave error like a memory allocation has failed and the* driver cannot continue functioning normally