2020-02-17 21:17:19 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
|
|
|
|
#include <arch/cpu.h>
|
2020-05-18 20:27:04 +02:00
|
|
|
#include <console/console.h>
|
2020-02-17 21:17:19 +01:00
|
|
|
#include <soc/cpu.h>
|
|
|
|
#include <soc/soc_util.h>
|
2020-05-18 20:27:04 +02:00
|
|
|
#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");
|
|
|
|
}
|
|
|
|
}
|
2020-02-17 21:17:19 +01:00
|
|
|
|
2020-05-20 02:42:41 +02:00
|
|
|
bool soc_is_pollock(void)
|
2020-02-17 21:17:19 +01:00
|
|
|
{
|
2020-05-18 20:43:49 +02:00
|
|
|
return soc_is_zen_plus() && get_socket_type() == SOCKET_FT5;
|
2020-02-17 21:17:19 +01:00
|
|
|
}
|
|
|
|
|
2020-04-12 02:17:44 +02:00
|
|
|
/*
|
|
|
|
* TODO: This detection works for the Dali SKUs used in Chrome-devices, but fails for other
|
|
|
|
* Dali SKUs, since other Dali SKUs have a Zen+ CPUID and not a Raven2 one.
|
|
|
|
*/
|
2020-05-20 02:42:41 +02:00
|
|
|
bool soc_is_dali(void)
|
2020-02-17 21:17:19 +01:00
|
|
|
{
|
2020-05-18 20:43:49 +02:00
|
|
|
return soc_is_raven2() && get_socket_type() == SOCKET_FP5;
|
2020-02-17 21:17:19 +01:00
|
|
|
}
|
|
|
|
|
2020-05-20 02:42:41 +02:00
|
|
|
bool soc_is_picasso(void)
|
2020-02-17 21:17:19 +01:00
|
|
|
{
|
2020-05-18 20:43:49 +02:00
|
|
|
return soc_is_zen_plus() && get_socket_type() == SOCKET_FP5;
|
2020-02-17 21:17:19 +01:00
|
|
|
}
|
|
|
|
|
2020-05-20 02:42:41 +02:00
|
|
|
bool soc_is_raven2(void)
|
2020-02-17 21:17:19 +01:00
|
|
|
{
|
|
|
|
/* mask lower model number nibble and stepping */
|
|
|
|
return cpuid_eax(1) >> 8 == RAVEN2_CPUID >> 8;
|
|
|
|
}
|
|
|
|
|
2020-05-20 02:42:41 +02:00
|
|
|
bool soc_is_zen_plus(void)
|
2020-02-17 21:17:19 +01:00
|
|
|
{
|
|
|
|
/* mask lower model number nibble and stepping */
|
|
|
|
return cpuid_eax(1) >> 8 == PICASSO_CPUID >> 8;
|
|
|
|
}
|