oemcommands.cpp (dd14c0f75d9af7783afb3e9e124ca5c015a8609b) | oemcommands.cpp (ef0efbc402a0a4bbc237361e18ab9fe070c4acdd) |
---|---|
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 * --- 40 unchanged lines hidden (view full) --- 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> &); 56 | 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 * --- 40 unchanged lines hidden (view full) --- 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> &); 56 |
57namespace variant_ns = sdbusplus::message::variant_ns; | |
58nlohmann::json oemData __attribute__((init_priority(101))); 59 60enum class LanParam : uint8_t 61{ 62 INPROGRESS = 0, 63 AUTHSUPPORT = 1, 64 AUTHENABLES = 2, 65 IP = 3, --- 116 unchanged lines hidden (view full) --- 182 std::string ipaddress; 183 auto ipObjectInfo = ipmi::network::getIPObject( 184 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 185 186 auto properties = ipmi::getAllDbusProperties( 187 bus, ipObjectInfo.second, ipObjectInfo.first, 188 ipmi::network::IP_INTERFACE); 189 | 57nlohmann::json oemData __attribute__((init_priority(101))); 58 59enum class LanParam : uint8_t 60{ 61 INPROGRESS = 0, 62 AUTHSUPPORT = 1, 63 AUTHENABLES = 2, 64 IP = 3, --- 116 unchanged lines hidden (view full) --- 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 |
190 ipaddress = variant_ns::get<std::string>(properties["Address"]); | 189 ipaddress = std::get<std::string>(properties["Address"]); |
191 192 std::strcpy(data, ipaddress.c_str()); 193 } 194 break; 195 196 case LanParam::IPV6: 197 { 198 auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE; 199 std::string ipaddress; 200 auto ipObjectInfo = ipmi::network::getIPObject( 201 bus, ipmi::network::IP_INTERFACE, ipmi::network::ROOT, ethIP); 202 203 auto properties = ipmi::getAllDbusProperties( 204 bus, ipObjectInfo.second, ipObjectInfo.first, 205 ipmi::network::IP_INTERFACE); 206 | 190 191 std::strcpy(data, ipaddress.c_str()); 192 } 193 break; 194 195 case LanParam::IPV6: 196 { 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 |
207 ipaddress = variant_ns::get<std::string>(properties["Address"]); | 206 ipaddress = std::get<std::string>(properties["Address"]); |
208 209 std::strcpy(data, ipaddress.c_str()); 210 } 211 break; 212 213 case LanParam::MAC: 214 { 215 std::string macAddress; 216 auto macObjectInfo = 217 ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE, 218 ipmi::network::ROOT, ethdevice); 219 220 auto variant = ipmi::getDbusProperty( 221 bus, macObjectInfo.second, macObjectInfo.first, 222 ipmi::network::MAC_INTERFACE, "MACAddress"); 223 | 207 208 std::strcpy(data, ipaddress.c_str()); 209 } 210 break; 211 212 case LanParam::MAC: 213 { 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"); 222 |
224 macAddress = variant_ns::get<std::string>(variant); | 223 macAddress = std::get<std::string>(variant); |
225 226 sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT, 227 (data), (data + 1), (data + 2), (data + 3), (data + 4), 228 (data + 5)); 229 std::strcpy(data, macAddress.c_str()); 230 } 231 break; 232 --- 30 unchanged lines hidden (view full) --- 263 if (property == interface->second.end()) 264 { 265 continue; 266 } 267 268 try 269 { 270 Value variant = property->second; | 224 225 sscanf(macAddress.c_str(), ipmi::network::MAC_ADDRESS_FORMAT, 226 (data), (data + 1), (data + 2), (data + 3), (data + 4), 227 (data + 5)); 228 std::strcpy(data, macAddress.c_str()); 229 } 230 break; 231 --- 30 unchanged lines hidden (view full) --- 262 if (property == interface->second.end()) 263 { 264 continue; 265 } 266 267 try 268 { 269 Value variant = property->second; |
271 std::string &result = 272 sdbusplus::message::variant_ns::get<std::string>(variant); | 270 std::string &result = std::get<std::string>(variant); |
273 if (result.size() > maxFRUStringLength) 274 { 275 phosphor::logging::log<phosphor::logging::level::ERR>( 276 "FRU serial number exceed maximum length"); 277 return -1; 278 } 279 data = result; 280 return 0; 281 } | 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 } |
282 catch (sdbusplus::message::variant_ns::bad_variant_access &e) | 280 catch (std::bad_variant_access &e) |
283 { 284 phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); 285 return -1; 286 } 287 } 288 return -1; 289} 290 --- 1360 unchanged lines hidden --- | 281 { 282 phosphor::logging::log<phosphor::logging::level::ERR>(e.what()); 283 return -1; 284 } 285 } 286 return -1; 287} 288 --- 1360 unchanged lines hidden --- |