mb/intel/adlrvp: Switch to using device pointers

This change replaces the device tree walks with device pointers by
using alias for dptf_policy device.

Change-Id: I02ca63ac2cc1b8ed2f5a381b3824c9beff7f33ec
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57870
Reviewed-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh 2021-09-22 23:38:17 -07:00 committed by Paul Fagerburg
parent eafca1f13a
commit 4f5e8e030c
2 changed files with 4 additions and 9 deletions

View File

@ -307,7 +307,7 @@ chip soc/intel/alderlake
register "options.fan.fine_grained_control" = "1"
register "options.fan.step_size" = "2"
device generic 0 on end
device generic 0 alias dptf_policy on end
end
end
device ref ipu on

View File

@ -19,19 +19,14 @@ const struct cpu_power_limits limits[] = {
{ PCI_DEVICE_ID_INTEL_ADL_P_ID_3, 5000, 45000, 115000, 115000 },
};
WEAK_DEV_PTR(dptf_policy);
void variant_update_power_limits(void)
{
const struct device_path policy_path[] = {
{ .type = DEVICE_PATH_PCI, .pci.devfn = SA_DEVFN_DPTF},
{ .type = DEVICE_PATH_GENERIC, .generic.id = 0}
};
const struct device *policy_dev = find_dev_nested_path(pci_root_bus(),
policy_path, ARRAY_SIZE(policy_path));
const struct device *policy_dev = DEV_PTR(dptf_policy);
if (!policy_dev)
return;
struct drivers_intel_dptf_config *config = policy_dev->chip_info;
struct drivers_intel_dptf_config *config = config_of(policy_dev);
uint16_t mchid = pci_s_read_config16(PCI_DEV(0, 0, 0), PCI_DEVICE_ID);