diff options
author | Julius Werner <jwerner@chromium.org> | 2021-04-12 17:23:55 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2021-04-14 01:03:33 +0000 |
commit | 62fa9f3cf940f447e5b103aa31d95ea7dc257bb9 (patch) | |
tree | 145dd5e8a79cf2bfe582e171b5eda0cd5e23565a /src | |
parent | 43c9d709c75813276f166da8b6bc7bc220e5288d (diff) |
intel: mma: Use new CBFS API
This patch changes the Intel MMA driver to use the new CBFS API.
Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: Icc11d0c2a9ec1bd7a1d6af362f849dac16375433
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52282
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/drivers/intel/fsp2_0/mma_core.c | 2 | ||||
-rw-r--r-- | src/soc/intel/common/mma.c | 42 | ||||
-rw-r--r-- | src/soc/intel/common/mma.h | 13 | ||||
-rw-r--r-- | src/soc/intel/skylake/romstage/fsp_params.c | 12 |
4 files changed, 24 insertions, 45 deletions
diff --git a/src/drivers/intel/fsp2_0/mma_core.c b/src/drivers/intel/fsp2_0/mma_core.c index c19b299011..f71be7a83d 100644 --- a/src/drivers/intel/fsp2_0/mma_core.c +++ b/src/drivers/intel/fsp2_0/mma_core.c @@ -23,7 +23,7 @@ void setup_mma(FSP_M_CONFIG *memory_cfg) { struct mma_config_param mma_cfg; - if (mma_locate_param(&mma_cfg)) { + if (mma_map_param(&mma_cfg)) { printk(BIOS_DEBUG, "MMA: set up failed\n"); return; } diff --git a/src/soc/intel/common/mma.c b/src/soc/intel/common/mma.c index e015567a69..04d766dc81 100644 --- a/src/soc/intel/common/mma.c +++ b/src/soc/intel/common/mma.c @@ -14,7 +14,6 @@ #define TEST_PARAM_MAX_SIZE 100 #define MMA_DATA_SIGNATURE (('M' << 0) | ('M' << 8) | \ ('A' << 16) | ('D' << 24)) -#define MMA_CBFS_REGION "COREBOOT" struct mma_data_container { uint32_t mma_signature; /* "MMAD" */ @@ -99,31 +98,20 @@ static int label_value(const char *haystack, size_t haystack_sz, return 0; } -int mma_locate_param(struct mma_config_param *mma_cfg) +int mma_map_param(struct mma_config_param *mma_cfg) { void *mma_test_metadata; size_t mma_test_metadata_file_len; char test_filename[TEST_NAME_MAX_SIZE], test_param_filename[TEST_PARAM_MAX_SIZE]; - struct cbfsf metadata_fh, test_content_fh, test_param_fh; - uint32_t mma_type = CBFS_TYPE_MMA; - uint32_t efi_type = CBFS_TYPE_EFI; bool metadata_parse_flag = true; printk(BIOS_DEBUG, "MMA: Entry %s\n", __func__); - if (cbfs_locate_file_in_region(&metadata_fh, MMA_CBFS_REGION, - MMA_TEST_METADATA_FILENAME)) { - printk(BIOS_DEBUG, "MMA: Failed to locate %s\n", - MMA_TEST_METADATA_FILENAME); - return -1; - } - - mma_test_metadata = rdev_mmap_full(&metadata_fh.data); - mma_test_metadata_file_len = region_device_sz(&metadata_fh.data); - - if (!mma_test_metadata || !mma_test_metadata_file_len) { - printk(BIOS_DEBUG, "MMA: Failed to read %s\n", + mma_test_metadata = cbfs_ro_map(MMA_TEST_METADATA_FILENAME, + &mma_test_metadata_file_len); + if (!mma_test_metadata) { + printk(BIOS_DEBUG, "MMA: Failed to map %s\n", MMA_TEST_METADATA_FILENAME); return -1; } @@ -145,7 +133,7 @@ int mma_locate_param(struct mma_config_param *mma_cfg) metadata_parse_flag = false; } - rdev_munmap(&metadata_fh.data, mma_test_metadata); + cbfs_unmap(mma_test_metadata); if (!metadata_parse_flag) return -1; @@ -153,24 +141,18 @@ int mma_locate_param(struct mma_config_param *mma_cfg) printk(BIOS_DEBUG, "MMA: Got MMA_TEST_NAME=%s MMA_TEST_PARAM=%s\n", test_filename, test_param_filename); - if (cbfs_locate_file_in_region(&test_content_fh, MMA_CBFS_REGION, - test_filename)) { - printk(BIOS_DEBUG, "MMA: Failed to locate %s\n", - test_filename); + mma_cfg->test_content = cbfs_ro_map(test_filename, &mma_cfg->test_content_size); + if (!mma_cfg->test_content) { + printk(BIOS_DEBUG, "MMA: Failed to map %s\n", test_filename); return -1; } - cbfs_file_data(&mma_cfg->test_content, &test_content_fh); - - if (cbfs_locate_file_in_region(&test_param_fh, MMA_CBFS_REGION, - test_param_filename)) { - printk(BIOS_DEBUG, "MMA: Failed to locate %s\n", - test_param_filename); + mma_cfg->test_param = cbfs_ro_map(test_param_filename, &mma_cfg->test_param_size); + if (!mma_cfg->test_param) { + printk(BIOS_DEBUG, "MMA: Failed to map %s\n", test_param); return -1; } - cbfs_file_data(&mma_cfg->test_param, &test_param_fh); - printk(BIOS_DEBUG, "MMA: %s exit success\n", __func__); return 0; diff --git a/src/soc/intel/common/mma.h b/src/soc/intel/common/mma.h index e58edaf518..47313401cb 100644 --- a/src/soc/intel/common/mma.h +++ b/src/soc/intel/common/mma.h @@ -3,18 +3,19 @@ #ifndef _SOC_MMA_H_ #define _SOC_MMA_H_ -#include <commonlib/region.h> +#include <types.h> struct mma_config_param { - struct region_device test_content; - struct region_device test_param; + void *test_content; + size_t test_content_size; + void *test_param; + size_t test_param_size; }; -/* Locate mma metadata in CBFS, parse, find and fill rdev for - * mma test content and test param. +/* Locate mma metadata in CBFS, parse, find and map mma test content and test param. * Returns 0 on success, < 0 on failure. */ -int mma_locate_param(struct mma_config_param *mma_cfg); +int mma_map_param(struct mma_config_param *mma_cfg); /* Locate the MMA hob from the FSP Hob list, This is implemented * specific to FSP version. * Returns 0 on success, < 0 on failure. diff --git a/src/soc/intel/skylake/romstage/fsp_params.c b/src/soc/intel/skylake/romstage/fsp_params.c index 6c6e2e62c5..294bf447ab 100644 --- a/src/soc/intel/skylake/romstage/fsp_params.c +++ b/src/soc/intel/skylake/romstage/fsp_params.c @@ -176,14 +176,10 @@ void soc_update_memory_params_for_mma(FSP_M_CONFIG *memory_cfg, /* Boot media is memory mapped for Skylake and Kabylake (SPI). */ assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED)); - memory_cfg->MmaTestContentPtr = - (uintptr_t) rdev_mmap_full(&mma_cfg->test_content); - memory_cfg->MmaTestContentSize = - region_device_sz(&mma_cfg->test_content); - memory_cfg->MmaTestConfigPtr = - (uintptr_t) rdev_mmap_full(&mma_cfg->test_param); - memory_cfg->MmaTestConfigSize = - region_device_sz(&mma_cfg->test_param); + memory_cfg->MmaTestContentPtr = (uintptr_t)mma_cfg->test_content; + memory_cfg->MmaTestContentSize = mma_cfg->test_content_size; + memory_cfg->MmaTestConfigPtr = (uintptr_t)mma_cfg->test_param; + memory_cfg->MmaTestConfigSize = mma_cfg->test_param_size; memory_cfg->MrcFastBoot = 0x00; memory_cfg->SaGv = 0x02; } |