summaryrefslogtreecommitdiffstats
path: root/src/usr/fsi/errlud_fsi.C
blob: f00530d22a63a6507f63b427af504450015c20f2 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/fsi/errlud_fsi.C $                                    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2013,2017                        */
/* [+] 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 errlud_fsi.C
 *
 *  @brief Implementation of classes to log FSI FFDC
 */
#include "errlud_fsi.H"
#include <fsi/fsi_reasoncodes.H>
#include <string.h>
#include "fsidd.H"
#include "fsi_common.H"

namespace FSI
{

//------------------------------------------------------------------------------
//  Presence
//------------------------------------------------------------------------------
UdPresence::UdPresence( TARGETING::Target* i_target )
{
    // Set up Ud instance variables
    iv_CompId = FSI_COMP_ID;
    iv_Version = 1;
    iv_SubSection = FSI_UDT_PRESENCE;

    FsiDD& fsidd = Singleton<FsiDD>::instance();
    FSI::FsiChipInfo_t l_chip_info = fsidd.getFsiInfo(i_target);
    uint64_t l_slaveIndex = fsidd.getSlaveEnableIndex(l_chip_info.master,
                                                      l_chip_info.type);

    //***** Memory Layout *****
    // 4 bytes  : Slave HUID
    // 4 bytes  : Master HUID
    // 1 byte   : FSI_MASTER_TYPE
    // 1 byte   : port
    // 1 byte   : cascade
    // 2 bytes  : flags
    // 4 bytes  : linkid (node+proc+type+port)
    // 2 bytes  : Size of iv_slaves[]
    // 8 bytes  : slave enable Index
    // X bytes  : iv_slaves[]

    char * l_pBuf = reinterpret_cast<char *>(
                          reallocUsrBuf(sizeof(uint32_t)*2
                                        +sizeof(uint8_t)*3
                                        +sizeof(uint16_t)
                                        +sizeof(uint32_t)
                                        +sizeof(uint16_t)
                                        +sizeof(uint64_t)
                                        +sizeof(fsidd.iv_slaves)));
    uint32_t tmp32 = 0;
    uint16_t tmp16 = 0;
    uint8_t tmp8 = 0;

    tmp32 = TARGETING::get_huid(l_chip_info.slave);
    memcpy(l_pBuf, &tmp32, sizeof(tmp32));
    l_pBuf += sizeof(tmp32);

    tmp32 = TARGETING::get_huid(l_chip_info.master);
    memcpy(l_pBuf, &tmp32, sizeof(tmp32));
    l_pBuf += sizeof(tmp32);

    tmp8 = l_chip_info.type;
    memcpy(l_pBuf, &tmp8, sizeof(tmp8));
    l_pBuf += sizeof(tmp8);

    tmp8 = l_chip_info.port;
    memcpy(l_pBuf, &tmp8, sizeof(tmp8));
    l_pBuf += sizeof(tmp8);

    tmp8 = l_chip_info.cascade;
    memcpy(l_pBuf, &tmp8, sizeof(tmp8));
    l_pBuf += sizeof(tmp8);

    tmp16 = l_chip_info.flags;
    memcpy(l_pBuf, &tmp16, sizeof(tmp16));
    l_pBuf += sizeof(tmp16);

    tmp32 = l_chip_info.linkid.id;
    memcpy(l_pBuf, &tmp32, sizeof(tmp32));
    l_pBuf += sizeof(tmp32);

    tmp16 = sizeof(fsidd.iv_slaves);
    memcpy(l_pBuf, &tmp16, sizeof(tmp16));
    l_pBuf += sizeof(tmp16);

    memcpy(l_pBuf, &l_slaveIndex, sizeof(l_slaveIndex));
    l_pBuf += sizeof(l_slaveIndex);

    memcpy(l_pBuf, fsidd.iv_slaves, sizeof(fsidd.iv_slaves));
    l_pBuf += sizeof(fsidd.iv_slaves);
}

//------------------------------------------------------------------------------
UdPresence::~UdPresence()
{

}


//------------------------------------------------------------------------------
//  Operation
//------------------------------------------------------------------------------
UdOperation::UdOperation( TARGETING::Target* i_target,
                          uint64_t i_address,
                          bool i_readNotWrite )
{
    // Set up Ud instance variables
    iv_CompId = FSI_COMP_ID;
    iv_Version = 1;
    iv_SubSection = FSI_UDT_OPERATION;

    //***** Memory Layout *****
    // 4 bytes  : Target HUID
    // 8 bytes  : FSI Address
    // 1 byte   : 1=read, 0=write

    char * l_pBuf = reinterpret_cast<char *>(
                          reallocUsrBuf(sizeof(uint32_t)
                                        +sizeof(uint64_t)
                                        +sizeof(uint8_t)
                                        ));

    uint32_t tmp32 = TARGETING::get_huid(i_target);
    memcpy(l_pBuf, &tmp32, sizeof(tmp32));
    l_pBuf += sizeof(tmp32);

    memcpy(l_pBuf, &i_address, sizeof(i_address));
    l_pBuf += sizeof(i_address);

    uint8_t tmp8 = i_readNotWrite;
    memcpy(l_pBuf, &tmp8, sizeof(tmp8));
    l_pBuf += sizeof(tmp8);
}

//------------------------------------------------------------------------------
UdOperation::~UdOperation()
{

}



}
OpenPOWER on IntegriCloud