summaryrefslogtreecommitdiffstats
path: root/src/usr/errl/plugins/errludlogregister.H
blob: 87450fad6ade698ddbd50a2432ce514f3251f590 (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/errl/plugins/errludlogregister.H $                    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2012,2014              */
/*                                                                        */
/* 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 ERRL_UDLOGREGISTER_H
#define ERRL_UDLOGREGISTER_H

/**
 *  @file errludlogregister.H
 *
 *  Defines the ErrlUserDetailsParserLogRegister class that parses register FFDC
 *  user detail in an error log
 */

#include "errluserdetails.H"

#include <../devicefw/userif.H>
#include <../devicefw/driverif.H>

namespace ERRORLOG
{

/**
 * @class ErrlUserDetailsLogRegister
 *
 * Parses LogRegister user detail in an error log
 */
class ErrlUserDetailsParserLogRegister : public ErrlUserDetailsParser
{
public:
    /**
     *  @brief Constructor
     */
    ErrlUserDetailsParserLogRegister() {}

    /**
     *  @brief Destructor
     */
    virtual ~ErrlUserDetailsParserLogRegister() {}

    /**
     *  @brief Parses register user detail data from an error log
     *
     *  @param  i_version Version of the data
     *  @param  i_parse   ErrlUsrParser object for outputting information
     *  @param  i_pBuffer Pointer to buffer containing detail data
     *  @param  i_buflen  Length of the buffer
     */
    virtual void parse(errlver_t i_version,
                       ErrlUsrParser & i_parser,
                       void * i_pBuffer,
                       const uint32_t i_buflen) const
    {
        uint8_t *pBuf = reinterpret_cast<uint8_t *>(i_pBuffer);

        // while there is still at least 1 word of data left
        for (; (pBuf + sizeof(uint32_t)) <= ((uint8_t*)i_pBuffer + i_buflen); )
        {
            // first is the HUID
            uint32_t *pData = reinterpret_cast<uint32_t *>(pBuf);
            if (ntohl(*pData) == 0xFFFFFFFF)
            {
                i_parser.PrintString("LogRegister",
                            "Target: MASTER_PROCESSOR_CHIP_TARGET_SENTINEL");
            }
            else
            {
                i_parser.PrintNumber( "LogRegister",
                            "Target: HUID = 0x%08X", ntohl(*pData) );
            }
            pData++;
            pBuf += sizeof(*pData);

            // next is the count of registers to dump
            const uint8_t count = *pBuf;
            pBuf++;

            for (uint32_t i = 0; i < count;i++)
            {
                // format of data in the buffer is:
                // i_accessType, regParam[i], uint8_t(i_dataSize), i_dataBuf
                uint8_t l_accessType = *pBuf;
                pBuf++;
                int32_t numArgs = -1;
                std::vector <const char *> addrParams;
                switch (l_accessType)
                {
                    // one parameter
                    case DeviceFW::SCOM:        // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::SCOM");
                        numArgs = 1;
                        addrParams.push_back("  Scom address");
                        break;
                    case DeviceFW::FSI:         // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::FSI");
                        numArgs = 1;
                        addrParams.push_back("  FSI address");
                        break;
                    case DeviceFW::SPD:         // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::SPD");
                        numArgs = 1;
                        addrParams.push_back("  SPD keyword enumaration");
                        break;
                    case DeviceFW::XSCOM:       // driverif.H
                        i_parser.PrintString("AccessType", "DeviceFW::XSCOM");
                        numArgs = 1;
                        addrParams.push_back("  XScom address");
                        break;
                    case DeviceFW::FSISCOM:     // driverif.H
                        i_parser.PrintString("AccessType", "DeviceFW::FSISCOM");
                        numArgs = 1;
                        addrParams.push_back("  FSISCOM address");
                        break;
                    // two parameters
                    case DeviceFW::MVPD:        // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::MVPD");
                        numArgs = 2;
                        addrParams.push_back("  MVPD record");
                        addrParams.push_back("  MVPD keyword");
                        break;
                    case DeviceFW::EEPROM:      // driverif.H
                        i_parser.PrintString("AccessType", "DeviceFW::EEPROM");
                        numArgs = 2;
                        addrParams.push_back("  I2C slave device address");
                        addrParams.push_back("  EEPROM chip number");
                        break;
                    // three parameters
                    case DeviceFW::I2C:         // driverif.H
                        i_parser.PrintString("AccessType", "DeviceFW::I2C");
                        numArgs = 3;
                        addrParams.push_back("  I2C port");
                        addrParams.push_back("  I2C master engine");
                        addrParams.push_back("  Device address");
                        break;
                    // not logged!
                    case DeviceFW::PRESENT:     // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::PRESENT "
                                                    "- not logged");
                        break;
                    case DeviceFW::PNOR:        // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::PNOR "
                                                    "- not logged");
                        break;
                    case DeviceFW::MAILBOX:     // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::MAILBOX "
                                                    "- not logged");
                        break;
                    case DeviceFW::CVPD:     // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::CVPD "
                                                    "- not logged");
                        break;
                    case DeviceFW::SCAN:     // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::SCAN "
                                                    "- not logged");
                        break;
                    case DeviceFW::IBSCOM:     // userif.H
                        i_parser.PrintString("AccessType", "DeviceFW::IBSCOM "
                                                    "- not logged");
                        break;
                    default:
                        i_parser.PrintNumber("AccessType", "UNKNOWN 0x%X"
                                                    "- not logged",
                                                    l_accessType);
                        break;
                } // switch l_accessType

                if (numArgs != -1)
                {
                    uint64_t *pData64 = reinterpret_cast<uint64_t *>(pBuf);
                    for (int32_t i = 0;i < numArgs;i++)
                    {
                        std::vector<char> l_traceEntry(20);
                        sprintf(&(l_traceEntry[0]),"0x%016llX", ntohll(*pData64));
                        i_parser.PrintString(addrParams[i], &(l_traceEntry[0]));

                        pData64++;
                        pBuf += sizeof(*pData64);
                    }
                    const uint8_t dataSize = *pBuf;
                    i_parser.PrintNumber("  Register data", "size: 0x%X bytes",
                                            dataSize);
                    pBuf++;

                    pData64 = reinterpret_cast<uint64_t *>(pBuf);
                    i_parser.PrintHexDump( pData64, dataSize);
                    pBuf += dataSize;
                } // numArgs
            } // for count
        } // for
    } // parse

private:
    // Disabled
    ErrlUserDetailsParserLogRegister(const ErrlUserDetailsParserLogRegister &);
    ErrlUserDetailsParserLogRegister & operator=(
        const ErrlUserDetailsParserLogRegister &);
};

}

#endif

OpenPOWER on IntegriCloud