dos2unix conversion
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I78a4c2f28285ea30d66895b352402bfd12f95c00
diff --git a/oem/ibm/configurations/events/oem_ibm_event_state_sensor.json b/oem/ibm/configurations/events/oem_ibm_event_state_sensor.json
index e7ddc2b..b32f207 100644
--- a/oem/ibm/configurations/events/oem_ibm_event_state_sensor.json
+++ b/oem/ibm/configurations/events/oem_ibm_event_state_sensor.json
@@ -1,48 +1,48 @@
-{
- "entries": [
- {
- "containerID": 0,
- "entityType": 57346,
- "entityInstance": 0,
- "sensorOffset": 1,
- "event_states": [
- 1,
- 2,
- 3
- ],
- "dbus": {
- "object_path": "/xyz/openbmc_project/network/hypervisor/eth0/ipv4/addr0",
- "interface": "xyz.openbmc_project.Object.Enable",
- "property_name": "Enabled",
- "property_type": "bool",
- "property_values": [
- true,
- false,
- false
- ]
- }
- },
- {
- "containerID": 0,
- "entityType": 57346,
- "entityInstance": 1,
- "sensorOffset": 1,
- "event_states": [
- 1,
- 2,
- 3
- ],
- "dbus": {
- "object_path": "/xyz/openbmc_project/network/hypervisor/eth1/ipv4/addr0",
- "interface": "xyz.openbmc_project.Object.Enable",
- "property_name": "Enabled",
- "property_type": "bool",
- "property_values": [
- true,
- false,
- false
- ]
- }
- }
- ]
-}
+{
+ "entries": [
+ {
+ "containerID": 0,
+ "entityType": 57346,
+ "entityInstance": 0,
+ "sensorOffset": 1,
+ "event_states": [
+ 1,
+ 2,
+ 3
+ ],
+ "dbus": {
+ "object_path": "/xyz/openbmc_project/network/hypervisor/eth0/ipv4/addr0",
+ "interface": "xyz.openbmc_project.Object.Enable",
+ "property_name": "Enabled",
+ "property_type": "bool",
+ "property_values": [
+ true,
+ false,
+ false
+ ]
+ }
+ },
+ {
+ "containerID": 0,
+ "entityType": 57346,
+ "entityInstance": 1,
+ "sensorOffset": 1,
+ "event_states": [
+ 1,
+ 2,
+ 3
+ ],
+ "dbus": {
+ "object_path": "/xyz/openbmc_project/network/hypervisor/eth1/ipv4/addr0",
+ "interface": "xyz.openbmc_project.Object.Enable",
+ "property_name": "Enabled",
+ "property_type": "bool",
+ "property_values": [
+ true,
+ false,
+ false
+ ]
+ }
+ }
+ ]
+}
diff --git a/oem/ibm/libpldm/platform_oem_ibm.c b/oem/ibm/libpldm/platform_oem_ibm.c
index 7090f95..db7090a 100644
--- a/oem/ibm/libpldm/platform_oem_ibm.c
+++ b/oem/ibm/libpldm/platform_oem_ibm.c
@@ -1,50 +1,50 @@
-#include "platform_oem_ibm.h"
-#include "platform.h"
-#include <string.h>
-
-int encode_bios_attribute_update_event_req(uint8_t instance_id,
- uint8_t format_version, uint8_t tid,
- uint8_t num_handles,
- const uint8_t *list_of_handles,
- size_t payload_length,
- struct pldm_msg *msg)
-{
- if (format_version != 1) {
- return PLDM_ERROR_INVALID_DATA;
- }
-
- if (msg == NULL || list_of_handles == NULL) {
- return PLDM_ERROR_INVALID_DATA;
- }
-
- if (num_handles == 0) {
- return PLDM_ERROR_INVALID_DATA;
- }
-
- if (payload_length !=
- (PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES + sizeof(num_handles) +
- (num_handles * sizeof(uint16_t)))) {
- return PLDM_ERROR_INVALID_LENGTH;
- }
-
- struct pldm_header_info header = {0};
- header.msg_type = PLDM_REQUEST;
- header.instance = instance_id;
- header.pldm_type = PLDM_PLATFORM;
- header.command = PLDM_PLATFORM_EVENT_MESSAGE;
- uint8_t rc = pack_pldm_header(&header, &(msg->hdr));
- if (rc != PLDM_SUCCESS) {
- return rc;
- }
-
- struct pldm_bios_attribute_update_event_req *request =
- (struct pldm_bios_attribute_update_event_req *)msg->payload;
- request->format_version = format_version;
- request->tid = tid;
- request->event_class = PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE;
- request->num_handles = num_handles;
- memcpy(request->bios_attribute_handles, list_of_handles,
- num_handles * sizeof(uint16_t));
-
- return PLDM_SUCCESS;
+#include "platform_oem_ibm.h"
+#include "platform.h"
+#include <string.h>
+
+int encode_bios_attribute_update_event_req(uint8_t instance_id,
+ uint8_t format_version, uint8_t tid,
+ uint8_t num_handles,
+ const uint8_t *list_of_handles,
+ size_t payload_length,
+ struct pldm_msg *msg)
+{
+ if (format_version != 1) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ if (msg == NULL || list_of_handles == NULL) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ if (num_handles == 0) {
+ return PLDM_ERROR_INVALID_DATA;
+ }
+
+ if (payload_length !=
+ (PLDM_PLATFORM_EVENT_MESSAGE_MIN_REQ_BYTES + sizeof(num_handles) +
+ (num_handles * sizeof(uint16_t)))) {
+ return PLDM_ERROR_INVALID_LENGTH;
+ }
+
+ struct pldm_header_info header = {0};
+ header.msg_type = PLDM_REQUEST;
+ header.instance = instance_id;
+ header.pldm_type = PLDM_PLATFORM;
+ header.command = PLDM_PLATFORM_EVENT_MESSAGE;
+ uint8_t rc = pack_pldm_header(&header, &(msg->hdr));
+ if (rc != PLDM_SUCCESS) {
+ return rc;
+ }
+
+ struct pldm_bios_attribute_update_event_req *request =
+ (struct pldm_bios_attribute_update_event_req *)msg->payload;
+ request->format_version = format_version;
+ request->tid = tid;
+ request->event_class = PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE;
+ request->num_handles = num_handles;
+ memcpy(request->bios_attribute_handles, list_of_handles,
+ num_handles * sizeof(uint16_t));
+
+ return PLDM_SUCCESS;
}
\ No newline at end of file
diff --git a/oem/ibm/libpldm/platform_oem_ibm.h b/oem/ibm/libpldm/platform_oem_ibm.h
index 7d918e7..f0aafd3 100644
--- a/oem/ibm/libpldm/platform_oem_ibm.h
+++ b/oem/ibm/libpldm/platform_oem_ibm.h
@@ -1,56 +1,56 @@
-#ifndef PLATFORM_OEM_IBM_H
-#define PLATFORM_OEM_IBM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "base.h"
-#include <stddef.h>
-#include <stdint.h>
-
-enum pldm_event_types_ibm_oem {
- PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE = 0xF0,
-};
-
-/** @struct pldm_bios_attribute_update_event_req
- *
- * Structure representing PlatformEventMessage command request data for OEM
- * event type BIOS attribute update.
- */
-struct pldm_bios_attribute_update_event_req {
- uint8_t format_version;
- uint8_t tid;
- uint8_t event_class;
- uint8_t num_handles;
- uint8_t bios_attribute_handles[1];
-} __attribute__((packed));
-
-/** @brief Encode PlatformEventMessage request data for BIOS attribute update
- *
- * @param[in] instance_id - Message's instance id
- * @param[in] format_version - Version of the event format
- * @param[in] tid - Terminus ID for the terminus that originated the event
- * message
- * @param[in] num_handles - Number of BIOS handles with an update
- * @param[in] list_of_handles - Pointer to the list of BIOS attribute handles
- * @param[in] payload_length - Length of request message payload
- * @param[out] msg - Message will be written to this
- *
- * @return pldm_completion_codes
- *
- * @note Caller is responsible for memory alloc and dealloc of param
- * 'msg.payload'
- */
-int encode_bios_attribute_update_event_req(uint8_t instance_id,
- uint8_t format_version, uint8_t tid,
- uint8_t num_handles,
- const uint8_t *list_of_handles,
- size_t payload_length,
- struct pldm_msg *msg);
-
-#ifdef __cplusplus
-}
-#endif
-
+#ifndef PLATFORM_OEM_IBM_H
+#define PLATFORM_OEM_IBM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "base.h"
+#include <stddef.h>
+#include <stdint.h>
+
+enum pldm_event_types_ibm_oem {
+ PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE = 0xF0,
+};
+
+/** @struct pldm_bios_attribute_update_event_req
+ *
+ * Structure representing PlatformEventMessage command request data for OEM
+ * event type BIOS attribute update.
+ */
+struct pldm_bios_attribute_update_event_req {
+ uint8_t format_version;
+ uint8_t tid;
+ uint8_t event_class;
+ uint8_t num_handles;
+ uint8_t bios_attribute_handles[1];
+} __attribute__((packed));
+
+/** @brief Encode PlatformEventMessage request data for BIOS attribute update
+ *
+ * @param[in] instance_id - Message's instance id
+ * @param[in] format_version - Version of the event format
+ * @param[in] tid - Terminus ID for the terminus that originated the event
+ * message
+ * @param[in] num_handles - Number of BIOS handles with an update
+ * @param[in] list_of_handles - Pointer to the list of BIOS attribute handles
+ * @param[in] payload_length - Length of request message payload
+ * @param[out] msg - Message will be written to this
+ *
+ * @return pldm_completion_codes
+ *
+ * @note Caller is responsible for memory alloc and dealloc of param
+ * 'msg.payload'
+ */
+int encode_bios_attribute_update_event_req(uint8_t instance_id,
+ uint8_t format_version, uint8_t tid,
+ uint8_t num_handles,
+ const uint8_t *list_of_handles,
+ size_t payload_length,
+ struct pldm_msg *msg);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* PLATFORM_OEM_IBM_H */
\ No newline at end of file
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
index 0ae1adb..a8d070e 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.cpp
@@ -1,117 +1,117 @@
-#include "platform_oem_ibm.hpp"
-
-#include "libpldm/platform_oem_ibm.h"
-#include "libpldm/requester/pldm.h"
-
-#include "common/utils.hpp"
-#include "libpldmresponder/pdr.hpp"
-
-#include <iostream>
-
-namespace pldm
-{
-namespace responder
-{
-namespace platform
-{
-
-int sendBiosAttributeUpdateEvent(
- uint8_t eid, dbus_api::Requester* requester,
- const std::vector<uint16_t>& handles,
- pldm::requester::Handler<pldm::requester::Request>* handler)
-{
- constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0";
- constexpr auto hostStateInterface =
- "xyz.openbmc_project.State.Boot.Progress";
- constexpr auto hostStateProperty = "BootProgress";
-
- try
- {
- auto propVal = pldm::utils::DBusHandler().getDbusPropertyVariant(
- hostStatePath, hostStateProperty, hostStateInterface);
- const auto& currHostState = std::get<std::string>(propVal);
- if ((currHostState != "xyz.openbmc_project.State.Boot.Progress."
- "ProgressStages.SystemInitComplete") &&
- (currHostState != "xyz.openbmc_project.State.Boot.Progress."
- "ProgressStages.OSRunning") &&
- (currHostState != "xyz.openbmc_project.State.Boot.Progress."
- "ProgressStages.OSStart"))
- {
- return PLDM_SUCCESS;
- }
- }
- catch (const sdbusplus::exception::SdBusError& e)
- {
- std::cerr << "Error in getting current host state, continue ... \n";
- }
-
- auto instanceId = requester->getInstanceId(eid);
-
- std::vector<uint8_t> requestMsg(
- sizeof(pldm_msg_hdr) + sizeof(pldm_bios_attribute_update_event_req) -
- 1 + (handles.size() * sizeof(uint16_t)),
- 0);
-
- auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
-
- auto rc = encode_bios_attribute_update_event_req(
- instanceId, PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION,
- pldm::responder::pdr::BmcMctpEid, handles.size(),
- reinterpret_cast<const uint8_t*>(handles.data()),
- requestMsg.size() - sizeof(pldm_msg_hdr), request);
- if (rc != PLDM_SUCCESS)
- {
- std::cerr << "Message encode failure 1. PLDM error code = " << std::hex
- << std::showbase << rc << "\n";
- requester->markFree(eid, instanceId);
- return rc;
- }
-
- if (requestMsg.size())
- {
- std::ostringstream tempStream;
- for (int byte : requestMsg)
- {
- tempStream << std::setfill('0') << std::setw(2) << std::hex << byte
- << " ";
- }
- std::cout << tempStream.str() << std::endl;
- }
-
- auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
- const pldm_msg* response,
- size_t respMsgLen) {
- if (response == nullptr || !respMsgLen)
- {
- std::cerr
- << "Failed to receive response for platform event message \n";
- return;
- }
- uint8_t completionCode{};
- uint8_t status{};
- auto rc = decode_platform_event_message_resp(response, respMsgLen,
- &completionCode, &status);
- if (rc || completionCode)
- {
- std::cerr << "Failed to decode_platform_event_message_resp: "
- << "rc=" << rc
- << ", cc=" << static_cast<unsigned>(completionCode)
- << std::endl;
- }
- };
- rc = handler->registerRequest(
- eid, instanceId, PLDM_PLATFORM, PLDM_PLATFORM_EVENT_MESSAGE,
- std::move(requestMsg), std::move(platformEventMessageResponseHandler));
- if (rc)
- {
- std::cerr << "Failed to send the platform event message \n";
- }
-
- return rc;
-}
-
-} // namespace platform
-
-} // namespace responder
-
-} // namespace pldm
+#include "platform_oem_ibm.hpp"
+
+#include "libpldm/platform_oem_ibm.h"
+#include "libpldm/requester/pldm.h"
+
+#include "common/utils.hpp"
+#include "libpldmresponder/pdr.hpp"
+
+#include <iostream>
+
+namespace pldm
+{
+namespace responder
+{
+namespace platform
+{
+
+int sendBiosAttributeUpdateEvent(
+ uint8_t eid, dbus_api::Requester* requester,
+ const std::vector<uint16_t>& handles,
+ pldm::requester::Handler<pldm::requester::Request>* handler)
+{
+ constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0";
+ constexpr auto hostStateInterface =
+ "xyz.openbmc_project.State.Boot.Progress";
+ constexpr auto hostStateProperty = "BootProgress";
+
+ try
+ {
+ auto propVal = pldm::utils::DBusHandler().getDbusPropertyVariant(
+ hostStatePath, hostStateProperty, hostStateInterface);
+ const auto& currHostState = std::get<std::string>(propVal);
+ if ((currHostState != "xyz.openbmc_project.State.Boot.Progress."
+ "ProgressStages.SystemInitComplete") &&
+ (currHostState != "xyz.openbmc_project.State.Boot.Progress."
+ "ProgressStages.OSRunning") &&
+ (currHostState != "xyz.openbmc_project.State.Boot.Progress."
+ "ProgressStages.OSStart"))
+ {
+ return PLDM_SUCCESS;
+ }
+ }
+ catch (const sdbusplus::exception::SdBusError& e)
+ {
+ std::cerr << "Error in getting current host state, continue ... \n";
+ }
+
+ auto instanceId = requester->getInstanceId(eid);
+
+ std::vector<uint8_t> requestMsg(
+ sizeof(pldm_msg_hdr) + sizeof(pldm_bios_attribute_update_event_req) -
+ 1 + (handles.size() * sizeof(uint16_t)),
+ 0);
+
+ auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
+
+ auto rc = encode_bios_attribute_update_event_req(
+ instanceId, PLDM_PLATFORM_EVENT_MESSAGE_FORMAT_VERSION,
+ pldm::responder::pdr::BmcMctpEid, handles.size(),
+ reinterpret_cast<const uint8_t*>(handles.data()),
+ requestMsg.size() - sizeof(pldm_msg_hdr), request);
+ if (rc != PLDM_SUCCESS)
+ {
+ std::cerr << "Message encode failure 1. PLDM error code = " << std::hex
+ << std::showbase << rc << "\n";
+ requester->markFree(eid, instanceId);
+ return rc;
+ }
+
+ if (requestMsg.size())
+ {
+ std::ostringstream tempStream;
+ for (int byte : requestMsg)
+ {
+ tempStream << std::setfill('0') << std::setw(2) << std::hex << byte
+ << " ";
+ }
+ std::cout << tempStream.str() << std::endl;
+ }
+
+ auto platformEventMessageResponseHandler = [](mctp_eid_t /*eid*/,
+ const pldm_msg* response,
+ size_t respMsgLen) {
+ if (response == nullptr || !respMsgLen)
+ {
+ std::cerr
+ << "Failed to receive response for platform event message \n";
+ return;
+ }
+ uint8_t completionCode{};
+ uint8_t status{};
+ auto rc = decode_platform_event_message_resp(response, respMsgLen,
+ &completionCode, &status);
+ if (rc || completionCode)
+ {
+ std::cerr << "Failed to decode_platform_event_message_resp: "
+ << "rc=" << rc
+ << ", cc=" << static_cast<unsigned>(completionCode)
+ << std::endl;
+ }
+ };
+ rc = handler->registerRequest(
+ eid, instanceId, PLDM_PLATFORM, PLDM_PLATFORM_EVENT_MESSAGE,
+ std::move(requestMsg), std::move(platformEventMessageResponseHandler));
+ if (rc)
+ {
+ std::cerr << "Failed to send the platform event message \n";
+ }
+
+ return rc;
+}
+
+} // namespace platform
+
+} // namespace responder
+
+} // namespace pldm
diff --git a/oem/ibm/libpldmresponder/platform_oem_ibm.hpp b/oem/ibm/libpldmresponder/platform_oem_ibm.hpp
index 6f3a320..94dc2dd 100644
--- a/oem/ibm/libpldmresponder/platform_oem_ibm.hpp
+++ b/oem/ibm/libpldmresponder/platform_oem_ibm.hpp
@@ -1,36 +1,36 @@
-#pragma once
-
-#include "pldmd/dbus_impl_requester.hpp"
-#include "requester/handler.hpp"
-
-#include <vector>
-
-namespace pldm
-{
-namespace responder
-{
-namespace platform
-{
-
-/** @brief To send BIOS attribute update event
- *
- * When the attribute value changes for any BIOS attribute, then
- * PlatformEventMessage command with OEM event type
- * PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE is send to host with the
- * list of BIOS attribute handles.
- *
- * @param[in] eid - MCTP EID of host firmware
- * @param[in] requester - pointer to Requester object
- * @param[in] handles - List of BIOS attribute handles
- * @param[in] handler - PLDM request handler
- */
-int sendBiosAttributeUpdateEvent(
- uint8_t eid, dbus_api::Requester* requester,
- const std::vector<uint16_t>& handles,
- pldm::requester::Handler<pldm::requester::Request>* handler);
-
-} // namespace platform
-
-} // namespace responder
-
-} // namespace pldm
+#pragma once
+
+#include "pldmd/dbus_impl_requester.hpp"
+#include "requester/handler.hpp"
+
+#include <vector>
+
+namespace pldm
+{
+namespace responder
+{
+namespace platform
+{
+
+/** @brief To send BIOS attribute update event
+ *
+ * When the attribute value changes for any BIOS attribute, then
+ * PlatformEventMessage command with OEM event type
+ * PLDM_EVENT_TYPE_OEM_EVENT_BIOS_ATTRIBUTE_UPDATE is send to host with the
+ * list of BIOS attribute handles.
+ *
+ * @param[in] eid - MCTP EID of host firmware
+ * @param[in] requester - pointer to Requester object
+ * @param[in] handles - List of BIOS attribute handles
+ * @param[in] handler - PLDM request handler
+ */
+int sendBiosAttributeUpdateEvent(
+ uint8_t eid, dbus_api::Requester* requester,
+ const std::vector<uint16_t>& handles,
+ pldm::requester::Handler<pldm::requester::Request>* handler);
+
+} // namespace platform
+
+} // namespace responder
+
+} // namespace pldm