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
165
166
167
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/framework/resolution/prdfClockResolution.C $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* [+] 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 */
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#define prdfClockResolution_C
#include <iipSystem.h>
#include <prdfExtensibleChip.H>
#include <prdfGlobal.H>
#include <iipServiceDataCollector.h>
#include <prdfClockResolution.H>
#include <prdfPlatServices.H>
#undef prdfClockResolution_C
namespace PRDF
{
using namespace PlatServices;
//------------------------------------------------------------------------------
// Member Function Specifications
//------------------------------------------------------------------------------
// Find the active clock source and blame it
int32_t ClockResolution::Resolve(STEP_CODE_DATA_STRUCT & serviceData)
{
using namespace TARGETING;
uint32_t l_rc = SUCCESS;
// callout clock osc
if ( (iv_targetType == TYPE_PROC) ||
(iv_targetType == TYPE_MEMBUF) )
{
TargetHandle_t l_ptargetClock =
getActiveRefClk(iv_ptargetClock, TYPE_OSCREFCLK);
// Callout this chip if nothing else.
// Or in the case of hostboot, use this chip for addClockCallout
if(NULL == l_ptargetClock)
{
l_ptargetClock = iv_ptargetClock;
}
// callout the clock source
// HB does not have the osc target modeled
// so we need to use the proc target with
// osc clock type to call out
#ifndef __HOSTBOOT_MODULE
serviceData.service_data->SetCallout(l_ptargetClock);
#else
serviceData.service_data->SetCallout(
PRDcallout(l_ptargetClock,
PRDcalloutData::TYPE_PROCCLK));
#endif
}
else if (iv_targetType == TYPE_PEC)
{
// Check if both PCI clocks have failed
bool bothClocksFailed = false;
ExtensibleChip *procChip =
(ExtensibleChip *)systemPtr->GetChip(iv_ptargetClock);
SCAN_COMM_REGISTER_CLASS *oscSw = procChip->getRegister("OSC_SW_SENSE");
l_rc = oscSw->Read();
if ( SUCCESS == l_rc )
{
const uint32_t OSC_0_OK = 28;
const uint32_t OSC_1_OK = 29;
if ( !(oscSw->IsBitSet(OSC_0_OK) || oscSw->IsBitSet(OSC_1_OK) ) )
{
bothClocksFailed = true;
// Callout both PCI Clocks
#ifndef __HOSTBOOT_MODULE
TargetHandle_t pciOsc =
getClockId( iv_ptargetClock, TYPE_OSCPCICLK, 0 );
if (pciOsc)
serviceData.service_data->SetCallout( pciOsc );
pciOsc = getClockId( iv_ptargetClock, TYPE_OSCPCICLK, 1 );
if (pciOsc)
serviceData.service_data->SetCallout( pciOsc );
#else
serviceData.service_data->SetCallout(
PRDcallout(iv_ptargetClock,
PRDcalloutData::TYPE_PCICLK0));
serviceData.service_data->SetCallout(
PRDcallout(iv_ptargetClock,
PRDcalloutData::TYPE_PCICLK1));
#endif
}
}
else
{
PRDF_ERR( "ClockResolution::Resolve "
"Read() failed on OSC_SW_SENSE huid 0x%08X",
iv_ptargetClock );
}
if ( !bothClocksFailed )
{
TargetHandle_t l_ptargetClock =
PlatServices::getActiveRefClk(iv_ptargetClock, TYPE_OSCPCICLK);
// Callout this chip if nothing else.
if(NULL == l_ptargetClock)
{
l_ptargetClock = iv_ptargetClock;
}
// callout the clock source
// HB does not have the osc target modeled
// so we need to use the proc target with
// osc clock type to call out
#ifndef __HOSTBOOT_MODULE
serviceData.service_data->SetCallout(l_ptargetClock);
#else
serviceData.service_data->SetCallout(
PRDcallout(l_ptargetClock,
PRDcalloutData::TYPE_PCICLK));
#endif
}
}
// Get all connected chips for non-CLOCK_CARD types.
else
{
//Callout every device connected to this clock source.
TargetHandleList l_targetsConnectedToClock =
PlatServices::getConnected( iv_ptargetClock, iv_targetType );
for( TargetHandleList::iterator i = l_targetsConnectedToClock.begin();
i != l_targetsConnectedToClock.end(); ++i )
{
if ( NULL != (*i) )
{
serviceData.service_data->SetCallout( *i );
}
}
}
return(l_rc);
}
} // end namespace PRDF
|