summaryrefslogtreecommitdiffstats
path: root/control/gen-fan-zone-defs.py
Commit message (Collapse)AuthorAgeFilesLines
* Move generated code template to fileMatthew Barth2018-05-111-234/+14
| | | | | | | | | | | | | | 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>
* 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>
* 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>
* Add target interface for fan controlLei YU2018-02-261-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Current fan control assumes the use of the FanSpeed interface for fan targets. For fans controlled by pwm, FanPwm interface is added. This commit adds "target_interface" config parameter, so that user can specify the interface for the fan targets. E.g. - inventory: /system/chassis/motherboard/fan0 cooling_zone: 0 cooling_profile: air sensors: - fan0 target_interface: xyz.openbmc_project.Control.FanPwm The config is optional and defaults to FanSpeed, so the current code will not be affected. Tested: Use this config on Romulus, ensures the fan control sets target on FanPwm interface and works fine. Change-Id: I73adccaa770d657b5d7aaeb307917f89588524de Signed-off-by: Lei YU <mine260309@gmail.com>
* Support properties of type stringMatthew Barth2018-01-291-7/+29
| | | | | | | | | | | | Properties used within set speed events may be of type string to trigger an action. These should be handled where the defined type attribute is given as 'std::string' and a parsed value is an instance of python str type. Resolves openbmc/openbmc#292 Change-Id: Ib188e7abc212062a1c61950abaa28434a4726521 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Allow timers & embedded actions within an actionMatthew Barth2017-11-171-28/+64
| | | | | | | | | Add support for timer parameters to action functions along with recursively build action functions that are a parameter to an event action. Change-Id: Ic126c8dfc85d5ede5f53034262f8910913e4cdd4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Modify generating event actionsMatthew Barth2017-11-171-15/+10
| | | | | | | | Move to constructing the entire event action parameter string within the python code in prep for additional special parameters. Change-Id: I517ad859813e348cd6781cc9be11ab92fa6cac09 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer type for set speed event timersMatthew Barth2017-11-171-2/+6
| | | | | | | | This is the first step towards allowing timer driven and/or wrapped actions where the timer interval and type will be defined by the user. Change-Id: If008fda5a2b73117e869f93223e0bfe61290f858 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate selected handlersMatthew Barth2017-11-171-48/+125
| | | | | | | | The available event handlers are listed within the events yaml and would be selected per event. Change-Id: Ia393009b3a10b6f47f5de9a0e6d44f804576f05a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Update event initializationMatthew Barth2017-11-171-7/+6
| | | | | | | | | | | | | | | | Using a null dbus message to the event signal will perform the necessary steps to initialize the event parameters using the given signal handler's function directly. i.e.) In the case for subscribing to PropertiesChanged signals, initially the given property must be read. When the PropertiesChanged signal struct is given a null message, it finds the property, reads the value, and then can perform the given signal handler function directly. This produces the same functional path as receiving a PropertiesChanged signal containing the property value within the message. Change-Id: I35575cfff66eb0305156be786cb1f5536d42bb1c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate selected match strings and signalsMatthew Barth2017-11-071-76/+117
| | | | | | | | | The available matches and their associated signals are now listed within the events yaml and can be added to the list of matches to register for per event. Change-Id: I65f657038afe7c68a421adb4820ea09e275be06d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Allow no parameter action functionsMatthew Barth2017-09-281-22/+41
| | | | | | | Action functions are not required to have parameters. Change-Id: I04bf8294d9be9141cc7d8d3183628c94b777154a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set speed event parser updatesMatthew Barth2017-09-181-143/+202
| | | | | | | | | Added some optimizations in the event yaml format to nest set speed events that have the same preconditions and allow multiple actions to be taken within a single set speed event. Change-Id: I21ec395b6c9686e1efd5abc1be48d563480fec5f Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer option to run set speed event actionsMatthew Barth2017-08-161-0/+32
| | | | | | | | | | | For groups within set speed events where the property values of the group may not signal its action to occur, an optional timer may be added to the event. This timer is configured as a repeating timer on the interval provided where upon timer expiration, the event's action is run. Change-Id: I4cbe8a0ab1b734bfc7828706a6515af7f6d78b52 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add interfacesAdded subscriptions to groupsMatthew Barth2017-08-141-13/+22
| | | | | | | | | | | | For each group in an event, subscribe to the interfacesAdded signals in the case where the member(s) of a group may or may not exist when initialized. Additionally, updated to use the propertiesChanged function to remove repetitive property change subscription lines generated. Change-Id: I52b0cd839383ebb90e93a81b5bac02ee7c4f44b2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Update parser to support optional preconditionsMatthew Barth2017-08-081-2/+137
| | | | | | | | | | | | | | | | | Set speed events are now allowed to have preconditions defined within the event where those preconditions must be met before the set speed event is enabled and active. The supported precondition added is against a list of groups and their properties matching a given value. The parser generates a precondition with the same layout as a set speed event where the event is nested as the last parameter to the precondition function. Having the set speed event as the last input parameter to precondition functions is required. Resolves openbmc/openbmc#1835 Change-Id: I7a247e7eb2d6b31ba9a60da1bc321a35edda9b24 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add increase & decrease timer values in secondsMatthew Barth2017-07-061-0/+10
| | | | | | | | | | | | | | | | | Support setting the increase delay time(in seconds) for each zone from the zone yaml file. Speed increases use a delay type timer where the amount of time given delays additional increase requests from happening until the fans within the zone reach the highest net increase in speeds. Support setting the decrease interval time(in seconds) for each zone from the zone yaml file. Since decreasing is done on an interval, a decrease interval time of zero disables the decrease interval timer causing no decreases in speed to occur. Speed decreases use an interval type timer to decrease the fan speeds within the zone when no speed increase requests exist on the given time interval. Change-Id: I88334a313b6e2820b768fa7e3f1cb65887f29258 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Allow generation of map types in eventsMatthew Barth2017-06-261-1/+15
| | | | | | | Resolves openbmc/openbmc#940 Change-Id: I238cd4a6ef69c1d54a775ad90ee87e6e327b82bd Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add default floor speed supportMatthew Barth2017-06-261-0/+3
| | | | | Change-Id: Id2d3b362e79e7a8c2330181f68ae11e43f84e2fd Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add interface to uniquely identify propertiesMatthew Barth2017-06-261-0/+1
| | | | | | | | The interface is needed on the properties stored to uniquely identify each property used in events. Change-Id: Ia062f25514d7ed04ef1023a02eecad4738711ffb Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Check for zone number and conditionGunnar Mills2017-06-261-6/+17
| | | | | | | | | Only add events to the zone if the conditions and zone number are correct. Resolves openbmc/openbmc#1500 Change-Id: Ia040fcbdd9093d25d4ed1773d5fea0ed8a95ba2b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* pep8 style changesGunnar Mills2017-06-261-5/+5
| | | | | | | Fixed pep8 warnings in gen-fan-zone-defs.py Change-Id: I78472a1e9ce1bd6eb14e0352398c6470fa144604 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Parse zone conditionsGunnar Mills2017-06-261-6/+69
| | | | | | | Zone conditions are used to determine which zone to use. Change-Id: I11f0ffa4da12532aeedf88941fb8a2d7fca5d352 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Use updated match methods for signal callbacksMatthew Barth2017-06-051-4/+7
| | | | | | | | Attach the event handler callback function to the match along with generating the match string using the new match methods Change-Id: I7595d65cbc615f29db60e2a65534ee5b635d6f96 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Fixed alignment issuesMatthew Barth2017-05-311-61/+65
| | | | | | | Fixed resulting pep8 alignment issues in the generated template Change-Id: I26d316a86c40896cda729683b26ccf06a3f89d5f Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate list of property change signalsMatthew Barth2017-05-311-0/+31
| | | | | | | | Add the list of property(s) associated to a set speed event where the handler updates the property cached on the zone for the action Change-Id: Ifac61dda6eb200ca28735ddfaab3d34c9a9df758 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate set speed event actionsMatthew Barth2017-05-311-0/+38
| | | | | | | | Adds the set speed event action functions with the associated parameters in the order required for the function Change-Id: Ib08f2442d8ff1fb3d49ab5234eacc2db8304a20d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Parse set speed event groupsMatthew Barth2017-05-311-2/+56
| | | | | | | | Adds the groups for a set speed event for each zone listed within the event. The groups are for maintaining a cached property value. Change-Id: I2de9cf62215f9861e8ea2e6807df11e6a04638fb Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add modes to phosphor-fan-controlMatt Spinler2017-05-161-3/+12
| | | | | | | | | | | | | | | phosphor-fan-control can behave differently based on its command line arguments --init: Set fans to full speed, delay for a configurable amount of time to allow fans to ramp up, start the fan control ready target, and then exit. --control: Start the control algorithm. Never exits. Will be started as part of the fan control ready target. Change-Id: I453daf8cc05a5c85a19c098e1cca64cac2ad9520 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Fan control: Generate structures from YAMLMatt Spinler2017-04-271-23/+103
| | | | | | | | | Using data from the zone and fan definition yaml files, generate a .cpp file with data structures that define the fan zones and the fans in those zones for a system. Change-Id: I5679ee692856e01138750f41bc23eb0cbb7f9464 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Fan control: Python script frameworkMatt Spinler2017-04-271-0/+78
The basics of a python script that will generate the fan zone data structures for the fan control code from zone and fan yaml files using a mako template. Change-Id: I1d92dc55c2b6dd986e5aaae0d3440ef85cbe79c0 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
OpenPOWER on IntegriCloud