mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-17 14:05:52 +00:00

Rename get_datasize() to intel_microcode_get_datasize() and make it an inline. [ tglx: Make the argument typed and fix up the IFS code ] Suggested-by: Boris Petkov <bp@alien8.de> Signed-off-by: Ashok Raj <ashok.raj@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20230812195727.894165745@linutronix.de
63 lines
1.7 KiB
C
63 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_X86_MICROCODE_INTEL_H
|
|
#define _ASM_X86_MICROCODE_INTEL_H
|
|
|
|
struct microcode_header_intel {
|
|
unsigned int hdrver;
|
|
unsigned int rev;
|
|
unsigned int date;
|
|
unsigned int sig;
|
|
unsigned int cksum;
|
|
unsigned int ldrver;
|
|
unsigned int pf;
|
|
unsigned int datasize;
|
|
unsigned int totalsize;
|
|
unsigned int metasize;
|
|
unsigned int reserved[2];
|
|
};
|
|
|
|
struct microcode_intel {
|
|
struct microcode_header_intel hdr;
|
|
unsigned int bits[];
|
|
};
|
|
|
|
#define MC_HEADER_SIZE (sizeof(struct microcode_header_intel))
|
|
#define MC_HEADER_TYPE_MICROCODE 1
|
|
#define MC_HEADER_TYPE_IFS 2
|
|
#define DEFAULT_UCODE_DATASIZE (2000)
|
|
|
|
static inline int intel_microcode_get_datasize(struct microcode_header_intel *hdr)
|
|
{
|
|
return hdr->datasize ? : DEFAULT_UCODE_DATASIZE;
|
|
}
|
|
|
|
static inline u32 intel_get_microcode_revision(void)
|
|
{
|
|
u32 rev, dummy;
|
|
|
|
native_wrmsrl(MSR_IA32_UCODE_REV, 0);
|
|
|
|
/* As documented in the SDM: Do a CPUID 1 here */
|
|
native_cpuid_eax(1);
|
|
|
|
/* get the current revision from MSR 0x8B */
|
|
native_rdmsr(MSR_IA32_UCODE_REV, dummy, rev);
|
|
|
|
return rev;
|
|
}
|
|
|
|
#ifdef CONFIG_CPU_SUP_INTEL
|
|
extern void __init load_ucode_intel_bsp(void);
|
|
extern void load_ucode_intel_ap(void);
|
|
extern void show_ucode_info_early(void);
|
|
extern int __init save_microcode_in_initrd_intel(void);
|
|
void reload_ucode_intel(void);
|
|
#else
|
|
static inline __init void load_ucode_intel_bsp(void) {}
|
|
static inline void load_ucode_intel_ap(void) {}
|
|
static inline void show_ucode_info_early(void) {}
|
|
static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; }
|
|
static inline void reload_ucode_intel(void) {}
|
|
#endif
|
|
|
|
#endif /* _ASM_X86_MICROCODE_INTEL_H */
|