summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Rebase correction (timerPos -> timerConfPos)Matthew Barth2018-11-061-1/+1
| | | | | Change-Id: I5ab5adcc22f044b3cf0955082061c67f2a281307 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* 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 <wak@google.com>
* 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 <msbarth@us.ibm.com>
* Prefer bind over method call in lambdaWilliam A. Kennington III2018-11-052-3/+5
| | | | | | | | | | | | | 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 <wak@google.com>
* 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 <wak@google.com>
* 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 <wak@google.com>
* 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 <wak@google.com>
* 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 <wak@google.com>
* Switch sd_event loops to sdeventplusWilliam A. Kennington III2018-10-2924-166/+99
| | | | | | | | | 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 <wak@google.com>
* gitignore: add libtoolPatrick Venture2018-10-241-0/+2
| | | | | | | Add libtool artifact to gitignore. Change-Id: Ie283f97cc0d714be89ebed420f439322cda653b1 Signed-off-by: Patrick Venture <venture@google.com>
* Fix exit status codesWilliam A. Kennington III2018-10-199-20/+18
| | | | | | | | | | 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 <wak@google.com>
* Makefile: Fix library compile flagsWilliam A. Kennington III2018-10-191-0/+4
| | | | | | | | We are missing flags for compiling against dependencies used in libfan. Change-Id: I62addac0d153be194171acee77ec7a32a503b85c Signed-off-by: William A. Kennington III <wak@google.com>
* phosphor-fan-presence: use c++17Vernon Mauery2018-10-041-1/+1
| | | | | | | Update configure.ac to choose the c++17 standard Change-Id: I9c7bba8ae28101e95eb969dd1d1ae01f37cd3e48 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Fix libfan_la_CXXFLAGSLei YU2018-09-262-1/+5
| | | | | | | | | | | | | The libfan_la_CXXFLAGS was incorrectly defined as empty by a typo, fix it. Then specify gcc-ar gcc-ranlib for link time optimization, otherwise the static library will get link error. Tested: Verify the build is OK in CI, local build, and SDK build. Resolves openbmc/phosphor-fan-presence#11 Change-Id: I17c83b9927a796f8928a71688c1640d1a602a108 Signed-off-by: Lei YU <mine260309@gmail.com>
* Add -flto to CXXFLAGSAndrew Geissler2018-08-275-5/+9
| | | | | | | | | | Per openbmc/openbmc#3364, adding -flto to CXX flags in order to reduce overall library and binary sizes. Ref: https://gcc.gnu.org/wiki/LinkTimeOptimization Change-Id: I3ee31a15fc0ded4308aa9d00a11b41bc62eb9799 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
* Handle SdBusError exceptionsMatthew Barth2018-07-173-13/+35
| | | | | | | | | | 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 <msbarth@us.ibm.com>
* Use s.c_str() in log messagesJoseph Reynolds2018-05-301-2/+2
| | | | | | | | | Partly resolves openbmc/openbmc 2905 Tested: static_assert only Change-Id: I0cabc8d84c763af924d067880417c9a11bcfde58 Signed-off-by: Joseph Reynolds <jrey@us.ibm.com>
* Add MAINTAINERS fileAndrew Jeffery2018-05-211-0/+46
| | | | | Change-Id: Iee7a92941638d2b147eef2f0e85f9c90f638003c Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* utility: Remove getService functionMatthew Barth2018-05-172-59/+1
| | | | | | | | | | The getService function is no longer used and is not necessary with the getService function within sdbusplus.hpp Tested: N/A Change-Id: Ifad8ec1efb64508923d4f5c42bef318f0b03124c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* utility: Remove getInvService functionMatthew Barth2018-05-172-14/+0
| | | | | | | | | | The getInvService function is no longer used and is not necessary with the getService function within sdbusplus.hpp Tested: N/A Change-Id: Ibb2d55ef5be1852ae8ebd3dac32d66518d5d705c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* cooling-type: Use lookupAndCallMethodMatthew Barth2018-05-173-21/+18
| | | | | | | | | | | | | Have phosphor-cooling-type fail with a DBusMethodError exception when a failure occurs on updating inventory. Resolves: openbmc/openbmc#2628 Tested: Cooling type properties still set correctly Change-Id: Ia7e3379fc7d75c70e9c71d4f940f9da84b9f5774 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* Throw DBusPropertyError for all property accessesMatthew Barth2018-05-172-7/+100
| | | | | | | | | | | | | 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 <msbarth@us.ibm.com>
* Add set property functions without mapper lookupMatthew Barth2018-05-171-0/+44
| | | | | | | | Tested: Property set with provided service name Change-Id: I158d33f85602f48d1dfe8baa7ce54eec6e8f8296 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Call method and return functionMatthew Barth2018-05-171-0/+21
| | | | | | | | | | | | Add a function that calls a method and returns the response message without checking for an error. Its up to the user of this function to check if response.is_method_error() exists and handle accordingly. Tested: Method is called and raw response is returned Change-Id: I6678a78d8cfb32d2d13dba7cb48719fd26eccebc Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* Throw custom exceptions on D-Bus method failuresMatt Spinler2018-05-096-44/+130
| | | | | | | | | | | | | | | | | | | | | 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 <spinler@us.ibm.com>
* Presence: Fix a log metadata entryMatt Spinler2018-05-091-1/+1
| | | | | Change-Id: I2d7b154de98bef1cb518d036496828c57a391144 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Add generation of propertiesMatch conditionMatthew Barth2018-05-032-1/+50
| | | | | | | | | | | | | | | | | Update the mako template to generate conditions within the FanDefinition sections when a condition is defined for a fan. Each supported condition function's parameters are generated within a `getCondParams` mako method, allowing easy support of additional conditions with differing parameters. Tested: A given condition's function and parameters generate correctly No condition function is generated on a fan where not defined Resolves: openbmc/openbmc#2976 Change-Id: I3f0b30702fdcef6749929d85543270863eb26381 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Support optional conditions on creating fansMatthew Barth2018-05-035-2/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the functional infrastructure to optionally attach a condition function to a fan definition. When a condition is defined on a fan, it must be true for a fan's associated functional properties to be created. When the given condition fails, that fan's functional properties will not be created by fan monitor. A fan without a defined condition will have all of its associated functional properties created. Example of generated condition (generation commit to follow): make_condition(condition::propertiesMatch( std::vector<PropertyState>{ PropertyState{ PropertyIdentity{ "/xyz/openbmc_project/inventory/system/chassis", "xyz.openbmc_project.Inventory.Decorator.CoolingType", "WaterCooled" }, static_cast<bool>(false) } } )), Tested: Fan functional properties are not created when a condition fails Fan functional properties are created when condition passes Fan functional properties are created when no condition exists Change-Id: I9ced2e520d2f97e6655c9417970b3e976d78fef4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add methods to return property variantMatthew Barth2018-05-031-0/+77
| | | | | | | | | | | | Create methods to return a property variant for use where the overloaded comparison operations are needed against a property value stored as a variant. Tested: A property is looked up and returned as the given variant type Change-Id: Iab557781a3ab9e33d3595ad69db5544a25efe2eb Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* Get a property without service name lookupMatthew Barth2018-03-121-0/+40
| | | | | | | | | | | Expand on the current getProperty functions to allow a service name to be passed in so a mapper lookup is not necessary. Tested: A property value is read from a message where the service is given Change-Id: Ia0450163744c9f89a26a053ec2cfb44ae761426d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* 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 <msbarth@us.ibm.com>
* Add GetSubTree method for single interfaceMatthew Barth2018-03-061-0/+38
| | | | | | | | | | | | Perform a GetSubTree mapper call and return the mapper response structure as is for a single interface over a given path subtree depth. Tested: Returned subtree structure matches mapper structure for an interface Returned subtree data matches mapper data for an interface Change-Id: If6b66433a331ac20633ac99c458eb5edb653bff2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Make event actions optionalMatthew Barth2018-03-061-2/+5
| | | | | | | | | | | | | | | | | | Event actions should be made optional for events that only require subscribing to group signals. This is in preparation for separating signal and timer based event actions. A use case would be where one event can be used to subscribe to signals that update cached property values without performing an action, and another timer based event performs an action based on those property values the signal event provides. Tested: Events without an action are generated correctly Events without an action are handled correctly and run no action Change-Id: I757a82ce6c45ac637ce7cea8f82a62b98b600e3e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Parse a list of groups with zone conditionsMatthew Barth2018-03-061-198/+219
| | | | | | | | | | | | | | | Set speed events can use a list of groups associated with its actions where each group defines what zone conditions the group should be included in actions. Tested: List a single group within an event List two groups within an event with different zone conditions List two groups within an event in the same zone conditions List more than two groups with different zone conditions Change-Id: Ifba30e116f92d945f8812c15e856a5e772e077f2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Handle timer expiration on state changesMatthew Barth2018-03-011-19/+17
| | | | | | | | | | | | | | | | | | Update to start all tach sensor functional state change timers on a fan where the corresponding state and inventory is updated when the timer expires. Only start the timer in nonfunctional mode when a tach sensor is out of range and is currently functional and start the functional mode timer when its in range and currently nonfunctional. Tested: Tach sensors are marked nonfunctional as normal. Tach sensors are updated to functional after 5sec(yaml test value) Nonfunctional timer is cancelled if fan returns within spec Functional timer is cancelled if fan returns out of spec Change-Id: I88622d07d8713f88e8070940a4bd96046a053fb5 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Define a mode for tach sensor timerMatthew Barth2018-03-014-14/+67
| | | | | | | | | | | | | | Use a single timer on the tach sensors for delaying both nonfunctional and functional state changes by declaring what mode the timer is in. Since a fan is either transitioning from a functional state to a nonfunctional state or vice-versa, enabling the timer in the mode requested allows the user to define a delay for both of these transition states. Tested: Current nonfunctional timer delay operates the same Change-Id: I0c165355d41d27e1906918953e5226968062ee16 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add tach sensor functional delayMatthew Barth2018-03-016-4/+21
| | | | | | | | | | | | | | Add ability to define a delay to marking a tach sensor as functional when it transitions from a nonfunctional state. Essentially this gives the option to wait a given amount of time that a tach sensor must be within the allowed deviation before being updated to functional. Default functional delay = 0 seconds Tested: Current fan definition values function the same Change-Id: I58bf70d2335e27c06037b755cbee8dae81528a5a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* NonzeroSpeed: Check trust determination sensorsMatthew Barth2018-03-012-6/+11
| | | | | | | | | | | | Only include defined trust determination sensors in checking the group trust. Tested: Current trust group associations & reactions are unchanged Combination of sensors included and excluded in trust determination Change-Id: I0f610b2910ffda849871a9ac9be95f2c056d8248 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
OpenPOWER on IntegriCloud