From ef9136ff253a96d66a9b2348f967045cefb56ac3 Mon Sep 17 00:00:00 2001 From: Sridhar Siricilla Date: Mon, 7 Jun 2021 22:30:09 +0530 Subject: mb/google/brya: Update PMC Descriptor for Alder lake A0(0x906a0) silicon The patch updates PMC Descriptor which is part of Descriptor Region if system equipped with Alder lake A0 silicon. This change allows to use unified Descriptor Region for Alder lake A0(CPU ID:0x906a0) and B0 (CPUD ID:0x906a1) silicons. BUG=B:187431859 TEST=Verified PMC Descriptor getting modified for Alder lake B0 silicon if not updated. coreboot logs appear as below with this patch: On First boot after flashing the image: coreboot-coreboot-unknown.9999.4589c0f Wed Jun 9 18:23:43 UTC 2021 bootblock starting (log level: 8)... CPU: Genuine Intel(R) 0000 CPU: ID 906a0, Alderlake Platform, ucode: 0000001a .. FMAP: Found "FLASH" version 1.1 at 0x1804000. FMAP: base = 0x0 size = 0x2000000 #areas = 32 FMAP: area SI_DESC found @ 0 (4096 bytes) SF: Detected 00 0000 with sector size 0x1000, total 0x2000000 Erasing flash addr 0 + 4 KiB Update of PMC Descriptor successful, trigger GLOBAL RESET Next boot after GLOBAL RESET: coreboot-coreboot-unknown.9999.4589c0f Wed Jun 9 18:23:43 UTC 2021 bootblock starting (log level: 8)... .. FMAP: area SI_DESC found @ 0 (4096 bytes) SF: Detected 00 0000 with sector size 0x1000, total 0x2000000 Update of PMC Descriptor is not required! VBOOT: Loading verstage. .. CBFS: Found 'fallback/verstage' @0x2264c0 size 0x16b08 in mcache @0xfef84d38 Signed-off-by: Sridhar Siricilla Change-Id: I6d9a2ce0f0b3e386eefa1962ce706b58f31a8576 Reviewed-on: https://review.coreboot.org/c/coreboot/+/55254 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/mainboard/google/brya/bootblock.c | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src/mainboard/google/brya') diff --git a/src/mainboard/google/brya/bootblock.c b/src/mainboard/google/brya/bootblock.c index 1815615f5e..6576469c9c 100644 --- a/src/mainboard/google/brya/bootblock.c +++ b/src/mainboard/google/brya/bootblock.c @@ -2,6 +2,57 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + +#define SI_DESC_REGION "SI_DESC" +#define SI_DESC_REGION_SZ 4096 +#define PMC_DESC_7_BYTE3 0xc32 + +/* It updates PMC Descriptor in the Descriptor Region */ +static void configure_pmc_descriptor(void) +{ + uint8_t si_desc_buf[SI_DESC_REGION_SZ]; + struct region_device desc_rdev; + + if (fmap_locate_area_as_rdev_rw(SI_DESC_REGION, &desc_rdev) < 0) { + printk(BIOS_ERR, "Failed to locate %s in the FMAP\n", SI_DESC_REGION); + return; + } + + if (rdev_readat(&desc_rdev, si_desc_buf, 0, SI_DESC_REGION_SZ) != SI_DESC_REGION_SZ) { + printk(BIOS_ERR, "Failed to read Descriptor Region from SPI Flash\n"); + return; + } + + if (si_desc_buf[PMC_DESC_7_BYTE3] == 0x40) { + si_desc_buf[PMC_DESC_7_BYTE3] = 0x44; + + if (rdev_eraseat(&desc_rdev, 0, SI_DESC_REGION_SZ) != SI_DESC_REGION_SZ) { + printk(BIOS_ERR, "Failed to erase Descriptor Region area\n"); + return; + } + + if (rdev_writeat(&desc_rdev, si_desc_buf, 0, SI_DESC_REGION_SZ) + != SI_DESC_REGION_SZ) { + printk(BIOS_ERR, "Failed to update Descriptor Region\n"); + return; + } + + printk(BIOS_DEBUG, "Update of PMC Descriptor successful, trigger GLOBAL RESET\n"); + + pmc_global_reset_enable(1); + do_full_reset(); + die("Failed to trigger GLOBAL RESET\n"); + } + + printk(BIOS_DEBUG, "Update of PMC Descriptor is not required!\n"); +} void bootblock_mainboard_early_init(void) { @@ -10,3 +61,9 @@ void bootblock_mainboard_early_init(void) pads = variant_early_gpio_table(&num); gpio_configure_pads(pads, num); } + +void bootblock_mainboard_init(void) +{ + if (cpu_get_cpuid() == CPUID_ALDERLAKE_A0) + configure_pmc_descriptor(); +} -- cgit v1.2.3