Skip to content

Commit 6d97914

Browse files
committed
APSS P8/P9 Spec Compatibility
Change-Id: Ib6cc0f872c22131b4268b3016d264460b7ef9098 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36450 Reviewed-by: Andres A. Lugo-Reyes <aalugore@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com> Reviewed-by: William A. Bryan <wilbryan@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
1 parent ddf83aa commit 6d97914

File tree

4 files changed

+87
-10
lines changed

4 files changed

+87
-10
lines changed

src/common/gpe_export.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ typedef struct nop
5858

5959
typedef struct gpe_shared_data
6060
{
61-
uint32_t nest_freq_div; // Nest freq / 4
62-
uint32_t reserved[63];
61+
uint32_t nest_freq_div; // Nest freq / 4
62+
uint32_t spipss_spec_p9; // Which APSS spec to use
63+
uint32_t reserved[62];
6364
} gpe_shared_data_t;
6465

6566
#endif //_GPE_EXPORT_H

src/occ_405/main.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ void check_runtime_environment(void)
174174
// slow down RTL for Simics
175175
G_mics_per_tick = SIMICS_MICS_PER_TICK;
176176
G_dcom_tx_apss_wait_time = SIMICS_MICS_PER_TICK * 6 / 10;
177+
178+
// Same comment as above about lower 32-bits. Bit 62 can be toggled
179+
// on or off (in Simics) to indicate for which APSS specification the
180+
// model is configured.
181+
G_shared_gpe_data.spipss_spec_p9 =
182+
(0 != (flags & 0x0000000000000002) ) ? FALSE : TRUE;
183+
184+
}
185+
else
186+
{
187+
G_shared_gpe_data.spipss_spec_p9 = 0;
177188
}
178189
}
179190

@@ -1812,6 +1823,14 @@ int main(int argc, char **argv)
18121823
else
18131824
{
18141825
MAIN_TRAC_INFO("Currently running in Simics environment");
1826+
if(G_shared_gpe_data.spipss_spec_p9)
1827+
{
1828+
MAIN_TRAC_INFO("Using P9 Spec for APSS data gathering");
1829+
}
1830+
else
1831+
{
1832+
MAIN_TRAC_INFO("Using P8 Spec for APSS data gathering");
1833+
}
18151834
}
18161835

18171836
// Trace what happened before ssx initialization

src/occ_gpe0/apss_read.c

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
#include "gpe_util.h"
3434

3535
extern uint8_t G_apss_mode;
36-
36+
extern gpe_shared_data_t * G_gpe_shared_data;
3737
/*
3838
* Function Specifications:
3939
*
@@ -97,12 +97,26 @@ void apss_start_pwr_meas_read(ipc_msg_t* cmd, void* arg)
9797
if (APSS_MODE_COMPOSITE == G_apss_mode)
9898
{
9999
// clock_divider=36, frames=17 (i.e. 18)
100-
regValue = 0x8092200000000000;
100+
if(G_gpe_shared_data->spipss_spec_p9)
101+
{
102+
regValue = 0x8092200000000000; // P9 Spec
103+
}
104+
else
105+
{
106+
regValue = 0x8093C00000000000; // P9 Actual (16 frames)
107+
}
101108
}
102109
else
103110
{
104111
// clock_divider=36, frames=15 (i.e. 16)
105-
regValue = 0x8091E00000000000;
112+
if(G_gpe_shared_data->spipss_spec_p9)
113+
{
114+
regValue = 0x8091E00000000000; // P9 Spec
115+
}
116+
else
117+
{
118+
regValue = 0x8093C00000000000; // P9 Actual
119+
}
106120
}
107121
rc = putscom_abs(SPIPSS_ADC_CTRL_REG1, regValue);
108122
if(rc)
@@ -192,6 +206,7 @@ void apss_continue_pwr_meas_read(ipc_msg_t* cmd, void* arg)
192206
// the ipc arguments are passed through the ipc_msg_t structure, has a pointer
193207
// to the G_gpe_continue_pwr_meas_read_args
194208

209+
uint64_t regValue = 0;
195210
int rc;
196211
ipc_async_cmd_t *async_cmd = (ipc_async_cmd_t*)cmd;
197212
apss_continue_args_t *args = (apss_continue_args_t*)async_cmd->cmd_data;
@@ -256,6 +271,45 @@ void apss_continue_pwr_meas_read(ipc_msg_t* cmd, void* arg)
256271
gpe_set_ffdc(&(args->error), SPIPSS_ADC_RDATA_REG3, GPE_RC_SCOM_GET_FAILED, rc);
257272
break;
258273
}
274+
275+
// If we're trying to do composite mode for the P8 spec, we need to configure
276+
// the ADC controller again. P9 spec does not need to do this since there would
277+
// be room for up to 32 frames.
278+
if ( (APSS_MODE_COMPOSITE == G_apss_mode) &&(!G_gpe_shared_data->spipss_spec_p9) )
279+
{
280+
// ADC FSM, clock_divider=7, frames=1 (ie 2 for gpio ports)
281+
regValue = 0x8090400000000000;
282+
rc = putscom_abs(SPIPSS_ADC_CTRL_REG1, regValue);
283+
if(rc)
284+
{
285+
PK_TRACE("apss_continue_pwr_meas_read: SPIPSS_ADC_CTRL_REG1 putscom failed. rc = 0x%08x",
286+
rc);
287+
gpe_set_ffdc(&(args->error), SPIPSS_ADC_CTRL_REG1, GPE_RC_SCOM_PUT_FAILED, rc);
288+
break;
289+
}
290+
291+
// APSS command to continue previous command
292+
regValue = 0x0000000000000000;
293+
rc = putscom_abs(SPIPSS_ADC_WDATA_REG, regValue);
294+
if(rc)
295+
{
296+
PK_TRACE("apss_continue_pwr_meas_read: SPIPSS_ADC_WDATA_REG putscom failed. rc = 0x%08x",
297+
rc);
298+
gpe_set_ffdc(&(args->error), SPIPSS_ADC_WDATA_REG, GPE_RC_SCOM_PUT_FAILED, rc);
299+
break;
300+
}
301+
302+
// Start SPI Transaction
303+
regValue = 0x8000000000000000;
304+
rc = putscom_abs(SPIPSS_ADC_COMMAND_REG, regValue);
305+
if(rc)
306+
{
307+
PK_TRACE("apss_continue_pwr_meas_read: SPIPSS_ADC_COMMAND_REG putscom failed. rc = 0x%08x",
308+
rc);
309+
gpe_set_ffdc(&(args->error), SPIPSS_ADC_COMMAND_REG, GPE_RC_SCOM_PUT_FAILED, rc);
310+
break;
311+
}
312+
}
259313
} while(0);
260314

261315
#ifdef DEBUG_APSS_SEQ
@@ -302,7 +356,7 @@ void apss_complete_pwr_meas_read(ipc_msg_t* cmd, void* arg)
302356
int rc;
303357
ipc_async_cmd_t *async_cmd = (ipc_async_cmd_t*)cmd;
304358
apss_complete_args_t *args = (apss_complete_args_t*)async_cmd->cmd_data;
305-
359+
uint32_t rdata_reg = 0;
306360
do {
307361
// wait for ADC completion, or timeout after 100 micro seconds.
308362
// scom register SPIPSS_ADC_STATUS_REG's bit 0 (HWCTRL_ONGOING)
@@ -329,12 +383,16 @@ void apss_complete_pwr_meas_read(ipc_msg_t* cmd, void* arg)
329383
// If we're in composite mode, collect the GPIO data
330384
if (APSS_MODE_COMPOSITE == G_apss_mode)
331385
{
386+
// RDATA4-7 do not exist on P9 HW, spec says they should.
387+
if(G_gpe_shared_data->spipss_spec_p9) rdata_reg = SPIPSS_ADC_RDATA_REG4;
388+
else rdata_reg = SPIPSS_ADC_RDATA_REG0;
389+
332390
// Read first 8 bytes of data (GPIO frames) into meas_data[0]
333-
rc = getscom_abs(SPIPSS_ADC_RDATA_REG4, &args->meas_data[0]);
391+
rc = getscom_abs(rdata_reg, &args->meas_data[0]);
334392
if(rc)
335393
{
336-
PK_TRACE("apss_complete_pwr_meas_read: SPIPSS_ADC_RDATA_REG4 getscom failed. rc = 0x%08x",
337-
rc);
394+
PK_TRACE("apss_complete_pwr_meas_read: RDATA_REG(0x%08X) getscom failed. rc = 0x%08x",
395+
rdata_reg, rc);
338396
gpe_set_ffdc(&(args->error), SPIPSS_ADC_RDATA_REG4, GPE_RC_SCOM_GET_FAILED, rc);
339397
break;
340398
}

src/occ_gpe0/gpe0_main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ int main(int argc, char **argv)
8383
l_timebase = PPE_TIMEBASE_HZ;
8484
}
8585

86-
8786
// initializes kernel data (stack, threads, timebase, timers, etc.)
8887
pk_initialize((PkAddress)G_kernel_stack,
8988
KERNEL_STACK_SIZE,

0 commit comments

Comments
 (0)