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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/framework/rule/prdrChip.H $ */
/* */
/* IBM CONFIDENTIAL */
/* */
/* COPYRIGHT International Business Machines Corp. 2004,2012 */
/* */
/* p1 */
/* */
/* Object Code Only (OCO) source materials */
/* Licensed Internal Code Source Materials */
/* IBM HostBoot Licensed Internal Code */
/* */
/* The source code for this program is not published or otherwise */
/* divested of its trade secrets, irrespective of what has been */
/* deposited with the U.S. Copyright Office. */
/* */
/* Origin: 30 */
/* */
/* IBM_PROLOG_END_TAG */
#ifndef __PRDRCHIP_H
#define __PRDRCHIP_H
#include <string>
#include <stdint.h>
#include <netinet/in.h>
#include <prdrRegister.H>
namespace PRDR_COMPILER
{
class ExtraSignature
{
public:
uint32_t iv_sig;
std::string * iv_sname;
std::string * iv_desc;
ExtraSignature(uint32_t i_sig,
std::string * i_sname,
std::string * i_desc) : iv_sig(i_sig),
iv_sname(i_sname),
iv_desc(i_desc) {};
ExtraSignature & operator=(const ExtraSignature & l_rhs)
{
this->iv_sig = l_rhs.iv_sig;
this->iv_sname = l_rhs.iv_sname;
this->iv_desc = l_rhs.iv_desc;
return *this;
};
};
class Chip
{
public:
std::string * cv_sname;
std::string * cv_name;
uint32_t cv_chipid;
uint32_t cv_targetType;
uint32_t cv_signatureOffset;
uint32_t cv_dumptype; //@ecdf
RegisterList cv_reglist;
std::list<ExtraSignature> cv_sigExtras;
uint16_t cv_scomlen; // Default Scom Address.
std::string cv_name_default;
Chip() : cv_sname(NULL),
cv_name(&cv_name_default),
cv_chipid(0),
cv_targetType(0),
cv_signatureOffset(0),
cv_dumptype(0), //@ecdf
cv_reglist(),
cv_sigExtras(),
cv_scomlen(0) {};
static void merge(Chip * i_l, Chip * i_r)
{
if (NULL != i_r->cv_sname)
i_l->cv_sname = i_r->cv_sname;
if (&i_r->cv_name_default != i_r->cv_name)
i_l->cv_name = i_r->cv_name;
if (0 != i_r->cv_chipid)
i_l->cv_chipid = i_r->cv_chipid;
if (0 != i_r->cv_scomlen)
i_l->cv_scomlen = i_r->cv_scomlen;
if (0 != i_r->cv_targetType)
i_l->cv_targetType = i_r->cv_targetType;
if (0 != i_r->cv_signatureOffset)
i_l->cv_signatureOffset = i_r->cv_signatureOffset;
if (0 != i_r->cv_dumptype) //@ecdf
i_l->cv_dumptype = i_r->cv_dumptype;
i_l->cv_reglist.insert(i_l->cv_reglist.end(),
i_r->cv_reglist.begin(),
i_r->cv_reglist.end());
i_l->cv_sigExtras.insert(i_l->cv_sigExtras.end(),
i_r->cv_sigExtras.begin(),
i_r->cv_sigExtras.end());
};
void print()
{
using namespace std;
cout << "Chip " << *cv_sname << ":" << endl;
cout << "\tLong Name: " << *cv_name << endl;
cout << "\tChip ID: " << cv_chipid << endl;
cout << "\tTarget Type: " << cv_targetType << endl;
cout << "\tSignature Offset: " << cv_signatureOffset << endl;
cout << "\tDefault Dumptype: " << cv_dumptype << endl; //@ecdf
cout << "\tDefault ScomLen: " << cv_scomlen << endl;
cout << "\tRegisters: (" << cv_reglist.size() << ")" << endl;
for (RegisterList::iterator i = cv_reglist.begin();
i != cv_reglist.end();
i++)
{
(*i)->print();
}
};
int output(FILE * l_file)
{
uint32_t l_temp;
uint16_t l_temp16;
fwrite("PRDRCHIP", 8, 1, l_file);
l_temp = htonl(cv_chipid);
fwrite(&l_temp, sizeof(l_temp), 1, l_file);
l_temp = htonl(cv_targetType);
fwrite(&l_temp, sizeof(l_temp), 1, l_file);
l_temp = htonl(cv_signatureOffset);
fwrite(&l_temp, sizeof(l_temp), 1, l_file);
// Write dumptype to file. //@ecdf
l_temp = htonl(cv_dumptype);
fwrite(&l_temp, sizeof(l_temp), 1, l_file);
l_temp16 = htons(cv_scomlen);
fwrite(&l_temp16, sizeof(l_temp16), 1, l_file);
l_temp16 = htons(cv_reglist.size());
fwrite(&l_temp16, sizeof(l_temp16), 1, l_file);
for (RegisterList::iterator i = cv_reglist.begin();
i != cv_reglist.end();
i++)
{
(*i)->output(l_file, cv_signatureOffset);
}
return 0;
}
void outputRegisterFile(std::ostream & o_file)
{
o_file << "( 0x" << std::hex << cv_targetType << ", 0x" << std::hex
<< cv_signatureOffset << " )" << std::endl;
for (RegisterList::iterator i = cv_reglist.begin();
i != cv_reglist.end();
i++)
{
(*i)->outputRegisterFile(o_file, cv_signatureOffset);
}
};
};
} // end namespace PRDR_COMPILER
#endif
|