| 1 |
|
| 2 |
|
| 3 |
#include <cpu/cpu.h> |
| 4 |
#include <cpu/intel/cpu_ids.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <device/pci_ids.h> |
| 7 |
#include <device/pci_ops.h> |
| 8 |
#include <soc/lpm.h> |
| 9 |
#include <soc/pci_devs.h> |
| 10 |
#include <soc/soc_chip.h> |
| 11 |
#include <static.h> |
| 12 |
#include <types.h> |
| 13 |
|
| 14 |
|
| 15 |
static bool platform_is_up3(void) |
| 16 |
{ |
| 17 |
const struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT); |
| 18 |
u32 cpu_id = cpu_get_cpuid(); |
| 19 |
uint16_t mchid = pci_read_config16(dev, PCI_DEVICE_ID); |
| 20 |
|
| 21 |
if ((cpu_id != CPUID_TIGERLAKE_A0) && (cpu_id != CPUID_TIGERLAKE_B0)) |
| 22 |
return false; |
| 23 |
|
| 24 |
return ((mchid == PCI_DID_INTEL_TGL_ID_U_2_2) || |
| 25 |
(mchid == PCI_DID_INTEL_TGL_ID_U_4_2)); |
| 26 |
} |
| 27 |
|
| 28 |
int get_supported_lpm_mask(struct soc_intel_tigerlake_config *config) |
| 29 |
{ |
| 30 |
const config_t *conf = config_of_soc(); |
| 31 |
if (!conf->s0ix_enable) |
| 32 |
return 0; |
| 33 |
|
| 34 |
int disable_mask; |
| 35 |
|
| 36 |
|
| 37 |
disable_mask = config->LpmStateDisableMask; |
| 38 |
|
| 39 |
|
| 40 |
if (platform_is_up3()) |
| 41 |
disable_mask |= LPM_S0i3_3 | LPM_S0i3_4 | LPM_S0i2_2; |
| 42 |
|
| 43 |
|
| 44 |
if (config->external_bypass == false) |
| 45 |
disable_mask |= LPM_S0i3_0 | LPM_S0i3_1 | LPM_S0i3_2 | LPM_S0i3_3 | LPM_S0i3_4; |
| 46 |
|
| 47 |
|
| 48 |
if (config->external_clk_gated == false) |
| 49 |
disable_mask |= LPM_S0i3_4; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
if (config->external_phy_gated == false) |
| 56 |
disable_mask |= LPM_S0i3_3 | LPM_S0i3_4 | LPM_S0i2_2; |
| 57 |
|
| 58 |
|
| 59 |
if (is_devfn_enabled(PCH_DEVFN_CNVI_WIFI) || is_devfn_enabled(PCH_DEVFN_ISH)) |
| 60 |
disable_mask |= LPM_S0i3_2 | LPM_S0i3_3 | LPM_S0i3_4; |
| 61 |
|
| 62 |
return LPM_S0iX_ALL & ~disable_mask; |
| 63 |
} |