Patrick Georgi submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved Mathew King: Looks good to me, approved
ec/google/wilco: Set cpu id and cores to EC

Set CPU ID and cores to EC then EC will adapt power table
according to the CPU ID and number of cores.

BUG=b:148126144
BRANCH=None
TEST=check EC can get correct CPU id and cores.

Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com>
Change-Id: I23f5580b15a20a01e03a5f4c798e73574f874c9a
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38566
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Mathew King <mathewk@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M src/ec/google/wilco/chip.c
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/ec/google/wilco/chip.c b/src/ec/google/wilco/chip.c
index b44cbd6..5729b4a 100644
--- a/src/ec/google/wilco/chip.c
+++ b/src/ec/google/wilco/chip.c
@@ -16,10 +16,13 @@
#include <arch/acpi.h>
#include <arch/acpi_device.h>
#include <arch/acpigen.h>
+#include <arch/cpu.h>
#include <bootstate.h>
#include <cbmem.h>
+#include <console/console.h>
#include <device/pnp.h>
#include <ec/acpi/ec.h>
+#include <intelblocks/cpulib.h>
#include <pc80/keyboard.h>
#include <stdint.h>

@@ -124,6 +127,14 @@
}
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, wilco_ec_resume, NULL);

+static int wilco_set_cpu_id(void)
+{
+ uint32_t cpu_phy_cores, cpu_virtual_cores;
+
+ cpu_read_topology(&cpu_phy_cores, &cpu_virtual_cores);
+ return wilco_ec_set_cpuid(cpu_get_cpuid(), cpu_phy_cores, 0);
+}
+
static void wilco_ec_init(struct device *dev)
{
if (!dev->enabled)
@@ -153,6 +164,10 @@

/* Turn on camera power */
wilco_ec_send(KB_CAMERA, CAMERA_ON);
+
+ /* Set cpu id and phy cores */
+ if (wilco_set_cpu_id())
+ printk(BIOS_ERR, "EC: use default cpu power table\n");
}

static void wilco_ec_resource(struct device *dev, int index,

To view, visit change 38566. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I23f5580b15a20a01e03a5f4c798e73574f874c9a
Gerrit-Change-Number: 38566
Gerrit-PatchSet: 5
Gerrit-Owner: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Gerrit-Reviewer: Bora Guvendik <bora.guvendik@intel.com>
Gerrit-Reviewer: Duncan Laurie <dlaurie@chromium.org>
Gerrit-Reviewer: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Gerrit-Reviewer: Mathew King <mathewk@chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: Selma Bensaid <selma.bensaid@intel.corp-partner.google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged