summaryrefslogtreecommitdiffstats
path: root/src/usr/mbox
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert@us.ibm.com>2012-06-14 15:23:25 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-07-09 13:41:04 -0500
commit434253f2763c99351a8c790f43704cca816ba442 (patch)
tree699483556d5c47a7cb21f87a721ce88ce3d1312b /src/usr/mbox
parente4a23b3b4b8a7906852a39f7fef202f04f374ce6 (diff)
downloadtalos-hostboot-434253f2763c99351a8c790f43704cca816ba442.tar.gz
talos-hostboot-434253f2763c99351a8c790f43704cca816ba442.zip
Mailbox additional error handling for Hardware errors and Invalid messages
RTC: 37990 Change-Id: I8378845ed412490a3bd214ac5198ea1fc9f19664 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1221 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/mbox')
-rw-r--r--src/usr/mbox/mailboxsp.C333
-rw-r--r--src/usr/mbox/mailboxsp.H51
-rw-r--r--src/usr/mbox/mbox_dma_buffer.H60
-rw-r--r--src/usr/mbox/mboxdd.C65
-rw-r--r--src/usr/mbox/mboxdd.H48
-rw-r--r--src/usr/mbox/plugins/makefile44
-rw-r--r--src/usr/mbox/plugins/mboxParse.C28
-rw-r--r--src/usr/mbox/test/mboxsptest.H115
8 files changed, 551 insertions, 193 deletions
diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C
index bdb7e895d..835de1f2f 100644
--- a/src/usr/mbox/mailboxsp.C
+++ b/src/usr/mbox/mailboxsp.C
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mailbox/mailboxsp.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/mailboxsp.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
/**
* @file mailboxsp.C
* @brief mailbox service provider definition
@@ -33,6 +34,7 @@
#include <sys/vfs.h>
#include <devicefw/userif.H>
#include <mbox/mbox_reasoncodes.H>
+#include <mbox/mboxUdParser.H>
#define HBMBOX_TRACE_NAME HBMBOX_COMP_NAME
@@ -200,10 +202,10 @@ void MailboxSp::msgHandler()
// or MBOX_DATA_WRITE_ERR - serious - assert
if(err)
{
- // TODO story 37990
errlCommit(err,HBMBOX_COMP_ID);
- assert(0);
+ TRACFCOMP(g_trac_mbox, ERR_MRK"MBOXSP HALTED on critical error!");
+ crit_assert(0);
}
if(iv_shutdown_msg && quiesced())
@@ -246,6 +248,7 @@ void MailboxSp::msgHandler()
iv_shutdown_msg = msg; // Respond to this when done
iv_disabled = true; // stop incomming new messages
+ handleUnclaimed();
if(quiesced())
{
handleShutdown(); // done - shutdown now.
@@ -545,9 +548,7 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
*msg = i_mbox_msg.msg_payload; // copy
// Handle moving data from DMA buffer
- // TODO for pending messages the extra_data is not a DMA address
- // so change this to check for valid DMA address instead of NULL.
- if(msg->extra_data != NULL)
+ if(iv_dmaBuffer.isDmaAddress(msg->extra_data))
{
uint64_t msg_sz = msg->data[1];
void * buf = malloc(msg_sz);
@@ -641,13 +642,23 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
i_mbox_msg.msg_queue_id
);
+ UserDetailsMboxMsg
+ ffdc(reinterpret_cast<uint64_t*>(&i_mbox_msg),
+ sizeof(mbox_msg_t),
+ reinterpret_cast<uint64_t*>(msg->extra_data),
+ msg->data[1]);
+
+ ffdc.addToLog(err);
+
err->collectTrace(HBMBOXMSG_TRACE_NAME);
errlCommit(err,HBMBOX_COMP_ID);
free(msg->extra_data);
msg_free(msg);
- assert(0);
+ TRACFCOMP(g_trac_mbox,
+ ERR_MRK"MBOXSP HALTED on critical error!");
+ crit_assert(0);
}
}
@@ -657,8 +668,15 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
mbox_msg_t mbox_msg;
mbox_msg.msg_queue_id = FSP_MAILBOX_MSGQ;
mbox_msg.msg_payload.type = MSG_INVALID_MSG_TYPE;
- mbox_msg.msg_payload.data[0] = msg->type;
- mbox_msg.msg_payload.data[1] = i_mbox_msg.msg_queue_id;
+ mbox_msg.msg_id = i_mbox_msg.msg_id;
+
+ // msg_id and msg_queue_id
+ mbox_msg.msg_payload.data[0] =
+ *(reinterpret_cast<uint64_t*>(&i_mbox_msg));
+ // type & flags
+ mbox_msg.msg_payload.data[1] =
+ *(reinterpret_cast<uint64_t*>(msg));
+
mbox_msg.msg_payload.extra_data = NULL;
mbox_msg.msg_payload.__reserved__async = 0; // async
@@ -686,9 +704,17 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
MBOX::MOD_MBOXSRV_RCV,
MBOX::RC_INVALID_MESSAGE_TYPE , // reason Code
i_mbox_msg.msg_queue_id, // rc from msg_send
- i_mbox_msg.msg_payload.type
+ msg->type
);
+ UserDetailsMboxMsg
+ ffdc(reinterpret_cast<uint64_t*>(&i_mbox_msg),
+ sizeof(mbox_msg_t),
+ reinterpret_cast<uint64_t*>(msg->extra_data),
+ msg->data[1]);
+
+ ffdc.addToLog(err);
+
err->collectTrace(HBMBOXMSG_TRACE_NAME);
errlCommit(err,HBMBOX_COMP_ID);
@@ -701,8 +727,6 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
else if(i_mbox_msg.msg_queue_id != FSP_MAILBOX_MSGQ)
{
// Queue message to wait until queue is registered.
- // TODO - on shutdown, report if iv_pending is not empty.
-
// copy in non-dma instance of payload msg
i_mbox_msg.msg_payload = *msg;
@@ -727,58 +751,118 @@ void MailboxSp::recv_msg(mbox_msg_t & i_mbox_msg)
void MailboxSp::handle_hbmbox_msg(mbox_msg_t & i_mbox_msg)
{
- if(i_mbox_msg.msg_payload.type == MSG_REQUEST_DMA_BUFFERS)
+ msg_t * msg = &(i_mbox_msg.msg_payload);
+
+ if(msg->type == MSG_REQUEST_DMA_BUFFERS)
{
// DMA req. will be resolved by send_msg
send_msg(&i_mbox_msg); // response message
}
- else if(i_mbox_msg.msg_payload.type == MSG_INVALID_MSG_QUEUE_ID)
+ else if(msg->type == MSG_INVALID_MSG_QUEUE_ID ||
+ msg->type == MSG_INVALID_MSG_TYPE)
{
+ mbox_msg_t * bad_mbox_msg =
+ reinterpret_cast<mbox_msg_t*>(&(msg->data[0]));
+ msg_t * bad_msg = &(bad_mbox_msg->msg_payload);
+
+ TRACFCOMP(g_trac_mbox, ERR_MRK"Invalid message was sent to FSP. Queue"
+ " id: 0x%08x Type: %08x",
+ bad_mbox_msg->msg_queue_id,
+ bad_msg->type);
+
/*@ errorlog tag
* @errortype ERRL_SEV_INFORMATIONAL
* @moduleid MOD_MBOXSRV_FSP_MSG
* @reasoncode RC_INVALID_QUEUE
* @userdata1 msg queue
- * @defdesc Message from FSP. A message queue sent to FSP
- * was not within a valid range
+ * @userdata2 msg type
+ * @defdesc Message from FSP. An invalid message queue ID
+ * or mesage type was sent to the FSP.
*/
errlHndl_t err = new ERRORLOG::ErrlEntry
(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
MBOX::MOD_MBOXSRV_FSP_MSG,
MBOX::RC_INVALID_QUEUE,
- i_mbox_msg.msg_payload.data[0],
- 0
+ bad_mbox_msg->msg_queue_id,
+ bad_msg->type
);
+ UserDetailsMboxMsg
+ ffdc(reinterpret_cast<uint64_t*>(&i_mbox_msg),
+ sizeof(mbox_msg_t),
+ reinterpret_cast<uint64_t*>(msg->extra_data),
+ msg->data[1]);
+
+ ffdc.addToLog(err);
+
err->collectTrace(HBMBOXMSG_TRACE_NAME);
- errlCommit(err,HBMBOX_COMP_ID);
+ // If the msg was sync then we need to respond to the
+ // orignal sender and clean up the respondq
+ if(!msg_is_async(bad_msg))
+ {
+ msg_t * key = reinterpret_cast<msg_t*>(bad_mbox_msg->msg_id);
+ msg_respond_t * response = iv_respondq.find(key);
+ if(response)
+ {
+ iv_respondq.erase(response); // unlink from the list
+
+ //response->key->extra_data points to the original msg
+ // Send back the error log
+ response->key->data[1] = reinterpret_cast<uint64_t>(err);
+ err = NULL;
+ msg_respond(iv_msgQ,response->key);
+
+ delete response;
+ }
+ else // nothing to respond to - just log the error
+ {
+ errlCommit(err,HBMBOX_COMP_ID);
+ }
+ }
+ else // async - nothing to respond to -just log the error
+ {
+ errlCommit(err,HBMBOX_COMP_ID);
+ }
}
- else
+ else // unknown/un-architected message from fsp MBOX
{
+ TRACFCOMP(g_trac_mbox,
+ ERR_MRK
+ "Unknown message of type 0x%x received from FSP.",
+ msg->type);
+
/*@ errorlog tag
* @errortype ERRL_SEV_INFORMATIONAL
- * @moduleid MOD_MBOXSRV_FSP_MSG
- * @reasoncode RC_INVALID_MBOX_MSG_TYPE
+ * @moduleid MBOX::MOD_MBOXSRV_FSP_MSG
+ * @reasoncode MBOX::RC_INVALID_MESSAGE_TYPE
* @userdata1 msg type
* @userdata2 msg queue id
- * @defdesc Message from FSP. A message type sent to FSP
- * was not within a valid range
+ * @defdesc Message from FSP to HB MBOX of an unknown type
*/
errlHndl_t err = new ERRORLOG::ErrlEntry
(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
MBOX::MOD_MBOXSRV_FSP_MSG,
- MBOX::RC_INVALID_MBOX_MSG_TYPE,
- i_mbox_msg.msg_payload.data[0],
- i_mbox_msg.msg_payload.data[1]
+ MBOX::RC_INVALID_MESSAGE_TYPE,
+ msg->type,
+ i_mbox_msg.msg_queue_id
);
+ UserDetailsMboxMsg
+ ffdc(reinterpret_cast<uint64_t*>(&i_mbox_msg),
+ sizeof(mbox_msg_t),
+ reinterpret_cast<uint64_t*>(msg->extra_data),
+ msg->data[1]);
+
+ ffdc.addToLog(err);
+
err->collectTrace(HBMBOXMSG_TRACE_NAME);
errlCommit(err,HBMBOX_COMP_ID);
}
+
}
@@ -834,46 +918,70 @@ errlHndl_t MailboxSp::send(queue_id_t i_q_id, msg_t * io_msg)
msg->data[0] = static_cast<uint64_t>(i_q_id);
msg->extra_data = reinterpret_cast<void*>(io_msg); // Payload message
- if(msg_is_async(io_msg))
- {
- rc = msg_send(mboxQ, msg);
- }
- else
+ if(mboxQ != NULL)
{
- rc = msg_sendrecv(mboxQ, msg);
-
- if(0 == rc)
+ if(msg_is_async(io_msg))
{
- err = reinterpret_cast<errlHndl_t>(msg->data[1]);
+ rc = msg_send(mboxQ, msg);
}
+ else
+ {
+ rc = msg_sendrecv(mboxQ, msg);
- msg_free(msg);
+ if(0 == rc)
+ {
+ err = reinterpret_cast<errlHndl_t>(msg->data[1]);
+ }
- // io_msg now contains response message
- }
+ msg_free(msg);
- if(rc != 0)
+ // io_msg now contains response message
+ }
+
+ if(rc != 0)
+ {
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @moduleid MBOX::MOD_MBOXSRV_SEND
+ * @reasoncode MBOX::RC_INVALID_QUEUE
+ * @userdata1 returncode from msg_sendrecv()
+ *
+ * @defdesc Invalid message or message queue
+ *
+ */
+ err = new ERRORLOG::ErrlEntry
+ (
+ ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
+ MBOX::MOD_MBOXSRV_SEND, // moduleid
+ MBOX::RC_INVALID_QUEUE, // reason Code
+ rc, // msg_sendrecv errno
+ i_q_id // msg queue id
+ );
+
+ // This Trace has the msg
+ err->collectTrace(HBMBOXMSG_TRACE_NAME);
+ }
+ }
+ else
{
/*@ errorlog tag
- * @errortype ERRL_SEV_CRITICAL_SYS_TERM
+ * @errortype ERRL_SEV_INFORMATIONAL
* @moduleid MBOX::MOD_MBOXSRV_SEND
- * @reasoncode MBOX::RC_INVALID_QUEUE
- * @userdata1 returncode from msg_sendrecv()
+ * @reasoncode MBOX::RC_MBOX_SERVICE_NOT_READY
+ * @userdata1 The destination message queue id
*
- * @defdesc Invalid message or message queue
+ * @defdesc Host boot mailbox service is not available
+ * at this time.
*
*/
err = new ERRORLOG::ErrlEntry
(
- ERRORLOG::ERRL_SEV_CRITICAL_SYS_TERM, // severity
+ ERRORLOG::ERRL_SEV_INFORMATIONAL, // severity
MBOX::MOD_MBOXSRV_SEND, // moduleid
- MBOX::RC_INVALID_QUEUE, // reason Code
- rc, // msg_sendrecv errno
- i_q_id // msg queue id
+ MBOX::RC_MBOX_SERVICE_NOT_READY, // reason Code
+ i_q_id, // queue id
+ 0 //
);
-
- // This Trace has the msg
- err->collectTrace(HBMBOXMSG_TRACE_NAME);
}
return err;
@@ -990,12 +1098,10 @@ errlHndl_t MailboxSp::handleInterrupt()
{
err->collectTrace(HBMBOX_TRACE_NAME);
err->collectTrace(HBMBOXMSG_TRACE_NAME);
-
- // return err
}
else
{
- TRACDCOMP(g_trac_mbox,"MBOXSP status=%lx",mbox_status);
+ TRACDCOMP(g_trac_mbox,"MBOXSP: status=%lx",mbox_status);
if(mbox_status & MBOX_HW_ACK)
{
@@ -1029,7 +1135,7 @@ errlHndl_t MailboxSp::handleInterrupt()
if(mbox_status & MBOX_DOORBELL_ERROR)
{
TRACFCOMP(g_trac_mbox,
- ERR_MRK"MBOX status 0x%lx",
+ ERR_MRK"MBOX Hardware reported errors detected status 0x%lx",
mbox_status);
if(mbox_status & MBOX_DATA_WRITE_ERR)
@@ -1061,7 +1167,6 @@ errlHndl_t MailboxSp::handleInterrupt()
else if(mbox_status & MBOX_PARITY_ERR)
{
// Hardware detected parity error
- // - TODO How does BB handle this error ???
// Log it and continue
/*@ errorlog tag
@@ -1083,7 +1188,6 @@ errlHndl_t MailboxSp::handleInterrupt()
err->collectTrace(HBMBOX_TRACE_NAME);
errlCommit(err,HBMBOX_COMP_ID);
- // err = NULL don't return err.
}
else if(mbox_status & MBOX_ILLEGAL_OP)
{
@@ -1109,7 +1213,6 @@ errlHndl_t MailboxSp::handleInterrupt()
);
err->collectTrace(HBMBOX_TRACE_NAME);
errlCommit(err,HBMBOX_COMP_ID);
- // err = NULL Don't return err
}
//else if(mbox_status & MBOX_DATA_READ_ERR)
@@ -1129,19 +1232,85 @@ errlHndl_t MailboxSp::handleInterrupt()
}
+// Handle unclaimed messages in iv_pendingq
+void MailboxSp::handleUnclaimed()
+{
+ for(send_q_t::iterator mbox_msg = iv_pendingq.begin();
+ mbox_msg != iv_pendingq.end();
+ ++mbox_msg)
+ {
+ mbox_msg_t r_mbox_msg;
+ r_mbox_msg.msg_queue_id = FSP_MAILBOX_MSGQ;
+ r_mbox_msg.msg_payload.type = MSG_INVALID_MSG_QUEUE_ID;
+ r_mbox_msg.msg_id = mbox_msg->msg_id;
+
+ mbox_msg_t * msg = &(*mbox_msg);
+ // msg_id and msg_queue_id
+ r_mbox_msg.msg_payload.data[0] =
+ *(reinterpret_cast<uint64_t*>(msg));
+ // type & flags
+ r_mbox_msg.msg_payload.data[1] =
+ *(reinterpret_cast<uint64_t*>(&(msg->msg_payload)));
+
+ r_mbox_msg.msg_payload.extra_data = NULL;
+ r_mbox_msg.msg_payload.__reserved__async = 0; // async
+
+ send_msg(&r_mbox_msg);
+
+ TRACFCOMP(g_trac_mbox,
+ ERR_MRK
+ "MailboxSp::handleUnclaimed> Message never claimed. "
+ "Queueid 0x%08x",
+ mbox_msg->msg_queue_id);
+
+ /*@ errorlog tag
+ * @errortype ERRL_SEV_INFORMATIONAL
+ * @moduleid MBOX::MOD_MBOXSRC_UNCLAIMED
+ * @reasoncode MBOX::RC_INVALID_QUEUE
+ * @userdata1 msg queue
+ * @userdata2 msg type
+ * @defdesc Message from FSP. Message not claimed
+ * by any Hostboot service.
+ */
+ errlHndl_t err = new ERRORLOG::ErrlEntry
+ (
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ MBOX::MOD_MBOXSRC_UNCLAIMED,
+ MBOX::RC_INVALID_QUEUE, // reason Code
+ mbox_msg->msg_queue_id, // message queue id
+ mbox_msg->msg_payload.type // message type
+ );
+
+ UserDetailsMboxMsg
+ ffdc(reinterpret_cast<uint64_t*>(msg),
+ sizeof(mbox_msg_t),
+ reinterpret_cast<uint64_t*>(msg->msg_payload.extra_data),
+ msg->msg_payload.data[1]);
+
+ ffdc.addToLog(err);
+
+ errlCommit(err,HBMBOX_COMP_ID);
+ }
+ iv_pendingq.clear();
+}
+
+
void MailboxSp::handleShutdown()
{
// Shutdown the hardware
errlHndl_t err = mboxddShutDown(iv_trgt);
+ INTR::unRegisterMsgQ(INTR::FSP_MAILBOX);
+
if(err) // SCOM failed.
{
// If this failed, the whole system is probably buggered up.
+
errlCommit(err,HBMBOX_COMP_ID);
- assert(0);
- }
- INTR::unRegisterMsgQ(INTR::FSP_MAILBOX);
+ TRACFCOMP(g_trac_mbox, ERR_MRK"MBOXSP HALTED on critical error!");
+ crit_assert(0);
+ }
msg_respond(iv_msgQ,iv_shutdown_msg);
TRACFCOMP(g_trac_mbox,INFO_MRK"Mailbox is shutdown");
diff --git a/src/usr/mbox/mailboxsp.H b/src/usr/mbox/mailboxsp.H
index 796a1f36a..fd191402b 100644
--- a/src/usr/mbox/mailboxsp.H
+++ b/src/usr/mbox/mailboxsp.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mailbox/mailboxsp.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/mailboxsp.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#if !defined(__MBOXSP__)
#define __MBOXSP__
/**
@@ -201,6 +202,12 @@ namespace MBOX
void handleNewMessage(msg_t* i_msg);
/**
+ * Handle any unclaimed messages from FSP to HB
+ * @post iv_pending.size() == 0;
+ */
+ void handleUnclaimed();
+
+ /**
* Handle shutdown
*/
void handleShutdown();
diff --git a/src/usr/mbox/mbox_dma_buffer.H b/src/usr/mbox/mbox_dma_buffer.H
index a05ace6f2..ab208717d 100644
--- a/src/usr/mbox/mbox_dma_buffer.H
+++ b/src/usr/mbox/mbox_dma_buffer.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mbox/mbox_dma_buffer.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/mbox_dma_buffer.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#if !defined(__MBOX_DMA_BUFFER_H)
#define __MBOX_DMA_BUFFER_H
@@ -91,6 +92,21 @@ namespace MBOX
ALWAYS_INLINE
bool ownsAllBlocks() { return iv_dir == makeMask(VmmManager::MBOX_DMA_PAGES); }
+ /**
+ * Query if address is a DMA address
+ * @param[in] i_address, The address to query
+ * @return [true - is a DMA address | false - is not a DMA address]
+ */
+ ALWAYS_INLINE
+ bool isDmaAddress(void * i_address) const
+ {
+ uint64_t address = reinterpret_cast<uint64_t>(i_address);
+ return
+ (address >= VmmManager::MBOX_DMA_ADDR &&
+ address < (VmmManager::MBOX_DMA_ADDR +
+ (VmmManager::MBOX_DMA_PAGES *
+ VmmManager::MBOX_DMA_PAGESIZE)));
+ }
private:
diff --git a/src/usr/mbox/mboxdd.C b/src/usr/mbox/mboxdd.C
index 61740041c..e881d8527 100644
--- a/src/usr/mbox/mboxdd.C
+++ b/src/usr/mbox/mboxdd.C
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mbox/mboxdd.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/mboxdd.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#include "mboxdd.H"
#include <mbox/mboxif.H>
#include <mbox/mbox_reasoncodes.H>
@@ -36,6 +37,9 @@ TRAC_INIT(&g_trac_mbox, "MBOX", 4096); //4K
namespace MBOX
{
+#if defined(__DESTRUCTIVE_MBOX_TEST__)
+ bool g_forceError = false;
+#endif
/**
* @brief Performs an MBOX Read Operation
* This function performs a MBOX Read operation. It follows a pre-defined
@@ -182,6 +186,15 @@ errlHndl_t mboxRead(TARGETING::Target* i_target,void *o_buffer,
}
}
+#if defined(__DESTRUCTIVE_MBOX_TEST__)
+ if(g_forceError)
+ {
+ TRACFCOMP(g_trac_mbox,"MBOXDD> forcing error!");
+ g_forceError = false;
+ l_stat |= MBOX_DOORBELL_ERROR | MBOX_DATA_WRITE_ERR;
+ }
+#endif
+
// No errors so read the doorbell status and control 1a register
l_err = deviceOp(DeviceFW::READ,i_target,
l_64bitBuf,l_64bitSize,
@@ -575,6 +588,7 @@ errlHndl_t mboxGetErrStat(TARGETING::Target* i_target,uint64_t &o_status)
} while(0);
+
return l_err;
}
@@ -668,4 +682,11 @@ errlHndl_t mboxddShutDown(TARGETING::Target* i_target)
return err;
}
+#if defined(__DESTRUCTIVE_MBOX_TEST__)
+void forceErrorOnNextOperation()
+{
+ TRACFCOMP(g_trac_mbox,"ForceErrorOnNextOperatiron: g_forceError true");
+ g_forceError = true;
+}
+#endif
}; //end MBOX namespace
diff --git a/src/usr/mbox/mboxdd.H b/src/usr/mbox/mboxdd.H
index 29851bcc6..ee01369d5 100644
--- a/src/usr/mbox/mboxdd.H
+++ b/src/usr/mbox/mboxdd.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mbox/mboxdd.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/mboxdd.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __MBOX_MBOXDD_H
#define __MBOX_MBOXDD_H
@@ -113,6 +114,9 @@ namespace MBOX
errlHndl_t mboxGetErrStat(TARGETING::Target* i_target,
uint64_t &o_status);
+#if defined(__DESTRUCTIVE_MBOX_TEST__)
+ void forceErrorOnNextOperation();
+#endif
//Mailbox 1 Status & Interrupt register addresses
enum MboxRegs {
diff --git a/src/usr/mbox/plugins/makefile b/src/usr/mbox/plugins/makefile
new file mode 100644
index 000000000..02560b76f
--- /dev/null
+++ b/src/usr/mbox/plugins/makefile
@@ -0,0 +1,44 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/mbox/plugins/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 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 other-
+# wise divested of its trade secrets, irrespective of what has
+# been deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
+.include "../plugins.mk"
+
+MY_PLUGIN = libB-1100
+MY_OBJS = mboxParse.o
+
+.if ( $(CONTEXT) == "x86.nfp" )
+
+LIBRARIES = ${MY_PLUGIN}.a
+EXPLIBS = ${MY_PLUGIN}.a
+${MY_PLUGIN}.a_OFILES = ${MY_OBJS}
+
+.else
+
+BUILD_SHARED_OBJS =
+SHARED_LIBRARIES EXPSHLIBS = ${MY_PLUGIN}.so
+${MY_PLUGIN}.so_EXTRA_LIBS = libbase.so
+${MY_PLUGIN}.so_SHLDFLAGS += ${SHLDFLAGS} -Wl,-soname,${.TARGET}
+${MY_PLUGIN}.so_OFILES = ${MY_OBJS}
+
+.endif
+
+.include <${RULES_MK}>
diff --git a/src/usr/mbox/plugins/mboxParse.C b/src/usr/mbox/plugins/mboxParse.C
new file mode 100644
index 000000000..5d2a78f7d
--- /dev/null
+++ b/src/usr/mbox/plugins/mboxParse.C
@@ -0,0 +1,28 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/plugins/mboxParse.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
+#include <errl/errludparser.H>
+#include <mbox/mboxUdParserFactory.H>
+
+ERRL_MAKE_UD_PARSER(mbox::UserDetailsParserFactory, HBMBOX_COMP_ID)
+
diff --git a/src/usr/mbox/test/mboxsptest.H b/src/usr/mbox/test/mboxsptest.H
index ff43bd5b1..2bc243eb1 100644
--- a/src/usr/mbox/test/mboxsptest.H
+++ b/src/usr/mbox/test/mboxsptest.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/mbox/test/mboxsptest.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 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 other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/usr/mbox/test/mboxsptest.H $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 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 other-
+ * wise divested of its trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ *
+ * Origin: 30
+ *
+ * IBM_PROLOG_END_TAG
+ */
#ifndef __MBOXSPTEST_H
#define __MBOXSPTEST_H
@@ -179,7 +180,7 @@ class MboxSPTest : public CxxTest::TestSuite
}
// TODO eventually the return data will be inverted or modified in
- // some way.
+ // some way?
if(msg->type != 2 ||
msg->data[0] != 0x001122334455667788 ||
msg->data[1] != 1)
@@ -211,6 +212,74 @@ class MboxSPTest : public CxxTest::TestSuite
msg_free(msg);
}
+
+ void testInvalidMsg(void)
+ {
+ msg_t * msg = msg_allocate();
+ msg->type = 0x8000ffff;
+ msg->extra_data = NULL;
+
+ // If there is no FSP then sync message will just come back OK - no errors
+
+ // For an async message w/o an FSP:
+ // Should see that the message bounced back and was queued.
+ // Should see a trace message and error log from mbox service
+ // indicating there was an unclaimed message at shutdown.
+ // For an async message with an FSP:
+ // Should just see a trace and error log from the mbox service that
+ // there was an invalid message.
+ errlHndl_t err = MBOX::send(MBOX::FSP_ECHO_MSGQ,msg);
+ if(err)
+ {
+ TS_FAIL("MBOXTEST::testInvalidMsg. Unexpected error log from send()");
+ errlCommit(err,HBMBOX_COMP_ID);
+ }
+ }
+
+#if defined(__DESTRUCTIVE_MBOX_TEST__)
+ void DISABLEtestHardwareError(void)
+ {
+ msg_t * msg = msg_allocate();
+ msg->type = 0x8000ffff;
+ msg->extra_data = NULL;
+
+ MBOX::forceErrorOnNextOperation();
+
+ errlHndl_t err = MBOX::send(MBOX::FSP_ECHO_MSGQ,msg);
+ if(err)
+ {
+ TS_FAIL("MBOXTEST::testHardwareError. Unexpected error log from send()");
+ errlCommit(err,HBMBOX_COMP_ID);
+ }
+
+ msg = msg_allocate();
+ msg->type = 0x8000fffe;
+ msg->extra_data = NULL;
+
+ err = MBOX::sendrecv(MBOX::FSP_ECHO_MSGQ,msg);
+ if(!err)
+ {
+ TS_FAIL("MBOXTEST::testHardwareError. No error log from sendrecv()");
+ }
+ else
+ {
+ delete err;
+ }
+
+ msg->type = 0x8000fffd;
+ err = MBOX::send(MBOX::FSP_ECHO_MSGQ,msg);
+ if(!err)
+ {
+ TS_FAIL("MBOXTEST::testHardwareError. No error log from send()");
+ }
+ else
+ {
+ delete err;
+ }
+
+ msg_free(msg);
+ }
+#endif
};
#endif
OpenPOWER on IntegriCloud