summaryrefslogtreecommitdiff
path: root/src/ec/google/wilco/commands.c
diff options
context:
space:
mode:
authorEric Lai <ericr_lai@compal.corp-partner.google.com>2020-01-23 14:43:08 +0800
committerPatrick Georgi <pgeorgi@google.com>2020-01-27 07:43:06 +0000
commitf74b6e351c921f2505691f5ece834b280e500395 (patch)
tree22137a1ecd25e2cd790ddbff68f089f12160e44a /src/ec/google/wilco/commands.c
parentec430ee343bdceaf21a7be462e8f856102bd2c09 (diff)
downloadcoreboot-f74b6e351c921f2505691f5ece834b280e500395.tar.xz
ec/google/wilco: add ec command set cpu id
Add new mailbox command support. Set CPU ID and cores to EC. EC will according to different CPU to set different power table. BUG=b:148126144 Signed-off-by: Eric Lai <ericr_lai@compal.corp-partner.google.com> Change-Id: I135d2421d2106934be996a1780786f6bb0bf6b34 Reviewed-on: https://review.coreboot.org/c/coreboot/+/38526 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Mathew King <mathewk@chromium.org>
Diffstat (limited to 'src/ec/google/wilco/commands.c')
-rw-r--r--src/ec/google/wilco/commands.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ec/google/wilco/commands.c b/src/ec/google/wilco/commands.c
index 626f9ddc2c..791141e814 100644
--- a/src/ec/google/wilco/commands.c
+++ b/src/ec/google/wilco/commands.c
@@ -224,3 +224,29 @@ void die_notify(void)
wilco_ec_mailbox(WILCO_EC_MSG_DEFAULT, KB_ERR_CODE,
&err_code, 1, NULL, 0);
}
+
+/*
+ * EC CPU ID data struct
+ * MBOX[2] = 0xFF
+ * MBOX[3] = CPUID_Low
+ * MBOX[4] = CPUID_Mid
+ * MBOX[5] = CPUID_High
+ * MBOX[6] = CPU_Core
+ * MBOX[7] = GPU_Core
+ * MBOX[8] = Reserved
+ */
+int wilco_ec_set_cpuid(uint32_t cpuid, uint8_t cpu_cores, uint8_t gpu_cores)
+{
+ uint8_t cpu_id[7] = {0}, i;
+
+ cpu_id[0] = 0xff;
+ for (i = 1; i < 4; i++) {
+ cpu_id[i] = cpuid & 0xff;
+ cpuid = cpuid >> 8;
+ }
+ cpu_id[4] = cpu_cores;
+ cpu_id[5] = gpu_cores;
+
+ return wilco_ec_mailbox(WILCO_EC_MSG_DEFAULT, KB_CPU_ID, cpu_id,
+ ARRAY_SIZE(cpu_id), NULL, 0);
+}