path: root/control
Commit message (Collapse)AuthorAgeFilesLines
* Verify mode provided is supportedMatthew Barth2019-02-181-1/+11
| | | | | | | | | | | Before updating the current mode, verify that the mode provided by the end-user is in the list of modes that are supported. Tested: Only supported modes can be set as the current mode Change-Id: Ie21839b6bf7245756fedf417e143c28bc9da32f1 Signed-off-by: Matthew Barth <>
* Initially use default current mode upon restoringMatthew Barth2019-02-181-2/+2
| | | | | | | | | | | | | | | | When restoring the persisted current mode, initially set the current mode to what's already provided. When no interface is defined within the zone yaml, a default value of "Default" is already set on the Control.ThermalMode interface. If an interface is provided on the zone yaml, and the Current property is initialized to a value, use this value initially upon restoring. During the restore, this value could change to what was persisted. Tested: Current mode is set correctly upon initialization & restore Change-Id: I0fae247303903d85e95fc044c96fc1809df2fa03 Signed-off-by: Matthew Barth <>
* Current mode set as uppercaseMatthew Barth2019-02-181-3/+6
| | | | | | | | | | | | Always set the current thermal control mode in uppercase to handle case insensitive modes given since it would be something possibly set by the end-user. Tested: Current mode always set in uppercase Change-Id: Ie159de24f5f9b4dd5651a9411f7b176501c4846a Signed-off-by: Matthew Barth <>
* Fix: srcrev bump 4b258ac8b6..7883f58ab2Matthew Barth2019-02-181-0/+1
| | | | | | | | | | Add missed python variable initialization causing srcrev bump fail Failed srcrev bump: Change-Id: I0d7d4647abe3c2f46cabfebf6be5ab500641f504 Signed-off-by: Matthew Barth <>
* Parse and generate zone interfacesMatthew Barth2019-02-142-0/+187
| | | | | | | | | | Interfaces can optionally be defined on each zone to include setting properties under those interfaces when fan control initializes the zone. Setting the property values here allows them to be initialized to a default value or set of values. Change-Id: I75d51a05caa9e5662a0608d285fd388acc8593e2 Signed-off-by: Matthew Barth <>
* Add framework to set properties on a zoneMatthew Barth2019-02-144-2/+44
| | | | | | | | | | | Properties hosted by a zone object need the ability to be set upon zone initialization. This adds support to allow the zone configuration yaml to contain what properties to set and with what values on a zone. The parser updates to generate what uses this framework is in a followup commit. Change-Id: I9fd93746cc097f05869400451daff03cf3ef89b7 Signed-off-by: Matthew Barth <>
* Use zone object's path attributeMatthew Barth2019-02-131-7/+2
| | | | | | | | A zone's object path is set when the zone is created and available to be used instead of determining the zone's object path each time. Change-Id: Iddfebd1545bb49054d95f8c19a71b2fbf9c2f592 Signed-off-by: Matthew Barth <>
* Update parser for properties on zone objectsMatthew Barth2019-02-133-14/+34
| | | | | | | | | | | | | | | | Create a service attribute that can be optionally defined on a group denoting what service is hosting the group members. Initially, defining a service name generates the group member(s) to be zone objects only. This service attribute will be enhanced to specifically note what service provides the group members and allow for a better trigger for properties on zone objects instead of generating a blank signal match. Tested: Blank signal match generated for group members in events used Change-Id: I483fcf6a5e210e5d70bc9d5c4c0dee15524b01b9 Signed-off-by: Matthew Barth <>
* Trigger current mode property change eventsMatthew Barth2019-02-131-1/+11
| | | | | | | | | | | | | | Each time the current mode property changes, handle the event similarly to other event signal triggers substituting with a null message. When the handler receives a null message, the property's value that triggered the event is retrieved whether from the zone object or from dbus. Tested: Triggered the use of alternative events based on thermal control mode property state Change-Id: Ibc663c3721c331393250bd32bda0d45cf0214f12 Signed-off-by: Matthew Barth <>
* Store and access zone object propertiesMatthew Barth2019-02-133-8/+99
| | | | | | | | | | | | | | | | | | Properties on the zone object require their event data to be stored for retrieval when their value changes, which allows the use of the current event handlers to update the cached value and trigger the event actions. When any event is initialized, any signals where the match string is empty performs a lookup for each group member to determine if they are on the zone object. Each member found to be on the zone object is then stored with the that event's data. Tested: Verified event data is stored for members on the zone object Verified event initialization correctly accesses zone object member's event data Change-Id: Id34f60eb12330428eeb1041de4e9bd1a4a686f21 Signed-off-by: Matthew Barth <>
* Override setting Current mode propertyMatthew Barth2019-02-132-0/+21
| | | | | | | When the Current mode property changes, the persisted value is updated. Change-Id: I319fbe2afb8112f7425dc0a1d765fe8f1c408bae Signed-off-by: Matthew Barth <>
* Restore current mode propertyMatthew Barth2019-02-132-1/+35
| | | | | | | | | | When the fan control zone is created, the current mode property is restored from persistent storage. If the persistent storage file does not exist or fails to be read, the current mode property is set to default. Change-Id: I5ba699f9b6683aea4f39444eace8c7d19a22c92d Signed-off-by: Matthew Barth <>
* Persist current mode property frameworkMatthew Barth2019-02-132-0/+23
| | | | | | | | Add the ability to save the current mode property value to persisted storage. Change-Id: I354fce7c11a61871a49c9b205dc79ee598f8b1c8 Signed-off-by: Matthew Barth <>
* Add thermal control interface to zone objectsMatthew Barth2019-02-135-5/+43
| | | | | | | | | | | | | When in control mode, the thermal control interface and mode property are added to each zone object. The object path for each zone consists of the configured object path plus the zone number. Ex) /xyz/openbmc_project/control/thermal/0 Tested: After fan control is started in control mode, dbus interface exists Change-Id: I88578a7e0eb7c730ffaa4cfc10989e280dc1d46d Signed-off-by: Matthew Barth <>
* Fan control dbus busname and object pathMatthew Barth2019-02-051-0/+2
| | | | | | | | | | | | Add fan control's default dbus busname and object path to use or what's provided thru configure. The fan control manager requests the busname after all the zones are created. Tested: Found the requested busname for a zone in the busctl list Change-Id: I8ee1e9e4094dcec958e8ae81ad4299357b8f792d Signed-off-by: Matthew Barth <>
* libfan: RemoveWilliam A. Kennington III2019-02-051-1/+0
| | | | | | | | | | | | | Since the removal of the custom timer implementation our libfan has nothing but a single header file. Since we have no object code left we do not need a library to contain this code since the header is directly included where needed. Tested: Built and run through unit tests. Change-Id: I139b83ab979ead88cfd4c180ba8847a29c6407e2 Signed-off-by: William A. Kennington III <>
* Remove timer in favor of sdeventplus/utility/timerWilliam A. Kennington III2019-02-054-40/+33
| | | | | | | | | | | This removes the custom timer implementation and moves to the sdeventplus utility. Functionally this should make no change Tested: Built and run through the unit test suite. Change-Id: Ib7ee90d489d5db72496aaaca91c3cf5490ad47d6 Signed-off-by: William A. Kennington III <>
* Parser updates to support alternate events actionMatthew Barth2019-01-251-4/+94
| | | | | | | | | | | | | | | With the use alternate events action, the ability to generate an event type is required within the parser. This action requires two separate lists of events to be generated and to generate the event code, it was necessary to add what code is generated for each section that comprises an event to the parser directly. Tested: Updated events yaml with an event to use the alternate events action Verified the generated code builds and runs on wspoon Change-Id: I2078610222b0ae0f7fdbcf348e5c9ff02c4108b6 Signed-off-by: Matthew Barth <>
* Add alternate events actionMatthew Barth2019-01-251-0/+72
| | | | | | | | | | | | | | | | | | | The alternate events action uses a group of properties to determine whether a default set of events should be used or an alternate set of events should be used. When any of the members of the group do not match the given property state, the default set of events are used. Once all members of the group match the given state, the alternate set of events are used. Each time the events used are to change, the current set of events are removed prior to loading the replacement set of events. Tested: Used the 'WaterCooled' property to trigger using the default or alternate floor speed events. Verified fan control memory usage doesnt grow by doing multiple event switching. Change-Id: Ib8a4b835bf370894c572ccfa8fdc5a4479ef570f Signed-off-by: Matthew Barth <>
* control: manager: Avoid the need for fconceptsBrad Bishop2018-11-281-1/+1
| | | | | | | | | | | Use of auto in a function parameter list is supported in c++17 but gcc8 requires enabling concepts TS support. We don't require a template anyway - just be explicit here and avoid the need for -fconcepts until such a time that other concepts TS features are required. Change-Id: Iec6205a2e4da41aeb5840dd9942778ba0f373842 Signed-off-by: Brad Bishop <>
* std::variant: Apply missing fixupWilliam A. Kennington III2018-11-271-2/+4
| | | | | | | | This code is not compiled during the unit test run. The issue was noticed trying to integrate into a real openbmc build. Change-Id: I30b7afaf722b1a14e5ac3d5e93e13b59db48be7a Signed-off-by: William A. Kennington III <>
* control/zone: Fix missing cassert includeWilliam A. Kennington III2018-11-121-0/+1
| | | | | | | | | This was relying on sdbusplus to provide a transitive include for <cassert>. Since we are directly using the assert() call we should include <cassert> ourselves. Change-Id: I095af26c7a589ab337facc6ac2d0c4983a0f0c2c Signed-off-by: William A. Kennington III <>
* control: Add interface when not in service cacheMatthew Barth2018-11-091-2/+7
| | | | | | | | | | | | | | | | | | When a service is cached, each interface it hosts is added to a list. In the case where an object path given to fan control is never found, a service lookup is performed on this path causing its given interface to be added. This fixes that interface from continuously being added in the case that the object path is attempted to be accessed continuously from dbus. Resolves openbmc/phosphor-fan-presence#12 Tested: Added & removed events containing object paths that dont exist, interface list remains the same size. Change-Id: Id034e7829566979c196cb9901cbea287ddab78d4 Signed-off-by: Matthew Barth <>
* Rebase correction (timerPos -> timerConfPos)Matthew Barth2018-11-061-1/+1
| | | | | Change-Id: I5ab5adcc22f044b3cf0955082061c67f2a281307 Signed-off-by: Matthew Barth <>
* control/zone: Use const references when iteratingWilliam A. Kennington III2018-11-061-1/+1
| | | | | | | | | | | We don't want to copy the object out of the container we are iterating over. Tested: Built and run through unit tests. Change-Id: I68b041f98e1c6a6a9dbc59448b629e1d22ba62c9 Signed-off-by: William A. Kennington III <>
* Remove all signals when an event is removedMatthew Barth2018-11-062-37/+93
| | | | | | | | | | | | | | Each event could have multiple signals associated and when the event is removed, all of those signals should also be removed. This ensures no dangling signals remain after an event is removed from be processed by fan control Tested: The total number of signals subscribed are reduced by the same number of signals of a removed event Change-Id: I651f70dbe6aed9c7eef06aff4eac9eae7ad89d77 Signed-off-by: Matthew Barth <>
* Prefer bind over method call in lambdaWilliam A. Kennington III2018-11-051-2/+3
| | | | | | | | | | | | | This reduces a layer of indirection since the function can be called directly instead of indirectly accessing it with the lambda. It also makes the instantiation more flexible since it can match callbacks with extra arguments. Tested: Built and run through unit tests. Change-Id: I5317203fa70c027c5e774ed6192952058e35bd81 Signed-off-by: William A. Kennington III <>
* control/zone: Reference instead of copying timer dataWilliam A. Kennington III2018-11-052-3/+8
| | | | | | | | Tested: Built and ran through unit tests. Change-Id: I9a98d9a3eaee47885b18b642ffd01a38a864dd02 Signed-off-by: William A. Kennington III <>
* control/zone: Refactor addTimerWilliam A. Kennington III2018-11-053-55/+33
| | | | | | | | | | | | Anything adding a timer uses roughly the same process of building the event data and timer from the event group, actions, and timer config. We can adjust the method to do this for all callers. Tested: Builds and passes unit tests. Change-Id: I4013ff2f7bff65095a6e1db7075bc013da374f51 Signed-off-by: William A. Kennington III <>
* control: Rename Timer -> TimerConfWilliam A. Kennington III2018-10-317-13/+14
| | | | | | | | | | | | It is confusing to read some of the type definitions that deal with timers when Timer could mean a timer instantiation or a set of timer configuration parameters. This change disambiguates the two types. Tested: Built and run through unit tests. Change-Id: I9dd6b47886747d56a86b6a50eb9a74a331d0a1fe Signed-off-by: William A. Kennington III <>
* control: Alias TimerType locallyWilliam A. Kennington III2018-10-313-8/+7
| | | | | | | | | | | This is needed for a future commit that removes the local phosphor::util::Timer implementation. Tested: Built and run through unit tests. Change-Id: I8ea3399fec8761055d4a0d94fb9ea91fd34040ea Signed-off-by: William A. Kennington III <>
* Switch sd_event loops to sdeventplusWilliam A. Kennington III2018-10-297-41/+28
| | | | | | | | | This change is mostly focused around plumbing the sdeventplus::Event object everywhere and using the member functions provided for the event. No migration to the timer utility is performed yet. Change-Id: I912ab82bc081239d3b7c3cf7c5caca6742ef9c87 Signed-off-by: William A. Kennington III <>
* Fix exit status codesWilliam A. Kennington III2018-10-193-7/+7
| | | | | | | | | | Using an exit status of -1 everywhere leads to the status being converted to 255 when output to a calling application. While this does signify an error it has a reserved meaning for exit status out of range. Lets use a valid general exit status of 1 instead. Change-Id: I326701c78985e34c430c258fe31d9e910da10405 Signed-off-by: William A. Kennington III <>
* Add -flto to CXXFLAGSAndrew Geissler2018-08-271-1/+2
| | | | | | | | | | Per openbmc/openbmc#3364, adding -flto to CXX flags in order to reduce overall library and binary sizes. Ref: Change-Id: I3ee31a15fc0ded4308aa9d00a11b41bc62eb9799 Signed-off-by: Andrew Geissler <>
* Handle SdBusError exceptionsMatthew Barth2018-07-172-8/+25
| | | | | | | | | | When the SdBusError exception was added, all sdbusplus::bus::call function use required this exception be handled appropriately in each case where it could occur. These changes are the result of handling the possibility of this exception correctly within the fan applications. Change-Id: I6ecef3008412b299a4fedbb13716f656cfbf1a90 Signed-off-by: Matthew Barth <>
* Use setProperty function in fan set speedMatthew Barth2018-05-171-25/+8
| | | | | | | | | | | | | | | | When a fan's target speed is set, using the setProperty function allows for better handling of dbus failures setting the fan target property. If a failure occurs setting this property, a journal entry is created and a DBusPropertyError exception is thrown to allow the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: Fan control application logs an error to the journal and then terminates when a dbus error occurs setting a fan target speed. Change-Id: Ibd4bd8b18b6010727831d97e32c14fd6c681e170 Signed-off-by: Matthew Barth <>
* Throw DBusPropertyError for all property accessesMatthew Barth2018-05-171-0/+8
| | | | | | | | | | | | | On all get/set property functions, when an error occurs performing the access of a property, throw a DBusPropertyError exception containing the identifying parameters of the property. Tested: DBusPropertyError exception occurs on failing to set a property DBusPropertyError exception occurs on failing to get a property Change-Id: I9882d62d75153b4320a8d4a21ba7a52efbdd0af2 Signed-off-by: Matthew Barth <>
* perf: Cache service name for fan target sensorsMatthew Barth2018-05-172-30/+14
| | | | | | | | | | | Cache the service name for each fan target sensor path and use that service when a new target speed is set on the Target property. Tested: Fan target sensor created and set speed functions the same Change-Id: I3e25e355cf5d31ce814a73c801c6f086fa45531a Signed-off-by: Matthew Barth <>
* Use shared callMethod function in control managerMatthew Barth2018-05-172-25/+8
| | | | | | | | | | | | | To better handle exit/restart of the fan control application use the shared callMethod function to call systemd's startunit on the fan control ready target. This allows the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: StartUnit on fan control ready target works the same Change-Id: Idce2d8831b4e8de0ef181a0849587e465419f68c Signed-off-by: Matthew Barth <>
* Use shared getProperty function in control managerMatthew Barth2018-05-171-51/+7
| | | | | | | | | | | | When the manager checks a getProperty condition for fan control, it should use the shared getProperty function that now returns a DbusMethodError to better exit/restart the fan control application. Tested: Condition check functions the same Change-Id: I37f83ef4273343bd527ac149ac5eee213d0ad63d Signed-off-by: Matthew Barth <>
* perf: Count state of properties before set speedMatthew Barth2018-05-171-18/+19
| | | | | | | | | | | | Once the number of properties at a given state are at/above the given number allowed, set the fan speed and stop checking the remaining properties. Tested: Action function results are unchanged Change-Id: Icfd347703c973b12f4b7806ea1ba84056f987253 Signed-off-by: Matthew Barth <>
* Enhance precondition function and tracingMatthew Barth2018-05-161-3/+12
| | | | | | | | | | | | | | | | Replace count_if with all_of in the property states match precondition to stop iterating over the group members once a property state does not match. Include additional debug tracing when the precondition passes and fails to help in determining where the precondition causes fans to be at full speed. Tested: Verify debug traces align with precondition state Change-Id: I1c3d8f096a645ac3bfcdfb7b9197682cf7ca52a0 Signed-off-by: Matthew Barth <>
* Move generated code template to fileMatthew Barth2018-05-113-234/+251
| | | | | | | | | | | | | | In preparation of enhancing the generated code format, the template used has been externalized and will continue to be modified in future commits to parse & generate more efficiently. Tested: Generated code remains unchanged Resolves openbmc/phosphor-fan-presence#8 Change-Id: Ifbf718e8a22acb2f2f939bbdcc2e7fe041e9ed58 Signed-off-by: Matthew Barth <>
* Remove property change traceMatthew Barth2018-05-091-5/+0
| | | | | | | | | | | | | | Fan control is required to be configured for all possible temperature sensors within a machine type, however not every configuration of that machine type contains all of those sensors. The trace removed here was filling the journal with unnecessary entries for sensors that are expected to not be present. Tested: Journal entry is not longer traced Change-Id: Iccb85ae7e9463ee03522ce4efde6410ed14a76ca Signed-off-by: Matthew Barth <>
* Throw custom exceptions on D-Bus method failuresMatt Spinler2018-05-094-20/+36
| | | | | | | | | | | | | | | | | | | | | All 3 fan applications - control, monitor, and presence have cases where it is expected that a getProperty call may fail because a sensor is missing. While the applications already handle this, the InternalFailure exception that was being thrown by the underlying call generates log entries that make it look like something bad happened. The custom exceptions now being thrown do not log anything on creation, but store all of the failing information so that any callers could still log the info if they wanted to. Tested: Boot a water cooled Witherspoon and see the fan presence and monitor applications not look like they are failing. Boot a system without the fan hwmon running, and see fan-control-init still show the fails. Change-Id: Ifd8ad6e3deb492bbaf33f12c7258125dce1e5ea8 Signed-off-by: Matt Spinler <>
* Rename remove object interface functionMatthew Barth2018-04-122-3/+3
| | | | | | | | | | Update the removeObjIntf function name to removeObjectInterface. This was requested per a review comment. Tested: N/A Change-Id: I52589724685bb5b8d92d3da22072b63b43f69a01 Signed-off-by: Matthew Barth <>
* Generate InterfacesRemoved signal eventsMatthew Barth2018-03-301-4/+12
| | | | | | | | | | | | | | | | | | | | In the case that an interface containing a property used within an event is removed from dbus, that event can subscribe to the InterfacesRemoved signal. When an InterfacesRemoved signal is received by fan control, the corresponding interface (and all associated properties) is removed from the cache used by all events. *Note: This area of signal subscription/handling code generation is intended to be re-worked under openbmc/openbmc#2911. This is the reason for supporting a different yaml layout for the InterfacesRemoved signal. Tested: Generated code constructs InterfacesRemoved signals correctly Resolves openbmc/openbmc#2223 Change-Id: Idc3e8db4e7dc07a2bb6898d3cc30ab775362dd35 Signed-off-by: Matthew Barth <>
* Add InterfacesRemoved signal handlingMatthew Barth2018-03-304-0/+129
| | | | | | | | | | | | | | | When an InterfacesRemoved signal is received for a subscribed object path, each interface returned is checked against the interface which was defined for each object on the event. When these are equal, the interface (and all associated properties) are removed from the shared cache of event properties. Tested: Manually added an InterfacesRemoved signal Verified interface was removed from object path in cache Change-Id: I348d82f14e0cfba2b18a81a9f54c6cb06b586797 Signed-off-by: Matthew Barth <>
* Minimize service name mapper lookupsMatthew Barth2018-03-122-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Retrieve the service names from the cached dataset within the zone for a path and interface, updating the cache when not found. This is used when initializing property values and service name owners. Additional performance enhancements to use `GetSubTree` prior to processing a set speed event will be included under openbmc/openbmc#2911. This will keep unnecessary `GetSubTree` lookups from occurring for paths/interfaces that don't exist to further improve upon initializing properties fan control is defined to use. Tested: First path updates service name cache for all paths sharing the same interface First missing interface on a path updates service name cache for all paths sharing that interface Verify mapper lookups for X number of paths sharing the same interface is reduced to (X-(X-1)) NameOwnerChanged events read/update the same set of service name cache Change-Id: Ia235b36ba5ae8cda38342d7521f3d87080c2970a Signed-off-by: Matthew Barth <>
* Cache service names for paths and interfacesMatthew Barth2018-03-122-0/+122
| | | | | | | | | | | | | | | | To lookup a service name for a given path and interface, use GetSubTree to retrieve all the service names from the root path for the interface and add each entry to a cached dataset. Tested: Check that a missing interface's service is added Check that a missing path that exists has its service added Inspect all missing paths for an interface are added Inspect missing interfaces are added to existing service Returned service name matches the service for a path/interface Change-Id: I6db05479e825350198896b2e237882f7ebc58d51 Signed-off-by: Matthew Barth <>
OpenPOWER on IntegriCloud