Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <baseboard/variants.h> |
| 16 | #include <chip.h> |
| 17 | #include <device/device.h> |
| 18 | #include <device/pci_ids.h> |
| 19 | #include <device/pci_ops.h> |
| 20 | |
| 21 | #define PL2_AML 18 |
| 22 | #define PL2_KBL 15 |
| 23 | |
| 24 | static uint32_t get_pl2(void) |
| 25 | { |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 26 | struct device *igd_dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 27 | uint16_t id; |
Kyösti Mälkki | 71756c21 | 2019-07-12 13:10:19 +0300 | [diff] [blame] | 28 | |
| 29 | id = pci_read_config16(igd_dev, PCI_DEVICE_ID); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 30 | /* Assume we only have KLB-Y and AML-Y SKUs */ |
| 31 | if (id == PCI_DEVICE_ID_INTEL_KBL_GT2_SULXM) |
| 32 | return PL2_KBL; |
| 33 | |
| 34 | return PL2_AML; |
| 35 | } |
| 36 | |
| 37 | /* Override dev tree settings per board */ |
| 38 | void variant_devtree_update(void) |
| 39 | { |
Kyösti Mälkki | d5f645c | 2019-09-28 00:20:27 +0300 | [diff] [blame] | 40 | config_t *cfg = config_of_soc(); |
Gaggery Tsai | 7130ca0 | 2018-07-31 15:55:54 -0700 | [diff] [blame] | 41 | |
| 42 | /* Update PL2 based on CPU */ |
| 43 | cfg->tdp_pl2_override = get_pl2(); |
| 44 | } |