summaryrefslogtreecommitdiffstats
path: root/sensordatahandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor ipmi::sensor::GetSensorResponse away from std::arraySui Chen2019-10-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors GetSensorResponse from std::array to struct. This change depends on change #23544. GetSensorResponse is an internal, intermediate structure, an unpacked form of a Get Sensor Reading response, providing direct access to its fields. Its life time is: GetReadingResponse -> GetSensorResponse -> ipmi::RspType. It is written to in 5 functions in the ipmi::sensor::get namespace, by four setter functions (setOffset, setReading, setAssertionBytes, enableScanning). It is currently read from by 1 function (ipmiSensorGetSensorReading) for transforming to an ipmi::RspType. Originally, the setter functions assumed bitwise equivalence between GetSensorResponse and GetReadingResponse, and the setter functions used reinterpret_cast to assign to a GetSensorResponse as if it were a GetReadingResponse. With this change, the reinterpret_cast's are removed, and the set functions now accept GetSensorResponse instead of GetReadingResponse, so the code gets a bit easier to read. Tested: Tested using a server with a BMC; sensor readings obtained through `ipmitool` appear to be correct (the reading might change within a small range): # ipmitool raw 0x04 0x2d 0x16 9B 40 00 00 Signed-off-by: Sui Chen <suichen@google.com> Change-Id: I5d454d6249f5431fb98169e6ef7c585c34024004
* sensordatahandler: Support empty inventory interfacesSantosh Puranik2019-05-091-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for empty inventory interfaces when asserting a sensor into the inventory. This is something already supported in ipmi-fru-parser, for example. Currently, the notify::assertion function expects that each DBUS interface also have a set of associated properties. One of the use-cases this commit tries to solve is when a sensor being asserted maps to an inventory item (accessed via xyz.openbmc_project.Inventory.Manager DBUS service) that implements a DBUS interface with no properties. For example, the GPU sensor is mapped to a GPU inventory object that implements the DBUS interface xyz.openbmc_project.Inventory.Item.Accelerator. This commit enables phosphor-host-ipmid to correctly create/update inventory objects even in cases where they implement DBUS interfaces that contain no properties. The sensor-example.yaml file has been updated to show an example of a GPU sensor, the inventory object for which implements a property-less DBUS interface. Tested: Tested on a witherspoon system that had some GPUs attached to it. Pulled also https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/21107 in order to generate the right sensor configs for testing. Verified that the GPU invetory objects that are created when the host asserts a GPU sensor now implement the empty interface xyz.openbmc_project.Inventory.Item.Accelerator Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com> Change-Id: I973580e285ae0fff1a513d3bbe8c03a89e0eeb83
* move variant to std namespaceVernon Mauery2019-04-181-10/+4
| | | | | | | | | | | sdbusplus::message::variant_ns has been std for a while now. This moves ipmid away from sdbusplus::message::variant_ns to directly use std::variant. Tested-by: built, compiles, and runs the same as before. Change-Id: I8caa945f31c926c2721319f001b9d7f83fd3f1b7 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Remove experimental filesystem spliceVernon Mauery2019-03-281-13/+1
| | | | | | | | | | In order to be compatible with older versions of GCC that did not have the experimental filesystem moved over to the standard paths, the code would splice the experimental code into the std namespace. This is no longer necessary with yocto 2.6 and the latest versions of GCC. Change-Id: I2db13c52a91456318795819f2d45c3386b4c56d2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* move types.hpp to ipmid/types.hpp for exportVernon Mauery2019-03-251-1/+1
| | | | | | | | | | types.hpp is required by utility.hpp, which is exported, so it needs to be exported as well. This moves it to the include/libipmid directory, changes the Makefile to export it, and changes all the files that include it so it can be found in the right place. Change-Id: I30ec365446e4de466c266ec4faa327478460ec05 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Move util.cpp/util.hpp to libipmidVernon Mauery2019-03-251-1/+1
| | | | | | | | | | | | | | | | These are functions that are used widely by ipmid providers, so it makes sense to put them in libipmi.so (the library that all providers must link against). Tested-by: use nm to inspect the binaries to see that the symbols are in the expected library. arm-openbmc-linux-gnueabi-nm libipmid.so.0.0.0 \ | grep getDbusObject 0001063c T _ZN4ipmi13getDbusObjectERN9sdbusplus.... Change-Id: I1221f807f2711c5301c5574623564ea1ae48a437 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Convert variant usage to std interfaceWilliam A. Kennington III2018-10-181-7/+15
| | | | | | | | | | | | | This is just a refactoring to use the c++17 std::variant interfaces instead of the mapbox::variant specific ones. We should be able to use mapbox::variant and std::variant interchangeably now. Tested: Built against sdbusplus with mapbox::variant and sbusplus using std::variant. Both variant compile and test out. Change-Id: I6fbaad3d12dd34968db6a10f3d74a65e07d0f0cc Signed-off-by: William A. Kennington III <wak@google.com>
* Remove direct uses of mapboxJames Feist2018-10-181-1/+1
| | | | | | | | | | sdbusplus is moving to std::variant, remove direct uses of mapbox to limit breakage. Tested-by: It built Change-Id: I3fe0ba0d96b6aad302927363b9596cc1bcce2393 Signed-off-by: James Feist <james.feist@linux.intel.com>
* move filesystem inclusion to bottom of listPatrick Venture2018-09-251-8/+10
| | | | | Change-Id: I4aa3c984992236bb5b4a5c62c3d42a33c12d55de Signed-off-by: Patrick Venture <venture@google.com>
* rename headers to match stylePatrick Venture2018-09-251-2/+1
| | | | | | | | | | | | | | | | | | Moving headers from ".h" to ".hpp" Reworked the header inclusion a bit so that host-ipmid is treated as a library, and local headers aren't. renamed apphandler.h => apphandler.hpp renamed chassishandler.h => chassishandler.hpp renamed globalhandler.h => globalhandler.hpp renamed sensorhandler.h => sensorhandler.hpp renamed storageaddsel.h => storageaddsel.hpp renamed storagehandler.h => storagehandler.hpp renamed systemintfcmds.h => systemintfcmds.hpp Change-Id: I9d4ce3dd57e2e996800f9020a10cc10cdf2c3914 Signed-off-by: Patrick Venture <venture@google.com>
* add .clang-formatPatrick Venture2018-09-071-77/+53
| | | | | Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5 Signed-off-by: Patrick Venture <venture@google.com>
* Standardize use of filesystemVernon Mauery2018-08-081-1/+11
| | | | | | | | | If <filesystem> exists, use that, if it doesn't, try <experimental/filesystem>. Either way, access it from std via a namespace splice. Change-Id: I5b35ee9f74b88e188cb3ca3fed9abaec64933697 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
* Use s.c_str() in log messagesJoseph Reynolds2018-05-311-6/+6
| | | | | | | | | | Fixes issues with data passed to phosphor::logging::log(entry()). This is part of a series of commits that resolves openbmc 2905. Tested: static_assert only Change-Id: I9fac771f54e4acbec97ce1360c106b6e3eb4fe9d Signed-off-by: Joseph Reynolds <jrey@us.ibm.com>
* Grammar and spelling fixesGunnar Mills2018-04-181-1/+1
| | | | | | | | | | Spelling errors found using github.com/lucasdemarchi/codespell A tool to fix common misspellings. This tool is licensed under GNU General Public License, version 2. Some additional grammar and capitalization errors were fixed as well. Change-Id: I700db4e6d7ba52b02374c9c3e84be0af8bd91859 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* sensors: rework sensor assertionBrad Bishop2018-03-071-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this patch the sensor assertion logic would generate an invalid DBus message or undefined behavior in several scenarios. - A bit is both asserted and desasserted: A well behaving client won't do this but the existing logic would generate an invalid property-set message with signature ssvv. Rework the logic such that no dbus traffic occurs. - No bits are asserted: Results in an invalid message with signature ss. Rework such that no dbus traffic occurs. - Empty offset value map in configuration: Results in an invalid message with signature s. Rework such that no dbus traffic occurs. - Empty offset value map entry (either assert or deassert) in configuration: Results in an invalid variant signature. Rework such that no dbus traffic occurs. - The same bit is specified in the configuration for multiple properties or interfaces: Can result in invalid messages with a wide variety of signatures. Rework such that one message is sent for each property being updated. - Invalid bit specified in value map entry Results in undefined behavior calling bitset::test. Rework such that entries in the value map with invalid bits are ignored. Tested: Verified the OperatingSystemStatus sensor can be set by a BIOS Change-Id: I4df9472a8bdc9e44e98e1a963838da0912d10683 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* sensor: Add support for multiple sensor naming patternTom Joseph2018-01-301-0/+14
| | | | | Change-Id: Ibf58d4a4f5a2783a9152f4b5f685e28ef527c5e2 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Modify the service lookup for set sensor commandTom Joseph2017-12-041-6/+4
| | | | | | | | | | | With the current implementation of the generated code for the sensors, the object path corresponding to the sensor is present. But lookup was done again for the object path which was unnecessary. The current change would would only lookup the service implementing the object path and the interface corresponding to the sensor. Change-Id: I185bc49f6387428d62ab0e5cb8326497837aa67f Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* IPMI changes to mark non present as non functionalDhruvaraj Subhashchandran2017-10-111-8/+24
| | | | | | | | | When marking a unit as functional, both functional state and presence need to be checked to avoid marking non-present units as functional. Change-Id: If7b710c39f1c2590b82378ebdb7014dc924599ff Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* IPMI changes to skip updating non present coresDhruvaraj Subhashchandran2017-10-111-0/+11
| | | | | | | | | Cores which are not present need not to be updated to inventory. This change is for skipping several updates to inventory based on skipOn value. Change-Id: I29e005a715ccae1df6eeaf35561a20896ecde0ac Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* Use static path for inventory managerDhruvaraj Subhashchandran2017-09-261-5/+2
| | | | | | | | | | | During boot after sending the inventory details host is asking for the a sensor value, that request is getting blocked because the ipmid on BMC is busy with processing the inventory data. Adding an optimization in processing inventory, which will reduce the wait. Change-Id: I490c98220e0244fb6c766432aa1ea8cf25ae1502 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* sensor: Add function to map dbus info to reading fieldTom Joseph2017-09-141-0/+36
| | | | | | | | | For sensor's with reading type eventData2, the eventdata2 field is mapped to the reading field in the get sensor reading command response. Change-Id: I9ad85ddb48d6c273a22e476e29ea9bbb34c13e24 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Add function to map dbus info to assertion statusTom Joseph2017-09-141-0/+76
| | | | | Change-Id: I30aae9abd7905ae3299856d798d41e10859fed7f Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Refactor set sensor handling codeDeepak Kodihalli2017-08-151-31/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | A summary of the changes: - Do not generate per sensor type code to update d-bus objects corresponding to sensors. Function to update d-bus objects based on standard sensor event types, such as assertion, event data, are now generic functions - the need not be generated per sensor or per sensor type. - There's a special case where the assertion is treated as a reading (i.e read the entire assertion field as-is). In this case, code needs to be generated per sensor because the type of the mapped d-bus property can vary. In this case have a generic template function, and generate minimal code like so: inline ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData, const Info& sensorInfo) { // Corresponding d-bus property is uint32_t return set::readingAssertion<uint32_t>(cmdData, sensorInfo); } - Make sensor-example.yaml succinct. - Make the code in writesensor.mako.cpp more pythonic. Change-Id: I84415ca6e3f756bbb51a90e290539eb086a7f78b Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Fix for reboot attempt and catch internal failures.Dhruvaraj Subhashchandran2017-08-101-11/+9
| | | | | | | | | | | The assumption was reboot attempt left will be sent through reading data in ipmi sensor data, but it is being sent as assertion so adding support to read raw data from assertion bits. Added a catch for internal failures while calling update function for sensors. Change-Id: If45d003c1c22f60e7c8a723c1ff9d077c53cad37 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* IPMI: Virtual sensor support in host ipmidDhruvaraj Subhashchandran2017-08-041-0/+258
Resolves openbmc/openbmc#1608 Change-Id: Id76446061fd0fa6dc3dead702538e424293af7ce Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
OpenPOWER on IntegriCloud