<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div>On August 21, 2020, Mike Jones wrote:</div>>I am trying to understand how the Server power button in the webui<br>>works.<br>><br>>As before, using raspberry pi, and I’ll leave project links at the<br>>end for anyone that wants to use them. Things work up to monitoring<br>>voltages. Note the conf project has a phosphor branch for the full<br>>monty.>>To reverse engineer, I setup: dbus-monitor —system > someFile.log<br>><br>>There is a message for systemd1.Manager; member=StartUnit and best I<br>>can tell, somehow this gets routed to systemd to start some service<br>>or run some exe. I see this mentioned in the dbus transactions:<br>><br>>"<a href="mailto:obmc-host-start@0.target" target="_blank">obmc-host-start@0.target</a>”<br>><br>>And that is in /lib/systemd/system and depends<br>>on <a href="mailto:obmc-host-startmin@0.target" target="_blank">obmc-host-startmin@0.target</a>, but that does not depend on any<br>>service. So that is a dead end. It also depends on a reboot attempts,<br>>but I think that is not responsible for power on/off.<br>><br>>Then there are chassis services, but I cannot find a link from<br>><a href="mailto:obmc-host-start@0.target" target="_blank">obmc-host-start@0.target</a> to <a href="mailto:objc-chassis-poweron@0.target" target="_blank">objc-chassis-poweron@0.target</a>.<br><div><br></div><div><br></div><div><br></div><div>></div>>In this<br>>doc: <a href="https://github.com/openbmc/docs/blob/master/architecture/openbmc" target="_blank">https://github.com/openbmc/docs/blob/master/architecture/openbmc</a><br>>-systemd.md<br>><br>>It shows:<br>><br>><br>>ls -1 /lib/systemd/system/obmc-chassis-poweron\@0.target.requires/<br>><a href="mailto:op-power-start@0.service" target="_blank">op-power-start@0.service</a> <a href="mailto:op-wait-power-on@0.service" target="_blank">op-wait-power-on@0.service</a>>>But when I “ls” that path, the above dependencies are not there.<br>>There is only a dependency on <a href="mailto:phosphor-fan-presence-tach@0.service" target="_blank">phosphor-fan-presence-tach@0.service</a><br>><br>>There is some state service that lead to things with xzy paths, and I<br>>eventually found /run/systemd/units. These have file names starting<br>>with “invocation” in the names and link to GUID like nodes that don’t<br>>“cat” like a normal file. So I am not sure how those work. Is there<br>>some kernel driver that works like sysfs so that these nodes are not<br>>traditional files?<br>><br>>What I am trying to understand is two things:<br>><br>>- Interaction with the power regulator<br>>- Interaction with the host cpu<br>><br>>So my hope is someone can connect the dots of the path from the dbus<br>>to systemd through the targets to a service executable doing the work<br>>so I can try to replace them with:<br>><br>>- Something that turns the regulators on/off, with pmbus in this<br>>case.<br>>- Something that can behave like a host to keep the system happy like<br>>a real system.<br><div><br></div><div><div><br></div><div><div><br></div><div>Hi.  There is some design documentation here</div><div><br></div><div><a href="https://github.com/openbmc/docs/blob/master/designs/state-management-and-external-interfaces.md" target="_blank">https://github.com/openbmc/docs/blob/master/designs/state-management-and-external-interfaces.md</a></div><div><br></div><div>and that links to phosphor-state-manager which has a lot of the units <br></div><div>that kick off power and state transitions.</div><div><br></div><div><br></div><div>The op-power-start are for systems following the OpenPOWER reference <br></div><div>designs.  The regulators are sequenced by an external microcontroller <br></div><div>based on the state of a POWER_ON gpio from the BMC and a return <br></div><div>PGOOD to indicate the state.  There are also other op- prefixed units that <br></div><div>initiate the host processor initialization (after the units check that fans are <br></div><div>running as you found).  <br></div></div><div><br></div><div>There is also a watchdog that is started when the host is started and <br></div><div>pinged and stopped via IPMI.</div><div><br></div><div>If you are prototyping for a x86 system, there are alternative <br></div><div>power implementations where the gpio toggles to represent a <br></div><div>main power button push and their start cpu sequences.  I think <br></div><div>there are also arm systems but don't know what they are using <br></div><div>for host interaction.</div><div><br></div><div>I hope this advances your investigation and learning.</div><div><br></div><div>milton<br></div></div><div><br></div><div>></div>>Mike<br>><br>>My repos<br>>——————<br>><br>><a href="https://github.com/Proclivis/meta-pmbus-raspberrypi.git" target="_blank">https://github.com/Proclivis/meta-pmbus-raspberrypi.git</a><br>><a href="https://github.com/Proclivis/meta-pmbus-phosphor.git" target="_blank">https://github.com/Proclivis/meta-pmbus-phosphor.git</a><br>><a href="https://github.com/Proclivis/conf-openbmc-adi.git" target="_blank">https://github.com/Proclivis/conf-openbmc-adi.git</a><br>><br>>The monitor messages for StartUnit<br>>———<br>><br>>method call time=1598039669.247458 sender=:1.48 -><br>>destination=org.freedesktop.systemd1 serial=33<br>>path=/org/freedesktop/systemd1;<br>>interface=org.freedesktop.systemd1.Manager; member=StartUnit<br>>   string "<a href="mailto:obmc-host-start@0.target" target="_blank">obmc-host-start@0.target</a>"<br>>   string "replace"<br>>method call time=1598039669.276170 sender=:1.3 -><br>>destination=org.freedesktop.DBus serial=775<br>>path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;<br>>member=GetConnectionUnixUser<br>>   string ":1.48"<br>>method return time=1598039669.276234 sender=org.freedesktop.DBus -><br>>destination=:1.3 serial=4294967295 reply_serial=775<br>>   uint32 0<br>>method call time=1598039669.280376 sender=:1.3 -><br>>destination=org.freedesktop.DBus serial=776<br>>path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;<br>>member=AddMatch<br>>   string<br>>"type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/D<br>>Bus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=<br>>':1.48'"<br>>method return time=1598039669.280661 sender=org.freedesktop.DBus -><br>>destination=:1.3 serial=4294967295 reply_serial=776<br>>method call time=1598039669.280701 sender=:1.3 -><br>>destination=org.freedesktop.DBus serial=777<br>>path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;<br>>member=GetNameOwner<br>>   string ":1.48"<br>>method return time=1598039669.280738 sender=org.freedesktop.DBus -><br>>destination=:1.3 serial=4294967295 reply_serial=777<br>>   string ":1.48"<br>>signal time=1598039669.280774 sender=:1.3 -> destination=(null<br>>destination) serial=778 path=/org/freedesktop/systemd1;<br>>interface=org.freedesktop.systemd1.Manager; member=UnitNew<br>>   string "<a href="mailto:obmc-host-start@0.target" target="_blank">obmc-host-start@0.target</a>"<br>>   object path<br>>"/org/freedesktop/systemd1/unit/obmc_2dhost_2dstart_400_2etarget"<br>>signal time=1598039669.280823 sender=:1.3 -> destination=(null<br>>destination) serial=779 path=/org/freedesktop/systemd1;<br>>interface=org.freedesktop.systemd1.Manager; member=JobNew<br>>   uint32 1105<br>>   object path "/org/freedesktop/systemd1/job/1105"<br>>   string "<a href="mailto:obmc-host-start@0.target" target="_blank">obmc-host-start@0.target</a>"<br>>method return time=1598039669.280883 sender=:1.3 -> destination=:1.48<br>>serial=780 reply_serial=33<br>>   object path "/org/freedesktop/systemd1/job/1105"<br>>signal time=1598039669.281305 sender=:1.48 -> destination=(null<br>>destination) serial=34 path=/xyz/openbmc_project/state/host0;<br>>interface=org.freedesktop.DBus.Properties; member=PropertiesChanged<br>>   string "xyz.openbmc_project.State.Host"<br>>   array [<br>>      dict entry(<br>>         string "RequestedHostTransition"<br>>         variant             string<br>>"xyz.openbmc_project.State.Host.Transition.On"<br>>      )<br>>   ]<br>>   array [<br>>   ]</font><BR>