diff options
Diffstat (limited to 'transporthandler.cpp')
-rw-r--r-- | transporthandler.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/transporthandler.cpp b/transporthandler.cpp index 777171c..a88e0a2 100644 --- a/transporthandler.cpp +++ b/transporthandler.cpp @@ -164,6 +164,9 @@ enum class LanParam : uint8_t CiphersuiteEntries = 23, }; +static constexpr uint8_t oemCmdStart = 192; +static constexpr uint8_t oemCmdEnd = 255; + /** @brief IPMI IP Origin Types */ enum class IPSrc : uint8_t { @@ -1067,6 +1070,60 @@ SetStatus& getSetStatus(uint8_t channel) return setStatus[channel] = SetStatus::Complete; } +/** + * Define placeholder command handlers for the OEM Extension bytes for the Set + * LAN Configuration Parameters and Get LAN Configuration Parameters + * commands. Using "weak" linking allows the placeholder setLanOem/getLanOem + * functions below to be overridden. + * To create handlers for your own proprietary command set: + * Create/modify a phosphor-ipmi-host Bitbake append file within your Yocto + * recipe + * Create C++ file(s) that define IPMI handler functions matching the + * function names below (i.e. setLanOem). The default name for the + * transport IPMI commands is transporthandler_oem.cpp. + * Add: + * EXTRA_OECONF_append = " --enable-transport-oem=yes" + * Create a do_compile_prepend()/do_install_append method in your + * bbappend file to copy the file to the build directory. + * Add: + * PROJECT_SRC_DIR := "${THISDIR}/${PN}" + * # Copy the "strong" functions into the working directory, overriding the + * # placeholder functions. + * do_compile_prepend(){ + * cp -f ${PROJECT_SRC_DIR}/transporthandler_oem.cpp ${S} + * } + * + * # Clean up after complilation has completed + * do_install_append(){ + * rm -f ${S}/transporthandler_oem.cpp + * } + * + */ + +/** + * Define the placeholder OEM commands as having weak linkage. Create + * setLanOem, and getLanOem functions in the transporthandler_oem.cpp + * file. The functions defined there must not have the "weak" attribute + * applied to them. + */ +RspType<> setLanOem(uint8_t channel, uint8_t parameter, message::Payload& req) + __attribute__((weak)); +RspType<message::Payload> getLanOem(uint8_t channel, uint8_t parameter, + uint8_t set, uint8_t block) + __attribute__((weak)); + +RspType<> setLanOem(uint8_t channel, uint8_t parameter, message::Payload& req) +{ + req.trailingOk = true; + return response(ccParamNotSupported); +} + +RspType<message::Payload> getLanOem(uint8_t channel, uint8_t parameter, + uint8_t set, uint8_t block) +{ + return response(ccParamNotSupported); +} + RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, message::Payload& req) { @@ -1234,6 +1291,11 @@ RspType<> setLan(uint4_t channelBits, uint4_t, uint8_t parameter, } } + if ((parameter >= oemCmdStart) && (parameter <= oemCmdEnd)) + { + return setLanOem(channel, parameter, req); + } + req.trailingOk = true; return response(ccParamNotSupported); } @@ -1394,6 +1456,11 @@ RspType<message::Payload> getLan(uint4_t channelBits, uint3_t, bool revOnly, } } + if ((parameter >= oemCmdStart) && (parameter <= oemCmdEnd)) + { + return getLanOem(channel, parameter, set, block); + } + return response(ccParamNotSupported); } |