From 4aba7395b705725c5e441cce2fd269e734994939 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Mon, 20 Sep 2021 10:51:45 -0700 Subject: [PATCH] mb/google/brya: Switch to using device pointers using alias names This change replaces the device tree walks with device pointers by adding alias for dptf_policy generic device in the tree. Change-Id: I8fd5476a9cea84ab8b2678167b3e0504eecacf6c Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/57739 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Tim Wawrzynczak --- .../google/brya/variants/baseboard/brya/ramstage.c | 10 +++------- .../google/brya/variants/brya0/overridetree.cb | 2 +- .../google/brya/variants/gimble/overridetree.cb | 2 +- .../google/brya/variants/kano/overridetree.cb | 2 +- .../google/brya/variants/primus/overridetree.cb | 2 +- .../google/brya/variants/redrix/overridetree.cb | 2 +- 6 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/mainboard/google/brya/variants/baseboard/brya/ramstage.c b/src/mainboard/google/brya/variants/baseboard/brya/ramstage.c index 46e73a5ff1..1328213e29 100644 --- a/src/mainboard/google/brya/variants/baseboard/brya/ramstage.c +++ b/src/mainboard/google/brya/variants/baseboard/brya/ramstage.c @@ -11,18 +11,14 @@ #define MILLIWATTS_TO_WATTS 1000 +WEAK_DEV_PTR(dptf_policy); + void variant_update_power_limits(const struct cpu_power_limits *limits, size_t num_entries) { if (!num_entries) return; - 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; diff --git a/src/mainboard/google/brya/variants/brya0/overridetree.cb b/src/mainboard/google/brya/variants/brya0/overridetree.cb index d032a047b9..41d1018727 100644 --- a/src/mainboard/google/brya/variants/brya0/overridetree.cb +++ b/src/mainboard/google/brya/variants/brya0/overridetree.cb @@ -137,7 +137,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 diff --git a/src/mainboard/google/brya/variants/gimble/overridetree.cb b/src/mainboard/google/brya/variants/gimble/overridetree.cb index b20524a5bc..c2949c4877 100644 --- a/src/mainboard/google/brya/variants/gimble/overridetree.cb +++ b/src/mainboard/google/brya/variants/gimble/overridetree.cb @@ -72,7 +72,7 @@ chip soc/intel/alderlake [2] = { 16, 1000 }, [3] = { 8, 500 } }" - device generic 0 on end + device generic 0 alias dptf_policy on end end end device ref cnvi_wifi on diff --git a/src/mainboard/google/brya/variants/kano/overridetree.cb b/src/mainboard/google/brya/variants/kano/overridetree.cb index 5fc0c6b3a6..e6da3bbaf4 100644 --- a/src/mainboard/google/brya/variants/kano/overridetree.cb +++ b/src/mainboard/google/brya/variants/kano/overridetree.cb @@ -100,7 +100,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 diff --git a/src/mainboard/google/brya/variants/primus/overridetree.cb b/src/mainboard/google/brya/variants/primus/overridetree.cb index 8f4549534d..21be1c8073 100644 --- a/src/mainboard/google/brya/variants/primus/overridetree.cb +++ b/src/mainboard/google/brya/variants/primus/overridetree.cb @@ -107,7 +107,7 @@ chip soc/intel/alderlake [2] = { 16, 1000 }, [3] = { 8, 500 } }" - device generic 0 on end + device generic 0 alias dptf_policy on end end end device ref cnvi_wifi on diff --git a/src/mainboard/google/brya/variants/redrix/overridetree.cb b/src/mainboard/google/brya/variants/redrix/overridetree.cb index b87e4c4082..dbe71860c2 100644 --- a/src/mainboard/google/brya/variants/redrix/overridetree.cb +++ b/src/mainboard/google/brya/variants/redrix/overridetree.cb @@ -113,7 +113,7 @@ chip soc/intel/alderlake [2] = { 16, 1000 }, [3] = { 8, 500 } }" - device generic 0 on end + device generic 0 alias dptf_policy on end end end device ref ipu on