blob: 4dd66f9245f1366c7824d91ca59983d47302ea72 (
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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/occ_405/cmdh/cmdh_thread.c $ */
/* */
/* OpenPOWER OnChipController Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2015 */
/* [+] 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 */
#include "ssx.h"
#include "ssx_io.h"
#include "simics_stdio.h"
#include "errl.h"
#include "trac.h"
#include <thread.h>
#include <threadSch.h>
#include "state.h"
#include <cmdh_fsp.h>
extern uint8_t G_occ_interrupt_type;
eCmdhWakeupThreadMask G_cmdh_thread_wakeup_mask;
// Function Specification
//
// Name: Cmd_Hndl_thread_routine
//
// Description: This needs to be moved to separate file after we add cmd handler
// thread support
//
// End Function Specification
void Cmd_Hndl_thread_routine(void *arg)
{
#define OCC_RESP_READY_ALERT_TIMEOUT_ATTEMPTS 5
int l_rc = 0;
errlHndl_t l_errlHndl = NULL;
CHECKPOINT(CMDH_THREAD_STARTED);
CMDH_TRAC_INFO("Command Handler Thread Started ... " );
// ------------------------------------------------
// Initialize HW for FSP Comm
// ------------------------------------------------
cmdh_comm_init();
CHECKPOINT(COMM_INIT_COMPLETED);
// Read/trace push queue register
const uint32_t l_data = in32(OCB_OCBSHCS1);
CMDH_TRAC_INFO("Cmd_Hndl_thread_routine: OCB_OCBSHCS1=0x%08X", l_data);
// write data after checkpoint and update checkpoint length
G_fsp_msg.rsp->fields.data[3] = (l_data >> 24);
G_fsp_msg.rsp->fields.data[4] = (l_data >> 16) & 0xFF;
G_fsp_msg.rsp->fields.data[5] = (l_data >> 8) & 0xFF;
G_fsp_msg.rsp->fields.data[6] = (l_data ) & 0xFF;
G_fsp_msg.rsp->fields.data[7] = 0x11;
G_fsp_msg.rsp->fields.data_length[1] = 8; // 8 bytes vs 3
dcache_flush_line((void *)CMDH_OCC_RESPONSE_BASE_ADDRESS);
// ------------------------------------------------
// Loop forever, handling FSP commands
// ------------------------------------------------
while(1)
{
// ------------------------------------------------
// Block, Waiting on sem for a doorbell from FSP
// ------------------------------------------------
l_rc = cmdh_thread_wait_for_wakeup(); // Blocking Call
// ------------------------------------------------
// Handle the command
// ------------------------------------------------
if(SSX_OK == l_rc)
{
// Handle the command that TMGT just sent to OCC
if( CMDH_WAKEUP_FSP_COMMAND & G_cmdh_thread_wakeup_mask )
{
clearCmdhWakeupCondition(CMDH_WAKEUP_FSP_COMMAND);
l_errlHndl = cmdh_fsp_cmd_hndler();
// Commit an error if we get one passed back, do it before
// we tell the FSP we have a response ready
if(NULL != l_errlHndl)
{
commitErrl(&l_errlHndl);
}
}
}
}
}
|