Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21009
Change subject: intel/common/sgx: Use data pointer of device_t to get microcode ......................................................................
intel/common/sgx: Use data pointer of device_t to get microcode
Get microcode patch pointer from device_t struct of CPU.
Change-Id: I9196c30ec7ea52d7184a96b33835def197e2c799 Signed-off-by: Pratik Prajapati pratikkumar.v.prajapati@intel.com --- M src/soc/intel/common/block/include/intelblocks/sgx.h M src/soc/intel/common/block/sgx/sgx.c 2 files changed, 12 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/21009/1
diff --git a/src/soc/intel/common/block/include/intelblocks/sgx.h b/src/soc/intel/common/block/include/intelblocks/sgx.h index cc2dc7f..9929f0f 100644 --- a/src/soc/intel/common/block/include/intelblocks/sgx.h +++ b/src/soc/intel/common/block/include/intelblocks/sgx.h @@ -25,7 +25,7 @@ /* * Configure SGX. */ -void sgx_configure(const void *microcode_patch); +void sgx_configure(void);
/* * Configure core PRMRR diff --git a/src/soc/intel/common/block/sgx/sgx.c b/src/soc/intel/common/block/sgx/sgx.c index 53a68cf..55cb272 100644 --- a/src/soc/intel/common/block/sgx/sgx.c +++ b/src/soc/intel/common/block/sgx/sgx.c @@ -13,6 +13,7 @@ * GNU General Public License for more details. */
+#include <assert.h> #include <console/console.h> #include <chip.h> #include <cpu/x86/msr.h> @@ -156,13 +157,20 @@ return 0; }
-void sgx_configure(const void *microcode_patch) +void sgx_configure(void) { - device_t dev = SA_DEV_ROOT; + device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER); + assert(dev != NULL); + config_t *conf = dev->chip_info;
if (!conf->sgx_enable || !is_sgx_supported() || !is_prmrr_set()) { printk(BIOS_ERR, "SGX: pre-conditions not met\n"); + return; + } + + if (!dev->data) { + printk(BIOS_ERR, "SGX: microcode not set in device struct\n"); return; }
@@ -177,7 +185,7 @@ cpu_lock_sgx_memory();
/* Reload the microcode patch */ - intel_microcode_load_unlocked(microcode_patch); + intel_microcode_load_unlocked(dev->data);
/* Lock the SGX feature */ lock_sgx();