Add calls to the SBE FIFO device driver to perform the SBE
chip operations.
Change-Id: I2f1204efc8196e9d331789e7910f90537834ddde
Signed-off-by: Murulidhar Nataraju <murulidhar@in.ibm.com>
diff --git a/sbe_interfaces.cpp b/sbe_interfaces.cpp
index 28f0bb9..8575dad 100755
--- a/sbe_interfaces.cpp
+++ b/sbe_interfaces.cpp
@@ -1,6 +1,7 @@
#include <iostream>
#include <stdexcept>
#include <array>
+#include <endian.h>
#include "sbe_interfaces.hpp"
#include "sbe_chipOp_handler.hpp"
@@ -46,13 +47,15 @@
throw std::runtime_error("NULL FIFO device path");
}
- //Build SCOM read request command
+ //Build SCOM read request command.
+ //Handle byte order mismatch ,SBE is big endian and BMC is
+ //little endian.
std::array<sbe_word_t, READ_CMD_LENGTH> command =
{
static_cast<sbe_word_t>(READ_CMD_LENGTH),
- READ_OPCODE,
- upper(address),
- lower(address)
+ htobe32(READ_OPCODE),
+ htobe32(upper(address)),
+ htobe32(lower(address))
};
//Buffer to hold the response data along with the SBE header
@@ -79,14 +82,16 @@
}
//Build SCOM write request command
+ //Handle byte order mismatch, SBE is big endian and BMC is
+ //little endian.
std::array<sbe_word_t, WRITE_CMD_LENGTH> command =
{
static_cast<sbe_word_t>(WRITE_CMD_LENGTH),
- WRITE_OPCODE,
- upper(address),
- lower(address),
- upper(data),
- lower(data)
+ htobe32(WRITE_OPCODE),
+ htobe32(upper(address)),
+ htobe32(lower(address)),
+ htobe32(upper(data)),
+ htobe32(lower(data))
};
//Buffer to hold the SBE response status