Lines Matching +full:the +full:- +full:new +full:- +full:sd +full:- +full:bus +full:- +full:api +full:- +full:of +full:- +full:systemd
5 #include "elog-errors.hpp"
8 #include <ipmid/api.h>
11 #include <systemd/sd-bus.h>
13 #include <host-interface.hpp>
14 #include <ipmid-host/cmd.hpp>
15 #include <ipmid/api-types.hpp>
18 #include <sdbusplus/bus.hpp>
49 // Dive in to the IBM log to find the severity in mapSeverity()
55 return find->second; in mapSeverity()
66 uint8_t sensor = rec->sensorNum; in mapCalloutAssociation()
69 * Search the sensor number to inventory path mapping to figure out the in mapCalloutAssociation()
70 * inventory associated with the ESEL. in mapCalloutAssociation()
78 return found->first; in mapCalloutAssociation()
84 std::string getService(sdbusplus::bus_t& bus, const std::string& path, in getService() argument
88 bus.new_method_call("xyz.openbmc_project.ObjectMapper", in getService()
99 auto reply = bus.call(method); in getService()
117 return response.begin()->first; in getService()
144 // insert '/0' at the end of the character array. in createOCCLogEntry()
148 new char[(eSELData.size() * byteSeperator) + 1]()); in createOCCLogEntry()
165 // insert '/0' at the end of the character array. in createHostEntry()
174 new char[(eSELData.size() * byteSeperator) + 1]()); in createHostEntry()
191 /** @brief Helper function to do a graceful restart (reboot) of the BMC.
192 @return 0 on success, -1 on error
196 sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()}; in rebootBMC() local
197 auto service = getService(bus, stateBmcPath, stateBmcIntf); in rebootBMC()
200 log<level::ERR>("Error getting the service name to reboot the BMC."); in rebootBMC()
201 return -1; in rebootBMC()
205 auto method = bus.new_method_call(service.c_str(), stateBmcPath, in rebootBMC()
210 bus.call_noreply(method); in rebootBMC()
214 log<level::ERR>("Error calling to reboot the BMC.", in rebootBMC()
216 return -1; in rebootBMC()
222 // For the First partial add eSEL the SEL Record ID and offset
223 // value should be 0x0000. The extended data needs to be in
224 // the form of an IPMI SEL Event Record, with Event sensor type
225 // of 0xDF and Event Message format of 0x04. The returned
228 // This function creates a /tmp/esel file to store the
229 // incoming partial esel. It is the role of some other
230 // function to commit the error log in to long term
231 // storage. Likely via the ipmi add_sel command.
268 // 0 then then this is a new request in ipmi_ibm_oem_partial_esel()
274 rlen = (*data_len) - (uint8_t)(sizeof(esel_request_t)); in ipmi_ibm_oem_partial_esel()
293 // The first bit presents that this is the last partial packet in ipmi_ibm_oem_partial_esel()
294 // coming down. If that is the case advance the record id so we in ipmi_ibm_oem_partial_esel()
308 // If the eSEL record type is OCC metrics, then create the OCC log in ipmi_ibm_oem_partial_esel()
324 // Execute needed commands to prepare the system for a fw update from the host.
339 "fw_setenv openbmconce copy-files-to-ram copy-base-filesystem-to-ram"); in ipmi_ibm_oem_prep_fw_update()
347 // Touch the image-rwfs file to perform an empty update to force the save in ipmi_ibm_oem_prep_fw_update()
348 // in case we're already in ram and the flash is the same causing the ram in ipmi_ibm_oem_prep_fw_update()
350 rwfs_file.open("/run/initramfs/image-rwfs", in ipmi_ibm_oem_prep_fw_update()
354 // Reboot the BMC for settings to take effect in ipmi_ibm_oem_prep_fw_update()
358 fprintf(stderr, "Failed to reset BMC: %s\n", strerror(-rc)); in ipmi_ibm_oem_prep_fw_update()
359 return -1; in ipmi_ibm_oem_prep_fw_update()
373 sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()}; in ipmi_ibm_oem_bmc_factory_reset() local
375 // Since this is a one way command (i.e. the host is requesting a power in ipmi_ibm_oem_bmc_factory_reset()
376 // off of itself and a reboot of the BMC) we can exceed the 5 second in ipmi_ibm_oem_bmc_factory_reset()
377 // IPMI timeout. Testing has shown that the power off can take up to in ipmi_ibm_oem_bmc_factory_reset()
383 auto service = getService(bus, stateChassisPath, stateChassisIntf); in ipmi_ibm_oem_bmc_factory_reset()
390 auto method = bus.new_method_call(service.c_str(), stateChassisPath, in ipmi_ibm_oem_bmc_factory_reset()
395 bus.call_noreply(method); in ipmi_ibm_oem_bmc_factory_reset()
399 log<level::ERR>("Error powering off the chassis", in ipmi_ibm_oem_bmc_factory_reset()
404 // Wait a few seconds for the chassis to power off in ipmi_ibm_oem_bmc_factory_reset()
408 method = bus.new_method_call(bmcUpdaterServiceName, softwarePath, in ipmi_ibm_oem_bmc_factory_reset()
412 bus.call_noreply(method); in ipmi_ibm_oem_bmc_factory_reset()
421 // Wait a few seconds for service that sets the reset env variable to in ipmi_ibm_oem_bmc_factory_reset()
422 // complete before the BMC is rebooted in ipmi_ibm_oem_bmc_factory_reset()
429 log<level::ALERT>("The BMC needs to be manually rebooted to complete " in ipmi_ibm_oem_bmc_factory_reset()
430 "the factory reset."); in ipmi_ibm_oem_bmc_factory_reset()
439 // Storage to keep the object alive during process life
461 // Create new object on the bus in register_netfn_ibm_oem_commands()
474 // and this will be as part of that. in register_netfn_ibm_oem_commands()