1#!/bin/sh 2 3# Utility to print all SST data present on D-Bus. 4# Simply searches for all objects implementing known interfaces and prints out 5# the property values on those interfaces. 6 7BUSCTL='busctl' 8XYZ='xyz.openbmc_project' 9OBJECT_MAPPER="$XYZ.ObjectMapper /xyz/openbmc_project/object_mapper $XYZ.ObjectMapper" 10CPU_INTF="$XYZ.Control.Processor.CurrentOperatingConfig" 11CONFIG_INTF="$XYZ.Inventory.Item.Cpu.OperatingConfig" 12 13trim_quotes() { 14 trim_obj=${1%\"} 15 trim_obj=${trim_obj#\"} 16 echo $trim_obj 17} 18 19get_sub_tree_paths() { 20 resp=$($BUSCTL call $OBJECT_MAPPER GetSubTreePaths sias "$1" 0 "$2" "$3" \ 21 | cut -d' ' -f3-) 22 for obj in $resp 23 do 24 trim_quotes $obj 25 done 26} 27 28get_service_from_object() { 29 trim_quotes $($BUSCTL call $OBJECT_MAPPER GetObject sas "$1" "$2" "$3" \ 30 | cut -d' ' -f3) 31} 32 33get_property_names() { 34 service=$1 35 object=$2 36 intf=$3 37 $BUSCTL introspect $service $object $intf \ 38 | awk '/property/ {print substr($1, 2)}' 39} 40 41get_property() { 42 service=$1 43 object=$2 44 intf=$3 45 prop=$4 46 $BUSCTL get-property $service $object $intf $prop 47} 48 49 50cpu_paths=$(get_sub_tree_paths "/" 1 "$CPU_INTF") 51for cpu_path in $cpu_paths 52do 53 service=$(get_service_from_object $cpu_path 1 $CPU_INTF) 54 echo "Found SST on $cpu_path on $service" 55 for prop in $(get_property_names $service $cpu_path $CPU_INTF) 56 do 57 echo " $prop: $(get_property $service $cpu_path $CPU_INTF $prop)" 58 done 59 60 61 profiles=$(get_sub_tree_paths "$cpu_path" 1 "$CONFIG_INTF") 62 for profile in $profiles 63 do 64 echo 65 echo " Found Profile $profile" 66 for prop in $(get_property_names $service $profile $CONFIG_INTF) 67 do 68 echo " $prop: $(get_property $service $profile $CONFIG_INTF $prop)" 69 done 70 done 71done 72