soc/intel/common: Add support to control coreboot and Intel SoC features
The patch adds a framework to control coreboot and Intel SoC features dynamically. BIOS reads control information from OEM Section in the Descriptor Region and control the developer selected features. With the feature, debug team can control the selected SoC and coreboot features without rebuilding coreboot. In order to enable the feature, SOC_INTEL_COMMON_BLOCK_DEBUG_FEATURE has to be selcted from mainboard. The OEM section starts from offset:0xf00 till end of the Descriptor Region(0xfff). BUG=b:153410586 BRANCH=None TEST=Verified CSE firmware update functionality on brya Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Change-Id: I5ba40926bd9ad909654f152e48cdd648b28afd62 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61380 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Ronak Kanabar <ronak.kanabar@intel.com> Reviewed-by: Maulik V Vaghela <maulik.v.vaghela@intel.com>
This commit is contained in:
parent
bd656b4e4c
commit
2c2706ccef
|
@ -2,3 +2,9 @@ config SOC_INTEL_COMMON_BASECODE
|
|||
bool
|
||||
help
|
||||
Common coreboot stages and non-IP block for Intel platform
|
||||
|
||||
if SOC_INTEL_COMMON_BASECODE
|
||||
|
||||
source "src/soc/intel/common/basecode/*/Kconfig"
|
||||
|
||||
endif
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
config SOC_INTEL_COMMON_BASECODE_DEBUG_FEATURE
|
||||
bool
|
||||
default n
|
||||
help
|
||||
Driver to control runtime features of Intel SoC & coreboot. For example, controlling
|
||||
the CSE firmware update feature without rebuilding the code.
|
|
@ -0,0 +1 @@
|
|||
romstage-$(CONFIG_SOC_INTEL_COMMON_BASECODE_DEBUG_FEATURE) += debug_feature.c
|
|
@ -0,0 +1,44 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include <boot_device.h>
|
||||
#include <commonlib/region.h>
|
||||
#include <intelbasecode/debug_feature.h>
|
||||
#include <console/console.h>
|
||||
#include <fmap.h>
|
||||
|
||||
#define SI_DESC_OEM_SECTION_OFFSET 0xF00
|
||||
#define PRE_MEM_FEATURE_CTRL_OFFSET SI_DESC_OEM_SECTION_OFFSET
|
||||
#define PRE_MEM_FEATURE_CTRL_SZ 64
|
||||
#define SI_DESC_REGION_SZ 4096
|
||||
|
||||
struct pre_mem_ft {
|
||||
uint8_t reserved[64];
|
||||
};
|
||||
|
||||
static struct pre_mem_ft pre_mem_debug;
|
||||
|
||||
_Static_assert(sizeof(struct pre_mem_ft) % 64 == 0 && sizeof(struct pre_mem_ft) <= 256,
|
||||
"sizeof(struct pre_mem_ft) must be a multiple of 64 bytes and up to 256 bytes");
|
||||
|
||||
uint8_t pre_mem_debug_init(void)
|
||||
{
|
||||
struct region_device desc_rdev;
|
||||
const struct region_device *boot_device = boot_device_ro();
|
||||
|
||||
if (!boot_device) {
|
||||
printk(BIOS_ERR, "Failed to get RW boot device\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rdev_chain(&desc_rdev, boot_device, 0, SI_DESC_REGION_SZ)) {
|
||||
printk(BIOS_ERR, "Failed to get description region device\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rdev_readat(&desc_rdev, &pre_mem_debug, PRE_MEM_FEATURE_CTRL_OFFSET,
|
||||
PRE_MEM_FEATURE_CTRL_SZ) != PRE_MEM_FEATURE_CTRL_SZ) {
|
||||
printk(BIOS_ERR, "Failed to read Descriptor Region from SPI Flash\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef SOC_INTEL_COMMON_BASECODE_DEBUG_FEATURE_H
|
||||
#define SOC_INTEL_COMMON_BASECODE_DEBUG_FEATURE_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/*
|
||||
* Reads OEM Section area in the Descriptor Region and
|
||||
* populates pre_mem_debug structure.
|
||||
*/
|
||||
uint8_t pre_mem_debug_init(void);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue