| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #ifndef __CPU__INTEL__MICROCODE__ |
| 3 | #define __CPU__INTEL__MICROCODE__ |
| 4 | |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | /* Find the microcode and reload the microcode if SoC has RELOAD_MICROCODE_PATCH |
| 8 | * config selected. */ |
| 9 | void intel_reload_microcode(void); |
| 10 | |
| 11 | void intel_update_microcode_from_cbfs(void); |
| 12 | /* Find a microcode that matches the revision and platform family returning |
| 13 | * NULL if none found. The found microcode is cached for faster access on |
| 14 | * subsequent calls of this function. |
| 15 | * |
| 16 | * Since this function caches the found microcode (NULL or a valid microcode |
| 17 | * pointer), it is expected to be run from BSP before starting any other APs. |
| 18 | * It is not multithread safe otherwise. */ |
| 19 | const void *intel_microcode_find(void); |
| 20 | |
| 21 | /* It is up to the caller to determine if parallel loading is possible as |
| 22 | * well as ensuring the microcode matches the family and revision (i.e. with |
| 23 | * intel_microcode_find()). */ |
| 24 | void intel_microcode_load_unlocked(const void *microcode_patch); |
| 25 | |
| 26 | /* SoC specific check to determine if microcode update is really |
| 27 | * required, will skip microcode update if true. */ |
| 28 | int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id); |
| 29 | |
| 30 | /* return the version of the currently running microcode */ |
| 31 | uint32_t get_current_microcode_rev(void); |
| 32 | |
| 33 | /* extract microcode revision from the given patch */ |
| 34 | uint32_t get_microcode_rev(const void *microcode); |
| 35 | /* extract microcode size from the given patch */ |
| 36 | uint32_t get_microcode_size(const void *microcode); |
| 37 | /* extract checksum from the given patch */ |
| 38 | uint32_t get_microcode_checksum(const void *microcode); |
| 39 | #endif |