Rizwan Qureshi has uploaded this change for review. ( https://review.coreboot.org/27365
Change subject: cpu/intel/microcode:[WIP] Add helper functions ......................................................................
cpu/intel/microcode:[WIP] Add helper functions
Add 4 helper functions: * 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.
Change-Id: I67a08ba40b393874d8cc17363fefe21e2ea904f3 Signed-off-by: Rizwan Qureshi rizwan.qureshi@intel.com --- M src/cpu/intel/microcode/microcode.c M src/include/cpu/intel/microcode.h 2 files changed, 29 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/27365/1
diff --git a/src/cpu/intel/microcode/microcode.c b/src/cpu/intel/microcode/microcode.c index 272edb5..8cfcb95 100644 --- a/src/cpu/intel/microcode/microcode.c +++ b/src/cpu/intel/microcode/microcode.c @@ -113,6 +113,26 @@ #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; diff --git a/src/include/cpu/intel/microcode.h b/src/include/cpu/intel/microcode.h index 0783ace..9170c02 100644 --- a/src/include/cpu/intel/microcode.h +++ b/src/include/cpu/intel/microcode.h @@ -31,4 +31,13 @@ * required, will skip microcode update if true. */ int soc_skip_ucode_update(u32 currrent_patch_id, u32 new_patch_id);
+/* return the the version of the currently running microcode */ +uint32_t get_current_microcode_rev(void); + +/* extract microcode revision from the given patch */ +uint32_t get_microcode_rev(const void *microcode); +/* extract microcode size from the given patch */ +uint32_t get_microcode_size(const void *microcode); +/* extract checksum from the given patch */ +uint32_t get_microcode_checksum(const void *microcode); #endif