aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpu/intel/microcode/microcode.c7
-rw-r--r--src/include/cpu/intel/microcode.h4
2 files changed, 9 insertions, 2 deletions
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c
index 0f362d4b35..9d6d28b3e6 100644
--- a/src/cpu/intel/microcode/microcode.c
+++ b/src/cpu/intel/microcode/microcode.c
@@ -119,13 +119,16 @@ uint32_t get_microcode_checksum(const void *microcode)
const void *intel_microcode_find(void)
{
- const struct microcode *ucode_updates;
+ static const struct microcode *ucode_updates;
size_t microcode_len;
u32 eax;
u32 pf, rev, sig, update_size;
unsigned int x86_model, x86_family;
msr_t msr;
+ if (ucode_updates)
+ return ucode_updates;
+
ucode_updates = cbfs_map(MICROCODE_CBFS_FILE, &microcode_len);
if (ucode_updates == NULL)
return NULL;
@@ -173,6 +176,8 @@ const void *intel_microcode_find(void)
microcode_len -= update_size;
}
+ ucode_updates = NULL;
+
return NULL;
}
diff --git a/src/include/cpu/intel/microcode.h b/src/include/cpu/intel/microcode.h
index f1a8601258..7fd6eac286 100644
--- a/src/include/cpu/intel/microcode.h
+++ b/src/include/cpu/intel/microcode.h
@@ -6,8 +6,10 @@
void intel_update_microcode_from_cbfs(void);
/* Find a microcode that matches the revision and platform family returning
- * NULL if none found. */
+ * NULL if none found. The found microcode is cached for faster access on
+ * subsequent calls of this function. */
const void *intel_microcode_find(void);
+
/* It is up to the caller to determine if parallel loading is possible as
* well as ensuring the microcode matches the family and revision (i.e. with
* intel_microcode_find()). */