diff options
author | Rizwan Qureshi <rizwan.qureshi@intel.com> | 2018-07-02 21:12:40 +0530 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2018-07-30 18:49:47 +0000 |
commit | 0d3915714c85d7ac22542848c19c53bec1ca2b42 (patch) | |
tree | 2f62bfecec761621dd67949b7ad8c2a5b3c2affb /src/cpu | |
parent | 2276d4f4a858da4a1cccc7cd8d870f0ac114efed (diff) |
cpu/intel/microcode: Add helper functions to get microcode info
Add 4 helper functions to get microcode info.
* get_current_microcode_rev
return the the version of the currently running microcode.
* get_microcode_rev
extract microcode revision from the given patch.
* get_microcode_size
extract microcode size from the given patch.
* get_microcode_checksum
extract checksum from the given patch.
The simpler thing would be to just move the struct microcode
to microcode.h so that the structure members can be dereferenced.
To encapsulate the structure details added the helper functions.
This information will be used in future to compare microcodes for update.
Change-Id: I67a08ba40b393874d8cc17363fefe21e2ea904f3
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/27365
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/intel/microcode/microcode.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index 272edb56b2..8cfcb95182 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -113,6 +113,26 @@ void intel_microcode_load_unlocked(const void *microcode_patch) #endif } +uint32_t get_current_microcode_rev(void) +{ + return read_microcode_rev(); +} + +uint32_t get_microcode_rev(const void *microcode) +{ + return ((struct microcode *)microcode)->rev; +} + +uint32_t get_microcode_size(const void *microcode) +{ + return ((struct microcode *)microcode)->total_size; +} + +uint32_t get_microcode_checksum(const void *microcode) +{ + return ((struct microcode *)microcode)->cksum; +} + const void *intel_microcode_find(void) { const struct microcode *ucode_updates; |