summaryrefslogtreecommitdiffstats
path: root/sensorhandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* ipmid: Rewrite ipmid to use the new architectureVernon Mauery2019-02-251-10/+0
| | | | | | | | | | | | | New architecture highlights: * The new registration detects handler type for argument unpacking. * Upon completion the response is automatically packed. * Handlers can make use of the new async/yield sdbusplus mechanism. * The queue exports a new dbus interface for method-based IPMI calls. * The legacy handler registration is still supported for now. * The legacy dbus interface is still supported for now. Change-Id: Iae8342d9771ccebd3a0834e35597c14be4cc39cf Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Add support for Entity Association RecordJaghathiswari Rankappagounder Natarajan2019-02-151-6/+88
| | | | | | | | | | | | | | Adding support for Entity Association Record (SDR type - 0x08h) This patch includes: 1) Entity Association Record yaml file example 2) Entity Assocation Record related script and mako file changes 3) Adding Entity Association Record in get_sdr IPMI command response From the host, tested that entity association records can be fetched Change-Id: I9cf598e5d27d2e8c6751bbaae2176e7c976974b1 Tested: Yes Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
* phosphor-host-ipmid: Add support for settable bit in FULL SDRJaghathiswari Rankappagounder Natarajan2019-02-151-0/+5
| | | | | | | | | | | | | | | | | There is a bit in SDR types 01h and 02h which indicate that a sensor is settable (Supports the "Set Sensor Reading And Event Status" command). Since OpenBMC has some sensors which support this command (eg. fan pwm sensor), the bit should also be set accordingly. The bit in question is Settable Sensor and can be found: IPMI Spec v2.0 rev 1.1: Section 43.1 SDR Type 01h, Full Sensor Record Table 43 - SDR Type 01h, byte 11, bit 7 Tested from the host side that the FULL SDR for sensors which are settable shows up as settable. Change-Id: I5bd140e035a5a96b977dbbbf4acaae0369e832d2 Tested: Yes Signed-off-by: Jaghathiswari Rankappagounder Natarajan <jaghu@google.com>
* Platform event commandJia, Chunhui2019-02-071-0/+93
| | | | | | | | | | | | | | | | | | This command is used for logging SEL. Tested: 1. test with netipmid and ipmid. 2. test pass with good parameter ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x80 0xc0 0x10 0xFF ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x00 0x30 0x10 0xab 3. test pass with bad parameter (expect invalid data length error) ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x00 0x30 ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x00 0x30 0x11 ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x00 0xc0 ipmitool raw 0x4 0x2 0x20 0x11 0x04 0x11 0x00 Change-Id: I7d51aac8fee2edb1faeb91f4c96a033736068779 Signed-off-by: Jia, Chunhui <chunhui.jia@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>
* Fix units for fan RPM sensorKirill Pakhomov2018-12-121-3/+1
| | | | | | | | | Use actual RPM unit type code from IPMI specification instead of revolutions type code coupled with per minute bit, which is also unused in most ipmi client implementations. Change-Id: If42900950a21f5526e890aef0dd6822e4e54c6e3 Signed-off-by: Kirill Pakhomov <k.pakhomov@yadro.com>
* cleanup: scope reductionPatrick Venture2018-10-311-2/+1
| | | | | | | | | | | | | | [app/channel.cpp:102]: (style) The scope of the variable 'resp' can be reduced. [ipmisensor.cpp:310]: (style) The scope of the variable 'i' can be reduced. [ipmid.cpp:506]: (style) The scope of the variable 'num_handlers' can be reduced. [read_fru_data.cpp:82]: (style) The scope of the variable 'fruId' can be reduced. [sensorhandler.cpp:256]: (style) The scope of the variable 'p' can be reduced. [storageaddsel.cpp:68]: (style) The scope of the variable 'p' can be reduced. Also delete two extra vertical lines. Change-Id: I8e72f8e1d94381f456674abf523d2f2fbdd8046d Signed-off-by: Patrick Venture <venture@google.com>
* Convert variant usage to std interfaceWilliam A. Kennington III2018-10-181-8/+9
| | | | | | | | | | | | | 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-8/+10
| | | | | | | | | | 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>
* cleanup: exception catching by referencePatrick Venture2018-10-171-1/+1
| | | | | | | [sensorhandler.cpp:650]: (style) Exception should be caught by reference. Change-Id: Iec747c2dff988fcf6c6ca29715afa1c44cceee6d Signed-off-by: Patrick Venture <venture@google.com>
* cleanup: c-style castingPatrick Venture2018-10-171-4/+4
| | | | | | | | | | | | | | | | [ipmisensor.cpp:308]: (style) C-style pointer casting [sensorhandler.cpp:302]: (style) C-style pointer casting [sensorhandler.cpp:376]: (style) C-style pointer casting [sensorhandler.cpp:404]: (style) C-style pointer casting [sensorhandler.cpp:405]: (style) C-style pointer casting [storageaddsel.cpp:157]: (style) C-style pointer casting [storageaddsel.cpp:187]: (style) C-style pointer casting Added missing const in reportSensorEventAssert and reportSensorEventDeassert as the *pTable->func(...) take the const pointer and the casting then was using the proper const casting. Change-Id: I54a591b4e5e678b8ec3cae2633617a5f7aac7a66 Signed-off-by: Patrick Venture <venture@google.com>
* Fix clang-format issue in sensorhandler.cppJason M. Bills2018-10-051-4/+3
| | | | | | | | | | A clang-format issue in sensorhandler.cpp was introduced by commit 0fbdbce22771dac6fe8d651e4c8155645807b83d that is causing CI to fail for changes to phosphor-host-ipmid. This commit updates sensorhandler.cpp with the latest clang-format changes. Change-Id: If37a25c50ee04264ce55c8c7959a4fee2aba4045 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
* sensorhandler: fix buffer overflow in Get SDREmily Shaffer2018-10-011-3/+17
| | | | | Change-Id: Id49f6294a506a870696554715b4835c7d7e6207b Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
* sensorhandler: fix buffer overrun in ipmi_fru_get_sdrEmily Shaffer2018-09-281-11/+6
| | | | | Change-Id: Ic12598027a92495e49f7cb06aa28f77c0727be44 Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
* add std namespace prefix to common methodsPatrick Venture2018-09-251-28/+34
| | | | | | | | Standard clib methods should be explicitly grabbed from the standard namespace. Change-Id: I8bcfcb260a99180d535ec8102c1a24c318cbc209 Signed-off-by: Patrick Venture <venture@google.com>
* replaced c headers with cpp where applicablePatrick Venture2018-09-251-7/+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>
* sensorhandler: Remove legacy functionsAdriana Kobylak2018-09-241-213/+3
| | | | | | | | | | | | | | The legacy sensors in the /org/openbmc/sensors path have been moved to the phosphor-ipmi-sensor-inventory%/config.yaml files and this path has been deprecated (From openbmc/openbmc rev: 8de4ff9fe3e3a5cbd7af150c126e97b182aa44cc). Remove the legacy functions that searched this deprecated path. Tested: Powered on a witherspoon to the host OS and there were no errors for the sensors that were moved out of the old path. Change-Id: Ifced118defdb3fe30abf26e332d847e8d3707477 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
* add .clang-formatPatrick Venture2018-09-071-221/+251
| | | | | Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5 Signed-off-by: Patrick Venture <venture@google.com>
* Use visitor instead of pulling values directlyJames Feist2018-08-091-4/+8
| | | | | | | | | | | Sensor thresholds pull out an int64_t and immediately assign it to a double. Use a visitor instead to avoid the intermediate and add flexibility / saftey to type readings. Tested-By: Verifed sensor list still worked. Change-Id: If49bf54ec1c0636b3549d433b86ecdbd1ea99b0d Signed-off-by: James Feist <james.feist@linux.intel.com>
* Fix Sensor query for derating factor returns 0Nagaraju Goruganti2018-05-081-1/+28
| | | | | | | | | | | | | The issue here is that for derating factor sensor read command, hostboot is expecting return value in event_status field, but we are sending it in sensor reading field. Testing: ipmitool raw 0x04 0x2d 0xd8 #it has to retrun "00 00 5a 00" Resolves openbmc/openbmc#3012 Change-Id: I09e3d02c946ad1d8a39ea747fc400fb623cbe6ef Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Reducing IPMI logging footprintAditya Saripalli2018-04-181-9/+2
| | | | | | | | | | | | -host-ipmid is very noisy in terms of journal logging. A small step towards cleaning that up. -Also converted printfs to phosphor-logging. Partially Resolves openbmc/openbmc#2507 Change-Id: I749c19c18d1cabf6f0216830c8cb0a08ee43d6de Signed-off-by: Aditya Saripalli <aditya0124@gmail.com> Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* sensorhandler: changed mutabiltity error code in get sensorJayanth Othayoth2018-04-111-1/+1
| | | | | | | | Changed mutability handling error code in get sensor from IPMI_CC_SENSOR_INVALID to IPMI_CC_ILLEGAL_COMMAND Change-Id: I599de08e3d3bc6a9820ac3978f0a4d160f19f55e Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* sensorhandler: Enable mutability based set functionJayanth Othayoth2018-04-111-0/+7
| | | | | | | Resolves openbmc/openbmc#2980 Change-Id: I67afd4e84ec96e5cfc2dd315604d70f41c67a438 Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
* Handle sensors that can not be found in SystemManagerLei YU2018-04-101-1/+8
| | | | | | | | | | | | | | | | | When a sensor id is not managed in yaml the code tries to get it from legacy SystemManager; And when the sensor id can not be found in SystemManager, it returns empty path, and cause segment fault. This commit makes it return -EINVAL when path is empty, and thus the code will handle this case properly without crash. Resolves openbmc/openbmc#3062 Tested: Boot host without ipmid crash on Romulus. Change-Id: I4240b9be54824543b5e795e898330aeb02c5eb90 Signed-off-by: Lei YU <mine260309@gmail.com>
* sensor: Refactor get sensor reading implementationTom Joseph2018-03-201-72/+75
| | | | | | | | | | Legacy sensors(org.openbmc) implementation is stubbed into a separate function for clarity. Sensor type lookup is needed to populate the reading for the legacy sensors, this was done for all the sensors. With this patch sensor type lookup is done only for the legacy sensors. Change-Id: Idd33e41669d8ad33529ad9ccdbed9d4da5ecda79 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Remove use of legacy inventory interfaceNagaraju Goruganti2018-03-121-70/+0
| | | | | | | | | | | | | | | | | | | Made below given changes: 1.With legacy code we used to read software version info from the system file: /etc/os-release, now with new updates we will read it from the s/w object which is implementing the interface "xyz.openbmc_project.Software.RedundancyPriority" interface. 2.Removed legacy code related to inventory(FRU) for sensors Tested: 1.Verified f/w version info using below given command >ipmitool mc info -I dbus 2.Verified get sensor type info using below given command >ipmitool raw 0x04 0x2f 0x02 -I dbus Resolves openbmc/openbmc#2870 Change-Id: I384bf4aaacd56f4a871833b533b2a8a68c489959 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Implement Get SDR and Reserve SDR repository commandTom Joseph2018-03-011-12/+6
| | | | | | | | | | | Both Get SDR and Reserve SDR repository command is same as Get Device SDR and Reserve Device SDR command respectively. So the same implementation is shared. Resolves openbmc/openbmc#2615 Change-Id: I64e37837bc5a616bed41a3ceff7d63033d88455c Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Updates to the get device sdr command implementationTom Joseph2018-03-011-103/+37
| | | | | Change-Id: Ibf5989b144ebe4ec75bd8d42c1d1167d7b16ecda Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Refactor get sensor reading commandTom Joseph2018-03-011-56/+5
| | | | | | | | 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: Refactor get sensor thresholds commandTom Joseph2018-03-011-97/+77
| | | | | | | | | | | | Using GetManagedObjects to get the thresholds could take upto 15~20 sec for the core temperatures. The time taken to fetch threshold properties via GetManagedObjects is proportional to the number of objects under the path. Since the dbus object path is available in the yaml it is performant to read the threshold properties directly. Change-Id: Ic22d8f4d73d8ce4eabdffd6fc7af23f73b981f66 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* SDR: Adding fru records as part of Get SDR commandRatan Gupta2018-02-131-6/+123
| | | | | | | | | | | Currently Get SDR only responds with physical/virtual sensor records,it doesn't support for FRU records,This commit adds the support for FRU records. Resolves openbmc/openbmc#2776 Change-Id: I34edfa892b32f4e866cf0c084d97c2f3482d40f4 Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Add Control.FanPwm as interface.Patrick Venture2018-02-071-0/+1
| | | | | | Change-Id: I20c2c162a28b7aabf14ae17ae2f456a6b10e0e6b Signed-off-by: Patrick Venture <venture@google.com> Signed-off-by: Kun Yi <kunyi@google.com>
* Support Get Sensor Thresholds CommandDhruvaraj Subhashchandran2018-02-061-0/+140
| | | | | | | | | Adding support for sensor thresholds command Resolves openbmc/openbmc#2624 Change-Id: I904c1b18c8709bceb7ecb7eec6e8e42e1f51525a Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* sensor: Modify the Get sensor reading commandTom Joseph2018-01-311-8/+11
| | | | | | | | | | | a) Scanning is enabled for all sensors, otherwise ipmitool would report the sensors as disabled. b) Correct the error handling scenario which will occur when the D-Bus object is not present or error occurs when reading the D-Bus property. Change-Id: I49535663a242305ab02a67f8f5998647cfee7eee Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Modify Get Device SDR command implementationTom Joseph2018-01-301-14/+17
| | | | | | | | | | a) Specify the sensor name deduction in the yaml b) Entity ID and entity instance is populated c) Sensor owner is set to BMC address, since all the sensors are present on the BMC. Change-Id: I7b64c48ad1dbd386e12b20af459e40baf0d97cd4 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Remove unwarranted call to free()Deepak Kodihalli2018-01-291-1/+0
| | | | | | | | | | | Do not free() the pointer allocated by sd_bus_message_read(), because systemd will free that once the message is unreferenced. The free() in question here was causing an ipmid core dump. Resolves openbmc/openbmc#2846. Change-Id: I118f6947e7292b68744d0034c72572e4dcb99f01 Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
* Add sensor entry for power supply redundancy enabled.Dhruvaraj Subhashchandran2018-01-221-0/+34
| | | | | | | | | | | IPMI to dbus lookup contained only mapping for PS redundancy disabled, adding the mapping for enabled. Changing the PS redundancy sensor type from D8 to CA. Resolves openbmc/openbmc#2810 Change-Id: I2399ce76a168f63f6a4528cff8aa397ef12d5e1e Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* sensorhandler: allow preconfigured unit and scaleEmily Shaffer2017-12-101-20/+34
| | | | | | | | | | | Allow specifying the scale and unit for a sensor in the YAML configuration. This can save clock time by no longer requiring the daemon to reach out to the sensor owner for the information. Change-Id: I5f63286fc32fb9d64ebab7d86d1dbb7ff40591f4 Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Patrick Venture <venture@google.com>
* Update Journal Variable NamesGunnar Mills2017-10-191-2/+4
| | | | | | | | | Journal entry variable names should be uppercase. https://www.freedesktop.org/software/systemd/man/sd_journal_print.html Also, fixed indentation. Change-Id: I2c838332ab7811ccc9a2c99f5b1f558c48f25f76 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Revert "Remove legacy reading of PS derating"Dhruvaraj Subhashchandran2017-10-041-0/+1
| | | | | | | This reverts commit 1bf3b749e9217f03fbc55bbb45802df9e715e3b0. Change-Id: Ib364199f4d676c2003450cad4b4d3d6077356fc1 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* Handle std::runtime_error exception in get sensor readingTom Joseph2017-10-031-0/+9
| | | | | | | Resolves openbmc/openbmc#2374 Change-Id: I596b5f0662b2506c8af4143ffa6438320d7bf4a2 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Remove legacy reading of PS deratingDhruvaraj Subhashchandran2017-09-251-1/+0
| | | | | | | Resolves openbmc/openbmc#2154 Change-Id: Ia5e150951fd077eddb4ee5a11d361eceee404e44 Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* sensor: Use getFunc for TPM and RebootAttempt sensorTom Joseph2017-09-141-71/+0
| | | | | Change-Id: I8d7581e2c14344425683870daf395fc895d1034c Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Use getFunc to handle the get sensor readingTom Joseph2017-09-141-3/+22
| | | | | Change-Id: If0f3185e7ce1d300be20b58ee5004a58e35c222d Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Handle the response of find_openbmc_pathTom Joseph2017-09-141-9/+12
| | | | | | | | | | | The sensor path of the inventory items does not include the inventory root, so would fail in the case of find_openbmc_path. If the return code of find_openbmc_path indicates failure, then it is logged and allowed to continue. The call to find_openbmc_path would be eventually removed. Change-Id: I7513bf4ab9b897ff5b64cfb77fd504e6ef4e227a Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensor: Add function to map dbus info to assertion statusTom Joseph2017-09-141-2/+2
| | | | | Change-Id: I30aae9abd7905ae3299856d798d41e10859fed7f Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* sensorhandler: support setting analog sensorsEmily Shaffer2017-09-131-57/+106
| | | | | | | | | | | | | | | | | | 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>
* Support Power Supply derating sensorTom Joseph2017-09-071-5/+4
| | | | | Change-Id: I893d09a4ecb88507386e8b89015c4b53b18951c3 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
OpenPOWER on IntegriCloud