Angel Pons | 2712398 | 2020-04-05 13:22:30 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 3 | |
| 4 | #include <baseboard/variants.h> |
| 5 | #include <chip.h> |
| 6 | #include <device/device.h> |
| 7 | #include <device/pci_ids.h> |
| 8 | #include <device/pci_ops.h> |
| 9 | |
| 10 | #define PL2_AML 18 |
| 11 | #define PL2_KBL 15 |
| 12 | |
| 13 | static uint32_t get_pl2(void) |
| 14 | { |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 15 | struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 16 | uint16_t id; |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 17 | |
| 18 | id = pci_read_config16(igd_dev, PCI_DEVICE_ID); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 19 | /* Assume we only have KLB-Y and AML-Y SKUs */ |
| 20 | if (id == PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM) |
| 21 | return PL2_KBL; |
| 22 | |
| 23 | return PL2_AML; |
| 24 | } |
| 25 | |
| 26 | /* Override dev tree settings per board */ |
| 27 | void variant_devtree_update(void) |
| 28 | { |
Kyösti Mälkki | d5f645c | 2019-09-28 00:20:27 +0300 | [diff] [blame] | 29 | config_t *cfg = config_of_soc(); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 30 | |
| 31 | /* Update PL2 based on CPU */ |
| 32 | cfg->tdp_pl2_override = get_pl2(); |
| 33 | } |