diff options
author | Mike Jones <mjjones@us.ibm.com> | 2011-10-17 10:33:13 -0500 |
---|---|---|
committer | MIKE J. JONES <mjjones@us.ibm.com> | 2011-10-17 10:52:16 -0500 |
commit | 0edaa15a20f8986a80d0c819dfa11648ef4f0d9e (patch) | |
tree | 482a1b424f650f01f4375cdbd87e90c52662818b /src/usr/hwpf/hwp | |
parent | d6ce3b30395982623494ad75c50e75c56fadcaca (diff) | |
download | talos-hostboot-0edaa15a20f8986a80d0c819dfa11648ef4f0d9e.tar.gz talos-hostboot-0edaa15a20f8986a80d0c819dfa11648ef4f0d9e.zip |
HWPF: Add fapiGetInitFileAttr function
Change-Id: I1fadb01b8f8e850fdc6c766138e8adb0ea2e0a51
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/436
Tested-by: Jenkins Server
Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp')
-rwxr-xr-x | src/usr/hwpf/hwp/fapiTestHwpAttr.C | 69 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/makefile | 3 |
2 files changed, 70 insertions, 2 deletions
diff --git a/src/usr/hwpf/hwp/fapiTestHwpAttr.C b/src/usr/hwpf/hwp/fapiTestHwpAttr.C index d8693d610..dd07721a5 100755 --- a/src/usr/hwpf/hwp/fapiTestHwpAttr.C +++ b/src/usr/hwpf/hwp/fapiTestHwpAttr.C @@ -34,6 +34,8 @@ * mjjones 06/30/2011 Created. * mjjones 09/07/2011 Update to test scratch attrs * mjjones 10/06/2011 Updates traces + * mjjones 10/07/2011 Removed target param + * Test scratch attributes * */ @@ -45,7 +47,7 @@ extern "C" //****************************************************************************** // hwpTestAttributes function //****************************************************************************** -fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target) +fapi::ReturnCode hwpTestAttributes() { FAPI_INF("hwpTestAttributes: Start HWP"); @@ -960,6 +962,71 @@ fapi::ReturnCode hwpTestAttributes(const fapi::Target & i_target) } //---------------------------------------------------------------------- + // Test getting scratch attributes with the fapiGetInitFileAttr function + //---------------------------------------------------------------------- + uint64_t l_val = 0; + fapi::AttributeId l_id; + fapi::AttributeId l_ids[] = {fapi::ATTR_SCRATCH_UINT8_1, + fapi::ATTR_SCRATCH_UINT8_2, + fapi::ATTR_SCRATCH_UINT32_1, + fapi::ATTR_SCRATCH_UINT32_2, + fapi::ATTR_SCRATCH_UINT64_1, + fapi::ATTR_SCRATCH_UINT64_2, + fapi::ATTR_SCRATCH_UINT8_ARRAY_1, + fapi::ATTR_SCRATCH_UINT8_ARRAY_2, + fapi::ATTR_SCRATCH_UINT32_ARRAY_1, + fapi::ATTR_SCRATCH_UINT32_ARRAY_2, + fapi::ATTR_SCRATCH_UINT64_ARRAY_1, + fapi::ATTR_SCRATCH_UINT64_ARRAY_2}; + + for (uint32_t i = 0; i < 12; i++) + { + l_val = 7; + l_id = l_ids[i]; + l_rc = fapiGetInitFileAttr(l_id, NULL, l_val); + + if (l_rc) + { + FAPI_ERR("hwpTestAttributes: ID: %d. Error 0x%x from fapiGetInitFileAttr", + l_ids[i], static_cast<uint32_t>(l_rc)); + break; + } + + if (l_val != 0) + { + l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; + FAPI_ERR("hwpTestAttributes: ID: %d. Get returned %d", + l_ids[i], static_cast<uint32_t>(l_val)); + break; + } + } + + if (l_rc) + { + break; + } + + //---------------------------------------------------------------------- + // Test getting an invalid scratch attribute + //---------------------------------------------------------------------- + fapi::AttributeId l_badId = static_cast<fapi::AttributeId>(0xff); + l_rc = fapiGetInitFileAttr(l_badId, NULL, l_val); + + if (l_rc) + { + FAPI_INF("hwpTestAttributes: Logging expected error 0x%x from fapiGetInitFileAttr", + static_cast<uint32_t>(l_rc)); + fapiLogError(l_rc); + break; + } + else + { + FAPI_ERR("hwpTestAttributes: Did not get error from fapiGetInitFileAttr"); + l_rc = fapi::FAPI_RC_ATTR_UNIT_TEST_FAIL; + break; + } + + //---------------------------------------------------------------------- // Test invalid accesses //---------------------------------------------------------------------- diff --git a/src/usr/hwpf/hwp/makefile b/src/usr/hwpf/hwp/makefile index 4eb0da718..25ed0e18d 100644 --- a/src/usr/hwpf/hwp/makefile +++ b/src/usr/hwpf/hwp/makefile @@ -31,6 +31,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat OBJS = fapiTestHwp.o \ fapiTestHwpError.o \ fapiTestHwpFfdc.o \ - fapiTestHwpConfig.o + fapiTestHwpConfig.o \ + fapiTestHwpAttr.o include ${ROOTPATH}/config.mk |