PEL: Dynamic location code for registry callout

The PEL callout type 'symbolic FRU with trusted location code'
previously had both the symoblic FRU name and the location code
specified in the PEL message registry.  However, there are cases where
the location code is not known until runtime so it cannot be specified
in the registry.

To solve this, create a boolean 'UseInventoryLocCode` key that can be
used in the registry callout entry to specify that the location code to
use for the callout should come from the FRU passed in using the
CALLOUT_INVENTORY_PATH entry in the AdditionalData event log property.
In this case, that FRU will not be added as a normal FRU callout as it
would normally be otherwise.  The registry that uses this must be the
first one in the callout list.

For example:
{
    "Priority": "high",
    "SymbolicFRUTrusted": "air_mover",
    "UseInventoryLocCode": true
},

along with CALLOUT_INVENTORY_PATH=<processor 0 path>

would result in a symbolic FRU callout with the trusted location code
being the processor 0 location code.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iaf65c523803662313f2ad5e197262b9f4e722332
diff --git a/extensions/openpower-pels/src.hpp b/extensions/openpower-pels/src.hpp
index 264fab2..5363864 100644
--- a/extensions/openpower-pels/src.hpp
+++ b/extensions/openpower-pels/src.hpp
@@ -414,24 +414,52 @@
                             const std::vector<src::MRU::MRUCallout>& mrus = {});
 
     /**
-     * @brief Adds FRU callouts based on the registry entry JSON
-     *       for this error.
+     * @brief Returns the callouts to use from the registry entry.
+     *
      * @param[in] regEntry - The message registry entry for the error
-     * @param[in] additionalData - The AdditionalData values
+     * @param[in] additionalData - The AdditionalData property
      * @param[in] dataIface - The DataInterface object
      */
-    void addRegistryCallouts(const message::Entry& regEntry,
-                             const AdditionalData& additionalData,
-                             const DataInterfaceBase& dataIface);
+    std::vector<message::RegistryCallout>
+        getRegistryCallouts(const message::Entry& regEntry,
+                            const AdditionalData& additionalData,
+                            const DataInterfaceBase& dataIface);
+
+    /**
+     * @brief Adds the FRU callouts from the list of registry callouts
+     *        passed in to the SRC.
+     *
+     * The last parameter is used only in a special case when the first
+     * callout is a symbolic FRU with a trusted location code.  See the
+     * addRegistryCallout documentation.
+     *
+     * @param[in] callouts - The message registry callouts to add
+     * @param[in] dataIface - The DataInterface object
+     * @param[in] trustedSymbolicFRUInvPath - The optional inventory path used
+     *                                        in the symbolic FRU case.
+     */
+    void addRegistryCallouts(
+        const std::vector<message::RegistryCallout>& callouts,
+        const DataInterfaceBase& dataIface,
+        std::optional<std::string> trustedSymbolicFRUInvPath);
 
     /**
      * @brief Adds a single FRU callout from the message registry.
      *
+     * If the last parameter is filled in, and the registry callout is a
+     * symbolic FRU callout with a trusted location code, and it has the
+     * 'useInventoryLocCode' member set to true, then the location code of
+     * that inventory item will be what is used for that trusted location code.
+     *
      * @param[in] callout - The registry callout structure
      * @param[in] dataIface - The DataInterface object
+     * @param[in] trustedSymbolicFRUInvPath - The optional inventory path used
+     *                                        in the symbolic FRU case.
      */
-    void addRegistryCallout(const message::RegistryCallout& callout,
-                            const DataInterfaceBase& dataIface);
+    void addRegistryCallout(
+        const message::RegistryCallout& callout,
+        const DataInterfaceBase& dataIface,
+        const std::optional<std::string>& trustedSymbolicFRUInvPath);
 
     /**
      * @brief Creates the Callouts object _callouts