summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/plat/fapiPlatHwAccess.C
blob: b7789a06cc13fe27005c3f19cff2424ade5af479 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/hwpf/plat/fapiPlatHwAccess.C $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2011
//
//  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 other-
//  wise divested of its trade secrets, irrespective of what has
//  been deposited with the U.S. Copyright Office.
//
//  Origin: 30
//
//  IBM_PROLOG_END
/**
 *  @file fapiPlatHwAccess.C
 *
 *  @brief Implements the fapiHwAccess.H functions.
 *
 *  Note that platform code must provide the implementation.
 */

#include <fapiHwAccess.H>
#include <fapiPlatTrace.H>
#include <errl/errlentry.H>
#include <targeting/targetservice.H>
#include <devicefw/userif.H>

extern "C"
{

//******************************************************************************
// GetScom function
//******************************************************************************
fapi::ReturnCode GetScom(const fapi::Target& i_target,
                         const uint64_t i_address,
                         ecmdDataBufferBase & o_data)
{
	FAPI_DBG(ENTER_MRK "GetScom");

	fapi::ReturnCode l_rc;
    errlHndl_t l_err = NULL;

    // Extract the component pointer
    TARGETING::Target* l_target = reinterpret_cast<TARGETING::Target*>(i_target.get());

    // Perform SCOM read
    uint64_t l_data = 0;
    size_t l_size = sizeof(uint64_t);
    l_err = deviceRead(l_target,
                       &l_data,
                       l_size,
                       DEVICE_SCOM_ADDRESS(i_address));
    if (l_err)
    {
        // Add the error log pointer as data to the ReturnCode
        FAPI_ERR("GetScom: HostBoot GetScom returns error");
        l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
        l_rc.setPlatData(reinterpret_cast<void *> (l_err));
    }
    else
    {
        o_data.setDoubleWord(0, l_data);
    }

    FAPI_DBG(EXIT_MRK "GetScom");
    return l_rc;
}

//******************************************************************************
// PutScom function
//******************************************************************************
fapi::ReturnCode PutScom(const fapi::Target& i_target,
                         const uint64_t i_address,
                         ecmdDataBufferBase & i_data)
{
    FAPI_DBG(ENTER_MRK "PutScom");
    fapi::ReturnCode l_rc;
    errlHndl_t l_err = NULL;

    // Extract the component pointer
    TARGETING::Target* l_target = reinterpret_cast<TARGETING::Target*>(i_target.get());

    // Perform SCOM read
    uint64_t l_data = i_data.getDoubleWord(0);
    size_t l_size = sizeof(uint64_t);
    l_err = deviceWrite(l_target,
                        &l_data,
                        l_size,
                        DEVICE_SCOM_ADDRESS(i_address));
    if (l_err)
    {
        // Add the error log pointer as data to the ReturnCode
        FAPI_ERR("Putscom: HostBoot Putscom returns error");
        l_rc = fapi::FAPI_RC_PLAT_ERR_SEE_DATA;
        l_rc.setPlatData(reinterpret_cast<void *> (l_err));
    }

    FAPI_DBG(EXIT_MRK "PutScom");
    return l_rc;
}

//@todo - Implement these functions later
#if 0
//******************************************************************************
// PutScomUnderMask function
//******************************************************************************
fapi::ReturnCode PutScomUnderMask(const fapi::Target& i_target,
                                  const uint64_t i_address,
                                  ecmdDataBufferBase & i_data,
                                  ecmdDataBufferBase & i_mask)
{
	FAPI_DBG(ENTER_MRK "PutScomUnderMask");

	FAPI_DBG(EXIT_MRK "PutScomUnderMask");
}

//******************************************************************************
// GetCfamRegister function
//******************************************************************************
fapi::ReturnCode GetCfamRegister(const fapi::Target& i_target,
                                 const uint32_t i_address,
                                 ecmdDataBufferBase & o_data)
{
	FAPI_DBG(ENTER_MRK "GetCfamRegister");

	FAPI_DBG(EXIT_MRK "GetCfamRegister");
}

//******************************************************************************
// PutCfamRegister function
//******************************************************************************
fapi::ReturnCode PutCfamRegister(const fapi::Target& i_target,
                                 const uint32_t i_address,
                                 ecmdDataBufferBase & i_data)
{
	FAPI_DBG(ENTER_MRK "PutCfamRegister");

	FAPI_DBG(EXIT_MRK "PutCfamRegister");
}

//******************************************************************************
// ModifyCfamRegister function
//******************************************************************************
fapi::ReturnCode ModifyCfamRegister(const fapi::Target& i_target,
                                    const uint32_t i_address,
                                    ecmdDataBufferBase & i_data,
                                    const fapi::ChipOpModifyMode i_modifyMode)
{
	FAPI_DBG(ENTER_MRK "ModifyCfamRegister");

	FAPI_DBG(EXIT_MRK "ModifyCfamRegister");
}
#endif

} // extern "C"
OpenPOWER on IntegriCloud