summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/intel/microcode/microcode.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c
index a4471ca042..15d6513b33 100644
--- a/src/cpu/intel/microcode/microcode.c
+++ b/src/cpu/intel/microcode/microcode.c
@@ -28,12 +28,16 @@
#include <cpu/x86/msr.h>
#include <cpu/intel/microcode.h>
-#if CONFIG_CPU_MICROCODE_IN_CBFS
#ifdef __PRE_RAM__
+#if CONFIG_CPU_MICROCODE_IN_CBFS
#include <arch/cbfs.h>
+#endif
#else
+#if CONFIG_CPU_MICROCODE_IN_CBFS
#include <cbfs.h>
#endif
+#include <smp/spinlock.h>
+DECLARE_SPIN_LOCK(microcode_lock)
#endif
struct microcode {
@@ -112,6 +116,9 @@ void intel_update_microcode(const void *microcode_updates)
printk(BIOS_DEBUG, "microcode: sig=0x%x pf=0x%x revision=0x%x\n",
sig, pf, rev);
#endif
+#if !defined(__ROMCC__) && !defined(__PRE_RAM__)
+ spin_lock(&microcode_lock);
+#endif
m = microcode_updates;
for(c = microcode_updates; m->hdrver; m = (const struct microcode *)c) {
@@ -142,6 +149,10 @@ void intel_update_microcode(const void *microcode_updates)
c += 2048;
}
}
+
+#if !defined(__ROMCC__) && !defined(__PRE_RAM__)
+ spin_unlock(&microcode_lock);
+#endif
}
#if CONFIG_CPU_MICROCODE_IN_CBFS