diff options
author | Patrick Rudolph <patrick.rudolph@9elements.com> | 2021-01-25 09:29:38 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-01-28 09:23:45 +0000 |
commit | 0bea950a479cc5b3b3bc8f362fc356ad43f9f892 (patch) | |
tree | 2d3e55b289a0b2d43f284f95cbd59b5111e3bb67 /src/cpu | |
parent | 27c9fcfc4857907132030b840ad7f21ca8269193 (diff) |
cpu/intel/microcode: Add caching layer in intel_microcode_find
Cache the found microcode for faster subsequent accesses.
Change-Id: Ic40d57964600f8f20ddb26c7d1691b043fd89f29
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/49896
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/intel/microcode/microcode.c | 7 |
1 files changed, 6 insertions, 1 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, µcode_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; } |