Add support for dynamic SST configuration change
- Implement the CurrentOperatingConfig getters to dynamically read
configuration via PECI. The approach is to read the value from
PECI for each D-Bus read. When the host is off, return "default"
values, and when the host is on but the read fails, return the last
read (cached) values.
- Implement the CurrentOperatingConfig setters to modify configuration
via PECI.
Tested:
- Change SST-PP profile and SST-BF flag via D-Bus properties, and
confirmed that host-side Linux tool shows changes.
- Change while host off and confirm it's rejected.
- Change while host booting and confirm it's rejected.
- Read configuration while host off and confirm last known values are
returned.
- Read configuration while host booting and confirm actual values are
returned.
- Change on ICX after host booted and confirm it's rejected.
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Change-Id: Ie6eed8ab23bff289e01d6d125402a5509d3a9110
diff --git a/tools/sst-info.sh b/tools/sst-info.sh
index 6005948..a1b15c8 100755
--- a/tools/sst-info.sh
+++ b/tools/sst-info.sh
@@ -4,6 +4,8 @@
# Simply searches for all objects implementing known interfaces and prints out
# the property values on those interfaces.
+set -e
+
BUSCTL='busctl'
XYZ='xyz.openbmc_project'
OBJECT_MAPPER="$XYZ.ObjectMapper /xyz/openbmc_project/object_mapper $XYZ.ObjectMapper"
@@ -46,26 +48,87 @@
$BUSCTL get-property $service $object $intf $prop
}
+set_property() {
+ service=$1
+ object=$2
+ intf=$3
+ prop=$4
+ signature=$5
+ value=$6
+ $BUSCTL set-property $service $object $intf $prop $signature $value
+}
-cpu_paths=$(get_sub_tree_paths "/" 1 "$CPU_INTF")
-for cpu_path in $cpu_paths
-do
- service=$(get_service_from_object $cpu_path 1 $CPU_INTF)
- echo "Found SST on $cpu_path on $service"
- for prop in $(get_property_names $service $cpu_path $CPU_INTF)
+show() {
+ cpu_paths=$(get_sub_tree_paths "/" 1 "$CPU_INTF")
+ for cpu_path in $cpu_paths
do
- echo " $prop: $(get_property $service $cpu_path $CPU_INTF $prop)"
- done
-
-
- profiles=$(get_sub_tree_paths "$cpu_path" 1 "$CONFIG_INTF")
- for profile in $profiles
- do
- echo
- echo " Found Profile $profile"
- for prop in $(get_property_names $service $profile $CONFIG_INTF)
+ service=$(get_service_from_object $cpu_path 1 $CPU_INTF)
+ echo "Found SST on $cpu_path on $service"
+ for prop in $(get_property_names $service $cpu_path $CPU_INTF)
do
- echo " $prop: $(get_property $service $profile $CONFIG_INTF $prop)"
+ echo " $prop: $(get_property $service $cpu_path $CPU_INTF $prop)"
+ done
+
+
+ profiles=$(get_sub_tree_paths "$cpu_path" 1 "$CONFIG_INTF")
+ for profile in $profiles
+ do
+ echo
+ echo " Found Profile $profile"
+ for prop in $(get_property_names $service $profile $CONFIG_INTF)
+ do
+ echo " $prop: $(get_property $service $profile $CONFIG_INTF $prop)"
+ done
done
done
-done
+}
+
+set_cpu_prop() {
+ cpu_basename=$1
+ prop=$2
+ signature=$3
+ value=$4
+
+
+ cpu_paths=$(get_sub_tree_paths "/" 1 "$CPU_INTF")
+ for cpu_path in $cpu_paths
+ do
+ if [[ $cpu_path != *$cpu_basename ]]
+ then
+ continue
+ fi
+
+ if [[ "$prop" == "AppliedConfig" ]]
+ then
+ value=$cpu_path/$value
+ fi
+
+ service=$(get_service_from_object $cpu_path 1 $CPU_INTF)
+ set_property $service $cpu_path $CPU_INTF $prop $signature $value
+ return 0
+ done
+
+ echo "$cpu_basename not found"
+ return 1
+}
+
+if [[ ${DEBUG:=0} -eq 1 ]]
+then
+ set -x
+fi
+
+action=${1:-show}
+
+case "$action" in
+ show) show ;;
+ set-config) set_cpu_prop $2 AppliedConfig o $3 ;;
+ set-bf) set_cpu_prop $2 BaseSpeedPriorityEnabled b $3 ;;
+ *)
+ echo "Usage:"
+ echo "$0 (show|set-config|set-bf) [ARGS...]"
+ echo ""
+ echo "show (Default action) - show info"
+ echo "set-config cpuN configM - Set applied operating config for cpuN to configM"
+ echo "set-bf cpuN val - Set SST-BF enablement for cpuN to val (boolean)"
+ ;;
+esac