2013-05-30 19:09:18 +00:00
|
|
|
#ifndef _ASM_X86_MICROCODE_AMD_H
|
|
|
|
#define _ASM_X86_MICROCODE_AMD_H
|
|
|
|
|
|
|
|
#include <asm/microcode.h>
|
|
|
|
|
|
|
|
#define UCODE_MAGIC 0x00414d44
|
|
|
|
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
|
|
|
|
#define UCODE_UCODE_TYPE 0x00000001
|
|
|
|
|
|
|
|
#define SECTION_HDR_SIZE 8
|
|
|
|
#define CONTAINER_HDR_SZ 12
|
|
|
|
|
|
|
|
struct equiv_cpu_entry {
|
|
|
|
u32 installed_cpu;
|
|
|
|
u32 fixed_errata_mask;
|
|
|
|
u32 fixed_errata_compare;
|
|
|
|
u16 equiv_cpu;
|
|
|
|
u16 res;
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct microcode_header_amd {
|
|
|
|
u32 data_code;
|
|
|
|
u32 patch_id;
|
|
|
|
u16 mc_patch_data_id;
|
|
|
|
u8 mc_patch_data_len;
|
|
|
|
u8 init_flag;
|
|
|
|
u32 mc_patch_data_checksum;
|
|
|
|
u32 nb_dev_id;
|
|
|
|
u32 sb_dev_id;
|
|
|
|
u16 processor_rev_id;
|
|
|
|
u8 nb_rev_id;
|
|
|
|
u8 sb_rev_id;
|
|
|
|
u8 bios_api_rev;
|
|
|
|
u8 reserved1[3];
|
|
|
|
u32 match_reg[8];
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
struct microcode_amd {
|
|
|
|
struct microcode_header_amd hdr;
|
|
|
|
unsigned int mpb[0];
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline u16 find_equiv_id(struct equiv_cpu_entry *equiv_cpu_table,
|
|
|
|
unsigned int sig)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (!equiv_cpu_table)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
while (equiv_cpu_table[i].installed_cpu != 0) {
|
|
|
|
if (sig == equiv_cpu_table[i].installed_cpu)
|
|
|
|
return equiv_cpu_table[i].equiv_cpu;
|
|
|
|
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern int __apply_microcode_amd(struct microcode_amd *mc_amd);
|
|
|
|
extern int apply_microcode_amd(int cpu);
|
2013-08-08 17:38:18 +00:00
|
|
|
extern enum ucode_state load_microcode_amd(u8 family, const u8 *data, size_t size);
|
2013-05-30 19:09:18 +00:00
|
|
|
|
2013-05-30 19:09:19 +00:00
|
|
|
#ifdef CONFIG_MICROCODE_AMD_EARLY
|
|
|
|
#ifdef CONFIG_X86_32
|
|
|
|
#define MPB_MAX_SIZE PAGE_SIZE
|
2013-05-31 06:53:24 +00:00
|
|
|
extern u8 amd_bsp_mpb[MPB_MAX_SIZE];
|
2013-05-30 19:09:19 +00:00
|
|
|
#endif
|
|
|
|
extern void __init load_ucode_amd_bsp(void);
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-18 22:23:59 +00:00
|
|
|
extern void load_ucode_amd_ap(void);
|
2013-05-30 19:09:19 +00:00
|
|
|
extern int __init save_microcode_in_initrd_amd(void);
|
|
|
|
#else
|
|
|
|
static inline void __init load_ucode_amd_bsp(void) {}
|
x86: delete __cpuinit usage from all x86 files
The __cpuinit type of throwaway sections might have made sense
some time ago when RAM was more constrained, but now the savings
do not offset the cost and complications. For example, the fix in
commit 5e427ec2d0 ("x86: Fix bit corruption at CPU resume time")
is a good example of the nasty type of bugs that can be created
with improper use of the various __init prefixes.
After a discussion on LKML[1] it was decided that cpuinit should go
the way of devinit and be phased out. Once all the users are gone,
we can then finally remove the macros themselves from linux/init.h.
Note that some harmless section mismatch warnings may result, since
notify_cpu_starting() and cpu_up() are arch independent (kernel/cpu.c)
are flagged as __cpuinit -- so if we remove the __cpuinit from
arch specific callers, we will also get section mismatch warnings.
As an intermediate step, we intend to turn the linux/init.h cpuinit
content into no-ops as early as possible, since that will get rid
of these warnings. In any case, they are temporary and harmless.
This removes all the arch/x86 uses of the __cpuinit macros from
all C files. x86 only had the one __CPUINIT used in assembly files,
and it wasn't paired off with a .previous or a __FINIT, so we can
delete it directly w/o any corresponding additional change there.
[1] https://lkml.org/lkml/2013/5/20/589
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2013-06-18 22:23:59 +00:00
|
|
|
static inline void load_ucode_amd_ap(void) {}
|
2013-05-30 19:09:19 +00:00
|
|
|
static inline int __init save_microcode_in_initrd_amd(void) { return -EINVAL; }
|
|
|
|
#endif
|
|
|
|
|
2013-05-30 19:09:18 +00:00
|
|
|
#endif /* _ASM_X86_MICROCODE_AMD_H */
|