Lines Matching +full:the +full:- +full:new +full:- +full:sd +full:- +full:bus +full:- +full:api +full:- +full:of +full:- +full:systemd
6 #include <linux/i2c-dev.h>
11 #include <systemd/sd-bus.h>
17 #include <ipmid/api.hpp>
23 #include <phosphor-logging/elog-errors.hpp>
24 #include <phosphor-logging/lg2.hpp>
47 extern sd_bus* bus;
87 "/usr/share/ipmi-providers/master_write_read_white_list.json";
102 * @brief Returns the Version info from primary s/w object
104 * Get the Version info from the active s/w object which is having high
106 * is "BMC" from the list of all s/w objects those are implementing
107 * RedundancyPriority interface from the given softwareRoot path.
109 * @return On success returns the Version info from primary s/w object.
119 ipmi::getAllDbusObjects(*ctx->bus, softwareRoot, redundancyIntf); in getActiveSoftwareVersionInfo()
133 ipmi::getService(*ctx->bus, redundancyIntf, softObject.first); in getActiveSoftwareVersionInfo()
135 ipmi::getManagedObjects(*ctx->bus, service, softwareRoot); in getActiveSoftwareVersionInfo()
185 sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()}; in getCurrentBmcState() local
187 // Get the Inventory object implementing the BMC interface in getCurrentBmcState()
189 ipmi::getDbusObject(bus, bmc_state_interface); in getCurrentBmcState()
191 ipmi::getDbusProperty(bus, bmcObject.second, bmcObject.first, in getCurrentBmcState()
207 // Nothing provided the BMC interface, therefore return whatever was in getCurrentBmcStateWithFallback()
208 // configured as the default. in getCurrentBmcStateWithFallback()
228 // Defined in 20.6 of ipmi doc
306 * @param sysAcpiState - ACPI system power state to set
307 * @param devAcpiState - ACPI device power state to set
316 sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()}; in ipmiSetAcpiPowerState() local
345 value = found->first; in ipmiSetAcpiPowerState()
350 ipmi::getDbusObject(bus, acpi_state::acpiInterface); in ipmiSetAcpiPowerState()
351 ipmi::setDbusProperty(bus, acpiObject.second, acpiObject.first, in ipmiSetAcpiPowerState()
393 value = found->first; in ipmiSetAcpiPowerState()
398 ipmi::getDbusObject(bus, acpi_state::acpiInterface); in ipmiSetAcpiPowerState()
399 ipmi::setDbusProperty(bus, acpiObject.second, acpiObject.first, in ipmiSetAcpiPowerState()
420 * @brief implements the get ACPI power state command
423 * - ACPI system power state
424 * - ACPI device power state
434 sdbusplus::bus_t bus{ipmid_get_sd_bus_connection()}; in ipmiGetAcpiPowerState() local
438 auto acpiObject = ipmi::getDbusObject(bus, acpi_state::acpiInterface); in ipmiGetAcpiPowerState()
441 bus, acpiObject.second, acpiObject.first, acpi_state::acpiInterface, in ipmiGetAcpiPowerState()
448 bus, acpiObject.second, acpiObject.first, acpi_state::acpiInterface, in ipmiGetAcpiPowerState()
472 /* version = 2.14.0-dev */
474 /* | |---------------- Minor */
475 /* |------------------ Major */
490 /* regex = "([\d]+).([\d]+).([\d]+)-dev-([\d]+)-g([0-9a-fA-F]{2}) */
491 /* ([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})" */
493 /* version = 2.14.0-dev-750-g37a7c5ad1-dirty */
496 /* | | | | | | | |-- Aux byte 3 (0xAD), index 8 */
497 /* | | | | | | |---- Aux byte 2 (0xC5), index 7 */
498 /* | | | | | |------ Aux byte 1 (0xA7), index 6 */
499 /* | | | | |-------- Aux byte 0 (0x37), index 5 */
500 /* | | | |------------- Not used, index 4 */
501 /* | | |------------------- Not used, index 3 */
502 /* | |---------------------- Minor (14), index 2 */
503 /* |------------------------ Major (2), index 1 */
518 return -1; in convertVersion()
528 return -1; in convertVersion()
532 { // For the platforms use year as major version, it would expect to in convertVersion()
533 // have major version between 0 - 99. If the major version is in convertVersion()
535 // converted to 0 - 99. in convertVersion()
551 return -1; in convertVersion()
580 return -1; in convertVersion()
589 return -1; in convertVersion()
592 /* @brief: Implement the Get Device ID IPMI command per the IPMI spec
593 * @param[in] ctx - shared_ptr to an IPMI context struct
596 * - Device ID (manufacturer defined)
597 * - Device revision[4 bits]; reserved[3 bits]; SDR support[1 bit]
598 * - FW revision major[7 bits] (binary encoded); available[1 bit]
599 * - FW Revision minor (BCD encoded)
600 * - IPMI version (0x02 for IPMI 2.0)
601 * - device support (bitfield of supported options)
602 * - MFG IANA ID (3 bytes)
603 * - product ID (2 bytes)
604 * - AUX info (4 bytes)
631 const char* filename = "/usr/share/ipmi-providers/dev_id.json"; in ipmiAppGetDeviceId()
639 int r = -1; in ipmiAppGetDeviceId()
653 // bit7 identifies if the device is available in ipmiAppGetDeviceId()
656 // or self-initialization in progress. in ipmiAppGetDeviceId()
657 // The availability may change in run time, so mask here in ipmiAppGetDeviceId()
705 // Set the availablitity of the BMC. in ipmiAppGetDeviceId()
708 // Don't read the file every time if successful in ipmiAppGetDeviceId()
724 // Set availability to the actual current BMC state in ipmiAppGetDeviceId()
736 auto ipmiAppGetSelfTestResults() -> ipmi::RspType<uint8_t, uint8_t> in ipmiAppGetSelfTestResults()
739 // 55h - No error. in ipmiAppGetSelfTestResults()
740 // 56h - Self Test function not implemented in this controller. in ipmiAppGetSelfTestResults()
741 // 57h - Corrupted or inaccesssible data or devices. in ipmiAppGetSelfTestResults()
742 // 58h - Fatal hardware error. in ipmiAppGetSelfTestResults()
743 // FFh - reserved. in ipmiAppGetSelfTestResults()
744 // all other: Device-specific 'internal failure'. in ipmiAppGetSelfTestResults()
747 // For byte 2 = 58h, all other: Device-specific in ipmiAppGetSelfTestResults()
748 // For byte 2 = 57h: self-test error bitfield. in ipmiAppGetSelfTestResults()
755 // [2] 1b = Internal Use Area of BMC FRU corrupted. in ipmiAppGetSelfTestResults()
767 // UUID is in RFC4122 format. Ex: 61a39523-78f2-11e5-9862-e6402cfc3223 in rfc4122ToIpmi()
768 // Per IPMI Spec 2.0 need to convert to 16 hex bytes and reverse the byte in rfc4122ToIpmi()
776 rfc4122.erase(std::remove(rfc4122.begin(), rfc4122.end(), '-'), in rfc4122ToIpmi()
807 uuid[uuidBinaryLength - (ind / 2) - 1] = static_cast<uint8_t>(b); in rfc4122ToIpmi()
813 -> ipmi::RspType<std::array<uint8_t, uuidBinaryLength>> in ipmiAppGetDeviceGuid()
815 // return a fixed GUID based on /etc/machine-id in ipmiAppGetDeviceGuid()
816 // This should match the /redfish/v1/Managers/bmc's UUID data in ipmiAppGetDeviceGuid()
819 // generated by systemd-id128 -p new as per man page in ipmiAppGetDeviceGuid()
824 // create the UUID from /etc/machine-id via the systemd API in ipmiAppGetDeviceGuid()
835 -> ipmi::RspType<uint8_t, uint8_t, uint8_t, uint8_t, uint8_t> in ipmiAppGetBtCapabilities()
837 // Per IPMI 2.0 spec, the input and output buffer size must be the max in ipmiAppGetBtCapabilities()
838 // buffer size minus one byte to allocate space for the length byte. in ipmiAppGetBtCapabilities()
840 constexpr uint8_t inputBufferSize = MAX_IPMI_BUFFER - 1; in ipmiAppGetBtCapabilities()
841 constexpr uint8_t outputBufferSize = MAX_IPMI_BUFFER - 1; in ipmiAppGetBtCapabilities()
850 -> ipmi::RspType<std::array<uint8_t, 16>> in ipmiAppGetSystemGuid()
855 // Get the Inventory object implementing BMC interface in ipmiAppGetSystemGuid()
867 // UUID is in RFC4122 format Ex: 61a39523-78f2-11e5-9862-e6402cfc3223 in ipmiAppGetSystemGuid()
899 * @brief set the session state as teardown
901 * This function is to set the session state to tear down in progress if the
904 * @param[in] busp - Dbus obj
905 * @param[in] service - service name
906 * @param[in] obj - object path
908 * @return success completion code if it sets the session state to
909 * tearDownInProgress else return the corresponding error completion code.
979 // Session id and handler are retrived from the object path and in ipmiAppCloseSession()
989 const std::string service = itr->first; in ipmiAppCloseSession()
1027 * This function validates the request data and retrive request session id,
1030 * @param[in] ctx - context of current session.
1031 * @param[in] sessionIndex - request session index
1032 * @param[in] payload - input payload
1033 * @param[in] reqSessionId - unpacked session Id will be asigned
1034 * @param[in] reqSessionHandle - unpacked session handle will be asigned
1037 * else return the correcponding error completion code.
1055 ipmi::getChannelInfo(ctx->channel, chInfo); in getSessionInfoRequestData()
1068 if (ctx->sessionId == session::sessionZero) in getSessionInfoRequestData()
1072 reqSessionId = ctx->sessionId; in getSessionInfoRequestData()
1132 /** Alias SessionDetails - contain the optional information about an
1135 * @param userID - uint6_t session user ID (0-63)
1136 * @param reserved - uint2_t reserved
1137 * @param privilege - uint4_t session privilege (0-5)
1138 * @param reserved - uint4_t reserved
1139 * @param channel - uint4_t session channel number
1140 * @param protocol - uint4_t session protocol
1141 * @param remoteIP - uint32_t remote IP address
1142 * @param macAddr - std::array<uint8_t, 6> mac address
1143 * @param port - uint16_t remote port
1151 * @param[in] ctx - ipmi::Context pointer for accessing D-Bus
1152 * @param[in] service - D-Bus service name to fetch details from
1153 * @param[in] objPath - D-Bus object path for session
1154 * @param[out] sessionHandle - return session handle for session
1155 * @param[out] sessionState - return session state for session
1156 * @param[out] details - return a SessionDetails tuple containing other
1158 * @return - ipmi::Cc success or error code
1259 std::string service = itr->first; in ipmiAppGetSessionInfo()
1302 * The System Firmware version is detected via following steps: in getSysFWVersion()
1303 * - Get all of object paths that include in getSysFWVersion()
1305 * - Get the Purpose property of above object paths. in getSysFWVersion()
1306 * - If the Purpose is Host then get the Version property. in getSysFWVersion()
1355 // Use the BMC hostname as the "System Name." in sysInfoReadSystemName()
1395 std::optional<std::vector<uint8_t>>> // data2-17
1428 sysInfoParamStore->update(IPMI_SYSINFO_SYSTEM_NAME, in ipmiAppGetSystemInfo()
1440 sysInfoParamStore->update(IPMI_SYSINFO_SYSTEM_FW_VERSION, *fwVersion); in ipmiAppGetSystemInfo()
1445 sysInfoParamStore->lookup(paramSelector); in ipmiAppGetSystemInfo()
1467 configParameterLength - configData.size(), 0x00); in ipmiAppGetSystemInfo()
1472 size_t offset = (setSelector * fullChunkSize) - configDataOverhead; in ipmiAppGetSystemInfo()
1477 count = std::min(paramString.length() - offset, fullChunkSize); in ipmiAppGetSystemInfo()
1500 // attempt to set the 'set in progress' value (in parameter #0) in ipmiAppSetSystemInfo()
1501 // when not in the set complete state. in ipmiAppSetSystemInfo()
1526 (configParameterLength - configData.size()), 0x00); in ipmiAppSetSystemInfo()
1532 sysInfoParamStore->update(IPMI_SYSINFO_SYSTEM_NAME, in ipmiAppSetSystemInfo()
1538 sysInfoParamStore->lookup(paramSelector); in ipmiAppSetSystemInfo()
1543 // parameter does not exist. Init new in ipmiAppSetSystemInfo()
1566 size_t offset = (setSelector * fullChunkSize) - configDataOverhead; in ipmiAppSetSystemInfo()
1571 count = std::min(paramString.length() - offset, configData.size()); in ipmiAppSetSystemInfo()
1574 sysInfoParamStore->update(paramSelector, paramString); in ipmiAppSetSystemInfo()
1621 // "Description": "Allow full read - ignore first byte write value in populateI2CControllerWRAllowlist()
1630 // "Description": "Allow full read - first byte match 0x05 and in populateI2CControllerWRAllowlist()
1715 // Skip as no-match, if requested write data is more than the in isCmdAllowlisted()
1738 * low-level I2C/SMBus write, read or write-read access
1739 * @param isPrivateBus -to indicate private bus usage
1740 * @param busId - bus id
1741 * @param channelNum - channel number
1742 * @param reserved - skip 1 bit
1743 * @param targetAddr - target address
1744 * @param read count - number of bytes to be read
1745 * @param writeData - data to be written
1748 * - readData - i2c response data
1770 "bus: {BUS}, addr: {ADDR}", in ipmiControllerWriteRead()
1771 "BUS", static_cast<uint8_t>(busId), "ADDR", lg2::hex, in ipmiControllerWriteRead()
1777 "/dev/i2c-" + std::to_string(static_cast<uint8_t>(busId)); in ipmiControllerWriteRead()