summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--src/include/errno.h46
-rw-r--r--src/include/sys/msg.h54
-rw-r--r--src/include/sys/vfs.h46
-rw-r--r--src/include/usr/mbox/mboxUdParser.H151
-rw-r--r--src/include/usr/mbox/mboxUdParserFactory.H54
-rw-r--r--src/include/usr/mbox/mbox_queues.H2
-rw-r--r--src/include/usr/mbox/mbox_reasoncodes.H57
-rw-r--r--src/lib/syscall_msg.C58
-rw-r--r--src/sys/vfs/vfs_main.C151
-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
17 files changed, 993 insertions, 370 deletions
diff --git a/src/include/errno.h b/src/include/errno.h
index 79eb30bbf..020366357 100644
--- a/src/include/errno.h
+++ b/src/include/errno.h
@@ -1,30 +1,32 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/errno.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// 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/include/errno.h $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2011-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 _ERRNO_H
#define _ERRNO_H
#define ENOENT 2 // No such file or directory
#define EIO 5 // I/O error
+#define ENXIO 6 // No such device or address
#define ENOEXEC 8 // Exec format error
#define EBADF 9 // Bad file descriptor
#define EAGAIN 11 // Try again
diff --git a/src/include/sys/msg.h b/src/include/sys/msg.h
index 4bbf0b265..129d0c36b 100644
--- a/src/include/sys/msg.h
+++ b/src/include/sys/msg.h
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/sys/msg.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// 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/include/sys/msg.h $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2010-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 __SYS_MSG_H
#define __SYS_MSG_H
@@ -144,6 +145,15 @@ void msg_q_destroy( msg_q_t q );
*/
int msg_q_register(msg_q_t q, const char* name);
+/** @fn msg_q_remove
+ * @brief Remove a message queue from the registry
+ *
+ * @param[in] name - name of the message queue
+ *
+ * @return 0 on success or -ENXIO if queue not found.
+ */
+int msg_q_remove(const char * name);
+
/** @fn msg_q_resolve
* @brief Given the name of a message queue, return the handle to it.
diff --git a/src/include/sys/vfs.h b/src/include/sys/vfs.h
index 3094a1707..254a10350 100644
--- a/src/include/sys/vfs.h
+++ b/src/include/sys/vfs.h
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/sys/vfs.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// 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/include/sys/vfs.h $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2010-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 __SYS_VFS_H
#define __SYS_VFS_H
@@ -67,6 +68,7 @@ extern const char* VFS_ROOT_MSG_VFS;
enum VfsMessages
{
VFS_MSG_REGISTER_MSGQ, //!< Message to VFS_ROOT to register a message queue
+ VFS_MSG_REMOVE_MSGQ, //!< Message to VFS_ROOT to remove a message queue
VFS_MSG_RESOLVE_MSGQ, //!< Message to VFS_ROOT to find a message queue
VFS_MSG_EXEC, //!< Message to VFS_ROOT execute a module
VFS_MSG_LOAD, //!< Message to vfsrp to load a module
diff --git a/src/include/usr/mbox/mboxUdParser.H b/src/include/usr/mbox/mboxUdParser.H
new file mode 100644
index 000000000..384c2077e
--- /dev/null
+++ b/src/include/usr/mbox/mboxUdParser.H
@@ -0,0 +1,151 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/mbox/mboxUdParser.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(_MBOXUDPARSER)
+#define _MBOXUDPARSER
+
+#include <errl/errluserdetails.H>
+#include <errl/errludparser.H>
+#include <util/align.H>
+#include <mbox/mbox_reasoncodes.H>
+
+namespace MBOX
+{
+#if defined(PARSER)
+
+ /**
+ * Parses mbox message user detail in an error log
+ */
+ class UserDetailsParserMboxMsg : public ERRORLOG::ErrlUserDetailsParser
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ UserDetailsParserMboxMsg() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~UserDetailsParserMboxMsg() {}
+
+ /**
+ * Parses a mbox msg in an error log.
+ *
+ * @param[in] i_version Version of the data
+ * @param[in] i_parse ErrlUsrParser object for the output info
+ * @param[in] i_pBuffer Pointer to the buffer containing detail data
+ * @param[in] i_buflen Length of the buffer
+ */
+ virtual void parse(errlver_t i_version,
+ ErrlUsrParser & i_parser,
+ void * i_pBuffer,
+ const uint32_t i_buflen) const
+ {
+ uint32_t * b32 = static_cast<uint32_t *>(i_pBuffer);
+ uint64_t * b64 = static_cast<uint64_t *>(b32 + 4);
+
+ uint32_t msg_id = ntohl(*b32);
+ uint32_t msg_q_id = ntohl(*(b32+1));
+ uint32_t msg_type = ntohl(*(b32+2));
+ uint32_t msg_flag = ntohl(*(b32+3));
+ uint64_t msg_dta0 = ntohll(*(b64));
+ uint64_t msg_dta1 = ntohll(*(b64+1));
+ uint64_t msg_extd = ntohll(*(b64+2));
+
+ i_parser.PrintNumber("MBOX message id: 0x%08x",msg_id);
+ i_parser.PrintNumber("MBOX queue id: 0x%08x",msg_q_id);
+ i_parser.PrintNumber("MBOX message type: 0x%08x",msg_type);
+ if(msg_flag & 0x80000000)
+ {
+ i_parser.PrintString("MBOX mesage is synchronous");
+ }
+ else
+ {
+ i_parser.PrintString("MBOX message is asynchronous");
+ }
+
+ i_parser.PrintNumber("MBOX data[0]: 0x%016lx",msg_dta0);
+ i_parser.PrintNumber("MBOX data[1]: 0x%016lx",msg_dta1);
+ i_parser.PrintNumber("MBOX Extra data pointer: 0x%016lx",msg_extd);
+
+
+ if(msg_extd != 0 && i_buflen > 40)
+ {
+ i_parser.PrintString("MBOX extra data:");
+
+ uint8_t * b08 = static_cast<uint8_t *>(b64 + 3);
+ size_t len = i_buflen - 40;
+
+ i_parser.PrintHexDump(b08,len);
+
+ }
+ }
+ };
+
+#else
+ class UserDetailsMboxMsg : public ERRORLOG::ErrlUserDetails
+ {
+ public:
+
+ UserDetailsMboxMsg(uint64_t * i_mbox_msg,
+ size_t i_msg_byte_size,
+ uint64_t * i_extra_data = NULL,
+ size_t i_data_byte_size = 0)
+ {
+ iv_CompId = HBMBOX_COMP_ID;
+ iv_Version = 1;
+ iv_SubSection = MBOX_UDT_MBOXMSG_DATA;
+ iv_merge = false;
+
+ if(i_extra_data == NULL)
+ {
+ i_data_byte_size = 0;
+ }
+
+ size_t msg_size = ALIGN_8(i_msg_byte_size);
+ size_t dta_size = ALIGN_8(i_data_byte_size);
+
+ uint64_t * buffer =
+ reinterpret_cast<uint64_t*>(reallocUsrBuf(msg_size+dta_size));
+
+ msg_size /= 8;
+ dta_size /= 8;
+ for(size_t i = 0; i < msg_size; ++i)
+ {
+ buffer[i] = i_mbox_msg[i];
+ }
+ for(size_t i = 0; i < dta_size; ++i)
+ {
+ buffer[msg_size+i] = i_extra_data[i];
+ }
+ }
+
+ ~UserDetailsMboxMsg() {}
+
+ };
+
+#endif
+};
+#endif
diff --git a/src/include/usr/mbox/mboxUdParserFactory.H b/src/include/usr/mbox/mboxUdParserFactory.H
new file mode 100644
index 000000000..a857e5522
--- /dev/null
+++ b/src/include/usr/mbox/mboxUdParserFactory.H
@@ -0,0 +1,54 @@
+/* IBM_PROLOG_BEGIN_TAG
+ * This is an automatically generated prolog.
+ *
+ * $Source: src/include/usr/mbox/mboxUdParserFactory.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(_MBOXUDPARSERFACTORY_H)
+#define _MBOXUDPARSERFACTORY_H
+
+#if defined(PARSER)
+
+#include <mbox/mboxUdParser.H>
+#include <mbox/mbox_reasoncodes.H>
+#include <errl/errludparserfactory.H>
+
+namespace mbox
+{
+ class UserDetailsParserFactory
+ : public ERRORLOG::ErrlUserDetailsParserFactory
+ {
+ public:
+ UserDetailsParserFactory()
+ {
+ registerParser<MBOX::UserDetailsParserMboxMsg>
+ (MBOX_UDT_MBOXMSG_DATA);
+ }
+
+ private:
+
+ UserDetailsParserFactory(const UserDetailsParserFactory &);
+ UserDetailsParserFactory & operator=
+ (const UserDetailsParserFactory &);
+ };
+};
+
+#endif
+#endif
diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H
index bd11f09a0..6c7134061 100644
--- a/src/include/usr/mbox/mbox_queues.H
+++ b/src/include/usr/mbox/mbox_queues.H
@@ -48,7 +48,7 @@ namespace MBOX
// FSP mailboxes
FSP_FIRST_MSGQ = 0x80000000,
- FSP_MAILBOX_MSGQ = FSP_FIRST_MSGQ,
+ FSP_MAILBOX_MSGQ,
FSP_PROGRESS_CODES_MSGQ,
FSP_TRACE_MSGQ,
FSP_ERRL_MSGQ,
diff --git a/src/include/usr/mbox/mbox_reasoncodes.H b/src/include/usr/mbox/mbox_reasoncodes.H
index 46d0b4738..ca298aad7 100644
--- a/src/include/usr/mbox/mbox_reasoncodes.H
+++ b/src/include/usr/mbox/mbox_reasoncodes.H
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/mbox/mbox_reasoncodes.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/include/usr/mbox/mbox_reasoncodes.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_REASONCODES_H
#define __MBOX_REASONCODES_H
@@ -39,6 +40,7 @@ namespace MBOX
MOD_MBOXSRV_FSP_MSG = 0x07, // MailboxSp::handle_hbmbox_msg
MOD_MBOXSRV_SENDMSG = 0x08, // MailboxSp::send_msg
MOD_MBOXSRV_INIT = 0x09, // MailboxSp::_init
+ MOD_MBOXSRC_UNCLAIMED = 0x0A, // MailboxSp::handleUnclaimed
};
enum MBOXReasonCode
@@ -60,6 +62,15 @@ namespace MBOX
RC_KERNEL_REG_FAILED = HBMBOX_COMP_ID | 0x0F,
RC_MAILBOX_DISABLED = HBMBOX_COMP_ID | 0x10,
};
-};
+
+ /**
+ * Defins for MBOX error og user detail data sections
+ */
+ enum mboxUserDetailDataSubsection
+ {
+ MBOX_UDT_MBOXMSG_DATA = 1,
+ };
+
+};
#endif
diff --git a/src/lib/syscall_msg.C b/src/lib/syscall_msg.C
index 8374d0d34..b35f6eef1 100644
--- a/src/lib/syscall_msg.C
+++ b/src/lib/syscall_msg.C
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/lib/syscall_msg.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// 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/lib/syscall_msg.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2010-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 <sys/msg.h>
#include <sys/interrupt.h>
#include <sys/syscall.h>
@@ -67,6 +68,19 @@ int msg_q_register(msg_q_t q, const char* name)
}
}
+int msg_q_remove(const char * name)
+{
+ msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
+ reinterpret_cast<void*>(MSGQ_ROOT_VFS));
+ msg_t * msg = msg_allocate();
+ msg->type = VFS_MSG_REMOVE_MSGQ;
+ msg->extra_data = (void *)name;
+ msg_sendrecv(vfsQ, msg);
+ int rc = static_cast<int>(msg->data[0]);
+ msg_free(msg);
+ return rc;
+}
+
msg_q_t msg_q_resolve(const char* name)
{
if (0 == strcmp(VFS_ROOT, name))
diff --git a/src/sys/vfs/vfs_main.C b/src/sys/vfs/vfs_main.C
index bc03d3c87..032a35c3f 100644
--- a/src/sys/vfs/vfs_main.C
+++ b/src/sys/vfs/vfs_main.C
@@ -1,25 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/sys/vfs/vfs_main.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// 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/sys/vfs/vfs_main.C $
+ *
+ * IBM CONFIDENTIAL
+ *
+ * COPYRIGHT International Business Machines Corp. 2010-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 <string.h>
#include <errno.h>
@@ -76,46 +77,66 @@ void vfs_main(void* i_barrier)
while(1)
{
- msg_t* msg = msg_wait(vfsMsgQ);
-
- switch(msg->type)
- {
- case VFS_MSG_REGISTER_MSGQ:
- {
- VfsEntry* e = new VfsEntry();
- strcpy(e->key.key, (char*) msg->extra_data);
- e->msg_q = (msg_q_t) msg->data[0];
- vfsContents.insert(e);
-
- printkd("VFS: Registering %p as %s\n",
- e->msg_q, e->key.key);
- msg_respond(vfsMsgQ, msg);
- }
- break;
-
- case VFS_MSG_RESOLVE_MSGQ:
- {
- VfsEntry::key_type k;
- strcpy(k.key, (char*) msg->extra_data);
- VfsEntry* e = vfsContents.find(k);
- if (NULL == e)
- msg->data[0] = (uint64_t) NULL;
- else
- msg->data[0] = (uint64_t) e->msg_q;
- msg_respond(vfsMsgQ, msg);
- }
- break;
-
- case VFS_MSG_EXEC:
- {
- printkd("VFS: Got exec request of %s\n",
- (const char*)msg->data[0]);
-
- VfsSystemModule* module =
+ msg_t* msg = msg_wait(vfsMsgQ);
+
+ switch(msg->type)
+ {
+ case VFS_MSG_REGISTER_MSGQ:
+ {
+ VfsEntry* e = new VfsEntry();
+ strcpy(e->key.key, (char*) msg->extra_data);
+ e->msg_q = (msg_q_t) msg->data[0];
+ vfsContents.insert(e);
+
+ printkd("VFS: Registering %p as %s\n",
+ e->msg_q, e->key.key);
+ msg_respond(vfsMsgQ, msg);
+ }
+ break;
+
+ case VFS_MSG_REMOVE_MSGQ:
+ {
+ VfsEntry::key_type k;
+ strcpy(k.key, (char*) msg->extra_data);
+ VfsEntry* e = vfsContents.find(k);
+ if(NULL != e)
+ {
+ msg->data[0] = 0; //(uint64_t) e->msg_q;
+ printkd("VFS: Removing msg queue %s\n",e->key.key);
+ vfsContents.erase(e);
+ delete e;
+ }
+ else
+ {
+ msg->data[0] = (uint64_t) (-ENXIO);
+ }
+ msg_respond(vfsMsgQ, msg);
+ }
+ break;
+
+ case VFS_MSG_RESOLVE_MSGQ:
+ {
+ VfsEntry::key_type k;
+ strcpy(k.key, (char*) msg->extra_data);
+ VfsEntry* e = vfsContents.find(k);
+ if (NULL == e)
+ msg->data[0] = (uint64_t) NULL;
+ else
+ msg->data[0] = (uint64_t) e->msg_q;
+ msg_respond(vfsMsgQ, msg);
+ }
+ break;
+
+ case VFS_MSG_EXEC:
+ {
+ printkd("VFS: Got exec request of %s\n",
+ (const char*)msg->data[0]);
+
+ VfsSystemModule* module =
vfs_find_module(VFS_MODULES,
(const char *) msg->data[0]);
- void* fnptr = vfs_start_entrypoint(module);
+ void* fnptr = vfs_start_entrypoint(module);
// child == -ENOENT means module not found in base image
// so send a message to VFS_MSG queue to look in the
@@ -146,13 +167,13 @@ void vfs_main(void* i_barrier)
msg->data[0] = (uint64_t) fnptr;
msg_respond(vfsMsgQ, msg);
}
- }
- break;
+ }
+ break;
- default:
- msg_free(msg);
- break;
- }
+ default:
+ msg_free(msg);
+ break;
+ }
} // end while(1)
}
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