linux/arch/x86/kernel/cpu/microcode/intel.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Intel CPU Microcode Update Driver for Linux
 *
 * Copyright (C) 2000-2006 Tigran Aivazian <[email protected]>
 *		 2006 Shaohua Li <[email protected]>
 *
 * Intel CPU microcode early update for Linux
 *
 * Copyright (C) 2012 Fenghua Yu <[email protected]>
 *		      H Peter Anvin" <[email protected]>
 */
#define pr_fmt(fmt)
#include <linux/earlycpio.h>
#include <linux/firmware.h>
#include <linux/uaccess.h>
#include <linux/initrd.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/cpu.h>
#include <linux/uio.h>
#include <linux/mm.h>

#include <asm/cpu_device_id.h>
#include <asm/processor.h>
#include <asm/tlbflush.h>
#include <asm/setup.h>
#include <asm/msr.h>

#include "internal.h"

static const char ucode_path[] =;

#define UCODE_BSP_LOADED

/* Current microcode patch used in early patching on the APs. */
static struct microcode_intel *ucode_patch_va __read_mostly;
static struct microcode_intel *ucode_patch_late __read_mostly;

/* last level cache size per core */
static unsigned int llc_size_per_core __ro_after_init;

/* microcode format is extended from prescott processors */
struct extended_signature {};

struct extended_sigtable {};

#define DEFAULT_UCODE_TOTALSIZE
#define EXT_HEADER_SIZE
#define EXT_SIGNATURE_SIZE

static inline unsigned int get_totalsize(struct microcode_header_intel *hdr)
{}

static inline unsigned int exttable_size(struct extended_sigtable *et)
{}

void intel_collect_cpu_info(struct cpu_signature *sig)
{}
EXPORT_SYMBOL_GPL();

static inline bool cpu_signatures_match(struct cpu_signature *s1, unsigned int sig2,
					unsigned int pf2)
{}

bool intel_find_matching_signature(void *mc, struct cpu_signature *sig)
{}
EXPORT_SYMBOL_GPL();

/**
 * intel_microcode_sanity_check() - Sanity check microcode file.
 * @mc: Pointer to the microcode file contents.
 * @print_err: Display failure reason if true, silent if false.
 * @hdr_type: Type of file, i.e. normal microcode file or In Field Scan file.
 *            Validate if the microcode header type matches with the type
 *            specified here.
 *
 * Validate certain header fields and verify if computed checksum matches
 * with the one specified in the header.
 *
 * Return: 0 if the file passes all the checks, -EINVAL if any of the checks
 * fail.
 */
int intel_microcode_sanity_check(void *mc, bool print_err, int hdr_type)
{}
EXPORT_SYMBOL_GPL();

static void update_ucode_pointer(struct microcode_intel *mc)
{}

static void save_microcode_patch(struct microcode_intel *patch)
{}

/* Scan blob for microcode matching the boot CPUs family, model, stepping */
static __init struct microcode_intel *scan_microcode(void *data, size_t size,
						     struct ucode_cpu_info *uci,
						     bool save)
{}

static enum ucode_state __apply_microcode(struct ucode_cpu_info *uci,
					  struct microcode_intel *mc,
					  u32 *cur_rev)
{}

static enum ucode_state apply_microcode_early(struct ucode_cpu_info *uci)
{}

static __init bool load_builtin_intel_microcode(struct cpio_data *cp)
{}

static __init struct microcode_intel *get_microcode_blob(struct ucode_cpu_info *uci, bool save)
{}

/*
 * Invoked from an early init call to save the microcode blob which was
 * selected during early boot when mm was not usable. The microcode must be
 * saved because initrd is going away. It's an early init call so the APs
 * just can use the pointer and do not have to scan initrd/builtin firmware
 * again.
 */
static int __init save_builtin_microcode(void)
{}
early_initcall(save_builtin_microcode);

/* Load microcode on BSP from initrd or builtin blobs */
void __init load_ucode_intel_bsp(struct early_load_data *ed)
{}

void load_ucode_intel_ap(void)
{}

/* Reload microcode on resume */
void reload_ucode_intel(void)
{}

static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
{}

static enum ucode_state apply_microcode_late(int cpu)
{}

static bool ucode_validate_minrev(struct microcode_header_intel *mc_header)
{}

static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter)
{}

static bool is_blacklisted(unsigned int cpu)
{}

static enum ucode_state request_microcode_fw(int cpu, struct device *device)
{}

static void finalize_late_load(int result)
{}

static struct microcode_ops microcode_intel_ops =;

static __init void calc_llc_size_per_core(struct cpuinfo_x86 *c)
{}

struct microcode_ops * __init init_intel_microcode(void)
{}