Skip to content

Commit 14b7653

Browse files
steffenchrisdcrowell77
authored andcommitted
DMI I/O Checkin
Change-Id: I10a42fa909444636f3d623b88143e4836ded686e Original-Change-Id: I9b9326ea8bc9d9734e74c170dfebbd9aaf73fb6f Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40666 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Gary A. Peterson <garyp@us.ibm.com> Reviewed-by: Richard J. Knight <rjknight@us.ibm.com> Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45614 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent 895e103 commit 14b7653

File tree

6 files changed

+562
-0
lines changed

6 files changed

+562
-0
lines changed
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/import/chips/centaur/procedures/hwp/io/p9_io_cen_pdwn_lanes.C $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
///
26+
/// @file p9_io_cen_pdwn_lanes.C
27+
/// @brief P9 Centaur Power Down Lanes.
28+
///----------------------------------------------------------------------------
29+
/// *HWP HWP Owner : Chris Steffen <cwsteffen@us.ibm.com>
30+
/// *HWP HWP Backup Owner : Gary Peterson <garyp@us.ibm.com>
31+
/// *HWP FW Owner : Jamie Knight <rjknight@us.ibm.com>
32+
/// *HWP Team : IO
33+
/// *HWP Level : 2
34+
/// *HWP Consumed by : FSP:HB
35+
///----------------------------------------------------------------------------
36+
///
37+
/// @verbatim
38+
/// High-level procedure flow:
39+
///
40+
/// A HWP that powers down lanes. This procedure should power down rx lanes,
41+
/// tx lanes, or both rx & tx lanes.
42+
///
43+
/// Procedure Prereq:
44+
/// - System clocks are running.
45+
///
46+
/// @endverbatim
47+
///----------------------------------------------------------------------------
48+
49+
// ----------------------------------------------------------------------------
50+
// Includes
51+
// ----------------------------------------------------------------------------
52+
#include "p9_io_cen_pdwn_lanes.H"
53+
#include "p9_io_scom.H"
54+
#include "p9_io_regs.H"
55+
56+
// ----------------------------------------------------------------------------
57+
// Procedure Function
58+
// ----------------------------------------------------------------------------
59+
fapi2::ReturnCode rx_pdwn_lanes(
60+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
61+
const std::vector< uint8_t >& i_bad_lanes);
62+
fapi2::ReturnCode tx_pdwn_lanes(
63+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
64+
const std::vector< uint8_t >& i_bad_lanes);
65+
66+
67+
/**
68+
* @brief A HWP that powers down the specified lanes on a given EDI+ Centaur
69+
* target. The rx & tx lanes in the vectors will be powered down on the
70+
* given target. Note: This procedure does not power down any lanes on the
71+
* connected target of the link.
72+
* @param[in] i_target FAPI2 Target
73+
* @param[in] i_rx_bad_lanes Vector of Rx Bad Lanes
74+
* @param[in] i_tx_bad_lanes Vector of Tx Bad Lanes
75+
* @retval ReturnCode
76+
*/
77+
fapi2::ReturnCode p9_io_cen_pdwn_lanes(
78+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
79+
const std::vector< uint8_t >& i_rx_bad_lanes,
80+
const std::vector< uint8_t >& i_tx_bad_lanes)
81+
{
82+
FAPI_IMP("Entering...");
83+
84+
FAPI_DBG("Rx Bad Lanes Size: %d", i_rx_bad_lanes.size());
85+
86+
if(!i_rx_bad_lanes.empty())
87+
{
88+
FAPI_TRY(rx_pdwn_lanes(i_target, i_rx_bad_lanes),
89+
"Rx Power Down Lanes Failed");
90+
}
91+
92+
FAPI_DBG("Tx Bad Lanes Size: %d", i_tx_bad_lanes.size());
93+
94+
if(!i_tx_bad_lanes.empty())
95+
{
96+
FAPI_TRY(tx_pdwn_lanes(i_target, i_tx_bad_lanes),
97+
"Tx Power Down Lanes Failed");
98+
}
99+
100+
fapi_try_exit:
101+
FAPI_IMP("Exiting...");
102+
return fapi2::current_err;
103+
}
104+
105+
/**
106+
* @brief A HWP that powers down the specified lanes on a given EDI+ Centaur
107+
* target. The rx lanes in the vector will be powered down on the
108+
* given target. Note: This procedure does not power down any lanes on the
109+
* connected target of the link.
110+
* @param[in] i_target FAPI2 Target
111+
* @param[in] i_bad_lanes Vector of Bad Lanes
112+
* @retval ReturnCode
113+
*/
114+
fapi2::ReturnCode rx_pdwn_lanes(
115+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
116+
const std::vector< uint8_t >& i_bad_lanes)
117+
{
118+
const uint8_t GRP0 = 0;
119+
FAPI_DBG("rx_pdwn_lanes: Enter Size(%d)", i_bad_lanes.size());
120+
char target_string[fapi2::MAX_ECMD_STRING_LEN];
121+
fapi2::toString(i_target, target_string, fapi2::MAX_ECMD_STRING_LEN);
122+
123+
if(!i_bad_lanes.empty())
124+
{
125+
for(uint8_t index = 0; index < i_bad_lanes.size(); ++index)
126+
{
127+
FAPI_DBG("Powering Down Rx Lane[%d/%d]: Target(%s:g%d:l%d)",
128+
index,
129+
i_bad_lanes.size() - 1,
130+
target_string,
131+
GRP0,
132+
i_bad_lanes[index]);
133+
134+
FAPI_TRY(io::rmw(EDIP_RX_LANE_DIG_PDWN, i_target, GRP0, i_bad_lanes[index], 1),
135+
"Failed rmw rx dig pdwn reg");
136+
137+
FAPI_TRY(io::rmw(EDIP_RX_LANE_ANA_PDWN, i_target, GRP0, i_bad_lanes[index], 1),
138+
"Failed rmw rx ana pdwn reg");
139+
140+
}
141+
}
142+
143+
fapi_try_exit:
144+
FAPI_IMP("rx_pdwn_lanes: Exiting.");
145+
return fapi2::current_err;
146+
}
147+
148+
/**
149+
* @brief A HWP that powers down the specified lanes on a given EDI+ Centaur
150+
* target. The tx lanes in the vector will be powered down on the
151+
* given target. Note: This procedure does not power down any lanes on the
152+
* connected target of the link.
153+
* @param[in] i_target FAPI2 Target
154+
* @param[in] i_bad_lanes Vector of Bad Lanes
155+
* @retval ReturnCode
156+
*/
157+
fapi2::ReturnCode tx_pdwn_lanes(
158+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
159+
const std::vector< uint8_t >& i_bad_lanes)
160+
{
161+
FAPI_IMP("tx_pdwn_lanes: Enter Size(%d)", i_bad_lanes.size());
162+
const uint8_t GRP0 = 0;
163+
const uint8_t LN0 = 0;
164+
uint8_t l_msbswap = 0;
165+
uint8_t l_end_lane = 0;
166+
uint8_t l_lane = 0;
167+
uint64_t l_data = 0;
168+
char target_string[fapi2::MAX_ECMD_STRING_LEN];
169+
fapi2::toString(i_target, target_string, fapi2::MAX_ECMD_STRING_LEN);
170+
171+
if(!i_bad_lanes.empty())
172+
{
173+
FAPI_TRY(io::read(EDIP_TX_MSBSWAP, i_target, GRP0, LN0, l_data),
174+
"Failed read edip_tx_msbswap");
175+
l_msbswap = io::get(EDIP_TX_MSBSWAP, l_data);
176+
177+
if(l_msbswap == 0x1)
178+
{
179+
FAPI_TRY(io::read(EDIP_TX_END_LANE_ID, i_target, GRP0, LN0, l_data));
180+
l_end_lane = io::get(EDIP_TX_END_LANE_ID, l_data);
181+
FAPI_DBG("edip_tx_msbswap: tx_end_lane_id(%d).", l_end_lane);
182+
}
183+
184+
for(uint8_t index = 0; index < i_bad_lanes.size(); ++index)
185+
{
186+
l_lane = i_bad_lanes[index];
187+
188+
if(l_msbswap == 0x1)
189+
{
190+
l_lane = l_end_lane - i_bad_lanes[index];
191+
FAPI_DBG("edip_tx_msbswap: tx_end_lane_id(%d) lane(%d -> %d).",
192+
l_end_lane, i_bad_lanes[index], l_lane);
193+
}
194+
195+
FAPI_DBG("Powering Down Tx Lane[%d/%d]: Target(%s:g%d:l%d)",
196+
index,
197+
i_bad_lanes.size() - 1,
198+
target_string,
199+
GRP0,
200+
l_lane);
201+
202+
FAPI_TRY(io::rmw(EDIP_TX_LANE_PDWN, i_target, GRP0, l_lane, 1));
203+
204+
}
205+
}
206+
207+
fapi_try_exit:
208+
FAPI_IMP("tx_pdwn_lanes: Exiting");
209+
return fapi2::current_err;
210+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/import/chips/centaur/procedures/hwp/io/p9_io_cen_pdwn_lanes.H $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
///----------------------------------------------------------------------------
26+
/// *HWP HWP Owner : Chris Steffen <cwsteffen@us.ibm.com>
27+
/// *HWP HWP Backup Owner : Gary Peterson <garyp@us.ibm.com>
28+
/// *HWP FW Owner : Jamie Knight <rjknight@us.ibm.com>
29+
/// *HWP Team : IO
30+
/// *HWP Level : 2
31+
/// *HWP Consumed by : FSP:HB
32+
///----------------------------------------------------------------------------
33+
34+
#ifndef _P9_IO_CEN_PDWN_LANES_H_
35+
#define _P9_IO_CEN_PDWN_LANES_H_
36+
37+
// ----------------------------------------------------------------------------
38+
// Includes
39+
// ----------------------------------------------------------------------------
40+
#include <fapi2.H>
41+
42+
// function pointer typedef definition for HWP call support
43+
typedef fapi2::ReturnCode (*p9_io_cen_pdwn_lanes_FP_t) (
44+
const fapi2::Target < fapi2::TARGET_TYPE_MEMBUF_CHIP >&,
45+
const std::vector< uint8_t >&,
46+
const std::vector< uint8_t >&);
47+
48+
extern "C"
49+
{
50+
51+
/**
52+
* @brief A HWP that powers down the specified lanes on a given EDI Centaur
53+
* target. The rx & tx lanes in the vectors will be powered down on the
54+
* given target. Note: This procedure does not power down any lanes on the
55+
* connected target of the link.
56+
* @param[in] i_target FAPI2 Target
57+
* @param[in] i_rx_bad_lanes Vector of Rx Bad Lanes
58+
* @param[in] i_tx_bad_lanes Vector of Tx Bad Lanes
59+
* @retval ReturnCode
60+
*/
61+
fapi2::ReturnCode p9_io_cen_pdwn_lanes(
62+
const fapi2::Target< fapi2::TARGET_TYPE_MEMBUF_CHIP >& i_target,
63+
const std::vector< uint8_t >& i_rx_bad_lanes,
64+
const std::vector< uint8_t >& i_tx_bad_lanes);
65+
66+
} // extern "C"
67+
68+
#endif // _P9_IO_CEN_PDWN_LANES_H_
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# IBM_PROLOG_BEGIN_TAG
2+
# This is an automatically generated prolog.
3+
#
4+
# $Source: src/import/chips/centaur/procedures/hwp/io/p9_io_cen_pdwn_lanes.mk $
5+
#
6+
# OpenPOWER HostBoot Project
7+
#
8+
# Contributors Listed Below - COPYRIGHT 2015,2017
9+
# [+] International Business Machines Corp.
10+
#
11+
#
12+
# Licensed under the Apache License, Version 2.0 (the "License");
13+
# you may not use this file except in compliance with the License.
14+
# You may obtain a copy of the License at
15+
#
16+
# http://www.apache.org/licenses/LICENSE-2.0
17+
#
18+
# Unless required by applicable law or agreed to in writing, software
19+
# distributed under the License is distributed on an "AS IS" BASIS,
20+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
21+
# implied. See the License for the specific language governing
22+
# permissions and limitations under the License.
23+
#
24+
# IBM_PROLOG_END_TAG
25+
PROCEDURE=p9_io_cen_pdwn_lanes
26+
$(call ADD_MODULE_SRCDIR,$(PROCEDURE),$(ROOTPATH)/chips/p9/procedures/hwp/io/)
27+
$(call BUILD_PROCEDURE)

0 commit comments

Comments
 (0)