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>
This commit is contained in:
parent
43c9d709c7
commit
62fa9f3cf9
|
@ -23,7 +23,7 @@ void setup_mma(FSP_M_CONFIG *memory_cfg)
|
||||||
{
|
{
|
||||||
struct mma_config_param mma_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");
|
printk(BIOS_DEBUG, "MMA: set up failed\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#define TEST_PARAM_MAX_SIZE 100
|
#define TEST_PARAM_MAX_SIZE 100
|
||||||
#define MMA_DATA_SIGNATURE (('M' << 0) | ('M' << 8) | \
|
#define MMA_DATA_SIGNATURE (('M' << 0) | ('M' << 8) | \
|
||||||
('A' << 16) | ('D' << 24))
|
('A' << 16) | ('D' << 24))
|
||||||
#define MMA_CBFS_REGION "COREBOOT"
|
|
||||||
|
|
||||||
struct mma_data_container {
|
struct mma_data_container {
|
||||||
uint32_t mma_signature; /* "MMAD" */
|
uint32_t mma_signature; /* "MMAD" */
|
||||||
|
@ -99,31 +98,20 @@ static int label_value(const char *haystack, size_t haystack_sz,
|
||||||
return 0;
|
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;
|
void *mma_test_metadata;
|
||||||
size_t mma_test_metadata_file_len;
|
size_t mma_test_metadata_file_len;
|
||||||
char test_filename[TEST_NAME_MAX_SIZE],
|
char test_filename[TEST_NAME_MAX_SIZE],
|
||||||
test_param_filename[TEST_PARAM_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;
|
bool metadata_parse_flag = true;
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "MMA: Entry %s\n", __func__);
|
printk(BIOS_DEBUG, "MMA: Entry %s\n", __func__);
|
||||||
|
|
||||||
if (cbfs_locate_file_in_region(&metadata_fh, MMA_CBFS_REGION,
|
mma_test_metadata = cbfs_ro_map(MMA_TEST_METADATA_FILENAME,
|
||||||
MMA_TEST_METADATA_FILENAME)) {
|
&mma_test_metadata_file_len);
|
||||||
printk(BIOS_DEBUG, "MMA: Failed to locate %s\n",
|
if (!mma_test_metadata) {
|
||||||
MMA_TEST_METADATA_FILENAME);
|
printk(BIOS_DEBUG, "MMA: Failed to map %s\n",
|
||||||
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_FILENAME);
|
MMA_TEST_METADATA_FILENAME);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +133,7 @@ int mma_locate_param(struct mma_config_param *mma_cfg)
|
||||||
metadata_parse_flag = false;
|
metadata_parse_flag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
rdev_munmap(&metadata_fh.data, mma_test_metadata);
|
cbfs_unmap(mma_test_metadata);
|
||||||
|
|
||||||
if (!metadata_parse_flag)
|
if (!metadata_parse_flag)
|
||||||
return -1;
|
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",
|
printk(BIOS_DEBUG, "MMA: Got MMA_TEST_NAME=%s MMA_TEST_PARAM=%s\n",
|
||||||
test_filename, test_param_filename);
|
test_filename, test_param_filename);
|
||||||
|
|
||||||
if (cbfs_locate_file_in_region(&test_content_fh, MMA_CBFS_REGION,
|
mma_cfg->test_content = cbfs_ro_map(test_filename, &mma_cfg->test_content_size);
|
||||||
test_filename)) {
|
if (!mma_cfg->test_content) {
|
||||||
printk(BIOS_DEBUG, "MMA: Failed to locate %s\n",
|
printk(BIOS_DEBUG, "MMA: Failed to map %s\n", test_filename);
|
||||||
test_filename);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cbfs_file_data(&mma_cfg->test_content, &test_content_fh);
|
mma_cfg->test_param = cbfs_ro_map(test_param_filename, &mma_cfg->test_param_size);
|
||||||
|
if (!mma_cfg->test_param) {
|
||||||
if (cbfs_locate_file_in_region(&test_param_fh, MMA_CBFS_REGION,
|
printk(BIOS_DEBUG, "MMA: Failed to map %s\n", test_param);
|
||||||
test_param_filename)) {
|
|
||||||
printk(BIOS_DEBUG, "MMA: Failed to locate %s\n",
|
|
||||||
test_param_filename);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
cbfs_file_data(&mma_cfg->test_param, &test_param_fh);
|
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "MMA: %s exit success\n", __func__);
|
printk(BIOS_DEBUG, "MMA: %s exit success\n", __func__);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -3,18 +3,19 @@
|
||||||
#ifndef _SOC_MMA_H_
|
#ifndef _SOC_MMA_H_
|
||||||
#define _SOC_MMA_H_
|
#define _SOC_MMA_H_
|
||||||
|
|
||||||
#include <commonlib/region.h>
|
#include <types.h>
|
||||||
|
|
||||||
struct mma_config_param {
|
struct mma_config_param {
|
||||||
struct region_device test_content;
|
void *test_content;
|
||||||
struct region_device test_param;
|
size_t test_content_size;
|
||||||
|
void *test_param;
|
||||||
|
size_t test_param_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Locate mma metadata in CBFS, parse, find and fill rdev for
|
/* Locate mma metadata in CBFS, parse, find and map mma test content and test param.
|
||||||
* mma test content and test param.
|
|
||||||
* Returns 0 on success, < 0 on failure.
|
* 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
|
/* Locate the MMA hob from the FSP Hob list, This is implemented
|
||||||
* specific to FSP version.
|
* specific to FSP version.
|
||||||
* Returns 0 on success, < 0 on failure.
|
* Returns 0 on success, < 0 on failure.
|
||||||
|
|
|
@ -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). */
|
/* Boot media is memory mapped for Skylake and Kabylake (SPI). */
|
||||||
assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED));
|
assert(CONFIG(BOOT_DEVICE_MEMORY_MAPPED));
|
||||||
|
|
||||||
memory_cfg->MmaTestContentPtr =
|
memory_cfg->MmaTestContentPtr = (uintptr_t)mma_cfg->test_content;
|
||||||
(uintptr_t) rdev_mmap_full(&mma_cfg->test_content);
|
memory_cfg->MmaTestContentSize = mma_cfg->test_content_size;
|
||||||
memory_cfg->MmaTestContentSize =
|
memory_cfg->MmaTestConfigPtr = (uintptr_t)mma_cfg->test_param;
|
||||||
region_device_sz(&mma_cfg->test_content);
|
memory_cfg->MmaTestConfigSize = mma_cfg->test_param_size;
|
||||||
memory_cfg->MmaTestConfigPtr =
|
|
||||||
(uintptr_t) rdev_mmap_full(&mma_cfg->test_param);
|
|
||||||
memory_cfg->MmaTestConfigSize =
|
|
||||||
region_device_sz(&mma_cfg->test_param);
|
|
||||||
memory_cfg->MrcFastBoot = 0x00;
|
memory_cfg->MrcFastBoot = 0x00;
|
||||||
memory_cfg->SaGv = 0x02;
|
memory_cfg->SaGv = 0x02;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue