Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41517 )
Change subject: soc/amd/picasso/soc_util: add socket type detection and printing ......................................................................
soc/amd/picasso/soc_util: add socket type detection and printing
Change-Id: I643a4c5f8a42a5fb0603a1a049545b57d16493a6 Signed-off-by: Felix Held felix-coreboot@felixheld.de --- M src/soc/amd/picasso/include/soc/soc_util.h M src/soc/amd/picasso/soc_util.c 2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/41517/1
diff --git a/src/soc/amd/picasso/include/soc/soc_util.h b/src/soc/amd/picasso/include/soc/soc_util.h index 9d769b9..8e2c598 100644 --- a/src/soc/amd/picasso/include/soc/soc_util.h +++ b/src/soc/amd/picasso/include/soc/soc_util.h @@ -1,5 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+enum socket_type { + SOCKET_FP5 = 0, + SOCKET_AM4 = 2, + SOCKET_FT5 = 3, +}; + +void print_socket_type(void); + int soc_is_pollock(void); int soc_is_dali(void); int soc_is_picasso(void); diff --git a/src/soc/amd/picasso/soc_util.c b/src/soc/amd/picasso/soc_util.c index 94ebb6b..a70d833 100644 --- a/src/soc/amd/picasso/soc_util.c +++ b/src/soc/amd/picasso/soc_util.c @@ -1,8 +1,41 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cpu.h> +#include <console/console.h> #include <soc/cpu.h> #include <soc/soc_util.h> +#include <types.h> + +#define SOCKET_TYPE_SHIFT 28 +#define SOCKET_TYPSE_MASK (0xf << SOCKET_TYPE_SHIFT) + +static enum socket_type get_socket_type(void) +{ + uint32_t ebx = cpuid_ebx(0x80000001); + ebx = (ebx & SOCKET_TYPSE_MASK) >> SOCKET_TYPE_SHIFT; + return (enum socket_type)ebx; +} + +void print_socket_type(void) +{ + enum socket_type socket = get_socket_type(); + + printk(BIOS_INFO, "Socket type: "); + + switch (socket) { + case SOCKET_FP5: + printk(BIOS_INFO, "FP5\n"); + break; + case SOCKET_AM4: + printk(BIOS_INFO, "AM4\n"); + break; + case SOCKET_FT5: + printk(BIOS_INFO, "FT5\n"); + break; + default: + printk(BIOS_INFO, "unknown\n"); + } +}
int soc_is_pollock(void) {
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41517 )
Change subject: soc/amd/picasso/soc_util: add socket type detection and printing ......................................................................
Patch Set 1:
cherry-picked this and the next patch onto my old local mandolin branch and added the print code to the mainboard and got the expected socket type in the serial log
Raul Rangel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41517 )
Change subject: soc/amd/picasso/soc_util: add socket type detection and printing ......................................................................
Patch Set 1: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/41517 )
Change subject: soc/amd/picasso/soc_util: add socket type detection and printing ......................................................................
soc/amd/picasso/soc_util: add socket type detection and printing
Change-Id: I643a4c5f8a42a5fb0603a1a049545b57d16493a6 Signed-off-by: Felix Held felix-coreboot@felixheld.de Reviewed-on: https://review.coreboot.org/c/coreboot/+/41517 Reviewed-by: Raul Rangel rrangel@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/amd/picasso/include/soc/soc_util.h M src/soc/amd/picasso/soc_util.c 2 files changed, 41 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Raul Rangel: Looks good to me, approved
diff --git a/src/soc/amd/picasso/include/soc/soc_util.h b/src/soc/amd/picasso/include/soc/soc_util.h index 9d769b9..8e2c598 100644 --- a/src/soc/amd/picasso/include/soc/soc_util.h +++ b/src/soc/amd/picasso/include/soc/soc_util.h @@ -1,5 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */
+enum socket_type { + SOCKET_FP5 = 0, + SOCKET_AM4 = 2, + SOCKET_FT5 = 3, +}; + +void print_socket_type(void); + int soc_is_pollock(void); int soc_is_dali(void); int soc_is_picasso(void); diff --git a/src/soc/amd/picasso/soc_util.c b/src/soc/amd/picasso/soc_util.c index 94ebb6b..a70d833 100644 --- a/src/soc/amd/picasso/soc_util.c +++ b/src/soc/amd/picasso/soc_util.c @@ -1,8 +1,41 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cpu.h> +#include <console/console.h> #include <soc/cpu.h> #include <soc/soc_util.h> +#include <types.h> + +#define SOCKET_TYPE_SHIFT 28 +#define SOCKET_TYPSE_MASK (0xf << SOCKET_TYPE_SHIFT) + +static enum socket_type get_socket_type(void) +{ + uint32_t ebx = cpuid_ebx(0x80000001); + ebx = (ebx & SOCKET_TYPSE_MASK) >> SOCKET_TYPE_SHIFT; + return (enum socket_type)ebx; +} + +void print_socket_type(void) +{ + enum socket_type socket = get_socket_type(); + + printk(BIOS_INFO, "Socket type: "); + + switch (socket) { + case SOCKET_FP5: + printk(BIOS_INFO, "FP5\n"); + break; + case SOCKET_AM4: + printk(BIOS_INFO, "AM4\n"); + break; + case SOCKET_FT5: + printk(BIOS_INFO, "FT5\n"); + break; + default: + printk(BIOS_INFO, "unknown\n"); + } +}
int soc_is_pollock(void) {
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41517 )
Change subject: soc/amd/picasso/soc_util: add socket type detection and printing ......................................................................
Patch Set 2:
Automatic boot test returned (PASS/FAIL/TOTAL): 4/0/4 Emulation targets: "QEMU x86 q35/ich9" using payload TianoCore : SUCCESS : https://lava.9esec.io/r/3574 "QEMU x86 q35/ich9" using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/3573 "QEMU x86 i440fx/piix4" using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/3572 "QEMU AArch64" using payload LinuxBoot_u-root_kexec : SUCCESS : https://lava.9esec.io/r/3571
Please note: This test is under development and might not be accurate at all!