Lines Matching +full:sub +full:- +full:bus
4 #for use by the phosphor-hwmon daemon. These configuration files
32 my $g_targetObj = Targets->new;
33 $g_targetObj->loadXML($serverwizFile);
45 sub getI2CSensors
48 my $connections = $g_targetObj->findConnections($bmc, "I2C");
52 for my $i2c (@{$connections->{CONN}}) {
54 my $chip = $i2c->{DEST_PARENT};
56 "unit-hwmon-feature",
68 $entry{name} = lc $g_targetObj->getInstanceName($chip);
79 sub removeUnusedHwmons
86 my $hwmon = $g_targetObj->getAttributeField($$units[$i],
89 my $name = $g_targetObj->getAttributeField($$units[$i],
104 sub getHwmonAttributes
112 my $hwmon = $g_targetObj->getAttributeField($unit,
117 my $name = $g_targetObj->getAttributeField($unit,
123 my $warnHigh = $g_targetObj->getAttributeField($unit,
130 my $warnLow = $g_targetObj->getAttributeField($unit,
137 my $critHigh = $g_targetObj->getAttributeField($unit,
144 my $critLow = $g_targetObj->getAttributeField($unit,
152 $entry->{hwmon} = { %hwmonFeatures };
158 #offset for the I2C bus the chip is on.
159 sub getI2CAttributes
165 my $addr = $g_targetObj->getAttribute($i2c->{DEST}, "I2C_ADDRESS");
167 $entry->{addr} = sprintf("%x", $addr);
171 if (!$g_targetObj->isBadAttribute($i2c->{SOURCE}, "REG_BASE_ADDRESS")) {
172 my $addr = $g_targetObj->getAttribute($i2c->{SOURCE},
174 $entry->{regBaseAddress} = sprintf("%x", hex($addr));
177 if (!$g_targetObj->isBadAttribute($i2c->{SOURCE}, "REG_OFFSET")) {
178 my $offset = $g_targetObj->getAttribute($i2c->{SOURCE},
180 $entry->{regOffset} = sprintf("%x", hex($offset));
186 sub makeConfFiles
201 # CRITHI_<feature> = <value> (e.g. CRITLO_temp1 = -1)
205 sub printConfFile
215 for my $feature (sort keys %{$entry->{hwmon}}) {
216 print $f "LABEL_$feature = \"$entry->{hwmon}{$feature}{label}\"\n";
219 if (exists $entry->{hwmon}{$feature}{warnhigh}) {
220 print $f "WARNHI_$feature = \"$entry->{hwmon}{$feature}{warnhigh}\"\n";
222 if (exists $entry->{hwmon}{$feature}{warnlow}) {
223 print $f "WARNLO_$feature = \"$entry->{hwmon}{$feature}{warnlow}\"\n";
225 if (exists $entry->{hwmon}{$feature}{crithigh}) {
226 print $f "CRITHI_$feature = \"$entry->{hwmon}{$feature}{crithigh}\"\n";
228 if (exists $entry->{hwmon}{$feature}{critlow}) {
229 print $f "CRITLO_$feature = \"$entry->{hwmon}{$feature}{critlow}\"\n";
238 sub getConfFilePath
242 my $mfgr = $g_targetObj->getAttribute($bmc, "MANUFACTURER");
260 #An example path is ahb/apb/i2c@1e78a000/i2c-bus@400/
261 sub getAspeedConfFilePath
266 if ($entry->{type} eq I2C_TYPE) {
269 if ((not exists $entry->{regBaseAddress}) ||
270 (not exists $entry->{regOffset})) {
275 $path = "$g_outputDir/ahb/apb/i2c\@$entry->{regBaseAddress}/i2c-bus@" .
276 "$entry->{regOffset}";
280 die "HWMON bus type $entry->{type} not implemented yet\n";
289 sub getConfFileName
292 return "$entry->{name}\@$entry->{addr}.conf";
296 sub printUsage
298 print "$0 -x [XML filename] -d [output base directory]\n";