UE error injection keyword for code update

This is a pre-requisite for openbmc/openbmc-test-automation#1059

Changes:
   - Moved test keyword "Inject Error Through HOST" to common
     RAS lib keyword.
   - Added "Code Update Unrecoverable Error Inject" keyword to
     facilitate UE error injection specially for code update.

Resolves  openbmc/openbmc-test-automation#1100

Change-Id: Ifcff9d28018ad4ee5e31d75622023c51f325b45a
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/test_host_ras.robot b/extended/test_host_ras.robot
index e2e268c..7f9bb90 100755
--- a/extended/test_host_ras.robot
+++ b/extended/test_host_ras.robot
@@ -220,35 +220,6 @@
 
 *** Keywords ***
 
-Inject Error Through HOST
-    [Documentation]  Inject checkstop on processor through HOST.
-    ...              Test sequence:
-    ...              1. Boot To HOST
-    ...              2. Clear any existing gard records
-    ...              3. Inject Error on processor/centaur
-    [Arguments]      ${fir}  ${chip_address}  ${threshold_limit}
-    # Description of argument(s):
-    # fir                 FIR (Fault isolation register) value (e.g. 2011400).
-    # chip_address        chip address (e.g 2000000000000000).
-    # threshold_limit     Threshold limit (e.g 1, 5, 32).
-
-    Delete Error Logs
-    Login To OS Host
-    Gard Operations On OS  clear all
-
-    # Fetch processor chip IDs.
-    ${chip_ids}=  Get ProcChipId From OS  Processor
-    ${proc_ids}=  Split String  ${chip_ids}
-    ${proc_id}=  Get From List  ${proc_ids}  1
-
-    ${threshold_limit}=  Convert To Integer  ${threshold_limit}
-    :FOR  ${i}  IN RANGE  ${threshold_limit}
-    \  Run Keyword  Putscom Operations On OS  ${proc_id}  ${fir}  ${chip_address}
-    # Adding delay after each error injection.
-    \  Sleep  10s
-    # Adding delay to get error log after error injection.
-    Sleep  120s
-
 Verify And Clear Gard Records On HOST
     [Documentation]  Verify And Clear gard records on HOST.
 
diff --git a/lib/ras/host_utils.robot b/lib/ras/host_utils.robot
index 597eb53..0b326e4 100644
--- a/lib/ras/host_utils.robot
+++ b/lib/ras/host_utils.robot
@@ -88,3 +88,40 @@
     # Example output:
     # 0x10010c00
     [Return]  ${translated_addr[1]}
+
+
+Inject Error Through HOST
+    [Documentation]  Inject checkstop on processor through HOST.
+    ...              Test sequence:
+    ...              1. Boot To HOST
+    ...              2. Clear any existing gard records
+    ...              3. Inject Error on processor/centaur
+    [Arguments]      ${fir}  ${chip_address}  ${threshold_limit}
+    # Description of argument(s):
+    # fir                 FIR (Fault isolation register) value (e.g. 2011400).
+    # chip_address        chip address (e.g 2000000000000000).
+    # threshold_limit     Threshold limit (e.g 1, 5, 32).
+
+    Delete Error Logs
+    Login To OS Host
+    Gard Operations On OS  clear all
+
+    # Fetch processor chip IDs.
+    ${chip_ids}=  Get ProcChipId From OS  Processor
+    ${proc_ids}=  Split String  ${chip_ids}
+    ${proc_id}=  Get From List  ${proc_ids}  1
+
+    ${threshold_limit}=  Convert To Integer  ${threshold_limit}
+    :FOR  ${i}  IN RANGE  ${threshold_limit}
+    \  Run Keyword  Putscom Operations On OS  ${proc_id}  ${fir}  ${chip_address}
+    # Adding delay after each error injection.
+    \  Sleep  10s
+    # Adding delay to get error log after error injection.
+    Sleep  120s
+
+
+Code Update Unrecoverable Error Inject
+    [Documentation]  Inject UE MCACALFIR checkstop on processor through
+    ...   host during PNOR code update.
+
+    Inject Error Through HOST  05010800  4000000000000000  1