diff options
author | Eric Lai <ericr_lai@compal.corp-partner.google.com> | 2020-01-25 22:14:04 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-02-01 19:53:11 +0000 |
commit | 123b191b47b3502eb326c2c229da6d5d1d15259e (patch) | |
tree | a984d1eb4304b810c63cc31e9e34f78d70b1ea7f /src/ec/google | |
parent | b3100775ae29caebd068db8f6209561abda2fb0c (diff) |
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>
Diffstat (limited to 'src/ec/google')
-rw-r--r-- | src/ec/google/wilco/chip.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ec/google/wilco/chip.c b/src/ec/google/wilco/chip.c index b44cbd6c64..5729b4aa27 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 @@ static void wilco_ec_resume(void *unused) } 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 @@ static void wilco_ec_init(struct device *dev) /* 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, |