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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/termination/slew_cal_status.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
///
/// @file slew_cal_status.C
/// @brief Process the status from slew calibration. This is it's own function
/// and file as it gets messey considering there are FFDC object per port ...
///
// *HWP HWP Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Consumed by: FSP:HB
#include <fapi2.H>
#include <mss.H>
#include <lib/termination/slew_cal.H>
using fapi2::TARGET_TYPE_MCBIST;
using fapi2::TARGET_TYPE_MCA;
using fapi2::TARGET_TYPE_SYSTEM;
using fapi2::TARGET_STATE_FUNCTIONAL;
using fapi2::FAPI2_RC_SUCCESS;
namespace mss
{
///
/// @brief Process FFDC for slew calibration
/// @param[in] MCA (port) target
/// @param[in] a vector of the steps which came before me
/// @param[in] the slew table to be operated on
/// @param[in] the calibration status
/// @param[in] the register value
/// @return A fapi2::ReturnCode, appropriate for the calibration status
///
fapi2::ReturnCode slew_cal_status(const fapi2::Target<TARGET_TYPE_MCA>& i_target,
std::vector<tags_t>& i_where_am_i,
const uint64_t l_slew_rate,
const uint64_t i_status,
const fapi2::buffer<uint64_t>& i_reg)
{
// Some short-hand for this subroutine
const char* l_type = i_where_am_i[0] == TAG_ADR ? "adr" : "data";
const uint64_t& l_speed = i_where_am_i[1];
const uint64_t& l_ohm = i_where_am_i[2];
const uint64_t& l_vns = i_where_am_i[3];
// Write up the message/error string once.
FAPI_INF("Slew calibration: %s slew %s, %lumhz %luohm %luV/ns: %d",
mss::c_str(i_target), l_type, l_speed, l_ohm, l_vns, l_slew_rate);
switch (i_status)
{
case SLEW_CAL_SUCCESS:
FAPI_DBG("Slew calibration success");
break;
case SLEW_CAL_WARNING:
FAPI_ERR("Slew calibration warning");
break;
case SLEW_CAL_NOT_DONE:
FAPI_ASSERT(false, fapi2::MSS_SLEW_CAL_TIMEOUT()
.set_PORT(mss::pos(i_target))
.set_DATA_ADR(i_where_am_i[0])
.set_IMP(l_ohm)
.set_SLEW(l_slew_rate)
.set_STAT_REG(i_reg)
.set_TARGET_IN_ERROR(i_target),
"Slew calibration timeout");
break;
case SLEW_CAL_ERRORS:
FAPI_ASSERT(false, fapi2::MSS_SLEW_CAL_ERROR()
.set_PORT(mss::pos(i_target))
.set_DATA_ADR(i_where_am_i[0])
.set_IMP(l_ohm)
.set_SLEW(l_slew_rate)
.set_STAT_REG(i_reg)
.set_TARGET_IN_ERROR(i_target),
"Slew calibration error");
break;
};
return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
return fapi2::current_err;
}
}
|