| 1 |
|
| 2 |
|
| 3 |
#include <device/pci.h> |
| 4 |
#include <device/pci_ids.h> |
| 5 |
#include <soc/pci_devs.h> |
| 6 |
#include <soc/pcu.h> |
| 7 |
#include <soc/ramstage.h> |
| 8 |
#include <soc/util.h> |
| 9 |
|
| 10 |
static void pcu2_init(struct device *dev) |
| 11 |
{ |
| 12 |
printk(BIOS_INFO, "%s: init registers\n", dev_path(dev)); |
| 13 |
|
| 14 |
if (CONFIG(SOC_INTEL_SKYLAKE_SP)) { |
| 15 |
pci_or_config32(dev, PCU_CR2_PKG_CST_ENTRY_CRITERIA_MASK, 0xFFFFFF); |
| 16 |
pci_or_config32(dev, PCU_CR2_PKG_CST_ENTRY_CRITERIA_MASK2, 7); |
| 17 |
|
| 18 |
pci_write_config32(dev, PCU_CR2_PROCHOT_RESPONSE_RATIO_REG, |
| 19 |
PROCHOT_RATIO); |
| 20 |
pci_or_config32(dev, PCU_CR2_DYNAMIC_PERF_POWER_CTL, |
| 21 |
UNOCRE_PLIMIT_OVERRIDE_SHIFT); |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
static void pcu2_final(struct device *dev) |
| 26 |
{ |
| 27 |
printk(BIOS_INFO, "%s: locking registers\n", dev_path(dev)); |
| 28 |
if (CONFIG(SOC_INTEL_SKYLAKE_SP) || CONFIG(SOC_INTEL_COOPERLAKE_SP)) { |
| 29 |
pci_or_config32(dev, PCU_CR2_DRAM_PLANE_POWER_LIMIT_LWR, |
| 30 |
PP_PWR_LIM_LOCK); |
| 31 |
} else { |
| 32 |
pci_or_config32(dev, PCU_CR2_DRAM_PLANE_POWER_LIMIT_UPR, |
| 33 |
PP_PWR_LIM_LOCK_UPR); |
| 34 |
} |
| 35 |
pci_or_config32(dev, PCU_CR2_DRAM_POWER_INFO_UPR, |
| 36 |
DRAM_POWER_INFO_LOCK_UPR); |
| 37 |
} |
| 38 |
|
| 39 |
static struct device_operations pcu2_ops = { |
| 40 |
.read_resources = pci_dev_read_resources, |
| 41 |
.set_resources = pci_dev_set_resources, |
| 42 |
.enable_resources = pci_dev_enable_resources, |
| 43 |
.init = pcu2_init, |
| 44 |
.final = pcu2_final, |
| 45 |
}; |
| 46 |
|
| 47 |
static const struct pci_driver pcu2_driver __pci_driver = { |
| 48 |
.ops = &pcu2_ops, |
| 49 |
.vendor = PCI_VID_INTEL, |
| 50 |
.device = PCU_CR2_DEVID, |
| 51 |
}; |