summaryrefslogtreecommitdiffstats
path: root/sensordatahandler.hpp
Commit message (Collapse)AuthorAgeFilesLines
* Refactor ipmi::sensor::GetSensorResponse away from std::arraySui Chen2019-10-281-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Throw on sensor's OperationalStatusBrandon Kim2019-08-121-0/+28
| | | | | | | | | | Add UPDATE_FUNCTIONAL_ON_FAIL and only when defined, read sensor's OperationalStatus interface for the functional property and throw if the sensor is not funcitonal. Bug: openbmc/phosphor-hwmon#10 Signed-off-by: Brandon Kim <brandonkim@google.com> Change-Id: I1144a6d3f8145bda73f3363664ca48b848a295db
* remove usage of sdbusplus::message::variantVernon Mauery2019-05-141-2/+2
| | | | | | | | | | | sdbusplus has had its alias of std::variant in place for long enough. This changes all ipmid references to use std::variant directly instead of the sdbusplus alias. Tested-by: building and running ipmid Change-Id: Id5b4136d4589aa598815edd3ef4202e64a7698e2 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* move variant to std namespaceVernon Mauery2019-04-181-4/+2
| | | | | | | | | | | 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>
* Only include ipmid/api.hpp for the new APIVernon Mauery2019-04-081-2/+1
| | | | | | | | | | | | | | After some feedback from users of the new IPMI API, they wanted to see two things: 1) don't require ipmid/api.hpp and ipmid/registration.hpp to be able to write new handlers 2) only require including ipmid/api.hpp (instead of ipmid/api.h) So now, by simply including ipmid/api.hpp instead of ipmid/api.h (deprecated), handlers incorporating the new IPMI API can be written. Change-Id: I446dcce70cff03d4ecc28c658292d052485f77fc 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>
* Create libipmid and libipmid-hostWilliam A. Kennington III2019-02-071-1/+1
| | | | | | | | | | | | | | | | | | | This starts a transition to common ipmid libraries that providers can link against. It will allow for a cleaner separation between common ipmid functionality and daemon type specific code. This is needed so we can resolve all of the symbols in the providers at link time instead of discovering bad linkage by building and running a full ipmi daemon. In future commits libraries will be packaged for libipmid and libipmid-host which provide all of the symbols used by the current set of ipmid providers. This is the first step, it just separates and renames the headers. Legacy symlinks are still kept around for compatability. It also adds stub libraries so that external users can start linking as intended. Change-Id: I6bbd7a146362012d26812a7b039d1c4075862cbd Signed-off-by: William A. Kennington III <wak@google.com>
* Convert variant usage to std interfaceWilliam A. Kennington III2018-10-181-2/+6
| | | | | | | | | | | | | 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>
* replaced c headers with cpp where applicablePatrick Venture2018-09-251-4/+5
| | | | | Change-Id: I23a70eb540ccde5d2aba467426769feffb07b516 Signed-off-by: Patrick Venture <venture@google.com>
* rename headers to match stylePatrick Venture2018-09-251-3/+2
| | | | | | | | | | | | | | | | | | 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-46/+38
| | | | | Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5 Signed-off-by: Patrick Venture <venture@google.com>
* sensor: Fix set sensor reading for analog sensorsTom Joseph2018-03-161-15/+9
| | | | | | | Tested: Set temperature sensor to sensor object Change-Id: I77b8dcd6f298ca7b09aac475c2e8da4af5825940 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Refactor get sensor reading commandTom Joseph2018-03-011-4/+7
| | | | | | | | Use the functor in the generated yaml to get the sensor reading for analog sensors. Change-Id: I2535cd5015096c3e1e2baa5f9a865fc6b27e6875 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Add support for multiple sensor naming patternTom Joseph2018-01-301-0/+54
| | | | | Change-Id: Ibf58d4a4f5a2783a9152f4b5f685e28ef527c5e2 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Map dbus info to sensor's reading fieldTom Joseph2017-09-141-0/+37
| | | | | Change-Id: I3e35bf78260b1fa29e992b00279f2dd166cd2fe1 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Add function to support sensor with readingAssertion typeTom Joseph2017-09-141-0/+34
| | | | | | | | readingAssertion is special type where the entire assert bitfield serves as the value or reading. Change-Id: Iaddbe846e04d2a53cff69d71670a96ccc66636a8 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Add function to map dbus info to reading fieldTom Joseph2017-09-141-0/+10
| | | | | | | | | 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/+49
| | | | | Change-Id: I30aae9abd7905ae3299856d798d41e10859fed7f Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensorhandler: support setting analog sensorsEmily Shaffer2017-09-131-0/+36
| | | | | | | | | | | | | | | | | | Refactor YAML format to denote mutability of sensors. Sensors which expect different formats for reads and writes should present two entries in the sensor YAML, one with the read interface and one with the write interface. Sensors which share a format for both reads and writes may present only one entry in the YAML with both readable and writable enums specified. If a sensor receives a write which has an interface of Sensor.Value, the "Set" message is sent via DBus to the path provided in the YAML. The previous codepath is maintained. Change-Id: I292f95b6fe936de759fd65ce72c842a1bfe66448 Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Patrick Venture <venture@google.com>
* Refactor set sensor handling codeDeepak Kodihalli2017-08-151-57/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fixed undefined reference while startingDhruvaraj Subhashchandran2017-08-071-1/+1
| | | | | Change-Id: I611a82ace75ac175f0127b4ee0fd586280f04f8a Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* IPMI: Virtual sensor support in host ipmidDhruvaraj Subhashchandran2017-08-041-0/+150
Resolves openbmc/openbmc#1608 Change-Id: Id76446061fd0fa6dc3dead702538e424293af7ce Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
OpenPOWER on IntegriCloud