PEL: peltool: Print Extended Reference Code field

Some refcodes span multiple words such as "B2001020 LP 32769". This is
to split the first and subsequent words as separate fields.

"Primary SRC": {
    "Section Version":          "1",
    "Sub-section type":         "0",
    "Created by":               "0x4552",
    "SRC Version":              "0x02",
    "SRC Format":               "0x00",
    "Virtual Progress SRC":     "False",
    "I5/OS Service Event Bit":  "False",
    "Hypervisor Dump Initiated":"False",
    "Power Control Net Fault":  "False",
    "Valid Word Count":         "0x04",
    "Reference Code":           "B2001020",
    "Extended Reference Code":  "LP 32769",
    "Hex Word 2":               "02008000",
    "Hex Word 3":               "00000000",
    "Hex Word 4":               "00000012",
    "Callout Section": {
        "Callout Count":        "1",
        "Callouts": [{
            "FRU Type":         "Symbolic FRU",
            "Priority":         "Medium Priority",
            "Part Number":      "NEXTLVL"
        }]
    }
}

Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: Id189014aa7269ef257fd706c3c2677cc4b587580
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 6619d3f..858c243 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -470,8 +470,22 @@
     jsonInsert(ps, "Valid Word Count", getNumberString("0x%02X", _wordCount),
                1);
     std::string refcode = asciiString();
-    refcode = refcode.substr(0, refcode.find(0x20));
+    std::string extRefcode;
+    size_t pos = refcode.find(0x20);
+    if (pos != std::string::npos)
+    {
+        size_t nextPos = refcode.find_first_not_of(0x20, pos);
+        if (nextPos != std::string::npos)
+        {
+            extRefcode = trimEnd(refcode.substr(nextPos));
+        }
+        refcode.erase(pos);
+    }
     jsonInsert(ps, "Reference Code", refcode, 1);
+    if (!extRefcode.empty())
+    {
+        jsonInsert(ps, "Extended Reference Code", extRefcode, 1);
+    }
     for (size_t i = 2; i <= _wordCount; i++)
     {
         jsonInsert(