blob: b2211f529a236c0978d32601b222f6111b35be89 [file] [log] [blame]
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05301#include "config.h"
2
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -05003#include "common_utility.hpp"
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05304#include "defines.hpp"
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -05005#include "ibm_vpd_utils.hpp"
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05006#include "ipz_parser.hpp"
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05307#include "keyword_vpd_parser.hpp"
Alpana Kumaria00936f2020-04-14 07:15:46 -05008#include "memory_vpd_parser.hpp"
SunnySrivastava1984e12b1812020-05-26 02:23:11 -05009#include "parser_factory.hpp"
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -050010#include "vpd_exceptions.hpp"
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053011
SunnySrivastava19849094d4f2020-08-05 09:32:29 -050012#include <assert.h>
Alpana Kumari8ea3f6d2020-04-02 00:26:07 -050013#include <ctype.h>
14
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053015#include <CLI/CLI.hpp>
Santosh Puranik88edeb62020-03-02 12:00:09 +053016#include <algorithm>
Alpana Kumari65b83602020-09-01 00:24:56 -050017#include <cstdarg>
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053018#include <exception>
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053019#include <filesystem>
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053020#include <fstream>
Alpana Kumari2f793042020-08-18 05:51:03 -050021#include <gpiod.hpp>
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053022#include <iostream>
23#include <iterator>
24#include <nlohmann/json.hpp>
Andrew Geissler280197e2020-12-08 20:51:49 -060025#include <phosphor-logging/log.hpp>
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053026
27using namespace std;
28using namespace openpower::vpd;
29using namespace CLI;
30using namespace vpd::keyword::parser;
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +053031using namespace openpower::vpd::constants;
32namespace fs = filesystem;
33using json = nlohmann::json;
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050034using namespace openpower::vpd::parser::factory;
SunnySrivastava1984945a02d2020-05-06 01:55:41 -050035using namespace openpower::vpd::inventory;
Alpana Kumaria00936f2020-04-14 07:15:46 -050036using namespace openpower::vpd::memory::parser;
SunnySrivastava1984e12b1812020-05-26 02:23:11 -050037using namespace openpower::vpd::parser::interface;
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -050038using namespace openpower::vpd::exceptions;
Andrew Geissler280197e2020-12-08 20:51:49 -060039using namespace phosphor::logging;
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +053040
Alpana Kumari65b83602020-09-01 00:24:56 -050041static const deviceTreeMap deviceTreeSystemTypeMap = {
Joel Stanley6fb0ef92021-05-26 13:14:32 +093042 {RAINIER_2U, "conf-aspeed-bmc-ibm-rainier-p1.dtb"},
43 {RAINIER_2U_V2, "conf-aspeed-bmc-ibm-rainier.dtb"},
44 {RAINIER_4U, "conf-aspeed-bmc-ibm-rainier-4u-p1.dtb"},
45 {RAINIER_4U_V2, "conf-aspeed-bmc-ibm-rainier-4u.dtb"},
Andrew Geissler2fe709f2021-03-25 10:59:07 -050046 {RAINIER_1S4U, "conf-aspeed-bmc-ibm-rainier-1s4u.dtb"},
47 {EVEREST, "conf-aspeed-bmc-ibm-everest.dtb"}};
Alpana Kumari65b83602020-09-01 00:24:56 -050048
Santosh Puranik88edeb62020-03-02 12:00:09 +053049/**
Santosh Puranik85893752020-11-10 21:31:43 +053050 * @brief Returns the power state for chassis0
51 */
52static auto getPowerState()
53{
54 // TODO: How do we handle multiple chassis?
55 string powerState{};
56 auto bus = sdbusplus::bus::new_default();
57 auto properties =
58 bus.new_method_call("xyz.openbmc_project.State.Chassis",
59 "/xyz/openbmc_project/state/chassis0",
60 "org.freedesktop.DBus.Properties", "Get");
61 properties.append("xyz.openbmc_project.State.Chassis");
62 properties.append("CurrentPowerState");
63 auto result = bus.call(properties);
64 if (!result.is_method_error())
65 {
66 variant<string> val;
67 result.read(val);
68 if (auto pVal = get_if<string>(&val))
69 {
70 powerState = *pVal;
71 }
72 }
73 cout << "Power state is: " << powerState << endl;
74 return powerState;
75}
76
77/**
Santosh Puranik88edeb62020-03-02 12:00:09 +053078 * @brief Expands location codes
79 */
80static auto expandLocationCode(const string& unexpanded, const Parsed& vpdMap,
81 bool isSystemVpd)
82{
83 auto expanded{unexpanded};
84 static constexpr auto SYSTEM_OBJECT = "/system/chassis/motherboard";
85 static constexpr auto VCEN_IF = "com.ibm.ipzvpd.VCEN";
86 static constexpr auto VSYS_IF = "com.ibm.ipzvpd.VSYS";
87 size_t idx = expanded.find("fcs");
88 try
89 {
90 if (idx != string::npos)
91 {
92 string fc{};
93 string se{};
94 if (isSystemVpd)
95 {
96 const auto& fcData = vpdMap.at("VCEN").at("FC");
97 const auto& seData = vpdMap.at("VCEN").at("SE");
98 fc = string(fcData.data(), fcData.size());
99 se = string(seData.data(), seData.size());
100 }
101 else
102 {
103 fc = readBusProperty(SYSTEM_OBJECT, VCEN_IF, "FC");
104 se = readBusProperty(SYSTEM_OBJECT, VCEN_IF, "SE");
105 }
106
Alpana Kumari81671f62021-02-10 02:21:59 -0600107 // TODO: See if ND0 can be placed in the JSON
108 expanded.replace(idx, 3, fc.substr(0, 4) + ".ND0." + se);
Santosh Puranik88edeb62020-03-02 12:00:09 +0530109 }
110 else
111 {
112 idx = expanded.find("mts");
113 if (idx != string::npos)
114 {
115 string mt{};
116 string se{};
117 if (isSystemVpd)
118 {
119 const auto& mtData = vpdMap.at("VSYS").at("TM");
120 const auto& seData = vpdMap.at("VSYS").at("SE");
121 mt = string(mtData.data(), mtData.size());
122 se = string(seData.data(), seData.size());
123 }
124 else
125 {
126 mt = readBusProperty(SYSTEM_OBJECT, VSYS_IF, "TM");
127 se = readBusProperty(SYSTEM_OBJECT, VSYS_IF, "SE");
128 }
129
130 replace(mt.begin(), mt.end(), '-', '.');
131 expanded.replace(idx, 3, mt + "." + se);
132 }
133 }
134 }
Alpana Kumari58e22142020-05-05 00:22:12 -0500135 catch (exception& e)
Santosh Puranik88edeb62020-03-02 12:00:09 +0530136 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500137 cerr << "Failed to expand location code with exception: " << e.what()
138 << "\n";
Santosh Puranik88edeb62020-03-02 12:00:09 +0530139 }
140 return expanded;
141}
Alpana Kumari2f793042020-08-18 05:51:03 -0500142
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530143/**
144 * @brief Populate FRU specific interfaces.
145 *
146 * This is a common method which handles both
147 * ipz and keyword specific interfaces thus,
148 * reducing the code redundancy.
149 * @param[in] map - Reference to the innermost keyword-value map.
150 * @param[in] preIntrStr - Reference to the interface string.
151 * @param[out] interfaces - Reference to interface map.
152 */
153template <typename T>
154static void populateFruSpecificInterfaces(const T& map,
155 const string& preIntrStr,
156 inventory::InterfaceMap& interfaces)
157{
158 inventory::PropertyMap prop;
159
160 for (const auto& kwVal : map)
161 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500162 vector<uint8_t> vec(kwVal.second.begin(), kwVal.second.end());
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530163
164 auto kw = kwVal.first;
165
166 if (kw[0] == '#')
167 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500168 kw = string("PD_") + kw[1];
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530169 }
Alpana Kumari8ea3f6d2020-04-02 00:26:07 -0500170 else if (isdigit(kw[0]))
171 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500172 kw = string("N_") + kw;
Alpana Kumari8ea3f6d2020-04-02 00:26:07 -0500173 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530174 prop.emplace(move(kw), move(vec));
175 }
176
177 interfaces.emplace(preIntrStr, move(prop));
178}
179
180/**
181 * @brief Populate Interfaces.
182 *
183 * This method populates common and extra interfaces to dbus.
184 * @param[in] js - json object
185 * @param[out] interfaces - Reference to interface map
186 * @param[in] vpdMap - Reference to the parsed vpd map.
Santosh Puranik88edeb62020-03-02 12:00:09 +0530187 * @param[in] isSystemVpd - Denotes whether we are collecting the system VPD.
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530188 */
189template <typename T>
190static void populateInterfaces(const nlohmann::json& js,
191 inventory::InterfaceMap& interfaces,
Santosh Puranik88edeb62020-03-02 12:00:09 +0530192 const T& vpdMap, bool isSystemVpd)
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530193{
194 for (const auto& ifs : js.items())
195 {
Santosh Puranik88edeb62020-03-02 12:00:09 +0530196 string inf = ifs.key();
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530197 inventory::PropertyMap props;
198
199 for (const auto& itr : ifs.value().items())
200 {
Santosh Puranik88edeb62020-03-02 12:00:09 +0530201 const string& busProp = itr.key();
202
Alpana Kumari31970de2020-02-17 06:49:57 -0600203 if (itr.value().is_boolean())
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530204 {
Santosh Puranik88edeb62020-03-02 12:00:09 +0530205 props.emplace(busProp, itr.value().get<bool>());
206 }
207 else if (itr.value().is_string())
208 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500209 if constexpr (is_same<T, Parsed>::value)
Santosh Puranik88edeb62020-03-02 12:00:09 +0530210 {
211 if (busProp == "LocationCode" &&
Alpana Kumari414d5ae2021-03-04 21:06:35 +0000212 inf == IBM_LOCATION_CODE_INF)
Santosh Puranik88edeb62020-03-02 12:00:09 +0530213 {
Alpana Kumari414d5ae2021-03-04 21:06:35 +0000214 // TODO deprecate the com.ibm interface later
Santosh Puranik88edeb62020-03-02 12:00:09 +0530215 auto prop = expandLocationCode(
216 itr.value().get<string>(), vpdMap, isSystemVpd);
217 props.emplace(busProp, prop);
Alpana Kumari414d5ae2021-03-04 21:06:35 +0000218 interfaces.emplace(XYZ_LOCATION_CODE_INF, props);
Santosh Puranik88edeb62020-03-02 12:00:09 +0530219 }
220 else
221 {
222 props.emplace(busProp, itr.value().get<string>());
223 }
224 }
225 else
226 {
227 props.emplace(busProp, itr.value().get<string>());
228 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530229 }
Alpana Kumari31970de2020-02-17 06:49:57 -0600230 else if (itr.value().is_object())
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530231 {
Alpana Kumari31970de2020-02-17 06:49:57 -0600232 const string& rec = itr.value().value("recordName", "");
233 const string& kw = itr.value().value("keywordName", "");
234 const string& encoding = itr.value().value("encoding", "");
235
Alpana Kumari58e22142020-05-05 00:22:12 -0500236 if constexpr (is_same<T, Parsed>::value)
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530237 {
Santosh Puranik88edeb62020-03-02 12:00:09 +0530238 if (!rec.empty() && !kw.empty() && vpdMap.count(rec) &&
239 vpdMap.at(rec).count(kw))
Alpana Kumari31970de2020-02-17 06:49:57 -0600240 {
241 auto encoded =
242 encodeKeyword(vpdMap.at(rec).at(kw), encoding);
Santosh Puranik88edeb62020-03-02 12:00:09 +0530243 props.emplace(busProp, encoded);
Alpana Kumari31970de2020-02-17 06:49:57 -0600244 }
245 }
Alpana Kumari58e22142020-05-05 00:22:12 -0500246 else if constexpr (is_same<T, KeywordVpdMap>::value)
Alpana Kumari31970de2020-02-17 06:49:57 -0600247 {
248 if (!kw.empty() && vpdMap.count(kw))
249 {
250 auto prop =
251 string(vpdMap.at(kw).begin(), vpdMap.at(kw).end());
252 auto encoded = encodeKeyword(prop, encoding);
Santosh Puranik88edeb62020-03-02 12:00:09 +0530253 props.emplace(busProp, encoded);
Alpana Kumari31970de2020-02-17 06:49:57 -0600254 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530255 }
256 }
257 }
258 interfaces.emplace(inf, move(props));
259 }
260}
261
Alpana Kumari2f793042020-08-18 05:51:03 -0500262static Binary getVpdDataInVector(const nlohmann::json& js, const string& file)
Alpana Kumari58e22142020-05-05 00:22:12 -0500263{
264 uint32_t offset = 0;
265 // check if offset present?
266 for (const auto& item : js["frus"][file])
267 {
268 if (item.find("offset") != item.end())
269 {
270 offset = item["offset"];
271 }
272 }
273
274 // TODO: Figure out a better way to get max possible VPD size.
275 Binary vpdVector;
276 vpdVector.resize(65504);
277 ifstream vpdFile;
278 vpdFile.open(file, ios::binary);
279
280 vpdFile.seekg(offset, ios_base::cur);
281 vpdFile.read(reinterpret_cast<char*>(&vpdVector[0]), 65504);
282 vpdVector.resize(vpdFile.gcount());
283
284 return vpdVector;
285}
286
Alpana Kumari2f793042020-08-18 05:51:03 -0500287/** This API will be called at the end of VPD collection to perform any post
288 * actions.
289 *
290 * @param[in] json - json object
291 * @param[in] file - eeprom file path
292 */
293static void postFailAction(const nlohmann::json& json, const string& file)
294{
295 if ((json["frus"][file].at(0)).find("postActionFail") ==
296 json["frus"][file].at(0).end())
297 {
298 return;
299 }
300
301 uint8_t pinValue = 0;
302 string pinName;
303
304 for (const auto& postAction :
305 (json["frus"][file].at(0))["postActionFail"].items())
306 {
307 if (postAction.key() == "pin")
308 {
309 pinName = postAction.value();
310 }
311 else if (postAction.key() == "value")
312 {
313 // Get the value to set
314 pinValue = postAction.value();
315 }
316 }
317
318 cout << "Setting GPIO: " << pinName << " to " << (int)pinValue << endl;
319
320 try
321 {
322 gpiod::line outputLine = gpiod::find_line(pinName);
323
324 if (!outputLine)
325 {
326 cout << "Couldn't find output line:" << pinName
327 << " on GPIO. Skipping...\n";
328
329 return;
330 }
331 outputLine.request(
332 {"Disable line", ::gpiod::line_request::DIRECTION_OUTPUT, 0},
333 pinValue);
334 }
335 catch (system_error&)
336 {
337 cerr << "Failed to set post-action GPIO" << endl;
338 }
339}
340
341/** Performs any pre-action needed to get the FRU setup for collection.
342 *
343 * @param[in] json - json object
344 * @param[in] file - eeprom file path
345 */
346static void preAction(const nlohmann::json& json, const string& file)
347{
348 if ((json["frus"][file].at(0)).find("preAction") ==
349 json["frus"][file].at(0).end())
350 {
351 return;
352 }
353
354 uint8_t pinValue = 0;
355 string pinName;
356
357 for (const auto& postAction :
358 (json["frus"][file].at(0))["preAction"].items())
359 {
360 if (postAction.key() == "pin")
361 {
362 pinName = postAction.value();
363 }
364 else if (postAction.key() == "value")
365 {
366 // Get the value to set
367 pinValue = postAction.value();
368 }
369 }
370
371 cout << "Setting GPIO: " << pinName << " to " << (int)pinValue << endl;
372 try
373 {
374 gpiod::line outputLine = gpiod::find_line(pinName);
375
376 if (!outputLine)
377 {
378 cout << "Couldn't find output line:" << pinName
379 << " on GPIO. Skipping...\n";
380
381 return;
382 }
383 outputLine.request(
384 {"FRU pre-action", ::gpiod::line_request::DIRECTION_OUTPUT, 0},
385 pinValue);
386 }
387 catch (system_error&)
388 {
389 cerr << "Failed to set pre-action GPIO" << endl;
390 return;
391 }
392
393 // Now bind the device
394 string bind = json["frus"][file].at(0).value("bind", "");
395 cout << "Binding device " << bind << endl;
396 string bindCmd = string("echo \"") + bind +
397 string("\" > /sys/bus/i2c/drivers/at24/bind");
398 cout << bindCmd << endl;
399 executeCmd(bindCmd);
400
401 // Check if device showed up (test for file)
402 if (!fs::exists(file))
403 {
404 cout << "EEPROM " << file << " does not exist. Take failure action"
405 << endl;
406 // If not, then take failure postAction
407 postFailAction(json, file);
408 }
409}
410
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530411/**
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530412 * @brief Prime the Inventory
413 * Prime the inventory by populating only the location code,
414 * type interface and the inventory object for the frus
415 * which are not system vpd fru.
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530416 *
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530417 * @param[in] jsObject - Reference to vpd inventory json object
418 * @param[in] vpdMap - Reference to the parsed vpd map
419 *
420 * @returns Map of items in extraInterface.
421 */
422template <typename T>
423inventory::ObjectMap primeInventory(const nlohmann::json& jsObject,
424 const T& vpdMap)
425{
426 inventory::ObjectMap objects;
427
428 for (auto& itemFRUS : jsObject["frus"].items())
429 {
Alpana Kumari2f793042020-08-18 05:51:03 -0500430 // Take pre actions
431 preAction(jsObject, itemFRUS.key());
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530432 for (auto& itemEEPROM : itemFRUS.value())
433 {
434 inventory::InterfaceMap interfaces;
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530435 inventory::Object object(itemEEPROM.at("inventoryPath"));
436
Santosh Puranik50f60bf2021-05-26 17:55:06 +0530437 if ((itemFRUS.key() != systemVpdFilePath) &&
438 !itemEEPROM.value("noprime", false))
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530439 {
Alpana Kumaricfd7a752021-02-07 23:23:01 -0600440 inventory::PropertyMap presProp;
441 presProp.emplace("Present", false);
442 interfaces.emplace("xyz.openbmc_project.Inventory.Item",
443 move(presProp));
444
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530445 if (itemEEPROM.find("extraInterfaces") != itemEEPROM.end())
446 {
447 for (const auto& eI : itemEEPROM["extraInterfaces"].items())
448 {
449 inventory::PropertyMap props;
Alpana Kumari414d5ae2021-03-04 21:06:35 +0000450 if (eI.key() == IBM_LOCATION_CODE_INF)
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530451 {
452 if constexpr (std::is_same<T, Parsed>::value)
453 {
454 for (auto& lC : eI.value().items())
455 {
456 auto propVal = expandLocationCode(
457 lC.value().get<string>(), vpdMap, true);
458
459 props.emplace(move(lC.key()),
460 move(propVal));
461 interfaces.emplace(move(eI.key()),
462 move(props));
463 }
464 }
465 }
466 else if (eI.key().find("Inventory.Item.") !=
467 string::npos)
468 {
469 interfaces.emplace(move(eI.key()), move(props));
470 }
471 }
472 }
473 objects.emplace(move(object), move(interfaces));
474 }
475 }
476 }
477 return objects;
478}
479
Alpana Kumari65b83602020-09-01 00:24:56 -0500480/**
481 * @brief This API executes command to set environment variable
482 * And then reboot the system
483 * @param[in] key -env key to set new value
484 * @param[in] value -value to set.
485 */
486void setEnvAndReboot(const string& key, const string& value)
487{
488 // set env and reboot and break.
489 executeCmd("/sbin/fw_setenv", key, value);
Andrew Geissler280197e2020-12-08 20:51:49 -0600490 log<level::INFO>("Rebooting BMC to pick up new device tree");
Alpana Kumari65b83602020-09-01 00:24:56 -0500491 // make dbus call to reboot
492 auto bus = sdbusplus::bus::new_default_system();
493 auto method = bus.new_method_call(
494 "org.freedesktop.systemd1", "/org/freedesktop/systemd1",
495 "org.freedesktop.systemd1.Manager", "Reboot");
496 bus.call_noreply(method);
497}
498
499/*
500 * @brief This API checks for env var fitconfig.
501 * If not initialised OR updated as per the current system type,
502 * update this env var and reboot the system.
503 *
504 * @param[in] systemType IM kwd in vpd tells about which system type it is.
505 * */
506void setDevTreeEnv(const string& systemType)
507{
508 string newDeviceTree;
509
510 if (deviceTreeSystemTypeMap.find(systemType) !=
511 deviceTreeSystemTypeMap.end())
512 {
513 newDeviceTree = deviceTreeSystemTypeMap.at(systemType);
514 }
515
516 string readVarValue;
517 bool envVarFound = false;
518
519 vector<string> output = executeCmd("/sbin/fw_printenv");
520 for (const auto& entry : output)
521 {
522 size_t pos = entry.find("=");
523 string key = entry.substr(0, pos);
524 if (key != "fitconfig")
525 {
526 continue;
527 }
528
529 envVarFound = true;
530 if (pos + 1 < entry.size())
531 {
532 readVarValue = entry.substr(pos + 1);
533 if (readVarValue.find(newDeviceTree) != string::npos)
534 {
535 // fitconfig is Updated. No action needed
536 break;
537 }
538 }
539 // set env and reboot and break.
540 setEnvAndReboot(key, newDeviceTree);
541 exit(0);
542 }
543
544 // check If env var Not found
545 if (!envVarFound)
546 {
547 setEnvAndReboot("fitconfig", newDeviceTree);
548 }
549}
550
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530551/**
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500552 * @brief API to call VPD manager to write VPD to EEPROM.
553 * @param[in] Object path.
554 * @param[in] record to be updated.
555 * @param[in] keyword to be updated.
556 * @param[in] keyword data to be updated
557 */
558void updateHardware(const string& objectName, const string& recName,
559 const string& kwdName, const Binary& data)
560{
561 try
562 {
563 auto bus = sdbusplus::bus::new_default();
564 auto properties =
565 bus.new_method_call(BUSNAME, OBJPATH, IFACE, "WriteKeyword");
566 properties.append(
567 static_cast<sdbusplus::message::object_path>(objectName));
568 properties.append(recName);
569 properties.append(kwdName);
570 properties.append(data);
571 bus.call(properties);
572 }
573 catch (const sdbusplus::exception::SdBusError& e)
574 {
575 std::string what =
576 "VPDManager WriteKeyword api failed for inventory path " +
577 objectName;
578 what += " record " + recName;
579 what += " keyword " + kwdName;
580 what += " with bus error = " + std::string(e.what());
581
582 // map to hold additional data in case of logging pel
583 PelAdditionalData additionalData{};
584 additionalData.emplace("CALLOUT_INVENTORY_PATH", objectName);
585 additionalData.emplace("DESCRIPTION", what);
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500586 createPEL(additionalData, PelSeverity::WARNING, errIntfForBusFailure);
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500587 }
588}
589
590/**
591 * @brief API to check if we need to restore system VPD
592 * This functionality is only applicable for IPZ VPD data.
593 * @param[in] vpdMap - IPZ vpd map
594 * @param[in] objectPath - Object path for the FRU
595 * @return EEPROMs with records and keywords updated at standby
596 */
597std::vector<RestoredEeproms> restoreSystemVPD(Parsed& vpdMap,
598 const string& objectPath)
599{
600 // the list of keywords for VSYS record is as per the S0 system. Should be
601 // updated for another type of systems
602 static std::unordered_map<std::string, std::vector<std::string>> svpdKwdMap{
603 {"VSYS", {"BR", "TM", "SE", "SU", "RB"}},
604 {"VCEN", {"FC", "SE"}},
605 {"LXR0", {"LX"}}};
606
607 // vector to hold all the EEPROMs updated at standby
608 std::vector<RestoredEeproms> updatedEeproms = {};
609
610 for (const auto& systemRecKwdPair : svpdKwdMap)
611 {
612 auto it = vpdMap.find(systemRecKwdPair.first);
613
614 // check if record is found in map we got by parser
615 if (it != vpdMap.end())
616 {
617 const auto& kwdListForRecord = systemRecKwdPair.second;
618 for (const auto& keyword : kwdListForRecord)
619 {
620 DbusPropertyMap& kwdValMap = it->second;
621 auto iterator = kwdValMap.find(keyword);
622
623 if (iterator != kwdValMap.end())
624 {
625 string& kwdValue = iterator->second;
626
627 // check bus data
628 const string& recordName = systemRecKwdPair.first;
629 const string& busValue = readBusProperty(
630 objectPath, ipzVpdInf + recordName, keyword);
631
632 if (busValue.find_first_not_of(' ') != string::npos)
633 {
634 if (kwdValue.find_first_not_of(' ') != string::npos)
635 {
636 // both the data are present, check for mismatch
637 if (busValue != kwdValue)
638 {
639 string errMsg = "VPD data mismatch on cache "
640 "and hardware for record: ";
641 errMsg += (*it).first;
642 errMsg += " and keyword: ";
643 errMsg += keyword;
644
645 // data mismatch
646 PelAdditionalData additionalData;
647 additionalData.emplace("CALLOUT_INVENTORY_PATH",
648 objectPath);
649
650 additionalData.emplace("DESCRIPTION", errMsg);
651
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500652 createPEL(additionalData, PelSeverity::WARNING,
653 errIntfForInvalidVPD);
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500654 }
655 }
656 else
657 {
658 // implies hardware data is blank
659 // update the map
660 Binary busData(busValue.begin(), busValue.end());
661
662 updatedEeproms.push_back(std::make_tuple(
663 objectPath, recordName, keyword, busData));
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500664
Sunny Srivastava90a63b92021-05-26 06:30:24 -0500665 // update the map as well, so that cache data is not
666 // updated as blank while populating VPD map on Dbus
667 // in populateDBus Api
668 kwdValue = busValue;
669 }
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500670 }
671 else if (kwdValue.find_first_not_of(' ') == string::npos)
672 {
673 string errMsg = "VPD is blank on both cache and "
674 "hardware for record: ";
675 errMsg += (*it).first;
676 errMsg += " and keyword: ";
677 errMsg += keyword;
678 errMsg += ". SSR need to update hardware VPD.";
679
680 // both the data are blanks, log PEL
681 PelAdditionalData additionalData;
682 additionalData.emplace("CALLOUT_INVENTORY_PATH",
683 objectPath);
684
685 additionalData.emplace("DESCRIPTION", errMsg);
686
687 // log PEL TODO: Block IPL
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500688 createPEL(additionalData, PelSeverity::ERROR,
689 errIntfForBlankSystemVPD);
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500690 continue;
691 }
692 }
693 }
694 }
695 }
696
697 return updatedEeproms;
698}
699
700/**
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530701 * @brief Populate Dbus.
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530702 * This method invokes all the populateInterface functions
703 * and notifies PIM about dbus object.
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530704 * @param[in] vpdMap - Either IPZ vpd map or Keyword vpd map based on the
705 * input.
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530706 * @param[in] js - Inventory json object
707 * @param[in] filePath - Path of the vpd file
708 * @param[in] preIntrStr - Interface string
709 */
710template <typename T>
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500711static void populateDbus(T& vpdMap, nlohmann::json& js, const string& filePath)
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530712{
713 inventory::InterfaceMap interfaces;
714 inventory::ObjectMap objects;
715 inventory::PropertyMap prop;
716
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500717 // map to hold all the keywords whose value has been changed at standby
718 vector<RestoredEeproms> updatedEeproms = {};
719
Santosh Puranik50f60bf2021-05-26 17:55:06 +0530720 bool isSystemVpd = (filePath == systemVpdFilePath);
721 if constexpr (is_same<T, Parsed>::value)
722 {
723 if (isSystemVpd)
724 {
725 std::vector<std::string> interfaces = {motherBoardInterface};
726 // call mapper to check for object path creation
727 MapperResponse subTree =
728 getObjectSubtreeForInterfaces(pimPath, 0, interfaces);
729 string mboardPath =
730 js["frus"][filePath].at(0).value("inventoryPath", "");
731
732 // Attempt system VPD restore if we have a motherboard
733 // object in the inventory.
734 if ((subTree.size() != 0) &&
735 (subTree.find(pimPath + mboardPath) != subTree.end()))
736 {
737 updatedEeproms = restoreSystemVPD(vpdMap, mboardPath);
738 }
739 else
740 {
741 log<level::ERR>("No object path found");
742 }
743 }
744 }
745
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530746 for (const auto& item : js["frus"][filePath])
747 {
748 const auto& objectPath = item["inventoryPath"];
749 sdbusplus::message::object_path object(objectPath);
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500750
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530751 // Populate the VPD keywords and the common interfaces only if we
752 // are asked to inherit that data from the VPD, else only add the
753 // extraInterfaces.
754 if (item.value("inherit", true))
755 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500756 if constexpr (is_same<T, Parsed>::value)
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530757 {
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530758 // Each record in the VPD becomes an interface and all
759 // keyword within the record are properties under that
760 // interface.
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530761 for (const auto& record : vpdMap)
762 {
763 populateFruSpecificInterfaces(
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500764 record.second, ipzVpdInf + record.first, interfaces);
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530765 }
766 }
Alpana Kumari58e22142020-05-05 00:22:12 -0500767 else if constexpr (is_same<T, KeywordVpdMap>::value)
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530768 {
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500769 populateFruSpecificInterfaces(vpdMap, kwdVpdInf, interfaces);
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530770 }
Santosh Puranik88edeb62020-03-02 12:00:09 +0530771 if (js.find("commonInterfaces") != js.end())
772 {
773 populateInterfaces(js["commonInterfaces"], interfaces, vpdMap,
774 isSystemVpd);
775 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530776 }
Santosh Puranik0859eb62020-03-16 02:56:29 -0500777 else
778 {
779 // Check if we have been asked to inherit specific record(s)
Alpana Kumari58e22142020-05-05 00:22:12 -0500780 if constexpr (is_same<T, Parsed>::value)
Santosh Puranik0859eb62020-03-16 02:56:29 -0500781 {
782 if (item.find("copyRecords") != item.end())
783 {
784 for (const auto& record : item["copyRecords"])
785 {
786 const string& recordName = record;
787 if (vpdMap.find(recordName) != vpdMap.end())
788 {
789 populateFruSpecificInterfaces(
SunnySrivastava1984e12b1812020-05-26 02:23:11 -0500790 vpdMap.at(recordName), ipzVpdInf + recordName,
Santosh Puranik0859eb62020-03-16 02:56:29 -0500791 interfaces);
792 }
793 }
794 }
795 }
796 }
Alpana Kumari58e22142020-05-05 00:22:12 -0500797 if (item.value("inheritEI", true))
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530798 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500799 // Populate interfaces and properties that are common to every FRU
800 // and additional interface that might be defined on a per-FRU
801 // basis.
802 if (item.find("extraInterfaces") != item.end())
803 {
804 populateInterfaces(item["extraInterfaces"], interfaces, vpdMap,
805 isSystemVpd);
806 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530807 }
808 objects.emplace(move(object), move(interfaces));
809 }
810
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530811 if (isSystemVpd)
812 {
Santosh Puranikd278df12021-05-10 15:51:42 +0530813 string systemJsonName{};
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +0530814 if constexpr (is_same<T, Parsed>::value)
815 {
Alpana Kumarif05effd2021-04-07 07:32:53 -0500816 // pick the right system json
Santosh Puranikd278df12021-05-10 15:51:42 +0530817 systemJsonName = getSystemsJson(vpdMap);
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +0530818 }
819
Santosh Puranikd278df12021-05-10 15:51:42 +0530820 fs::path target = systemJsonName;
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +0530821 fs::path link = INVENTORY_JSON_SYM_LINK;
822
Santosh Puranik0246a4d2020-11-04 16:57:39 +0530823 // Create the directory for hosting the symlink
824 fs::create_directories(VPD_FILES_PATH);
825 // unlink the symlink previously created (if any)
PriyangaRamasamy83a1d5d2020-04-30 19:15:43 +0530826 remove(INVENTORY_JSON_SYM_LINK);
827 // create a new symlink based on the system
828 fs::create_symlink(target, link);
829
830 // Reloading the json
831 ifstream inventoryJson(link);
832 auto js = json::parse(inventoryJson);
833 inventoryJson.close();
834
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530835 inventory::ObjectMap primeObject = primeInventory(js, vpdMap);
836 objects.insert(primeObject.begin(), primeObject.end());
Alpana Kumari65b83602020-09-01 00:24:56 -0500837
SunnySrivastava19849094d4f2020-08-05 09:32:29 -0500838 // if system VPD has been restored at standby, update the EEPROM
839 for (const auto& item : updatedEeproms)
840 {
841 updateHardware(get<0>(item), get<1>(item), get<2>(item),
842 get<3>(item));
843 }
Alpana Kumarif05effd2021-04-07 07:32:53 -0500844
845 // set the U-boot environment variable for device-tree
846 if constexpr (is_same<T, Parsed>::value)
847 {
848 const string imKeyword = getIM(vpdMap);
849 const string hwKeyword = getHW(vpdMap);
850 string systemType = imKeyword;
851
852 // check If system has constraint then append HW version to it.
853 ifstream sysJson(SYSTEM_JSON);
854 if (!sysJson)
855 {
856 throw((VpdJsonException("Failed to access Json path",
857 SYSTEM_JSON)));
858 }
859
860 try
861 {
862 auto systemJson = json::parse(sysJson);
Santosh Puranikd278df12021-05-10 15:51:42 +0530863 if (systemJson["system"].find(imKeyword) !=
864 systemJson["system"].end())
865 {
866 if (systemJson["system"][imKeyword].find("constraint") !=
867 systemJson["system"][imKeyword].end())
868 {
869 systemType += "_" + hwKeyword;
870 }
871 }
Alpana Kumarif05effd2021-04-07 07:32:53 -0500872 }
873 catch (json::parse_error& ex)
874 {
875 throw((VpdJsonException("System Json parsing failed",
876 SYSTEM_JSON)));
877 }
878
Alpana Kumarif05effd2021-04-07 07:32:53 -0500879 setDevTreeEnv(systemType);
880 }
PriyangaRamasamy8e140a12020-04-13 19:24:03 +0530881 }
882
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530883 // Notify PIM
Sunny Srivastava6c71c9d2021-04-15 04:43:54 -0500884 common::utility::callPIM(move(objects));
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530885}
886
887int main(int argc, char** argv)
888{
889 int rc = 0;
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500890 json js{};
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -0600891 Binary vpdVector{};
892 string file{};
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500893 // map to hold additional data in case of logging pel
894 PelAdditionalData additionalData{};
895
896 // this is needed to hold base fru inventory path in case there is ECC or
897 // vpd exception while parsing the file
898 std::string baseFruInventoryPath = {};
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530899
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500900 // severity for PEL
901 PelSeverity pelSeverity = PelSeverity::WARNING;
902
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530903 try
904 {
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530905 App app{"ibm-read-vpd - App to read IPZ format VPD, parse it and store "
906 "in DBUS"};
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530907
908 app.add_option("-f, --file", file, "File containing VPD (IPZ/KEYWORD)")
Alpana Kumari2f793042020-08-18 05:51:03 -0500909 ->required();
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530910
911 CLI11_PARSE(app, argc, argv);
912
Santosh Puranik12e24ff2021-05-11 19:33:50 +0530913 cout << "Parser launched with file: " << file << "\n";
914
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500915 // PEL severity should be ERROR in case of any system VPD failure
916 if (file == systemVpdFilePath)
917 {
918 pelSeverity = PelSeverity::ERROR;
919 }
920
Santosh Puranik0246a4d2020-11-04 16:57:39 +0530921 auto jsonToParse = INVENTORY_JSON_DEFAULT;
922
923 // If the symlink exists, it means it has been setup for us, switch the
924 // path
925 if (fs::exists(INVENTORY_JSON_SYM_LINK))
926 {
927 jsonToParse = INVENTORY_JSON_SYM_LINK;
928 }
929
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530930 // Make sure that the file path we get is for a supported EEPROM
Santosh Puranik0246a4d2020-11-04 16:57:39 +0530931 ifstream inventoryJson(jsonToParse);
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500932 if (!inventoryJson)
933 {
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500934 throw(VpdJsonException("Failed to access Json path", jsonToParse));
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500935 }
936
937 try
938 {
939 js = json::parse(inventoryJson);
940 }
941 catch (json::parse_error& ex)
942 {
Sunny Srivastava0746eee2021-03-22 13:36:54 -0500943 throw(VpdJsonException("Json parsing failed", jsonToParse));
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500944 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530945
Santosh Puranik12e24ff2021-05-11 19:33:50 +0530946 // Do we have the mandatory "frus" section?
947 if (js.find("frus") == js.end())
948 {
949 throw(VpdJsonException("FRUs section not found in JSON",
950 jsonToParse));
951 }
952
PriyangaRamasamy647868e2020-09-08 17:03:19 +0530953 // Check if it's a udev path - patterned as(/ahb/ahb:apb/ahb:apb:bus@)
954 if (file.find("/ahb:apb") != string::npos)
955 {
956 // Translate udev path to a generic /sys/bus/.. file path.
957 udevToGenericPath(file);
Santosh Puranik12e24ff2021-05-11 19:33:50 +0530958 cout << "Path after translation: " << file << "\n";
959
960 if ((js["frus"].find(file) != js["frus"].end()) &&
Santosh Puranik50f60bf2021-05-26 17:55:06 +0530961 (file == systemVpdFilePath))
PriyangaRamasamy647868e2020-09-08 17:03:19 +0530962 {
963 return 0;
964 }
965 }
966
967 if (file.empty())
968 {
969 cerr << "The EEPROM path <" << file << "> is not valid.";
970 return 0;
971 }
Santosh Puranik12e24ff2021-05-11 19:33:50 +0530972 if (js["frus"].find(file) == js["frus"].end())
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530973 {
Alpana Kumari58e22142020-05-05 00:22:12 -0500974 cout << "Device path not in JSON, ignoring" << endl;
Santosh Puranik88edeb62020-03-02 12:00:09 +0530975 return 0;
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530976 }
977
Alpana Kumari2f793042020-08-18 05:51:03 -0500978 if (!fs::exists(file))
979 {
980 cout << "Device path: " << file
981 << " does not exist. Spurious udev event? Exiting." << endl;
982 return 0;
983 }
984
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500985 baseFruInventoryPath = js["frus"][file][0]["inventoryPath"];
Santosh Puranik85893752020-11-10 21:31:43 +0530986 // Check if we can read the VPD file based on the power state
987 if (js["frus"][file].at(0).value("powerOffOnly", false))
988 {
989 if ("xyz.openbmc_project.State.Chassis.PowerState.On" ==
990 getPowerState())
991 {
992 cout << "This VPD cannot be read when power is ON" << endl;
993 return 0;
994 }
995 }
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -0500996
Alpana Kumari2f793042020-08-18 05:51:03 -0500997 try
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +0530998 {
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -0600999 vpdVector = getVpdDataInVector(js, file);
PriyangaRamasamy33c61c22021-04-06 11:15:57 -05001000 ParserInterface* parser = ParserFactory::getParser(vpdVector);
Alpana Kumari2f793042020-08-18 05:51:03 -05001001 variant<KeywordVpdMap, Store> parseResult;
1002 parseResult = parser->parse();
SunnySrivastava19849a195542020-09-07 06:04:50 -05001003
Alpana Kumari2f793042020-08-18 05:51:03 -05001004 if (auto pVal = get_if<Store>(&parseResult))
1005 {
1006 populateDbus(pVal->getVpdMap(), js, file);
1007 }
1008 else if (auto pVal = get_if<KeywordVpdMap>(&parseResult))
1009 {
1010 populateDbus(*pVal, js, file);
1011 }
1012
1013 // release the parser object
1014 ParserFactory::freeParser(parser);
1015 }
1016 catch (exception& e)
1017 {
1018 postFailAction(js, file);
PriyangaRamasamya504c3e2020-12-06 12:14:52 -06001019 throw;
Alpana Kumari2f793042020-08-18 05:51:03 -05001020 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05301021 }
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -05001022 catch (const VpdJsonException& ex)
1023 {
1024 additionalData.emplace("JSON_PATH", ex.getJsonPath());
1025 additionalData.emplace("DESCRIPTION", ex.what());
Sunny Srivastava0746eee2021-03-22 13:36:54 -05001026 createPEL(additionalData, pelSeverity, errIntfForJsonFailure);
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -05001027
1028 cerr << ex.what() << "\n";
1029 rc = -1;
1030 }
1031 catch (const VpdEccException& ex)
1032 {
1033 additionalData.emplace("DESCRIPTION", "ECC check failed");
1034 additionalData.emplace("CALLOUT_INVENTORY_PATH",
1035 INVENTORY_PATH + baseFruInventoryPath);
Sunny Srivastava0746eee2021-03-22 13:36:54 -05001036 createPEL(additionalData, pelSeverity, errIntfForEccCheckFail);
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -06001037 dumpBadVpd(file, vpdVector);
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -05001038 cerr << ex.what() << "\n";
1039 rc = -1;
1040 }
1041 catch (const VpdDataException& ex)
1042 {
1043 additionalData.emplace("DESCRIPTION", "Invalid VPD data");
1044 additionalData.emplace("CALLOUT_INVENTORY_PATH",
1045 INVENTORY_PATH + baseFruInventoryPath);
Sunny Srivastava0746eee2021-03-22 13:36:54 -05001046 createPEL(additionalData, pelSeverity, errIntfForInvalidVPD);
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -06001047 dumpBadVpd(file, vpdVector);
SunnySrivastava1984a20be8e2020-08-26 02:00:50 -05001048 cerr << ex.what() << "\n";
1049 rc = -1;
1050 }
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05301051 catch (exception& e)
1052 {
PriyangaRamasamyc2fe40f2021-03-02 06:27:33 -06001053 dumpBadVpd(file, vpdVector);
PriyangaRamasamyabb87ed2019-11-19 17:25:35 +05301054 cerr << e.what() << "\n";
1055 rc = -1;
1056 }
1057
1058 return rc;
Joel Stanley6fb0ef92021-05-26 13:14:32 +09301059}