summaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block
diff options
context:
space:
mode:
authorMichael Niewöhner <foss@mniewoehner.de>2019-10-08 12:00:24 +0200
committerNico Huber <nico.h@gmx.de>2019-10-10 14:06:09 +0000
commit6e66d7b8ebfd179f3fedd4ead05fe166d4e8e1fe (patch)
treef13d44396542f8edca7aa1fddd3118882faccd71 /src/soc/intel/common/block
parentedfe125bf9441fdfcfe37855ddcdc594d5e652aa (diff)
soc/intel: sgx: get rid of UEFI-style usage of global variable
Rework SGX enable status in a clean way without using a global variable. Change-Id: Ida6458eb46708df8fd238122aed41b57ca48c15b Signed-off-by: Michael Niewöhner <foss@mniewoehner.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35882 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'src/soc/intel/common/block')
-rw-r--r--src/soc/intel/common/block/include/intelblocks/sgx.h8
-rw-r--r--src/soc/intel/common/block/sgx/sgx.c33
2 files changed, 4 insertions, 37 deletions
diff --git a/src/soc/intel/common/block/include/intelblocks/sgx.h b/src/soc/intel/common/block/include/intelblocks/sgx.h
index 502483f7e9..693dd204e0 100644
--- a/src/soc/intel/common/block/include/intelblocks/sgx.h
+++ b/src/soc/intel/common/block/include/intelblocks/sgx.h
@@ -18,10 +18,6 @@
#include <soc/nvs.h>
-struct sgx_param {
- uint8_t enable;
-};
-
/*
* Lock SGX memory.
* CPU specific code needs to provide the implementation.
@@ -40,10 +36,6 @@ void prmrr_core_configure(void);
*/
void sgx_configure(void *unused);
-/* SOC specific API to get SGX params.
- * returns 0, if able to get SGX params; otherwise returns -1 */
-int soc_fill_sgx_param(struct sgx_param *sgx_param);
-
/* Fill GNVS data with SGX status, EPC base and length */
void sgx_fill_gnvs(global_nvs_t *gnvs);
diff --git a/src/soc/intel/common/block/sgx/sgx.c b/src/soc/intel/common/block/sgx/sgx.c
index 60714d9ce2..0edf50f09b 100644
--- a/src/soc/intel/common/block/sgx/sgx.c
+++ b/src/soc/intel/common/block/sgx/sgx.c
@@ -25,9 +25,6 @@
#include <soc/pci_devs.h>
#include <string.h>
-static bool sgx_param_valid;
-static struct sgx_param g_sgx_param;
-
static inline uint64_t sgx_resource(uint32_t low, uint32_t high)
{
uint64_t val;
@@ -36,28 +33,6 @@ static inline uint64_t sgx_resource(uint32_t low, uint32_t high)
return val;
}
-static const struct sgx_param *get_sgx_param(void)
-{
- if (sgx_param_valid)
- return &g_sgx_param;
-
- memset(&g_sgx_param, 0, sizeof(g_sgx_param));
- if (soc_fill_sgx_param(&g_sgx_param) < 0) {
- printk(BIOS_ERR, "SGX : Failed to get soc sgx param\n");
- return NULL;
- }
- sgx_param_valid = true;
- printk(BIOS_INFO, "SGX : param.enable = %d\n", g_sgx_param.enable);
-
- return &g_sgx_param;
-}
-
-static int soc_sgx_enabled(void)
-{
- const struct sgx_param *sgx_param = get_sgx_param();
- return sgx_param ? sgx_param->enable : 0;
-}
-
static int is_sgx_supported(void)
{
struct cpuid_result cpuid_regs;
@@ -79,7 +54,7 @@ void prmrr_core_configure(void)
} prmrr_base, prmrr_mask;
msr_t msr;
- if (!soc_sgx_enabled() || !is_sgx_supported())
+ if (!is_sgx_supported())
return;
msr = rdmsr(MSR_PRMRR_PHYS_MASK);
@@ -204,7 +179,7 @@ void sgx_configure(void *unused)
{
const void *microcode_patch = intel_mp_current_microcode();
- if (!soc_sgx_enabled() || !is_sgx_supported() || !is_prmrr_set()) {
+ if (!is_sgx_supported() || !is_prmrr_set()) {
printk(BIOS_ERR, "SGX: pre-conditions not met\n");
return;
}
@@ -234,9 +209,9 @@ void sgx_fill_gnvs(global_nvs_t *gnvs)
{
struct cpuid_result cpuid_regs;
- if (!soc_sgx_enabled() || !is_sgx_supported()) {
+ if (!is_sgx_supported()) {
printk(BIOS_DEBUG,
- "SGX: not enabled or not supported. skip gnvs fill\n");
+ "SGX: not supported. skip gnvs fill\n");
return;
}