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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/pore/poreve/porevesrc/pib2cfam.C $ */
/* */
/* IBM CONFIDENTIAL */
/* */
/* COPYRIGHT International Business Machines Corp. 2012,2013 */
/* */
/* 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 */
// -*- mode: C++; c-file-style: "linux"; -*-
// $Id: pib2cfam.C,v 1.16 2013/08/29 14:54:56 jeshua Exp $
/// \file pib2cfam.C
/// \brief A simple PibSlave that maps a small range of PIB addresses to CFAM
/// addresses.
#include "pib2cfam.H"
using namespace vsbe;
////////////////////////////// Creators //////////////////////////////
Pib2Cfam::Pib2Cfam()
{
}
Pib2Cfam::~Pib2Cfam()
{
}
//////////////////////////// Manipulators ////////////////////////////
static uint32_t
translateAddress(uint32_t address, fapi::Target* i_target)
{
uint8_t fsi_gpreg_scom_access = 0;
fapi::ReturnCode frc;
frc = FAPI_ATTR_GET( ATTR_FSI_GP_REG_SCOM_ACCESS, i_target, fsi_gpreg_scom_access );
if(!frc.ok()) {
FAPI_ERR( "Unable to get ATTR_FSI_GP_REG_SCOM_ACCESS for target\n" );
//JDS TODO - create an actual fapi error
// FAPI_SET_HWP_ERROR( frc, "Unable to get ATTR_FSI_GP_REG_SCOM_ACCESS for target\n" );
}
if( fsi_gpreg_scom_access ) {
return (address - 0x00050000) + 0x2800;
} else {
return (address - 0x00050000) + 0x1000;
}
}
fapi::ReturnCode
Pib2Cfam::operation(Transaction& io_transaction)
{
fapi::ReturnCode rc;
ModelError me;
switch (io_transaction.iv_mode) {
case ACCESS_MODE_READ:
switch (io_transaction.iv_address) {
case 0x00050006:
case 0x00050007:
case 0x0005000A:
case 0x00050012:
case 0x00050013:
case 0x00050014:
case 0x00050015:
case 0x00050016:
case 0x00050017:
case 0x00050018:
case 0x00050019:
case 0x0005001A:
case 0x0005001B:
rc = fapiGetCfamRegister(*iv_target,
translateAddress(io_transaction.iv_address, iv_target),
*iv_dataBuffer);
if (rc.ok()) {
io_transaction.iv_data =
((uint64_t)iv_dataBuffer->getWord(0)) << 32;
me = ME_SUCCESS;
} else {
me = ME_FAILURE;
}
break;
default:
me = ME_NOT_MAPPED_IN_MEMORY;
}
break;
case ACCESS_MODE_WRITE:
switch (io_transaction.iv_address) {
case 0x00050006:
case 0x00050007:
case 0x00050012:
case 0x00050013:
case 0x00050014:
case 0x00050015:
case 0x00050016:
case 0x00050017:
case 0x00050018:
case 0x0005001B:
iv_dataBuffer->setWordLength(1);
iv_dataBuffer->setWord(0, io_transaction.iv_data >> 32);
rc = fapiPutCfamRegister(*iv_target,
translateAddress(io_transaction.iv_address, iv_target),
*iv_dataBuffer);
if (rc.ok()) {
me = ME_SUCCESS;
} else {
me = ME_FAILURE;
}
break;
case 0x00050019:
case 0x0005001A:
FAPI_SET_HWP_ERROR(rc, RC_POREVE_PIB2CFAM_ERROR);
me = ME_BUS_SLAVE_PERMISSION_DENIED;
break;
default:
FAPI_SET_HWP_ERROR(rc, RC_POREVE_PIB2CFAM_ERROR);
me = ME_NOT_MAPPED_IN_MEMORY;
}
break;
default:
FAPI_SET_HWP_ERROR(rc, RC_POREVE_PIB2CFAM_ERROR);
me = ME_BUS_SLAVE_PERMISSION_DENIED;
break;
}
io_transaction.busError(me);
return rc;
}
/* Local Variables: */
/* c-basic-offset: 4 */
/* End: */
|