summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/pegasus/prdfPciOscSwitchDomain.H
blob: 8438988dc3e7c656c04ac4606d496844ce3202c0 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/pegasus/prdfPciOscSwitchDomain.H $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 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                                                     */

#ifndef prdfPciOscDomain_H
#define prdfPciOscDomain_H

#include <iipDomain.h>
#include <prdfExtensibleDomain.H>
#include <prdfParentDomain.H>
#include <prdfRuleChipDomain.H>


namespace PRDF
{
struct PciOscSwitchDetails
{
    ExtensibleChip * pciParentProc;
    TARGETING::TargetHandle_t pciOscCard;
    uint32_t pciOscPosition;
    TARGETING::TargetHandle_t procPciEndPoint;
    TARGETING::TargetHandle_t oscPciEndPoint;
    bool pciOscSwitchDone;
};

typedef std::vector <PciOscSwitchDetails> PciOscConnList;

//------------------------------------------------------------------------------

class PciOscSwitchDomain : public RuleChipDomain, public ExtensibleDomain,
                           public ParentDomain<ExtensibleDomain>
{
  public:

    /**
     * @brief Constructor
     * @param DOMAIN_ID  the domain ID
     */
    PciOscSwitchDomain( DOMAIN_ID domain_id );

    /**
     *  @brief Perform any initialization required by the hardware
     *  @returns error code
     */
    virtual int32_t Initialize(void);

    /**
     * @brief Query if anything in this domain is reporting given attention.
     * @param Attention type to query for. (@see iipsdbug.h)
     * @returns [true|false]
     * @pre Initialize()
     */
    virtual bool Query(ATTENTION_TYPE attentionType);

    /**
     * @brief Analyze errors within the domain
     * @param service data collector
     * @param attentiont type (@see iipsdbug.h)
     * @return return code
     * @pre Initialize(); Query() == true
     * @post domain element order may be modified.
     */
    virtual int32_t Analyze( STEP_CODE_DATA_STRUCT & i_sc,
                           ATTENTION_TYPE attentionType );
protected:

    /**
     * @brief Order the domain - with detecting element at the top
     * @param Attention type (@see iipsdbug.h)
     * @post domain elemenet order may be altered
     * @note this is called by Analyze()
     */
    virtual void Order( ATTENTION_TYPE i_attentionType );

  private: // function

    /**
     * @brief analyzes all the procs reporting switchover from a given pci osc.
     * @param     i_chip  A P8 chip.
     * @param     i_sc    The step code data struct.
     * @param     o_pciOscSwitchData  contains pci osc switch over data.
     * @note this is called by Analyze()
     */
    int32_t  analyzePciOscSwitch( ExtensibleChip * i_chip,
                                STEP_CODE_DATA_STRUCT & i_sc,
                                PciOscConnList & o_pciOscSwitchData );
    /**
     * @brief     clears few bits to reset PCI Osc switch over bit.
     * @param     io_oscSwitchData list of procs connected to faulty PCI OSC.
     * @return    SUCCESS if clearing of bit is success, FAIL otherwise.
     */
    int32_t clearPciSwitchError( PciOscConnList & io_oscSwitchData );

    /**
     * @brief  callout hardware parts and add signature based analysis data.
     * @param   i_sc    The step code data struct.
     * @param   i_pciOscSwitchData contains PCI osc failover data.
     */
    void addHwCalloutAndSignature( STEP_CODE_DATA_STRUCT & i_sc,
                                 PciOscConnList & i_pciOscSwitchData );
    /**
     * @brief checks if there is multiple PCI Osc failure.
     * @param  pciOscSwitchData PCI Osc fault data.
     * @return True if there is multiple PCI Osc failure, false otherwise.
     */
    bool checkMultiOscFailure( PciOscConnList & i_pciOscSwitchData );

    /**
     * @brief finds Rulechip associated with proc target.
     * @param     i_chipTgt   target associated with proc Rulechip.
     * @return    Rulechip associated with proc target
     */
    ExtensibleChip * findChip( TARGETING::TargetHandle_t i_chipTgt );

  private:  // Data
    enum { CONTAINER_SIZE = 16 };


};

inline PciOscSwitchDomain::PciOscSwitchDomain( DOMAIN_ID i_domainId ) :
    RuleChipDomain( i_domainId, PciOscSwitchDomain::CONTAINER_SIZE ),
    ExtensibleDomain( "PciOscSwitchDomain")
{}

} // end namespace PRDF

#endif /* prdfPciOscDomain_H */

OpenPOWER on IntegriCloud