summaryrefslogtreecommitdiffstats
path: root/storagehandler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove useless wildcard handlersVernon Mauery2020-02-061-16/+0
| | | | | | | | | The default action is to return Command Not Found, which is exactly what the wildcard handlers are doing. This just removes that extra code that is not needed. Change-Id: I0a25153395858efcdf56384ececaabc7eaf4e1af Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* storagehandler: move read FRU data to new APIanil kumar appana2020-01-141-28/+32
| | | | | | | | | | | | | Rewrite "Read FRU Data" command to new IPMI provider API. Tested: 1. verified Read FRU data is same both before and after the changes ipmitool raw 0x0a 0x11 0x74 58 00 3 //request 03 32 36 31 //response Signed-off-by: anil kumar appana <anil.kumarx.appana@intel.com> Change-Id: I3bd497068462ee97a7b3fe648c3b0727f998bb0b
* Handle exceptions correctly in GetSelTime and SetSelTimeTom Joseph2019-09-251-2/+2
| | | | | | | | Tested: Ensured that the exception is caught in the command handler and printed on the journal Change-Id: I8b45bd154d0fe7f698487a19d01b1dd709c77c75 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* move sensors into ipmi::sensor namespacePatrick Venture2019-09-171-2/+9
| | | | | | | | The object was left in the global namespace, but the type was in the ipmi::sensor namespace. Move the object into the namespace. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I88e46da4abda220d3b6fcc2ea64b8ef0decb0dc3
* Sensorhandler: move get SDR info & reserve SDR to new APIjayaprakash Mutyala2019-07-301-2/+3
| | | | | | | | | | | | | | | | | | | | Rewrite "Get SDR info and Reserve SDR" command to use the newly introduced IPMI provider API. Tested: verified using ipmitool sensor commands. a. get SDR info Command: ipmitool raw 0x04 0x20 0x01 Output: 02 01 Command: ipmitool raw 0x04 0x20 0x00 Output: 00 01 b. reserve sdr Command: ipmitool raw 0x04 0x22 Output: 01 00 Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: Id1d7015cec45c5524210033e4210c710da27e9ae Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
* storagehandler: move get & reserve SEL to new APIjayaprakash Mutyala2019-07-251-50/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite "Get sel info & Reserve SEL" commands to use the new API. Tested: 1. verified ipmitool sel info is same both before and after the changes Command: ipmitool sel info Output: SEL Information Version : 1.5 (v1.5, v2 compliant) Entries : 0 Free Space : 65535 bytes or more Percent Used : unknown Last Add Time : Not Available Last Del Time : Not Available Overflow : false Supported Cmds : 'Delete' 'Reserve' Command: ipmitool raw 0x0a 0x40 Output: 51 00 00 ff ff ff ff ff ff ff ff ff ff 0a 2. verfied the Reserve SEL command ipmitool raw 0x0a 0x42 01 00 ipmitool raw 0x0a 0x42 02 00 Change-Id: I37d602293066274a3fc417ad7e59cea3c73315f7 Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
* storagehandler: move get sdr info to new APIPradeep Kumar2019-07-051-20/+18
| | | | | | | | | | | | | Rewrite: "Get SDR repository info" command to new IPMI provider API. Tested: Verified using ipmitool. ipmitool raw 0x0a 0x20 51 01 00 ff ff 00 00 00 00 00 00 00 00 00 Change-Id: I4b18631c4b4182f2c98caa145c151f3079cd7fc4 Signed-off-by: Pradeep Kumar <pradeep1x.kumar@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* Fix privilege level for Read FRU Data commandJason M. Bills2019-06-241-2/+2
| | | | | | | | | | | | | | | | | Per the IPMI spec, the Read FRU Data command requires only User privilege level. Tested: Before: ipmitool -I lanplus -L USER raw 0xa 0x11 Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 rsp=0xd4): Insufficient privilege level After: ipmitool -I lanplus -L USER raw 0xa 0x11 Unable to send RAW command (channel=0x0 netfn=0xa lun=0x0 cmd=0x11 rsp=0xff): Unspecified error Change-Id: I4c4df9a0813a93f69f0d66994af37c8f67f74f9e Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
* storagehandler: move Add SEL to new APIanil kumar appana2019-06-241-29/+32
| | | | | | | | | | | | | | Rewrite "Add SEL Entry" command to use the newly introduced IPMI provider API. Tested: Verified the behavior to be same as previous change. ipmitool raw 0x0a 0x44 1 0 0xff 4 5 6 7 8 9 0 1 2 3 4 5 6 05 06 Signed-off-by: anil kumar appana <anil.kumarx.appana@intel.com> Change-Id: I49bad876a209fb55f1b5b635b5a4ded425d33af0
* storagehandler: move get & set SEL time to new APIjayaprakash Mutyala2019-05-281-57/+30
| | | | | | | | | | | | | | Rewrite "Get & Set SEL time" command to use the newly introduced IPMI provider API. Tested: Verified using ipmitool sel time get/set behavior before and after the changes. Change-Id: I856ac92356e4472a67bf0e354fff6c3e2ced0cdb Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
* remove usage of sdbusplus::message::variantVernon Mauery2019-05-141-3/+3
| | | | | | | | | | | 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>
* storagehandler: move get FRU area info to new APIPradeep Kumar2019-05-081-27/+19
| | | | | | | | | | | | | Rewritten "Get FRU inventory area info" command to use the newly introduced IPMI provider API. Tested: Unable to verify as command was returning error earlier too. Change-Id: I535e1d5c41a1e0dc253148bc52df5f22b70b4330 Signed-off-by: Pradeep Kumar <pradeep1x.kumar@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* storagehandler: move Clear SEL to new IPMI APIPradeep Kumar2019-05-071-43/+36
| | | | | | | | | | | | | | | | | Rewritten "Clear SEL" command to use the newly introduced IPMI provider API. Tested: verified operation of clear SEL, and queried the sel list before & after clear SEL execution. ipmitool raw 0x0a 0x47 0x08 0x00 0x43 0x4c 0x52 0x0 01 // response Change-Id: Id8b8fa351c9d42632f71ce3445a63491b8ef4d16 Signed-off-by: Pradeep Kumar <pradeep1x.kumar@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* storagehandler: move delete SEL to new APIPradeep Kumar2019-05-031-32/+26
| | | | | | | | | | | | | | | Rewritten "Delete SEL" command to use the newly introduced IPMI provider API. Tested: Verified the behavior to be same as previous change. ipmitool sel delete 5 Unable to delete entry 5: Requested sensor, data, or record not found Change-Id: I3b40be056ed1c9b3bb5ac75387c694abe16403b5 Signed-off-by: Pradeep Kumar <pradeep1x.kumar@intel.com> Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
* move variant to std namespaceVernon Mauery2019-04-181-3/+1
| | | | | | | | | | | 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-1/+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>
* 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 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>
* eSEL: Remove code related to logging eSELTom Joseph2019-02-071-4/+0
| | | | | Change-Id: I5392202352c2baa70d61768cbaef9eb0e1faad56 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.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>
* Add request data length check to IPMI SEL commandsJason M. Bills2019-02-061-0/+46
| | | | | | | | | | | | | | | This changes adds a data length check to all supported IPMI SEL commands. This prevents a command from being handled when too much data is provided in the request. Tested: Ran Get SEL Info, Reserve SEL, Get SEL Entry, Add SEL Entry Delete SEL Entry, Clear SEL, Get SEL Time, Set SEL Time, with and without an extra byte. Without the extra byte, the commands returned normally; with the extra byte, a 0xC7 is returned indicating that the request data length is invalid. Change-Id: Icdd7db80f1bced3e6efddb5c5655e9f44a4e0e3b Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
* Revert "eSEL: Remove unused code related to logging eSEL"Tom Joseph2019-02-041-0/+4
| | | | | | | | | | This reverts commit 54fad6de0541c2f98e9b511f1d30bbcbcd743db6. This commit is reverted because the mapping of D-Bus object path to sensor information is still needed. The mapping is needed to serve the SEL commands which translate D-Bus logging objects to SEL entries. Change-Id: I2505299671db1f0bd7f116ef0e2ca4a0273eead8
* eSEL: Remove unused code related to logging eSELTom Joseph2019-02-011-4/+0
| | | | | Change-Id: Ia9815102064d20795a44b8e6a7d8b324c280756c Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* storage: gcc8: standardize use of std::filesystemBrad Bishop2018-11-271-1/+1
| | | | | | | | | | | | This was already done repo-wide with 185b9f8b but this one spot appears to have been missed, and was caught by gcc8: | ../git/storagehandler.cpp:276:39: error: 'filesystem' is not a namespace-name | namespace fs = std::experimental::filesystem; | ^~~~~~~~~~ Change-Id: I79d70f0ba1268eae9fc76be690313a5128b59f17 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* Convert variant usage to std interfaceWilliam A. Kennington III2018-10-181-1/+4
| | | | | | | | | | | | | 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>
* Fix IPMI SEL reservations and cancellationsJason M. Bills2018-10-051-12/+18
| | | | | | | | | | | | | | | | | | | | | | | Per the IPMI Spec, the SEL must be reserved to Delete an entry Clear the SEL Get a partial entry Add a partial entry The current SEL reservation must be cancelled when A SEL entry is added A SEL entry is deleted The SEL is cleared The device is reset A new reservation is requested This change adds a reservation status to track when a reservation is active and a method to cancel the current reservation, and it uses that to cancel the reservation in the Delete, Clear, and Add SEL methods. Change-Id: Ifd72e6d06ecc622855bd9ce8cc3928cbd0f2c34b Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
* add std namespace prefix to common methodsPatrick Venture2018-09-251-16/+19
| | | | | | | | Standard clib methods should be explicitly grabbed from the standard namespace. Change-Id: I8bcfcb260a99180d535ec8102c1a24c318cbc209 Signed-off-by: Patrick Venture <venture@google.com>
* move filesystem inclusion to bottom of listPatrick Venture2018-09-251-17/+18
| | | | | Change-Id: I4aa3c984992236bb5b4a5c62c3d42a33c12d55de Signed-off-by: Patrick Venture <venture@google.com>
* rename headers to match stylePatrick Venture2018-09-251-5/+4
| | | | | | | | | | | | | | | | | | 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>
* Handle SdBusError exception in SEL commandsTom Joseph2018-09-121-11/+41
| | | | | Change-Id: Ia79b3e2ea4ca8783c912c9864be32107d170d561 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* add .clang-formatPatrick Venture2018-09-071-138/+133
| | | | | 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>
* Fix Host time is not getting printed to journalNagaraju Goruganti2018-05-081-2/+4
| | | | | | | | | | | | log<level::DEBUG> is not putting Host time into journal, instead it is putting it in the metadata. Made fix for it. Testing: ipmitool sel time get # Host time:xxx XXX x xx:xx:xx xxxx will be # printed in into journal Change-Id: I0ba72a871469a30c605ee3ec91a07787959d5ae3 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Check the offset length in the Read FRU commandTom Joseph2018-05-081-0/+5
| | | | | | | | | | The offset length is validated against the size of the FRU area, before proceeding with populating the response of the Read FRU command. Resolves openbmc/openbmc#3132 Change-Id: I2bc660b7e389f5c85bac0acc8068dd53ab328a65 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Check if the FRU Id is valid for FRU commandsTom Joseph2018-04-231-2/+16
| | | | | | | | | | | Validate FRU Id before proceesing with the command handling. Do not report error log for any FRU command failure, since IPMI is an external interface. Resolves openbmc/openbmc#3016 Change-Id: I9e2af3ce50285662f1b8f9600222e9ff3057a7e3 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Reducing IPMI logging footprintAditya Saripalli2018-04-181-28/+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>
* Fixed broken "fru read" commandNagaraju Goruganti2018-03-271-15/+14
| | | | | | | | | | | | | | | | Fixed below given two issues: 1.We are getting seg-fault due to incorrect format specifiers for log-entry. 2.When requested data count plus offset exceeds fruArea size, we through error, instead we can return remaining bytes. Tested: 1.Verified using below given command. ipmitool -I lanplus -C 3 -P 0penBmc -H <BMP_IP> fru read <fru_id> fru_file Resolves openbmc/openbmc#2893 Change-Id: Iecfe80ed7230b936eca86fd16208582ee7b4e09c Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
* Implement Get SDR and Reserve SDR repository commandTom Joseph2018-03-011-0/+11
| | | | | | | | | | | 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>
* Add Get Repository Info CommandDhruvaraj Subhashchandran2018-02-161-0/+31
| | | | | | | | | | Adding support for Get Repository Info command, which returns information about the SDR repository. resolves openbmc/openbmc#2614 Change-Id: Id1219de8021b5403a775ad6e8577dbc8edfc60cb Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
* FRU: Fix response for Read FRU Data CommandRatan Gupta2018-02-131-3/+11
| | | | | | | | 1) Add the count field as part of read fru command response. 2) Fix in copying the data from the offset. Change-Id: I2eaa76e82179ad65ba3af0f1795aeec40e68a0fc Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>
* Commit a MaintenanceProcedure log entry on a 0xDE SEL recordTom Joseph2017-11-031-1/+13
| | | | | | | | | | | | In the case of a procedure callout, HB sends a eSEL of 0xDF type. It is followed by a Add SEL record with OEM record type 0xDE and byte 11 in the record indicate the procedure associated with the eSEL. Resolves openbmc/openbmc#2368 Change-Id: Ia57f423c9d533cd8968b613d7522b409a9820198 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Update Journal Variable NamesGunnar Mills2017-10-191-2/+3
| | | | | | | | | 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>
* storagehandler: Use new phosphor-timemanager interfaceLei YU2017-10-191-89/+84
| | | | | | | | Update SEL-Time handlers to use sdbusplus and new phosphor-timemanager interface. Change-Id: Ib931a6bedc14037fc1a0a7c25698f67272520bb5 Signed-off-by: Lei YU <mine260309@gmail.com>
* storagehandler: sort include filesLei YU2017-10-171-11/+14
| | | | | Change-Id: Iaf49ed787a2e077af27f28d22507456e8efa2b41 Signed-off-by: Lei YU <mine260309@gmail.com>
* cater for property change signal to invalidate fru dataMarri Devender Rao2017-07-261-0/+1
| | | | | | | Resolves openbmc/openbmc#1560 Change-Id: I90897959dab76181a6006c372c4b60cc1bdd0c0c Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* cater for fru read callback functionsMarri Devender Rao2017-07-251-3/+64
| | | | | Change-Id: I2fdaef98faa6adc19efce0ede93b4ee728b9404c Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* register call back functions for FRU read commandsMarri Devender Rao2017-07-251-1/+32
| | | | | Change-Id: Idb0230ea173940deb17314dc09c4a562b97ede20 Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
* Add Clear SEL commandTom Joseph2017-07-191-0/+104
| | | | | Change-Id: I35b07e0bf1012d4b660d10cf17a47318f3c4e6e2 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Add Delete SEL entry commandTom Joseph2017-07-191-0/+92
| | | | | Change-Id: Iabeaca4b5057ef1bae44cb6d30704de3ce2f1269 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* Add Get SEL entry commandTom Joseph2017-07-191-0/+120
| | | | | Change-Id: I09983a127c7c2817a0ebb6d64ffb2a9585dcd235 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
OpenPOWER on IntegriCloud