summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/fapiTestHwpConfig.C
blob: dfd290f96cf69eb6e1c679e7fb25d78d8b61ad16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/fapiTestHwpConfig.C $                        */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2011,2012              */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 *  @file fapiTestHwpConfig.C
 *
 *  @brief Implements a Hardware Procedure that exercises the FAPI System Config
 *         Query functions.
 */

/*
 * Change Log ******************************************************************
 * Flag     Defect/Feature  User        Date        Description
 * ------   --------------  ----------  ----------- ----------------------------
 *                          mjjones     09/12/2011  Created.
 *                          mjjones     10/06/2011  Updated traces.
 *                          camvang     10/26/2011  Updated traces.
 *                          mjjones     01/13/2012  Use new ReturnCode interfaces
 *                          mjjones     02/21/2012  Use new Target toEcmdString
 *
 *  HWP_IGNORE_VERSION_CHECK
 */

#include <fapiTestHwpConfig.H>

extern "C"
{

//******************************************************************************
// hwpTestConfig
//******************************************************************************
fapi::ReturnCode hwpTestConfig(const fapi::Target & i_chip)
{
    FAPI_INF("hwpTestConfig: Start HWP");

    // Print the ecmd string of the chip
    FAPI_INF("hwpTestConfig: Chip: %s", i_chip.toEcmdString());

    fapi::ReturnCode l_rc;
    std::vector<fapi::Target> l_targets;

    // Call fapiGetChildChiplets to get the child MCS chiplets
    l_rc = fapiGetChildChiplets(i_chip, fapi::TARGET_TYPE_MCS_CHIPLET,
                                l_targets);

    if (l_rc)
    {
        FAPI_ERR("hwpTestConfig: Error from fapiGetChildChiplets");
    }
    else
    {
        FAPI_INF("hwpTestConfig: %d MCS chiplets", l_targets.size());

        if (l_targets.size() == 0)
        {
            FAPI_ERR("hwpTestConfig: No MCS chiplets");
            FAPI_SET_HWP_ERROR(l_rc, RC_TEST_CONFIG_NO_MCS_CHIPLETS);
        }
        else
        {
            // Save the first MCS target
            fapi::Target l_mcs = l_targets[0];

            // Call fapiGetAssociatedDimms to get the dimms for this MCS
            l_rc = fapiGetAssociatedDimms(l_mcs, l_targets);

            if (l_rc)
            {
                FAPI_ERR("hwpTestConfig: Error from fapiGetAssociatedDimms");
            }
            else
            {
                FAPI_INF("hwpTestConfig: %d dimms", l_targets.size());

                // Call fapiGetParentChip to get the parent of the MCS
                fapi::Target l_chip;

                l_rc = fapiGetParentChip(l_mcs, l_chip);

                if (l_rc)
                {
                    FAPI_ERR("hwpTestConfig: Error from fapiGetParentChip");
                }
                else
                {
                    // Check that the parent chip is is same as the input chip
                    if (i_chip != l_chip)
                    {
                        FAPI_ERR("hwpTestConfig: Chip mismatch");
                        FAPI_SET_HWP_ERROR(l_rc,
                            RC_TEST_CONFIG_PARENT_CHIP_MISMATCH);
                    }
                }
            }
        }
    }

    FAPI_INF("hwpTestConfig: End HWP");
    return l_rc;
}

} // extern "C"
OpenPOWER on IntegriCloud