oemcommands.cpp (ef0efbc402a0a4bbc237361e18ab9fe070c4acdd) | oemcommands.cpp (63c99be4ac026a326d6953d608376edb0e60007a) |
---|---|
1/* 2 * Copyright (c) 2018 Intel Corporation. 3 * Copyright (c) 2018-present Facebook. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18#include "xyz/openbmc_project/Common/error.hpp" | 1/* 2 * Copyright (c) 2018 Intel Corporation. 3 * Copyright (c) 2018-present Facebook. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18#include "xyz/openbmc_project/Common/error.hpp" |
19#include <ipmid/api.hpp> | |
20 | 19 |
20#include <ipmid/api.hpp> 21#include <ipmid/utils.hpp> 22#include <commandutils.hpp> |
|
21#include <nlohmann/json.hpp> | 23#include <nlohmann/json.hpp> |
24#include <oemcommands.hpp> 25#include <phosphor-logging/log.hpp> 26#include <sdbusplus/bus.hpp> 27 |
|
22#include <array> | 28#include <array> |
23#include <commandutils.hpp> | |
24#include <cstring> | 29#include <cstring> |
25#include <iostream> | 30#include <fstream> |
26#include <iomanip> | 31#include <iomanip> |
32#include <iostream> |
|
27#include <sstream> | 33#include <sstream> |
28#include <fstream> 29#include <oemcommands.hpp> 30#include <ipmid/utils.hpp> 31#include <phosphor-logging/log.hpp> 32#include <sdbusplus/bus.hpp> | |
33#include <string> 34#include <vector> 35 36#define SIZE_IANA_ID 3 37 38namespace ipmi 39{ 40 41using namespace phosphor::logging; 42 43static void registerOEMFunctions() __attribute__((constructor)); 44sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection()); // from ipmid/api.h 45static constexpr size_t maxFRUStringLength = 0x3F; 46 | 34#include <string> 35#include <vector> 36 37#define SIZE_IANA_ID 3 38 39namespace ipmi 40{ 41 42using namespace phosphor::logging; 43 44static void registerOEMFunctions() __attribute__((constructor)); 45sdbusplus::bus::bus dbus(ipmid_get_sd_bus_connection()); // from ipmid/api.h 46static constexpr size_t maxFRUStringLength = 0x3F; 47 |
47int plat_udbg_get_post_desc(uint8_t, uint8_t *, uint8_t, uint8_t *, uint8_t *, 48 uint8_t *); 49int plat_udbg_get_gpio_desc(uint8_t, uint8_t *, uint8_t *, uint8_t *, uint8_t *, 50 uint8_t *); 51ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t *, uint8_t *, 52 uint8_t *); 53ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t *, 54 uint8_t *); 55int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t> &, std::vector<uint8_t> &); | 48int plat_udbg_get_post_desc(uint8_t, uint8_t*, uint8_t, uint8_t*, uint8_t*, 49 uint8_t*); 50int plat_udbg_get_gpio_desc(uint8_t, uint8_t*, uint8_t*, uint8_t*, uint8_t*, 51 uint8_t*); 52ipmi_ret_t plat_udbg_get_frame_data(uint8_t, uint8_t, uint8_t*, uint8_t*, 53 uint8_t*); 54ipmi_ret_t plat_udbg_control_panel(uint8_t, uint8_t, uint8_t, uint8_t*, 55 uint8_t*); 56int sendMeCmd(uint8_t, uint8_t, std::vector<uint8_t>&, std::vector<uint8_t>&); |
56 57nlohmann::json oemData __attribute__((init_priority(101))); 58 59enum class LanParam : uint8_t 60{ 61 INPROGRESS = 0, 62 AUTHSUPPORT = 1, 63 AUTHENABLES = 2, --- 15 unchanged lines hidden (view full) --- 79constexpr auto SERVICE = "xyz.openbmc_project.Network"; 80constexpr auto IPV4_TYPE = "ipv4"; 81constexpr auto IPV6_TYPE = "ipv6"; 82constexpr auto IPV4_PREFIX = "169.254"; 83constexpr auto IPV6_PREFIX = "fe80"; 84constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP"; 85constexpr auto MAC_INTERFACE = "xyz.openbmc_project.Network.MACAddress"; 86 | 57 58nlohmann::json oemData __attribute__((init_priority(101))); 59 60enum class LanParam : uint8_t 61{ 62 INPROGRESS = 0, 63 AUTHSUPPORT = 1, 64 AUTHENABLES = 2, --- 15 unchanged lines hidden (view full) --- 80constexpr auto SERVICE = "xyz.openbmc_project.Network"; 81constexpr auto IPV4_TYPE = "ipv4"; 82constexpr auto IPV6_TYPE = "ipv6"; 83constexpr auto IPV4_PREFIX = "169.254"; 84constexpr auto IPV6_PREFIX = "fe80"; 85constexpr auto IP_INTERFACE = "xyz.openbmc_project.Network.IP"; 86constexpr auto MAC_INTERFACE = "xyz.openbmc_project.Network.MACAddress"; 87 |
87bool isLinkLocalIP(const std::string &address) | 88bool isLinkLocalIP(const std::string& address) |
88{ 89 return address.find(IPV4_PREFIX) == 0 || address.find(IPV6_PREFIX) == 0; 90} 91 | 89{ 90 return address.find(IPV4_PREFIX) == 0 || address.find(IPV6_PREFIX) == 0; 91} 92 |
92DbusObjectInfo getIPObject(sdbusplus::bus::bus &bus, 93 const std::string &interface, 94 const std::string &serviceRoot, 95 const std::string &match) | 93DbusObjectInfo getIPObject(sdbusplus::bus::bus& bus, 94 const std::string& interface, 95 const std::string& serviceRoot, 96 const std::string& match) |
96{ 97 auto objectTree = getAllDbusObjects(bus, serviceRoot, interface, match); 98 99 if (objectTree.empty()) 100 { 101 log<level::ERR>("No Object has implemented the IP interface", 102 entry("INTERFACE=%s", interface.c_str())); 103 } 104 105 DbusObjectInfo objectInfo; 106 | 97{ 98 auto objectTree = getAllDbusObjects(bus, serviceRoot, interface, match); 99 100 if (objectTree.empty()) 101 { 102 log<level::ERR>("No Object has implemented the IP interface", 103 entry("INTERFACE=%s", interface.c_str())); 104 } 105 106 DbusObjectInfo objectInfo; 107 |
107 for (auto &object : objectTree) | 108 for (auto& object : objectTree) |
108 { 109 auto variant = 110 ipmi::getDbusProperty(bus, object.second.begin()->first, 111 object.first, IP_INTERFACE, "Address"); 112 113 objectInfo = std::make_pair(object.first, object.second.begin()->first); 114 115 // if LinkLocalIP found look for Non-LinkLocalIP --- 18 unchanged lines hidden (view full) --- 134void flushOemData() 135{ 136 std::ofstream file(JSON_OEM_DATA_FILE); 137 file << oemData; 138 file.close(); 139 return; 140} 141 | 109 { 110 auto variant = 111 ipmi::getDbusProperty(bus, object.second.begin()->first, 112 object.first, IP_INTERFACE, "Address"); 113 114 objectInfo = std::make_pair(object.first, object.second.begin()->first); 115 116 // if LinkLocalIP found look for Non-LinkLocalIP --- 18 unchanged lines hidden (view full) --- 135void flushOemData() 136{ 137 std::ofstream file(JSON_OEM_DATA_FILE); 138 file << oemData; 139 file.close(); 140 return; 141} 142 |
142std::string bytesToStr(uint8_t *byte, int len) | 143std::string bytesToStr(uint8_t* byte, int len) |
143{ 144 std::stringstream ss; 145 int i; 146 147 ss << std::hex; 148 for (i = 0; i < len; i++) 149 { 150 ss << std::setw(2) << std::setfill('0') << (int)byte[i]; 151 } 152 153 return ss.str(); 154} 155 | 144{ 145 std::stringstream ss; 146 int i; 147 148 ss << std::hex; 149 for (i = 0; i < len; i++) 150 { 151 ss << std::setw(2) << std::setfill('0') << (int)byte[i]; 152 } 153 154 return ss.str(); 155} 156 |
156int strToBytes(std::string &str, uint8_t *data) | 157int strToBytes(std::string& str, uint8_t* data) |
157{ 158 std::string sstr; 159 int i; 160 161 for (i = 0; i < (str.length()) / 2; i++) 162 { 163 sstr = str.substr(i * 2, 2); 164 data[i] = (uint8_t)std::strtol(sstr.c_str(), NULL, 16); 165 } 166 return i; 167} 168 | 158{ 159 std::string sstr; 160 int i; 161 162 for (i = 0; i < (str.length()) / 2; i++) 163 { 164 sstr = str.substr(i * 2, 2); 165 data[i] = (uint8_t)std::strtol(sstr.c_str(), NULL, 16); 166 } 167 return i; 168} 169 |
169ipmi_ret_t getNetworkData(uint8_t lan_param, char *data) | 170ipmi_ret_t getNetworkData(uint8_t lan_param, char* data) |
170{ 171 ipmi_ret_t rc = IPMI_CC_OK; 172 sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection()); 173 174 const std::string ethdevice = "eth0"; 175 176 switch (static_cast<LanParam>(lan_param)) 177 { | 171{ 172 ipmi_ret_t rc = IPMI_CC_OK; 173 sdbusplus::bus::bus bus(ipmid_get_sd_bus_connection()); 174 175 const std::string ethdevice = "eth0"; 176 177 switch (static_cast<LanParam>(lan_param)) 178 { |
178 case LanParam::IP: 179 { | 179 case LanParam::IP: { |
180 auto ethIP = ethdevice + "/" + ipmi::network::IPV4_TYPE; 181 std::string ipaddress; 182 auto ipObjectInfo = ipmi::network::getIPObject( 183 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 184 185 auto properties = ipmi::getAllDbusProperties( 186 bus, ipObjectInfo.second, ipObjectInfo.first, 187 ipmi::network::IP_INTERFACE); 188 189 ipaddress = std::get<std::string>(properties["Address"]); 190 191 std::strcpy(data, ipaddress.c_str()); 192 } 193 break; 194 | 180 auto ethIP = ethdevice + "/" + ipmi::network::IPV4_TYPE; 181 std::string ipaddress; 182 auto ipObjectInfo = ipmi::network::getIPObject( 183 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 184 185 auto properties = ipmi::getAllDbusProperties( 186 bus, ipObjectInfo.second, ipObjectInfo.first, 187 ipmi::network::IP_INTERFACE); 188 189 ipaddress = std::get<std::string>(properties["Address"]); 190 191 std::strcpy(data, ipaddress.c_str()); 192 } 193 break; 194 |
195 case LanParam::IPV6: 196 { | 195 case LanParam::IPV6: { |
197 auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; 198 std::string ipaddress; 199 auto ipObjectInfo = ipmi::network::getIPObject( 200 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 201 202 auto properties = ipmi::getAllDbusProperties( 203 bus, ipObjectInfo.second, ipObjectInfo.first, 204 ipmi::network::IP_INTERFACE); 205 206 ipaddress = std::get<std::string>(properties["Address"]); 207 208 std::strcpy(data, ipaddress.c_str()); 209 } 210 break; 211 | 196 auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; 197 std::string ipaddress; 198 auto ipObjectInfo = ipmi::network::getIPObject( 199 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 200 201 auto properties = ipmi::getAllDbusProperties( 202 bus, ipObjectInfo.second, ipObjectInfo.first, 203 ipmi::network::IP_INTERFACE); 204 205 ipaddress = std::get<std::string>(properties["Address"]); 206 207 std::strcpy(data, ipaddress.c_str()); 208 } 209 break; 210 |
212 case LanParam::MAC: 213 { | 211 case LanParam::MAC: { |
214 std::string macAddress; 215 auto macObjectInfo = 216 ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE, 217 ipmi::network::ROOT, ethdevice); 218 219 auto variant = ipmi::getDbusProperty( 220 bus, macObjectInfo.second, macObjectInfo.first, 221 ipmi::network::MAC_INTERFACE, "MACAddress"); --- 9 unchanged lines hidden (view full) --- 231 232 default: 233 rc = IPMI_CC_PARM_OUT_OF_RANGE; 234 } 235 return rc; 236} 237 238// return code: 0 successful | 212 std::string macAddress; 213 auto macObjectInfo = 214 ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE, 215 ipmi::network::ROOT, ethdevice); 216 217 auto variant = ipmi::getDbusProperty( 218 bus, macObjectInfo.second, macObjectInfo.first, 219 ipmi::network::MAC_INTERFACE, "MACAddress"); --- 9 unchanged lines hidden (view full) --- 229 230 default: 231 rc = IPMI_CC_PARM_OUT_OF_RANGE; 232 } 233 return rc; 234} 235 236// return code: 0 successful |
239int8_t getFruData(std::string &data, std::string &name) | 237int8_t getFruData(std::string& data, std::string& name) |
240{ 241 std::string objpath = "/xyz/openbmc_project/FruDevice"; 242 std::string intf = "xyz.openbmc_project.FruDeviceManager"; 243 std::string service = getService(dbus, intf, objpath); 244 ObjectValueTree valueTree = getManagedObjects(dbus, service, "/"); 245 if (valueTree.empty()) 246 { 247 phosphor::logging::log<phosphor::logging::level::ERR>( 248 "No object implements interface", 249 phosphor::logging::entry("INTF=%s", intf.c_str())); 250 return -1; 251 } 252 | 238{ 239 std::string objpath = "/xyz/openbmc_project/FruDevice"; 240 std::string intf = "xyz.openbmc_project.FruDeviceManager"; 241 std::string service = getService(dbus, intf, objpath); 242 ObjectValueTree valueTree = getManagedObjects(dbus, service, "/"); 243 if (valueTree.empty()) 244 { 245 phosphor::logging::log<phosphor::logging::level::ERR>( 246 "No object implements interface", 247 phosphor::logging::entry("INTF=%s", intf.c_str())); 248 return -1; 249 } 250 |
253 for (const auto &item : valueTree) | 251 for (const auto& item : valueTree) |
254 { 255 auto interface = item.second.find("xyz.openbmc_project.FruDevice"); 256 if (interface == item.second.end()) 257 { 258 continue; 259 } 260 261 auto property = interface->second.find(name.c_str()); 262 if (property == interface->second.end()) 263 { 264 continue; 265 } 266 267 try 268 { 269 Value variant = property->second; | 252 { 253 auto interface = item.second.find("xyz.openbmc_project.FruDevice"); 254 if (interface == item.second.end()) 255 { 256 continue; 257 } 258 259 auto property = interface->second.find(name.c_str()); 260 if (property == interface->second.end()) 261 { 262 continue; 263 } 264 265 try 266 { 267 Value variant = property->second; |
270 std::string &result = std::get<std::string>(variant); | 268 std::string& result = std::get<std::string>(variant); |
271 if (result.size() > maxFRUStringLength) 272 { 273 phosphor::logging::log<phosphor::logging::level::ERR>( 274 "FRU serial number exceed maximum length"); 275 return -1; 276 } 277 data = result; 278 return 0; 279 } | 269 if (result.size() > maxFRUStringLength) 270 { 271 phosphor::logging::log<phosphor::logging::level::ERR>( 272 "FRU serial number exceed maximum length"); 273 return -1; 274 } 275 data = result; 276 return 0; 277 } |
280 catch (std::bad_variant_access &e) | 278 catch (std::bad_variant_access& e) |
281 { 282 phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); 283 return -1; 284 } 285 } 286 return -1; 287} 288 --- 9 unchanged lines hidden (view full) --- 298// Get Debug Frame Info 299//---------------------------------------------------------------------- 300ipmi_ret_t ipmiOemDbgGetFrameInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 301 ipmi_request_t request, 302 ipmi_response_t response, 303 ipmi_data_len_t data_len, 304 ipmi_context_t context) 305{ | 279 { 280 phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); 281 return -1; 282 } 283 } 284 return -1; 285} 286 --- 9 unchanged lines hidden (view full) --- 296// Get Debug Frame Info 297//---------------------------------------------------------------------- 298ipmi_ret_t ipmiOemDbgGetFrameInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 299 ipmi_request_t request, 300 ipmi_response_t response, 301 ipmi_data_len_t data_len, 302 ipmi_context_t context) 303{ |
306 uint8_t *req = reinterpret_cast<uint8_t *>(request); 307 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 304 uint8_t* req = reinterpret_cast<uint8_t*>(request); 305 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
308 uint8_t num_frames = 3; 309 310 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID 311 res[SIZE_IANA_ID] = num_frames; 312 *data_len = SIZE_IANA_ID + 1; 313 314 return IPMI_CC_OK; 315} 316 317//---------------------------------------------------------------------- 318// Get Debug Updated Frames 319//---------------------------------------------------------------------- 320ipmi_ret_t ipmiOemDbgGetUpdFrames(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 321 ipmi_request_t request, 322 ipmi_response_t response, 323 ipmi_data_len_t data_len, 324 ipmi_context_t context) 325{ | 306 uint8_t num_frames = 3; 307 308 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID 309 res[SIZE_IANA_ID] = num_frames; 310 *data_len = SIZE_IANA_ID + 1; 311 312 return IPMI_CC_OK; 313} 314 315//---------------------------------------------------------------------- 316// Get Debug Updated Frames 317//---------------------------------------------------------------------- 318ipmi_ret_t ipmiOemDbgGetUpdFrames(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 319 ipmi_request_t request, 320 ipmi_response_t response, 321 ipmi_data_len_t data_len, 322 ipmi_context_t context) 323{ |
326 uint8_t *req = reinterpret_cast<uint8_t *>(request); 327 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 324 uint8_t* req = reinterpret_cast<uint8_t*>(request); 325 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
328 uint8_t num_updates = 3; 329 *data_len = 4; 330 331 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID 332 res[SIZE_IANA_ID] = num_updates; 333 *data_len = SIZE_IANA_ID + num_updates + 1; 334 res[SIZE_IANA_ID + 1] = 1; // info page update 335 res[SIZE_IANA_ID + 2] = 2; // cri sel update --- 6 unchanged lines hidden (view full) --- 342// Get Debug POST Description 343//---------------------------------------------------------------------- 344ipmi_ret_t ipmiOemDbgGetPostDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 345 ipmi_request_t request, 346 ipmi_response_t response, 347 ipmi_data_len_t data_len, 348 ipmi_context_t context) 349{ | 326 uint8_t num_updates = 3; 327 *data_len = 4; 328 329 std::memcpy(res, req, SIZE_IANA_ID); // IANA ID 330 res[SIZE_IANA_ID] = num_updates; 331 *data_len = SIZE_IANA_ID + num_updates + 1; 332 res[SIZE_IANA_ID + 1] = 1; // info page update 333 res[SIZE_IANA_ID + 2] = 2; // cri sel update --- 6 unchanged lines hidden (view full) --- 340// Get Debug POST Description 341//---------------------------------------------------------------------- 342ipmi_ret_t ipmiOemDbgGetPostDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 343 ipmi_request_t request, 344 ipmi_response_t response, 345 ipmi_data_len_t data_len, 346 ipmi_context_t context) 347{ |
350 uint8_t *req = reinterpret_cast<uint8_t *>(request); 351 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 348 uint8_t* req = reinterpret_cast<uint8_t*>(request); 349 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
352 uint8_t index = 0; 353 uint8_t next = 0; 354 uint8_t end = 0; 355 uint8_t phase = 0; 356 uint8_t descLen = 0; 357 int ret; 358 359 index = req[3]; --- 22 unchanged lines hidden (view full) --- 382// Get Debug GPIO Description 383//---------------------------------------------------------------------- 384ipmi_ret_t ipmiOemDbgGetGpioDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 385 ipmi_request_t request, 386 ipmi_response_t response, 387 ipmi_data_len_t data_len, 388 ipmi_context_t context) 389{ | 350 uint8_t index = 0; 351 uint8_t next = 0; 352 uint8_t end = 0; 353 uint8_t phase = 0; 354 uint8_t descLen = 0; 355 int ret; 356 357 index = req[3]; --- 22 unchanged lines hidden (view full) --- 380// Get Debug GPIO Description 381//---------------------------------------------------------------------- 382ipmi_ret_t ipmiOemDbgGetGpioDesc(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 383 ipmi_request_t request, 384 ipmi_response_t response, 385 ipmi_data_len_t data_len, 386 ipmi_context_t context) 387{ |
390 uint8_t *req = reinterpret_cast<uint8_t *>(request); 391 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 388 uint8_t* req = reinterpret_cast<uint8_t*>(request); 389 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
392 393 uint8_t index = 0; 394 uint8_t next = 0; 395 uint8_t level = 0; 396 uint8_t pinDef = 0; 397 uint8_t descLen = 0; 398 int ret; 399 --- 23 unchanged lines hidden (view full) --- 423// Get Debug Frame Data 424//---------------------------------------------------------------------- 425ipmi_ret_t ipmiOemDbgGetFrameData(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 426 ipmi_request_t request, 427 ipmi_response_t response, 428 ipmi_data_len_t data_len, 429 ipmi_context_t context) 430{ | 390 391 uint8_t index = 0; 392 uint8_t next = 0; 393 uint8_t level = 0; 394 uint8_t pinDef = 0; 395 uint8_t descLen = 0; 396 int ret; 397 --- 23 unchanged lines hidden (view full) --- 421// Get Debug Frame Data 422//---------------------------------------------------------------------- 423ipmi_ret_t ipmiOemDbgGetFrameData(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 424 ipmi_request_t request, 425 ipmi_response_t response, 426 ipmi_data_len_t data_len, 427 ipmi_context_t context) 428{ |
431 uint8_t *req = reinterpret_cast<uint8_t *>(request); 432 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 429 uint8_t* req = reinterpret_cast<uint8_t*>(request); 430 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
433 uint8_t frame; 434 uint8_t page; 435 uint8_t next; 436 uint8_t count; 437 int ret; 438 439 frame = req[3]; 440 page = req[4]; --- 22 unchanged lines hidden (view full) --- 463// Get Debug Control Panel 464//---------------------------------------------------------------------- 465ipmi_ret_t ipmiOemDbgGetCtrlPanel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 466 ipmi_request_t request, 467 ipmi_response_t response, 468 ipmi_data_len_t data_len, 469 ipmi_context_t context) 470{ | 431 uint8_t frame; 432 uint8_t page; 433 uint8_t next; 434 uint8_t count; 435 int ret; 436 437 frame = req[3]; 438 page = req[4]; --- 22 unchanged lines hidden (view full) --- 461// Get Debug Control Panel 462//---------------------------------------------------------------------- 463ipmi_ret_t ipmiOemDbgGetCtrlPanel(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 464 ipmi_request_t request, 465 ipmi_response_t response, 466 ipmi_data_len_t data_len, 467 ipmi_context_t context) 468{ |
471 uint8_t *req = reinterpret_cast<uint8_t *>(request); 472 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 469 uint8_t* req = reinterpret_cast<uint8_t*>(request); 470 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
473 474 uint8_t panel; 475 uint8_t operation; 476 uint8_t item; 477 uint8_t count; 478 ipmi_ret_t ret; 479 480 panel = req[3]; --- 10 unchanged lines hidden (view full) --- 491 492//---------------------------------------------------------------------- 493// Set Dimm Info (CMD_OEM_SET_DIMM_INFO) 494//---------------------------------------------------------------------- 495ipmi_ret_t ipmiOemSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 496 ipmi_request_t request, ipmi_response_t response, 497 ipmi_data_len_t data_len, ipmi_context_t context) 498{ | 471 472 uint8_t panel; 473 uint8_t operation; 474 uint8_t item; 475 uint8_t count; 476 ipmi_ret_t ret; 477 478 panel = req[3]; --- 10 unchanged lines hidden (view full) --- 489 490//---------------------------------------------------------------------- 491// Set Dimm Info (CMD_OEM_SET_DIMM_INFO) 492//---------------------------------------------------------------------- 493ipmi_ret_t ipmiOemSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 494 ipmi_request_t request, ipmi_response_t response, 495 ipmi_data_len_t data_len, ipmi_context_t context) 496{ |
499 uint8_t *req = reinterpret_cast<uint8_t *>(request); | 497 uint8_t* req = reinterpret_cast<uint8_t*>(request); |
500 501 uint8_t index = req[0]; 502 uint8_t type = req[1]; 503 uint16_t speed; 504 uint32_t size; 505 506 memcpy(&speed, &req[2], 2); 507 memcpy(&size, &req[4], 4); --- 16 unchanged lines hidden (view full) --- 524 525//---------------------------------------------------------------------- 526// Get Board ID (CMD_OEM_GET_BOARD_ID) 527//---------------------------------------------------------------------- 528ipmi_ret_t ipmiOemGetBoardID(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 529 ipmi_request_t request, ipmi_response_t response, 530 ipmi_data_len_t data_len, ipmi_context_t context) 531{ | 498 499 uint8_t index = req[0]; 500 uint8_t type = req[1]; 501 uint16_t speed; 502 uint32_t size; 503 504 memcpy(&speed, &req[2], 2); 505 memcpy(&size, &req[4], 4); --- 16 unchanged lines hidden (view full) --- 522 523//---------------------------------------------------------------------- 524// Get Board ID (CMD_OEM_GET_BOARD_ID) 525//---------------------------------------------------------------------- 526ipmi_ret_t ipmiOemGetBoardID(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 527 ipmi_request_t request, ipmi_response_t response, 528 ipmi_data_len_t data_len, ipmi_context_t context) 529{ |
532 uint8_t *req = reinterpret_cast<uint8_t *>(request); 533 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 530 uint8_t* req = reinterpret_cast<uint8_t*>(request); 531 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
534 535 /* TODO: Needs to implement this after GPIO implementation */ 536 *data_len = 0; 537 538 return IPMI_CC_OK; 539} 540 541/* Helper functions to set boot order */ | 532 533 /* TODO: Needs to implement this after GPIO implementation */ 534 *data_len = 0; 535 536 return IPMI_CC_OK; 537} 538 539/* Helper functions to set boot order */ |
542void setBootOrder(uint8_t *data) | 540void setBootOrder(uint8_t* data) |
543{ 544 nlohmann::json bootMode; 545 uint8_t mode = data[0]; 546 int i; 547 548 bootMode["UEFI"] = (mode & BOOT_MODE_UEFI ? true : false); 549 bootMode["CMOS_CLR"] = (mode & BOOT_MODE_CMOS_CLR ? true : false); 550 bootMode["FORCE_BOOT"] = (mode & BOOT_MODE_FORCE_BOOT ? true : false); --- 15 unchanged lines hidden (view full) --- 566 567//---------------------------------------------------------------------- 568// Set Boot Order (CMD_OEM_SET_BOOT_ORDER) 569//---------------------------------------------------------------------- 570ipmi_ret_t ipmiOemSetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 571 ipmi_request_t request, ipmi_response_t response, 572 ipmi_data_len_t data_len, ipmi_context_t context) 573{ | 541{ 542 nlohmann::json bootMode; 543 uint8_t mode = data[0]; 544 int i; 545 546 bootMode["UEFI"] = (mode & BOOT_MODE_UEFI ? true : false); 547 bootMode["CMOS_CLR"] = (mode & BOOT_MODE_CMOS_CLR ? true : false); 548 bootMode["FORCE_BOOT"] = (mode & BOOT_MODE_FORCE_BOOT ? true : false); --- 15 unchanged lines hidden (view full) --- 564 565//---------------------------------------------------------------------- 566// Set Boot Order (CMD_OEM_SET_BOOT_ORDER) 567//---------------------------------------------------------------------- 568ipmi_ret_t ipmiOemSetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 569 ipmi_request_t request, ipmi_response_t response, 570 ipmi_data_len_t data_len, ipmi_context_t context) 571{ |
574 uint8_t *req = reinterpret_cast<uint8_t *>(request); | 572 uint8_t* req = reinterpret_cast<uint8_t*>(request); |
575 uint8_t len = *data_len; 576 577 *data_len = 0; 578 579 if (len != SIZE_BOOT_ORDER) 580 { 581 phosphor::logging::log<phosphor::logging::level::ERR>( 582 "Invalid Boot order length received"); --- 7 unchanged lines hidden (view full) --- 590 591//---------------------------------------------------------------------- 592// Get Boot Order (CMD_OEM_GET_BOOT_ORDER) 593//---------------------------------------------------------------------- 594ipmi_ret_t ipmiOemGetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 595 ipmi_request_t request, ipmi_response_t response, 596 ipmi_data_len_t data_len, ipmi_context_t context) 597{ | 573 uint8_t len = *data_len; 574 575 *data_len = 0; 576 577 if (len != SIZE_BOOT_ORDER) 578 { 579 phosphor::logging::log<phosphor::logging::level::ERR>( 580 "Invalid Boot order length received"); --- 7 unchanged lines hidden (view full) --- 588 589//---------------------------------------------------------------------- 590// Get Boot Order (CMD_OEM_GET_BOOT_ORDER) 591//---------------------------------------------------------------------- 592ipmi_ret_t ipmiOemGetBootOrder(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 593 ipmi_request_t request, ipmi_response_t response, 594 ipmi_data_len_t data_len, ipmi_context_t context) 595{ |
598 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 596 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
599 uint8_t mode = 0; 600 int i; 601 602 *data_len = SIZE_BOOT_ORDER; 603 604 if (oemData.find(KEY_BOOT_ORDER) == oemData.end()) 605 { 606 /* Return default boot order 0100090203ff */ --- 35 unchanged lines hidden (view full) --- 642// Set Machine Config Info (CMD_OEM_SET_MACHINE_CONFIG_INFO) 643//---------------------------------------------------------------------- 644ipmi_ret_t ipmiOemSetMachineCfgInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 645 ipmi_request_t request, 646 ipmi_response_t response, 647 ipmi_data_len_t data_len, 648 ipmi_context_t context) 649{ | 597 uint8_t mode = 0; 598 int i; 599 600 *data_len = SIZE_BOOT_ORDER; 601 602 if (oemData.find(KEY_BOOT_ORDER) == oemData.end()) 603 { 604 /* Return default boot order 0100090203ff */ --- 35 unchanged lines hidden (view full) --- 640// Set Machine Config Info (CMD_OEM_SET_MACHINE_CONFIG_INFO) 641//---------------------------------------------------------------------- 642ipmi_ret_t ipmiOemSetMachineCfgInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 643 ipmi_request_t request, 644 ipmi_response_t response, 645 ipmi_data_len_t data_len, 646 ipmi_context_t context) 647{ |
650 machineConfigInfo_t *req = reinterpret_cast<machineConfigInfo_t *>(request); | 648 machineConfigInfo_t* req = reinterpret_cast<machineConfigInfo_t*>(request); |
651 uint8_t len = *data_len; 652 653 *data_len = 0; 654 655 if (len < sizeof(machineConfigInfo_t)) 656 { 657 phosphor::logging::log<phosphor::logging::level::ERR>( 658 "Invalid machine configuration length received"); 659 return IPMI_CC_REQ_DATA_LEN_INVALID; 660 } 661 | 649 uint8_t len = *data_len; 650 651 *data_len = 0; 652 653 if (len < sizeof(machineConfigInfo_t)) 654 { 655 phosphor::logging::log<phosphor::logging::level::ERR>( 656 "Invalid machine configuration length received"); 657 return IPMI_CC_REQ_DATA_LEN_INVALID; 658 } 659 |
662 if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t *)) | 660 if (req->chassis_type >= sizeof(chassisType) / sizeof(uint8_t*)) |
663 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = "UNKNOWN"; 664 else 665 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = 666 chassisType[req->chassis_type]; 667 | 661 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = "UNKNOWN"; 662 else 663 oemData[KEY_MC_CONFIG][KEY_MC_CHAS_TYPE] = 664 chassisType[req->chassis_type]; 665 |
668 if (req->mb_type >= sizeof(mbType) / sizeof(uint8_t *)) | 666 if (req->mb_type >= sizeof(mbType) / sizeof(uint8_t*)) |
669 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = "UNKNOWN"; 670 else 671 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = mbType[req->mb_type]; 672 673 oemData[KEY_MC_CONFIG][KEY_MC_PROC_CNT] = req->proc_cnt; 674 oemData[KEY_MC_CONFIG][KEY_MC_MEM_CNT] = req->mem_cnt; 675 oemData[KEY_MC_CONFIG][KEY_MC_HDD35_CNT] = req->hdd35_cnt; 676 oemData[KEY_MC_CONFIG][KEY_MC_HDD25_CNT] = req->hdd25_cnt; 677 | 667 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = "UNKNOWN"; 668 else 669 oemData[KEY_MC_CONFIG][KEY_MC_MB_TYPE] = mbType[req->mb_type]; 670 671 oemData[KEY_MC_CONFIG][KEY_MC_PROC_CNT] = req->proc_cnt; 672 oemData[KEY_MC_CONFIG][KEY_MC_MEM_CNT] = req->mem_cnt; 673 oemData[KEY_MC_CONFIG][KEY_MC_HDD35_CNT] = req->hdd35_cnt; 674 oemData[KEY_MC_CONFIG][KEY_MC_HDD25_CNT] = req->hdd25_cnt; 675 |
678 if (req->riser_type >= sizeof(riserType) / sizeof(uint8_t *)) | 676 if (req->riser_type >= sizeof(riserType) / sizeof(uint8_t*)) |
679 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = "UNKNOWN"; 680 else 681 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = riserType[req->riser_type]; 682 683 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC] = {}; 684 int i = 0; 685 if (req->pcie_card_loc & BIT_0) 686 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT1"; 687 if (req->pcie_card_loc & BIT_1) 688 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT2"; 689 if (req->pcie_card_loc & BIT_2) 690 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT3"; 691 if (req->pcie_card_loc & BIT_3) 692 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT4"; 693 | 677 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = "UNKNOWN"; 678 else 679 oemData[KEY_MC_CONFIG][KEY_MC_RSR_TYPE] = riserType[req->riser_type]; 680 681 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC] = {}; 682 int i = 0; 683 if (req->pcie_card_loc & BIT_0) 684 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT1"; 685 if (req->pcie_card_loc & BIT_1) 686 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT2"; 687 if (req->pcie_card_loc & BIT_2) 688 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT3"; 689 if (req->pcie_card_loc & BIT_3) 690 oemData[KEY_MC_CONFIG][KEY_MC_PCIE_LOC][i++] = "SLOT4"; 691 |
694 if (req->slot1_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *)) | 692 if (req->slot1_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*)) |
695 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = "UNKNOWN"; 696 else 697 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = 698 pcieType[req->slot1_pcie_type]; 699 | 693 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = "UNKNOWN"; 694 else 695 oemData[KEY_MC_CONFIG][KEY_MC_SLOT1_TYPE] = 696 pcieType[req->slot1_pcie_type]; 697 |
700 if (req->slot2_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *)) | 698 if (req->slot2_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*)) |
701 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = "UNKNOWN"; 702 else 703 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = 704 pcieType[req->slot2_pcie_type]; 705 | 699 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = "UNKNOWN"; 700 else 701 oemData[KEY_MC_CONFIG][KEY_MC_SLOT2_TYPE] = 702 pcieType[req->slot2_pcie_type]; 703 |
706 if (req->slot3_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *)) | 704 if (req->slot3_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*)) |
707 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = "UNKNOWN"; 708 else 709 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = 710 pcieType[req->slot3_pcie_type]; 711 | 705 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = "UNKNOWN"; 706 else 707 oemData[KEY_MC_CONFIG][KEY_MC_SLOT3_TYPE] = 708 pcieType[req->slot3_pcie_type]; 709 |
712 if (req->slot4_pcie_type >= sizeof(pcieType) / sizeof(uint8_t *)) | 710 if (req->slot4_pcie_type >= sizeof(pcieType) / sizeof(uint8_t*)) |
713 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = "UNKNOWN"; 714 else 715 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = 716 pcieType[req->slot4_pcie_type]; 717 718 oemData[KEY_MC_CONFIG][KEY_MC_AEP_CNT] = req->aep_mem_cnt; 719 720 flushOemData(); --- 50 unchanged lines hidden (view full) --- 771// Byte 9:16 – CPU1 PPIN data 772// 773// Response: 774// Byte 1 – Completion Code 775ipmi_ret_t ipmiOemSetPPINInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 776 ipmi_request_t request, ipmi_response_t response, 777 ipmi_data_len_t data_len, ipmi_context_t context) 778{ | 711 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = "UNKNOWN"; 712 else 713 oemData[KEY_MC_CONFIG][KEY_MC_SLOT4_TYPE] = 714 pcieType[req->slot4_pcie_type]; 715 716 oemData[KEY_MC_CONFIG][KEY_MC_AEP_CNT] = req->aep_mem_cnt; 717 718 flushOemData(); --- 50 unchanged lines hidden (view full) --- 769// Byte 9:16 – CPU1 PPIN data 770// 771// Response: 772// Byte 1 – Completion Code 773ipmi_ret_t ipmiOemSetPPINInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 774 ipmi_request_t request, ipmi_response_t response, 775 ipmi_data_len_t data_len, ipmi_context_t context) 776{ |
779 uint8_t *req = reinterpret_cast<uint8_t *>(request); | 777 uint8_t* req = reinterpret_cast<uint8_t*>(request); |
780 std::string ppinStr; 781 int len; 782 783 if (*data_len > SIZE_CPU_PPIN * 2) 784 len = SIZE_CPU_PPIN * 2; 785 else 786 len = *data_len; 787 *data_len = 0; --- 35 unchanged lines hidden (view full) --- 823 824//---------------------------------------------------------------------- 825// Set PPR (CMD_OEM_SET_PPR) 826//---------------------------------------------------------------------- 827ipmi_ret_t ipmiOemSetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 828 ipmi_request_t request, ipmi_response_t response, 829 ipmi_data_len_t data_len, ipmi_context_t context) 830{ | 778 std::string ppinStr; 779 int len; 780 781 if (*data_len > SIZE_CPU_PPIN * 2) 782 len = SIZE_CPU_PPIN * 2; 783 else 784 len = *data_len; 785 *data_len = 0; --- 35 unchanged lines hidden (view full) --- 821 822//---------------------------------------------------------------------- 823// Set PPR (CMD_OEM_SET_PPR) 824//---------------------------------------------------------------------- 825ipmi_ret_t ipmiOemSetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 826 ipmi_request_t request, ipmi_response_t response, 827 ipmi_data_len_t data_len, ipmi_context_t context) 828{ |
831 uint8_t *req = reinterpret_cast<uint8_t *>(request); | 829 uint8_t* req = reinterpret_cast<uint8_t*>(request); |
832 uint8_t pprCnt, pprAct, pprIndex; 833 uint8_t selParam = req[0]; 834 uint8_t len = *data_len; 835 std::stringstream ss; 836 std::string str; 837 838 *data_len = 0; 839 --- 73 unchanged lines hidden (view full) --- 913 914//---------------------------------------------------------------------- 915// Get PPR (CMD_OEM_GET_PPR) 916//---------------------------------------------------------------------- 917ipmi_ret_t ipmiOemGetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 918 ipmi_request_t request, ipmi_response_t response, 919 ipmi_data_len_t data_len, ipmi_context_t context) 920{ | 830 uint8_t pprCnt, pprAct, pprIndex; 831 uint8_t selParam = req[0]; 832 uint8_t len = *data_len; 833 std::stringstream ss; 834 std::string str; 835 836 *data_len = 0; 837 --- 73 unchanged lines hidden (view full) --- 911 912//---------------------------------------------------------------------- 913// Get PPR (CMD_OEM_GET_PPR) 914//---------------------------------------------------------------------- 915ipmi_ret_t ipmiOemGetPpr(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 916 ipmi_request_t request, ipmi_response_t response, 917 ipmi_data_len_t data_len, ipmi_context_t context) 918{ |
921 uint8_t *req = reinterpret_cast<uint8_t *>(request); 922 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 919 uint8_t* req = reinterpret_cast<uint8_t*>(request); 920 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
923 uint8_t pprCnt, pprIndex; 924 uint8_t selParam = req[0]; 925 std::stringstream ss; 926 std::string str; 927 928 /* Any failure will return zero length data */ 929 *data_len = 0; 930 --- 94 unchanged lines hidden (view full) --- 1025// Byte 4 – Processor frequency in MHz (LSB) 1026// Byte 5 – Processor frequency in MHz (MSB) 1027// Byte 6..7 – Revision 1028// 1029ipmi_ret_t ipmiOemQSetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1030 ipmi_request_t request, ipmi_response_t response, 1031 ipmi_data_len_t data_len, ipmi_context_t context) 1032{ | 921 uint8_t pprCnt, pprIndex; 922 uint8_t selParam = req[0]; 923 std::stringstream ss; 924 std::string str; 925 926 /* Any failure will return zero length data */ 927 *data_len = 0; 928 --- 94 unchanged lines hidden (view full) --- 1023// Byte 4 – Processor frequency in MHz (LSB) 1024// Byte 5 – Processor frequency in MHz (MSB) 1025// Byte 6..7 – Revision 1026// 1027ipmi_ret_t ipmiOemQSetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1028 ipmi_request_t request, ipmi_response_t response, 1029 ipmi_data_len_t data_len, ipmi_context_t context) 1030{ |
1033 qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request); 1034 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *); | 1031 qProcInfo_t* req = reinterpret_cast<qProcInfo_t*>(request); 1032 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t*); |
1035 std::stringstream ss; 1036 std::string str; 1037 uint8_t len = *data_len; 1038 1039 *data_len = 0; 1040 1041 /* check for requested data params */ 1042 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam) --- 40 unchanged lines hidden (view full) --- 1083// Byte 4 – Processor frequency in MHz (LSB) 1084// Byte 5 – Processor frequency in MHz (MSB) 1085// Byte 6..7 – Revision 1086// 1087ipmi_ret_t ipmiOemQGetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1088 ipmi_request_t request, ipmi_response_t response, 1089 ipmi_data_len_t data_len, ipmi_context_t context) 1090{ | 1033 std::stringstream ss; 1034 std::string str; 1035 uint8_t len = *data_len; 1036 1037 *data_len = 0; 1038 1039 /* check for requested data params */ 1040 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam) --- 40 unchanged lines hidden (view full) --- 1081// Byte 4 – Processor frequency in MHz (LSB) 1082// Byte 5 – Processor frequency in MHz (MSB) 1083// Byte 6..7 – Revision 1084// 1085ipmi_ret_t ipmiOemQGetProcInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1086 ipmi_request_t request, ipmi_response_t response, 1087 ipmi_data_len_t data_len, ipmi_context_t context) 1088{ |
1091 qProcInfo_t *req = reinterpret_cast<qProcInfo_t *>(request); 1092 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t *); 1093 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 1089 qProcInfo_t* req = reinterpret_cast<qProcInfo_t*>(request); 1090 uint8_t numParam = sizeof(cpuInfoKey) / sizeof(uint8_t*); 1091 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
1094 std::stringstream ss; 1095 std::string str; 1096 1097 *data_len = 0; 1098 1099 /* check for requested data params */ 1100 if (req->paramSel < 1 || req->paramSel >= numParam) 1101 { --- 75 unchanged lines hidden (view full) --- 1177// Param#6 (Module Manufacturer ID): 1178// Byte 1 - Module Manufacturer ID, LSB 1179// Byte 2 - Module Manufacturer ID, MSB 1180// 1181ipmi_ret_t ipmiOemQSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1182 ipmi_request_t request, ipmi_response_t response, 1183 ipmi_data_len_t data_len, ipmi_context_t context) 1184{ | 1092 std::stringstream ss; 1093 std::string str; 1094 1095 *data_len = 0; 1096 1097 /* check for requested data params */ 1098 if (req->paramSel < 1 || req->paramSel >= numParam) 1099 { --- 75 unchanged lines hidden (view full) --- 1175// Param#6 (Module Manufacturer ID): 1176// Byte 1 - Module Manufacturer ID, LSB 1177// Byte 2 - Module Manufacturer ID, MSB 1178// 1179ipmi_ret_t ipmiOemQSetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1180 ipmi_request_t request, ipmi_response_t response, 1181 ipmi_data_len_t data_len, ipmi_context_t context) 1182{ |
1185 qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request); 1186 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *); | 1183 qDimmInfo_t* req = reinterpret_cast<qDimmInfo_t*>(request); 1184 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t*); |
1187 std::stringstream ss; 1188 std::string str; 1189 uint8_t len = *data_len; 1190 1191 *data_len = 0; 1192 1193 /* check for requested data params */ 1194 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam) --- 75 unchanged lines hidden (view full) --- 1270// Param#6 (Module Manufacturer ID): 1271// Byte 1 - Module Manufacturer ID, LSB 1272// Byte 2 - Module Manufacturer ID, MSB 1273// 1274ipmi_ret_t ipmiOemQGetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1275 ipmi_request_t request, ipmi_response_t response, 1276 ipmi_data_len_t data_len, ipmi_context_t context) 1277{ | 1185 std::stringstream ss; 1186 std::string str; 1187 uint8_t len = *data_len; 1188 1189 *data_len = 0; 1190 1191 /* check for requested data params */ 1192 if (len < 5 || req->paramSel < 1 || req->paramSel >= numParam) --- 75 unchanged lines hidden (view full) --- 1268// Param#6 (Module Manufacturer ID): 1269// Byte 1 - Module Manufacturer ID, LSB 1270// Byte 2 - Module Manufacturer ID, MSB 1271// 1272ipmi_ret_t ipmiOemQGetDimmInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1273 ipmi_request_t request, ipmi_response_t response, 1274 ipmi_data_len_t data_len, ipmi_context_t context) 1275{ |
1278 qDimmInfo_t *req = reinterpret_cast<qDimmInfo_t *>(request); 1279 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t *); 1280 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 1276 qDimmInfo_t* req = reinterpret_cast<qDimmInfo_t*>(request); 1277 uint8_t numParam = sizeof(dimmInfoKey) / sizeof(uint8_t*); 1278 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
1281 std::stringstream ss; 1282 std::string str; 1283 1284 *data_len = 0; 1285 1286 /* check for requested data params */ 1287 if (req->paramSel < 1 || req->paramSel >= numParam) 1288 { --- 95 unchanged lines hidden (view full) --- 1384// Data 1...8: HDD World Wide Name, LSB 1385// 1386ipmi_ret_t ipmiOemQSetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1387 ipmi_request_t request, 1388 ipmi_response_t response, 1389 ipmi_data_len_t data_len, 1390 ipmi_context_t context) 1391{ | 1279 std::stringstream ss; 1280 std::string str; 1281 1282 *data_len = 0; 1283 1284 /* check for requested data params */ 1285 if (req->paramSel < 1 || req->paramSel >= numParam) 1286 { --- 95 unchanged lines hidden (view full) --- 1382// Data 1...8: HDD World Wide Name, LSB 1383// 1384ipmi_ret_t ipmiOemQSetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1385 ipmi_request_t request, 1386 ipmi_response_t response, 1387 ipmi_data_len_t data_len, 1388 ipmi_context_t context) 1389{ |
1392 qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request); 1393 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *); | 1390 qDriveInfo_t* req = reinterpret_cast<qDriveInfo_t*>(request); 1391 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t*); |
1394 uint8_t ctrlType = req->hddCtrlType & 0x0f; 1395 std::stringstream ss; 1396 std::string str; 1397 uint8_t len = *data_len; 1398 1399 *data_len = 0; 1400 1401 /* check for requested data params */ --- 44 unchanged lines hidden (view full) --- 1446// Information) 1447// 1448ipmi_ret_t ipmiOemQGetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1449 ipmi_request_t request, 1450 ipmi_response_t response, 1451 ipmi_data_len_t data_len, 1452 ipmi_context_t context) 1453{ | 1392 uint8_t ctrlType = req->hddCtrlType & 0x0f; 1393 std::stringstream ss; 1394 std::string str; 1395 uint8_t len = *data_len; 1396 1397 *data_len = 0; 1398 1399 /* check for requested data params */ --- 44 unchanged lines hidden (view full) --- 1444// Information) 1445// 1446ipmi_ret_t ipmiOemQGetDriveInfo(ipmi_netfn_t netfn, ipmi_cmd_t cmd, 1447 ipmi_request_t request, 1448 ipmi_response_t response, 1449 ipmi_data_len_t data_len, 1450 ipmi_context_t context) 1451{ |
1454 qDriveInfo_t *req = reinterpret_cast<qDriveInfo_t *>(request); 1455 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t *); 1456 uint8_t *res = reinterpret_cast<uint8_t *>(response); | 1452 qDriveInfo_t* req = reinterpret_cast<qDriveInfo_t*>(request); 1453 uint8_t numParam = sizeof(driveInfoKey) / sizeof(uint8_t*); 1454 uint8_t* res = reinterpret_cast<uint8_t*>(response); |
1457 uint8_t ctrlType = req->hddCtrlType & 0x0f; 1458 std::stringstream ss; 1459 std::string str; 1460 1461 *data_len = 0; 1462 1463 /* check for requested data params */ 1464 if (req->paramSel < 1 || req->paramSel >= numParam || ctrlType > 2) --- 23 unchanged lines hidden (view full) --- 1488 [dimmInfoKey[req->paramSel]]; 1489 *data_len = strToBytes(str, res); 1490 1491 return IPMI_CC_OK; 1492} 1493 1494/* Helper function for sending DCMI commands to ME and getting response back */ 1495ipmi::RspType<std::vector<uint8_t>> sendDCMICmd(uint8_t cmd, | 1455 uint8_t ctrlType = req->hddCtrlType & 0x0f; 1456 std::stringstream ss; 1457 std::string str; 1458 1459 *data_len = 0; 1460 1461 /* check for requested data params */ 1462 if (req->paramSel < 1 || req->paramSel >= numParam || ctrlType > 2) --- 23 unchanged lines hidden (view full) --- 1486 [dimmInfoKey[req->paramSel]]; 1487 *data_len = strToBytes(str, res); 1488 1489 return IPMI_CC_OK; 1490} 1491 1492/* Helper function for sending DCMI commands to ME and getting response back */ 1493ipmi::RspType<std::vector<uint8_t>> sendDCMICmd(uint8_t cmd, |
1496 std::vector<uint8_t> &cmdData) | 1494 std::vector<uint8_t>& cmdData) |
1497{ 1498 std::vector<uint8_t> respData; 1499 1500 /* Add group id as first byte to request for ME command */ 1501 cmdData.insert(cmdData.begin(), groupDCMI); 1502 1503 if (sendMeCmd(ipmi::netFnGroup, cmd, cmdData, respData)) 1504 return ipmi::responseUnspecifiedError(); --- 144 unchanged lines hidden --- | 1495{ 1496 std::vector<uint8_t> respData; 1497 1498 /* Add group id as first byte to request for ME command */ 1499 cmdData.insert(cmdData.begin(), groupDCMI); 1500 1501 if (sendMeCmd(ipmi::netFnGroup, cmd, cmdData, respData)) 1502 return ipmi::responseUnspecifiedError(); --- 144 unchanged lines hidden --- |