EricR Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38526 )
Change subject: ec/google/wilco: add ec command set cpu id ......................................................................
ec/google/wilco: add ec command set cpu id
Add new mailbox command support. Set CPU ID and cores to EC.
BUG=b:1746900
Signed-off-by: Eric Lai ericr_lai@compal.corp-partner.google.com Change-Id: I135d2421d2106934be996a1780786f6bb0bf6b34 --- M src/ec/google/wilco/commands.c M src/ec/google/wilco/commands.h 2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/38526/1
diff --git a/src/ec/google/wilco/commands.c b/src/ec/google/wilco/commands.c index 626f9dd..636136b 100644 --- a/src/ec/google/wilco/commands.c +++ b/src/ec/google/wilco/commands.c @@ -224,3 +224,28 @@ 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); +} diff --git a/src/ec/google/wilco/commands.h b/src/ec/google/wilco/commands.h index 9a18580..bfdd111 100644 --- a/src/ec/google/wilco/commands.h +++ b/src/ec/google/wilco/commands.h @@ -52,6 +52,8 @@ KB_BIOS_PROGRESS = 0xc2, /* Inform the EC that a fatal error occurred */ KB_ERR_CODE = 0x7b, + /* Set CPU ID */ + KB_CPU_ID = 0xbf, };
enum ec_ram_addr { @@ -337,4 +339,18 @@ */ void wilco_ec_save_post_code(uint8_t post_code);
+/** + * wilco_ec_set_cpuid + * + * Set CPU ID to EC. + * + * @cpuid: read CPU ID from cpu_eax(1) + * @cpu_cores: cores of CPU + * @gpu_cores: cores of GPU + * + * Returns 0 if EC command was successful + * Returns -1 if EC command failed + */ +int wilco_ec_set_cpuid(uint32_t cpuid, uint8_t cpu_cores,uint8_t gpu_cores); + #endif /* EC_GOOGLE_WILCO_COMMANDS_H */