summaryrefslogtreecommitdiffstats
path: root/src/lib/occlib
diff options
context:
space:
mode:
authorWilliam Bryan <wilbryan@us.ibm.com>2017-06-08 12:22:36 -0500
committerMartha Broyles <mbroyles@us.ibm.com>2017-06-08 16:01:37 -0400
commit53c19c213e9ca6769bca90e864291898c5783a47 (patch)
tree40f4294f9d5cd399eebaa2da5156beece20b5de9 /src/lib/occlib
parentf5d0529142ff4edc716d080f6c8aada028f9ceeb (diff)
downloadtalos-occ-53c19c213e9ca6769bca90e864291898c5783a47.tar.gz
talos-occ-53c19c213e9ca6769bca90e864291898c5783a47.zip
Update occlib
Change-Id: I83664ede51fa4d46c56ca806abb75dbe881389d6 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41552 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com> Reviewed-by: Martha Broyles <mbroyles@us.ibm.com>
Diffstat (limited to 'src/lib/occlib')
-rw-r--r--src/lib/occlib/ipc_api.h48
-rw-r--r--src/lib/occlib/ipc_async_cmd.h7
-rw-r--r--src/lib/occlib/ipc_core.c79
-rw-r--r--src/lib/occlib/ipc_init.c26
-rw-r--r--src/lib/occlib/ipc_macros.h34
-rw-r--r--src/lib/occlib/ipc_ping.c14
-rw-r--r--src/lib/occlib/ipc_ping.h16
-rw-r--r--src/lib/occlib/ipc_structs.h40
-rw-r--r--src/lib/occlib/occhw_scom_cmd.h4
-rw-r--r--src/lib/occlib/occhw_shared_data.h4
-rw-r--r--src/lib/occlib/occhw_xir_dump.c5
11 files changed, 162 insertions, 115 deletions
diff --git a/src/lib/occlib/ipc_api.h b/src/lib/occlib/ipc_api.h
index e5269ad..68538c9 100644
--- a/src/lib/occlib/ipc_api.h
+++ b/src/lib/occlib/ipc_api.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -63,29 +63,29 @@
/// is known that it is safe for the message to be reused (sent as a command
/// again).
///
-void ipc_init_msg(ipc_msg_t* msg,
- uint32_t func_id,
- ipc_msg_handler_t resp_callback,
- void* callback_arg);
+void ipc_init_msg(ipc_msg_t* msg,
+ uint32_t func_id,
+ ipc_msg_handler_t resp_callback,
+ void* callback_arg);
//Use these to statically initialize an IPC message
#define IPC_MSG_INIT(_func_id, _resp_callback, _callback_arg) \
-{\
- {.node = KERN_DEQUE_ELEMENT_INIT()}, \
- .func_id.word32 = _func_id, \
- .ipc_rc = IPC_RC_SUCCESS, \
- .resp_callback = _resp_callback, \
- .callback_arg = _callback_arg \
-}
+ {\
+ {.node = KERN_DEQUE_ELEMENT_INIT()}, \
+ .func_id.word32 = _func_id, \
+ .ipc_rc = IPC_RC_SUCCESS, \
+ .resp_callback = _resp_callback, \
+ .callback_arg = _callback_arg \
+ }
#define IPC_MSG_CREATE(msg_name, _func_id, _resp_callback, _callback_arg) \
-ipc_msg_t msg_name = IPC_MSG_INIT(_func_id, _resp_callback, _callback_arg)
+ ipc_msg_t msg_name = IPC_MSG_INIT(_func_id, _resp_callback, _callback_arg)
///////////////////////////////////////////////////////////////////////////////
/// Free up a message to be reused.
///
/// \param msg a pointer to a message.
-///
+///
/// This interface should be called on a message when it is known that it is
/// safe to reuse the message. Normally, this would be one of the last things
/// performed in the response callback function for a command, but it may also
@@ -120,7 +120,7 @@ int ipc_set_cmd_target(ipc_msg_t* cmd, uint32_t target_id);
/// \param cmd A pointer to an initialized command message
///
/// It is expected that at some point prior to calling this function the
-/// message was initialized with a call to \a ipc_init_msg or
+/// message was initialized with a call to \a ipc_init_msg or
/// \a ipc_init_msgq_msg.
///
/// Once a message has been sent it is not safe to send again until it has been
@@ -131,7 +131,7 @@ int ipc_set_cmd_target(ipc_msg_t* cmd, uint32_t target_id);
/// \retval IPC_RC_SUCCESS The message was successfully placed on the target's
/// receive buffer.
///
-/// \retval IPC_RC_SELF_BLOCKED The call was made prior to calling
+/// \retval IPC_RC_SELF_BLOCKED The call was made prior to calling
/// \a ipc_enable.
///
/// \retval IPC_RC_INVALID_FUNC_ID The command was initialized with an invalid
@@ -148,7 +148,7 @@ int ipc_set_cmd_target(ipc_msg_t* cmd, uint32_t target_id);
///
/// \retval IPC_RC_TARGET_BLOCKED The command could not be sent because the
/// target is blocking any new messages.
-///
+///
int ipc_send_cmd(ipc_msg_t* cmd);
@@ -164,7 +164,7 @@ int ipc_send_cmd(ipc_msg_t* cmd);
/// is no risk of overlapping return codes.
///
/// It is expected that at some point prior to calling this function the
-/// message was initialized with a call to \a ipc_init_msg or
+/// message was initialized with a call to \a ipc_init_msg or
/// \a ipc_init_msgq_msg.
///
/// Once a message has been sent it is not safe to send again until it has been
@@ -399,11 +399,11 @@ void ipc_init_msgq(ipc_msgq_t* msgq);
//Use this to statically initialize an IPC message queue
#define IPC_MSGQ_CREATE(msgq) \
-ipc_msgq_t msgq = \
-{\
- .msg_head = KERN_DEQUE_SENTINEL_INIT(&msgq.msg_head),\
- .msg_sem = KERN_SEMAPHORE_INITIALIZATION(0, 0)\
-}
+ ipc_msgq_t msgq = \
+ {\
+ .msg_head = KERN_DEQUE_SENTINEL_INIT(&msgq.msg_head),\
+ .msg_sem = KERN_SEMAPHORE_INITIALIZATION(0, 0)\
+ }
///////////////////////////////////////////////////////////////////////////////
/// Initialize an IPC message and associate it with an IPC message queue
@@ -419,7 +419,7 @@ ipc_msgq_t msgq = \
/// wishes to have the command response placed on the specified IPC message
/// queue. This allows a thread to block (via the \a ipc_msq_recv interface)
/// on the message queue until a response to a command has arrived.
-///
+///
/// \note An IPC message queue can be associated with more than one IPC
/// message.
///
diff --git a/src/lib/occlib/ipc_async_cmd.h b/src/lib/occlib/ipc_async_cmd.h
index 9e39f82..e1ae41f 100644
--- a/src/lib/occlib/ipc_async_cmd.h
+++ b/src/lib/occlib/ipc_async_cmd.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -35,10 +35,11 @@
#ifndef __ASSEMBLER__
-typedef struct {
+typedef struct
+{
ipc_msg_t cmd;
void* cmd_data;
-}ipc_async_cmd_t;
+} ipc_async_cmd_t;
#endif /*__ASSEMBLER__*/
#endif /*__IPC_ASYNC_CMD_H__*/
diff --git a/src/lib/occlib/ipc_core.c b/src/lib/occlib/ipc_core.c
index dfa7422..16a0e60 100644
--- a/src/lib/occlib/ipc_core.c
+++ b/src/lib/occlib/ipc_core.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -35,8 +35,8 @@
uint8_t G_ipc_enabled = 0;
#ifndef STATIC_IPC_TABLES
-ipc_func_table_entry_t G_ipc_mt_handlers[IPC_MT_MAX_FUNCTIONS];
-ipc_func_table_entry_t G_ipc_st_handlers[IPC_ST_MAX_FUNCTIONS];
+ ipc_func_table_entry_t G_ipc_mt_handlers[IPC_MT_MAX_FUNCTIONS];
+ ipc_func_table_entry_t G_ipc_st_handlers[IPC_ST_MAX_FUNCTIONS];
#endif
///////////////////////////////////////////////////////////////////////////////
@@ -80,7 +80,9 @@ int ipc_send_msg(ipc_msg_t* msg, uint32_t target_id)
msgs[*write_count % IPC_CBUF_SIZE] = msg;
(*write_count)++;
-
+#ifdef GPE_IPC_TIMERS
+ msg->begin_time = in32(OCB_OTBR);
+#endif
//raise the IPC interrupt on the target
KERN_IRQ_STATUS_SET(IPC_GET_IRQ(target_id), 1);
}
@@ -96,8 +98,11 @@ int ipc_send_msg(ipc_msg_t* msg, uint32_t target_id)
rc = IPC_RC_TARGET_BLOCKED;
}
}
+
KERN_CRITICAL_SECTION_EXIT(&ctx);
- }while(0);
+ }
+ while(0);
+
return rc;
}
@@ -107,6 +112,7 @@ int ipc_send_msg(ipc_msg_t* msg, uint32_t target_id)
int ipc_send_cmd(ipc_msg_t* cmd)
{
int rc;
+
do
{
//don't allow sending new commands if IPC is disabled
@@ -141,16 +147,19 @@ int ipc_send_cmd(ipc_msg_t* cmd)
rc = ipc_send_msg(cmd, cmd->func_id.target_id);
cmd->ipc_rc = rc;
- }while(0);
+ }
+ while(0);
+
return rc;
}
////////////////////////////////////////////////////////////////////////////////
/// Send a command message back to the sender as a response message with status.
-///
+///
int ipc_send_rsp(ipc_msg_t* rsp, uint32_t ipc_rc)
{
int rc;
+
if(rsp->func_id.active_flag)
{
rsp->func_id.response_flag = 1;
@@ -161,6 +170,7 @@ int ipc_send_rsp(ipc_msg_t* rsp, uint32_t ipc_rc)
{
rc = IPC_RC_MSG_NOT_ACTIVE;
}
+
return rc;
}
@@ -182,6 +192,7 @@ void ipc_default_handler(ipc_msg_t* msg, void* arg)
int ipc_set_cmd_target(ipc_msg_t* cmd, uint32_t target_id)
{
int rc = IPC_RC_SUCCESS;
+
do
{
//verify that this is a muti-target function
@@ -194,7 +205,8 @@ int ipc_set_cmd_target(ipc_msg_t* cmd, uint32_t target_id)
{
cmd->func_id.target_id = target_id;
}
- }while(0);
+ }
+ while(0);
return rc;
}
@@ -208,7 +220,7 @@ void ipc_process_msg(ipc_msg_t* msg)
{
uint32_t table_index;
uint32_t table_limit;
- ipc_func_table_entry_t *func_table;
+ ipc_func_table_entry_t* func_table;
do
{
@@ -217,6 +229,10 @@ void ipc_process_msg(ipc_msg_t* msg)
{
if(msg->resp_callback)
{
+#ifdef GPE_IPC_TIMERS
+ msg->end_time = in32(OCB_OTBR);
+#endif
+
msg->resp_callback(msg, msg->callback_arg);
}
else
@@ -257,7 +273,8 @@ void ipc_process_msg(ipc_msg_t* msg)
//it should eventually time out and log the message as FFDC.
ipc_send_rsp(msg, IPC_RC_INVALID_FUNC_ID);
}
- }while(0);
+ }
+ while(0);
}
///////////////////////////////////////////////////////////////////////////////
@@ -267,12 +284,12 @@ void ipc_process_msg(ipc_msg_t* msg)
///
void ipc_process_cbuf(uint32_t sender_id)
{
- ipc_target_t *my_cbufs = &OSD_PTR->ipc_data.targets[OCCHW_INST_ID_SELF];
- uint8_t *read_count = &my_cbufs->counts.reads.counts8[sender_id];
- uint8_t *write_count = &my_cbufs->counts.writes.counts8[sender_id];
- ipc_msg_t **msg_ptrs = &my_cbufs->cbufs[sender_id][0];
- ipc_msg_t *cur_msg;
-
+ ipc_target_t* my_cbufs = &OSD_PTR->ipc_data.targets[OCCHW_INST_ID_SELF];
+ uint8_t* read_count = &my_cbufs->counts.reads.counts8[sender_id];
+ uint8_t* write_count = &my_cbufs->counts.writes.counts8[sender_id];
+ ipc_msg_t** msg_ptrs = &my_cbufs->cbufs[sender_id][0];
+ ipc_msg_t* cur_msg;
+
while(*read_count != *write_count)
{
@@ -291,13 +308,13 @@ void ipc_process_cbuf(uint32_t sender_id)
/// and processes them.
///
#ifdef __SSX__
-KERN_IRQ_HANDLER(ipc_irq_handler_full)
+ KERN_IRQ_HANDLER(ipc_irq_handler_full)
#else
-KERN_IRQ_HANDLER(ipc_irq_handler)
+ KERN_IRQ_HANDLER(ipc_irq_handler)
#endif
{
ipc_counts_t xored_counts;
- ipc_target_t *my_cbufs;
+ ipc_target_t* my_cbufs;
uint32_t sender_id;
// Processors could be sending us new packets while we're
@@ -325,7 +342,7 @@ KERN_IRQ_HANDLER(ipc_irq_handler)
// Use cntlzw to find the first buffer that isn't empty
sender_id = cntlz64(xored_counts.counts64) / IPC_CBUF_COUNT_BITS;
-
+
// If all buffers are empty then we're done
if(sender_id > OCCHW_INST_ID_MAX)
{
@@ -339,8 +356,10 @@ KERN_IRQ_HANDLER(ipc_irq_handler)
ipc_process_cbuf(sender_id);
}
+#ifndef UNIFIED_IRQ_HANDLER_GPE
// Unmask the irq before returning
KERN_IRQ_ENABLE(IPC_GET_IRQ(OCCHW_INST_ID_SELF));
+#endif
}
@@ -352,7 +371,7 @@ KERN_IRQ_HANDLER(ipc_irq_handler)
/// NOTE: This is only needed for SSX. PK only supports full interrupts.
///
#ifdef __SSX__
-KERN_IRQ_FAST2FULL(ipc_irq_handler, ipc_irq_handler_full);
+ KERN_IRQ_FAST2FULL(ipc_irq_handler, ipc_irq_handler_full);
#endif
@@ -366,16 +385,19 @@ int ipc_init(void)
#ifndef STATIC_IPC_TABLES
int i;
+
for(i = 0; i < IPC_MT_MAX_FUNCTIONS; i++)
{
G_ipc_mt_handlers[i].handler = ipc_default_handler;
G_ipc_mt_handlers[i].arg = 0;
}
+
for(i = 0; i < IPC_ST_MAX_FUNCTIONS; i++)
{
G_ipc_st_handlers[i].handler = ipc_default_handler;
G_ipc_st_handlers[i].arg = 0;
}
+
#endif
return IPC_RC_SUCCESS;
}
@@ -392,9 +414,9 @@ int ipc_enable(void)
{
// Install the IPI interrupt handler for this processor
rc = KERN_IRQ_HANDLER_SET(IPC_GET_IRQ(OCCHW_INST_ID_SELF),
- ipc_irq_handler,
- 0,
- KERN_CRITICAL);
+ ipc_irq_handler,
+ 0,
+ KERN_CRITICAL);
if(rc)
{
@@ -418,7 +440,8 @@ int ipc_enable(void)
//Allow us to send out new commands
G_ipc_enabled = 1;
- }while(0);
+ }
+ while(0);
return rc;
}
@@ -467,13 +490,15 @@ int ipc_disable(uint32_t target_id)
// is known to be halted.
for(i = 0; i <= OCCHW_INST_ID_MAX; i++)
{
- target_cbufs->counts.reads.counts8[i] =
+ target_cbufs->counts.reads.counts8[i] =
target_cbufs->counts.writes.counts8[i] - (IPC_CBUF_SIZE * 2);
}
KERN_CRITICAL_SECTION_EXIT(&ctx);
- }while(0);
+ }
+ while(0);
+
return rc;
}
diff --git a/src/lib/occlib/ipc_init.c b/src/lib/occlib/ipc_init.c
index 7797299..a322eb4 100644
--- a/src/lib/occlib/ipc_init.c
+++ b/src/lib/occlib/ipc_init.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -41,7 +41,7 @@ int ipc_set_handler(uint32_t function_id,
ipc_msg_handler_t handler,
void* callback_arg)
{
- ipc_func_table_entry_t *func_table;
+ ipc_func_table_entry_t* func_table;
uint32_t table_limit;
int rc = IPC_RC_SUCCESS;
ipc_func_id_t func_id = {{0}};
@@ -65,6 +65,7 @@ int ipc_set_handler(uint32_t function_id,
rc = IPC_RC_INVALID_TARGET_ID;
break;
}
+
table_limit = IPC_ST_NUM_FUNCIDS;
func_table = G_ipc_st_handlers;
}
@@ -84,23 +85,29 @@ int ipc_set_handler(uint32_t function_id,
func_table[func_id.table_index].handler = handler;
func_table[func_id.table_index].arg = callback_arg;
- }while(0);
+ }
+ while(0);
+
return rc;
}
///////////////////////////////////////////////////////////////////////////////
/// Initialize an IPC command message
///
-void ipc_init_msg(ipc_msg_t* msg,
- uint32_t func_id,
- ipc_msg_handler_t resp_callback,
- void* callback_arg)
+void ipc_init_msg(ipc_msg_t* msg,
+ uint32_t func_id,
+ ipc_msg_handler_t resp_callback,
+ void* callback_arg)
{
KERN_DEQUE_ELEMENT_CREATE(&msg->node);
msg->func_id.word32 = func_id;
msg->ipc_rc = IPC_RC_SUCCESS;
msg->resp_callback = resp_callback;
msg->callback_arg = callback_arg;
+#ifdef GPE_IPC_TIMERS
+ msg->begin_time = 0;
+ msg->end_time = 0;
+#endif
}
///////////////////////////////////////////////////////////////////////////////
@@ -138,11 +145,14 @@ int ipc_ping_cmd_init(ipc_ping_cmd_t* ping_cmd)
//initialize the semaphore count to 0 and set the max count to 1
rc = KERN_SEMAPHORE_CREATE(&ping_cmd->sem, 0, 1);
+
if(rc)
{
break;
}
- }while(0);
+ }
+ while(0);
+
return rc;
}
#endif /*IPC_ENABLE_PING*/
diff --git a/src/lib/occlib/ipc_macros.h b/src/lib/occlib/ipc_macros.h
index 8ac6233..ab9403c 100644
--- a/src/lib/occlib/ipc_macros.h
+++ b/src/lib/occlib/ipc_macros.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -40,13 +40,13 @@
///
#define IPC_FUNCIDS_TABLE_START \
typedef enum \
-{
+ {
///////////////////////////////////////////////////////////////////////////////
/// Marks the end of the IPC function ID table
///
#define IPC_FUNCIDS_TABLE_END \
-} ipc_func_enum_t;
+ } ipc_func_enum_t;
///////////////////////////////////////////////////////////////////////////////
/// Marks the start of the IPC multi-target function IDs within the IPC
@@ -77,7 +77,7 @@
///
#define IPC_FUNCIDS_ST_START(target_id) \
IPC_CONCAT_INST(IPC_ST_START_, target_id) = \
- (int)(((((uint32_t)target_id) << 24) | IPC_FLAG_VALID ) - 1),
+ (int)(((((uint32_t)target_id) << 24) | IPC_FLAG_VALID ) - 1),
///////////////////////////////////////////////////////////////////////////////
/// Marks the end of the IPC single-target function IDs for the specified
@@ -114,11 +114,11 @@
#define IPC_MT_FUNC_TABLE_START \
ipc_func_table_entry_t G_ipc_mt_handlers[IPC_MT_MAX_FUNCTIONS] = \
-{
+ {
#define IPC_ST_FUNC_TABLE_START \
ipc_func_table_entry_t G_ipc_st_handlers[IPC_ST_MAX_FUNCTIONS] = \
-{
+ {
#define IPC_HANDLER(func, arg) \
{func, arg},
@@ -130,16 +130,16 @@
{ipc_msgq_handler, msgq_ptr},
#define IPC_MT_FUNC_TABLE_END \
-};
+ };
#define IPC_ST_FUNC_TABLE_END \
-};
+ };
#else
#define IPC_MT_FUNC_TABLE_START
-#define IPC_ST_FUNC_TABLE_START
+#define IPC_ST_FUNC_TABLE_START
#define IPC_HANDLER(func, arg)
@@ -149,7 +149,7 @@
#define IPC_MT_FUNC_TABLE_END
-#define IPC_ST_FUNC_TABLE_END
+#define IPC_ST_FUNC_TABLE_END
#endif /*STATIC_IPC_TABLES*/
@@ -161,10 +161,10 @@
/// inside a critical interrupt context).
#ifdef __SSX__
#define IPC_DEFER_TO_NONCRITICAL(ipc_msg) \
-{ \
- ssx_deque_push_back(&G_ipc_deferred_queue, &ipc_msg->node); \
- ssx_irq_status_set(OCCHW_IRQ_ASYNC_IPI, 1); \
-}
+ { \
+ ssx_deque_push_back(&G_ipc_deferred_queue, &ipc_msg->node); \
+ ssx_irq_status_set(OCCHW_IRQ_ASYNC_IPI, 1); \
+ }
#else
#define IPC_DEFER_TO_NONCRITICAL(ipc_msg)
@@ -180,9 +180,9 @@
/// Sets the target to be invalid if it's not a multi-target function id
///////////////////////////////////////////////////////////////////////////////
#define IPC_SET_MT_TARGET(funcid, targetid) \
-(((funcid) & IPC_FLAG_MT)? \
- (((targetid) << IPC_TARGET_SHIFT) | ((funcid) & ~(IPC_TARGET_MASK))): \
- (IPC_TARGET_MASK | (funcid)))
+ (((funcid) & IPC_FLAG_MT)? \
+ (((targetid) << IPC_TARGET_SHIFT) | ((funcid) & ~(IPC_TARGET_MASK))): \
+ (IPC_TARGET_MASK | (funcid)))
///////////////////////////////////////////////////////////////////////////////
/// Retrieve the target ID from an IPC function id
diff --git a/src/lib/occlib/ipc_ping.c b/src/lib/occlib/ipc_ping.c
index f295c99..1b63dea 100644
--- a/src/lib/occlib/ipc_ping.c
+++ b/src/lib/occlib/ipc_ping.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -38,7 +38,7 @@ void ipc_ping_handler(ipc_msg_t* cmd, void* arg)
// deferred to a non-critical handler.
void ipc_ping_response(ipc_msg_t* rsp, void* arg)
{
- ipc_ping_cmd_t *ping_cmd = (ipc_ping_cmd_t*)rsp;
+ ipc_ping_cmd_t* ping_cmd = (ipc_ping_cmd_t*)rsp;
if(KERN_CONTEXT_CRITICAL_INTERRUPT())
{
@@ -64,6 +64,7 @@ int ipc_ping(ipc_ping_cmd_t* ping_cmd, uint32_t target_id)
{
//set the target (since this is a multi-target command)
rc = ipc_set_cmd_target(&ping_cmd->msg, target_id);
+
if(rc)
{
break;
@@ -71,6 +72,7 @@ int ipc_ping(ipc_ping_cmd_t* ping_cmd, uint32_t target_id)
//send the command
rc = ipc_send_cmd(&ping_cmd->msg);
+
if(rc)
{
break;
@@ -78,19 +80,23 @@ int ipc_ping(ipc_ping_cmd_t* ping_cmd, uint32_t target_id)
//assume that if we timed out then the target must have gone down.
rc = KERN_SEMAPHORE_PEND(&ping_cmd->sem, KERN_SECONDS(1));
+
if(rc)
{
if(rc == -KERN_SEMAPHORE_PEND_TIMED_OUT)
{
rc = IPC_RC_TIMEOUT;
}
+
break;
}
//response message was received. Now return the ipc_rc
rc = ipc_get_rc(&ping_cmd->msg);
-
- }while(0);
+
+ }
+ while(0);
+
return rc;
}
#endif /*IPC_ENABLE_PING*/
diff --git a/src/lib/occlib/ipc_ping.h b/src/lib/occlib/ipc_ping.h
index 0b315ee..ffe95b3 100644
--- a/src/lib/occlib/ipc_ping.h
+++ b/src/lib/occlib/ipc_ping.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -28,13 +28,13 @@ typedef struct
{
ipc_msg_t msg;
KERN_SEMAPHORE sem;
-}ipc_ping_cmd_t;
+} ipc_ping_cmd_t;
#ifdef IPC_ENABLE_PING
//server side ping message handler
void ipc_ping_handler(ipc_msg_t* cmd, void* arg);
-//Initialize a ping command.
+//Initialize a ping command.
int ipc_ping_cmd_init(ipc_ping_cmd_t* ping_cmd);
//function for handling the ping response on the local processor
@@ -42,11 +42,11 @@ void ipc_ping_response(ipc_msg_t* rsp, void* arg);
//Statically initialize a ping command
#define IPC_PING_CMD_CREATE(name) \
-ipc_ping_cmd_t name = \
-{\
- .msg = IPC_MSG_INIT(IPC_MT_PING, ipc_ping_response, 0), \
- .sem = KERN_SEMAPHORE_INITIALIZATION(0, 1) \
-}
+ ipc_ping_cmd_t name = \
+ {\
+ .msg = IPC_MSG_INIT(IPC_MT_PING, ipc_ping_response, 0), \
+ .sem = KERN_SEMAPHORE_INITIALIZATION(0, 1) \
+ }
//blocking command that can be run in a thread context to ping another target
int ipc_ping(ipc_ping_cmd_t* ping_cmd, uint32_t target_id);
diff --git a/src/lib/occlib/ipc_structs.h b/src/lib/occlib/ipc_structs.h
index 19aa7d9..aeec05f 100644
--- a/src/lib/occlib/ipc_structs.h
+++ b/src/lib/occlib/ipc_structs.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -35,21 +35,21 @@
#ifndef IPC_CBUF_SIZE
-#define IPC_CBUF_SIZE 8 //number of messages must be a power of 2
+ #define IPC_CBUF_SIZE 8 //number of messages must be a power of 2
#endif
//the maximum number of multi-target functions (common functions)
//This can be overriden in a global header that's included by all occ images
//so that it is the same across all processors.
#ifndef IPC_MT_MAX_FUNCTIONS
-#define IPC_MT_MAX_FUNCTIONS 8
+ #define IPC_MT_MAX_FUNCTIONS 8
#endif
//the maximum number of single-target functions (processor-specific functions)
//This can be overridden in a local header file and does not need to be the
//same across all processors.
-#ifndef IPC_ST_MAX_FUNCTIONS
-#define IPC_ST_MAX_FUNCTIONS 16
+#ifndef IPC_ST_MAX_FUNCTIONS
+ #define IPC_ST_MAX_FUNCTIONS 16
#endif
/// IPC return codes
@@ -90,9 +90,9 @@
// define the GLOBAL_CFG_USE_IPC macro. This allows IPC to compile
// without errors.
#ifdef GLOBAL_CFG_USE_IPC
-#include "ipc_func_ids.h"
+ #include "ipc_func_ids.h"
#else
-IPC_FUNCIDS_TABLE_START
+ IPC_FUNCIDS_TABLE_START
IPC_FUNCIDS_MT_START
IPC_FUNCIDS_MT_END
IPC_FUNCIDS_ST_START(OCCHW_INST_ID_GPE0)
@@ -105,7 +105,7 @@ IPC_FUNCIDS_TABLE_START
IPC_FUNCIDS_ST_END(OCCHW_INST_ID_GPE3)
IPC_FUNCIDS_ST_START(OCCHW_INST_ID_PPC)
IPC_FUNCIDS_ST_END(OCCHW_INST_ID_PPC)
-IPC_FUNCIDS_TABLE_END
+ IPC_FUNCIDS_TABLE_END
#endif /*GLOBAL_CFG_USE_IPC*/
//Statically check that the function tables are large enough
@@ -113,7 +113,7 @@ KERN_STATIC_ASSERT(IPC_MT_NUM_FUNCIDS <= IPC_MT_MAX_FUNCTIONS);
KERN_STATIC_ASSERT(IPC_ST_NUM_FUNCIDS <= IPC_ST_MAX_FUNCTIONS);
#ifdef __SSX__
-extern KERN_DEQUE G_ipc_deferred_queue;
+ extern KERN_DEQUE G_ipc_deferred_queue;
#endif
struct ipc_msg;
@@ -134,30 +134,30 @@ typedef struct
{
ipc_counts_t reads;
ipc_counts_t writes;
-}ipc_rwcounts_t;
+} ipc_rwcounts_t;
typedef struct
{
ipc_rwcounts_t counts;
ipc_msg_t* cbufs[OCCHW_MAX_INSTANCES][IPC_CBUF_SIZE];
- uint8_t pad[16];
-}ipc_target_t; //size is 6 x 32 = 192 bytes
+ uint8_t pad[16];
+} ipc_target_t; //size is 6 x 32 = 192 bytes
/// All of the shared data for IPC is contained in this structure
typedef struct
{
ipc_target_t targets[OCCHW_MAX_INSTANCES]; //880 bytes
-}ipc_shared_data_t;
+} ipc_shared_data_t;
//prototype for ipc handlers and callback functions
-typedef void (*ipc_msg_handler_t)(ipc_msg_t*, void *);
+typedef void (*ipc_msg_handler_t)(ipc_msg_t*, void*);
//function table entry
typedef struct
{
ipc_msg_handler_t handler;
void* arg;
-}ipc_func_table_entry_t;
+} ipc_func_table_entry_t;
extern ipc_func_table_entry_t G_ipc_mt_handlers[IPC_MT_MAX_FUNCTIONS];
@@ -177,7 +177,8 @@ typedef union
uint32_t table_index: 8;
};
uint32_t word32;
-}ipc_func_id_t;
+} ipc_func_id_t;
+
#define IPC_MSG_DEQUEUE_SZ 8 //expected size of a deque structure
struct ipc_msg
@@ -200,7 +201,10 @@ struct ipc_msg
ipc_msg_handler_t resp_callback;
//Argument passed into the callback function
- void *callback_arg;
+ void* callback_arg;
+
+ uint32_t begin_time; //!< Send start time
+ uint32_t end_time; //!< Response received time
};
//Do a static check on the size of KERN_DEQUE. IPC_MSG_DEQUE_SZ must be <= sizeof(KERN_DEQUE).
@@ -214,7 +218,7 @@ typedef struct
{
KERN_DEQUE msg_head;
KERN_SEMAPHORE msg_sem; //posted whenever a new message is queued
-}ipc_msgq_t;
+} ipc_msgq_t;
#endif /*__ASSEMBLER__*/
diff --git a/src/lib/occlib/occhw_scom_cmd.h b/src/lib/occlib/occhw_scom_cmd.h
index 52293b5..af80409 100644
--- a/src/lib/occlib/occhw_scom_cmd.h
+++ b/src/lib/occlib/occhw_scom_cmd.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -69,7 +69,7 @@ typedef union
uint32_t ipe : 1;
uint32_t sibrca : 8;
};
-}occhw_scom_status_t;
+} occhw_scom_status_t;
typedef struct
{
diff --git a/src/lib/occlib/occhw_shared_data.h b/src/lib/occlib/occhw_shared_data.h
index 1d31576..0fe9e9f 100644
--- a/src/lib/occlib/occhw_shared_data.h
+++ b/src/lib/occlib/occhw_shared_data.h
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -36,7 +36,7 @@
/// Hardcoded address for the location of the OCC shared data segment
/// This is placed in the non-cacheable aliased region of SRAM space
#ifndef OSD_ADDR
-#define OSD_ADDR 0xf7f00000
+ #define OSD_ADDR 0xf7f00000
#endif
/// Total space of the OCC shared data segment
diff --git a/src/lib/occlib/occhw_xir_dump.c b/src/lib/occlib/occhw_xir_dump.c
index d0edf31..483f1f3 100644
--- a/src/lib/occlib/occhw_xir_dump.c
+++ b/src/lib/occlib/occhw_xir_dump.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER OnChipController Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2016 */
+/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -49,7 +49,8 @@ int32_t occhw_xir_dump(uint32_t inst_id, occhw_xir_dump_t* xir_dump)
//TODO: dump the XIR regs once the addresses are available
rc = 0;
- }while(0);
+ }
+ while(0);
return rc;
}
OpenPOWER on IntegriCloud