diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2012-03-22 14:34:06 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2012-04-05 15:20:19 -0500 |
commit | 3b9b970812926d1cbc063174dd7f097b4fcb3793 (patch) | |
tree | 3b191befecbef21c540540f8c2fde42d68fb9e54 /src/include/usr/mbox | |
parent | d26e75088c24cdf95e02575b0d172068cdb1a58b (diff) | |
download | talos-hostboot-3b9b970812926d1cbc063174dd7f097b4fcb3793.tar.gz talos-hostboot-3b9b970812926d1cbc063174dd7f097b4fcb3793.zip |
Mailbox service provider
RTC: 35323
Change-Id: Ifd626870fcc31f94a684f8a19fdc7816e092a7fa
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/798
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr/mbox')
-rw-r--r-- | src/include/usr/mbox/mbox_queues.H | 92 | ||||
-rw-r--r-- | src/include/usr/mbox/mbox_reasoncodes.H | 13 | ||||
-rw-r--r-- | src/include/usr/mbox/mboxif.H | 64 |
3 files changed, 167 insertions, 2 deletions
diff --git a/src/include/usr/mbox/mbox_queues.H b/src/include/usr/mbox/mbox_queues.H new file mode 100644 index 000000000..1e19b62eb --- /dev/null +++ b/src/include/usr/mbox/mbox_queues.H @@ -0,0 +1,92 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/usr/mbox/mbox_queues.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 +#ifndef __MBOX_QUEUES_H +#define __MBOX_QUEUES_H + +/** + * @file mbox_queues.H + * @brief Mailbox queue identifiers. This file is shared between + * Hostboot and FSP. + */ + +namespace MBOX +{ + /** + * message queue IDs + * FSP msg_queue range 0x80000000 - 0xFFFFFFFF + * Hostboot msg_queue range 0x00000001 - 0x7FFFFFFF + */ + enum queue_id_t + { + NOT_FOUND = 0, + HB_MAILBOX_MSGQ, + HB_ISTEP_MSGQ, + // Add HB services here: + + HB_TEST_MSGQ = 0x7FFFFFFF, + + // FSP mailboxes + FSP_FIRST_MSGQ = 0x80000000, + FSP_MAILBOX_MSGQ = FSP_FIRST_MSGQ, + FSP_ECHO_MSGQ, + FSP_PROGRESS_CODES_MSGQ, + FSP_TRACE_MSGQ, + FSP_ERRL_MSGQ, + // Add FSP services here: + }; + + // Message types are only unique with in each message queue. Each message queue can + // use the entire range limited only by the restrictions listed below. + // + // Each HB and FSP service will need it's own list of message types + // Not sure where they belong. + // + // types 0x00000000 - 0x3FFFFFFF are considered secure messages + // and are disabled when under SecureBoot environment + // types 0x40000000 - 0x7FFFFFFF can be done at anytime + // types 0x80000000 - 0xFFFFFFFF are reserved on hostboot for kernel services + // This means hostboot services can't use them, but this is not a restriction + // on FSP services + enum + { + FIRST_SECURE_MSG = 0, + LAST_SECURE_MSG = 0x3FFFFFFF, + FIRST_UNSECURE_MSG = 0x40000000, + LAST_UNSECURE_MSG = 0x7FFFFFFF, + FIRST_HB_KERNEL_MSG = 0x80000000, + LAST_KERNEL_MSG = 0xFFFFFFFF + }; + + /** + * MBOX to MBOX service message types. + */ + enum msg_type_t + { + MSG_REQUEST_DMA_BUFFERS = FIRST_UNSECURE_MSG, + }; + + +}; + +#endif + diff --git a/src/include/usr/mbox/mbox_reasoncodes.H b/src/include/usr/mbox/mbox_reasoncodes.H index 0ee58ff58..f90870a8d 100644 --- a/src/include/usr/mbox/mbox_reasoncodes.H +++ b/src/include/usr/mbox/mbox_reasoncodes.H @@ -32,6 +32,10 @@ namespace MBOX MOD_MBOXDD_INVALID = 0x00, /**< Zero is an invalid module id */ MOD_MBOXDD_READ = 0x01, MOD_MBOXDD_WRITE = 0x02, + MOD_MBOXSRV_SEND = 0x03, // MailboxSp::send + MOD_MBOXSRV_HNDLR = 0x04, // MailboxSp::msgHandler + MOD_MBOXSRV_RCV = 0x05, // MailboxSp::recv_msg + MOD_MBOXREGISTER = 0x06, // MailboxSp::msgq_register }; enum MBOXReasonCode @@ -40,6 +44,15 @@ namespace MBOX RC_INVALID_MESSAGE_TYPE = HBMBOX_COMP_ID | 0x02, RC_NO_PERM_TO_SEND = HBMBOX_COMP_ID | 0x03, RC_MSG_PENDING = HBMBOX_COMP_ID | 0x04, + RC_INVALID_QUEUE = HBMBOX_COMP_ID | 0x05, + RC_RETRY_FAILED = HBMBOX_COMP_ID | 0x06, + RC_ALREADY_REGISTERED = HBMBOX_COMP_ID | 0x07, + RC_UNREGISTERED_MSG_QUEUE = HBMBOX_COMP_ID | 0x08, + RC_ILLEGAL_OP = HBMBOX_COMP_ID | 0x09, + RC_DATA_WRITE_ERR = HBMBOX_COMP_ID | 0x0A, + RC_PARITY_ERR = HBMBOX_COMP_ID | 0x0B, + RC_INVALID_MBOX_MSG_TYPE = HBMBOX_COMP_ID | 0x0C, + RC_MBOX_SERVICE_NOT_READY = HBMBOX_COMP_ID | 0x0D, }; }; diff --git a/src/include/usr/mbox/mboxif.H b/src/include/usr/mbox/mboxif.H index cb6b23ffe..fc321f757 100644 --- a/src/include/usr/mbox/mboxif.H +++ b/src/include/usr/mbox/mboxif.H @@ -23,8 +23,68 @@ #ifndef __MBOX_MBOXIF_H #define __MBOX_MBOXIF_H +#include <sys/msg.h> +#include <errl/errlentry.H> +#include <mbox/mbox_queues.H> + namespace MBOX { - // TODO add mailbox service interfaces -}; + /** + * Register a message queue to receive mailbox messages + * @param[in] i_queueu_id, The queue identifier + * @param[in] i_msgQ, The message queue created with msg_q_create() + * @see sys/msg.h + * @return errlHndl_t on error + */ + errlHndl_t msgq_register(queue_id_t i_queue_id, msg_q_t i_msgQ); + + /** + * Un register a message queue from the mailbox service + * @param[in] i_queue_id, The queue identifier + * @return The message queue | NULL if i_queue_id not registered. + */ + msg_q_t msgq_unregister(queue_id_t i_queue_id); + + /** + * Send message asynchronously + * @param[in] i_q_id id, of the FSP message queue to send the msg to. + * @param[in] i_msg. The message to send. + * + * @return errlHndl_t on error. + * + * @pre i_msg->extra_data == NULL If there is no extra data is associated + * with the message. + * + * @pre i_msg->extra_data = malloc(size); i_msg->data[1] = size; + * Any extra data associated with i_msg was obtained from the heap + * using malloc and i_msg->data[1] contains the length of that data. + * + * @post free(i_msg->extra_dat) was done (if no error) + * @post msg_free(i_msg) was done (if no error) + */ + errlHndl_t send(queue_id_t i_q_id, msg_t * i_msg); + + /** + * Send message synchronously + * @param[in] i_q_id id, of the FSP message queue to send the msg to. + * @param[in/out] io_msg. The message sent and returned. + * + * @return errlHndl_t on error + * + * @pre io_msg->extra_data == NULL If there is no extra data is associated + * with the message. + * + * @pre io_msg->extra_data = malloc(size); io_msg->data[1] = size; + * Any extra data associated with io_msg was obtained from the heap + * using malloc and io_msg->data[1] contains the length of that data. + * + * @post free(i_msg->extra_data) was done (if no error) + * + * @note: On return, if io_msg->extra_data != NULL, the caller must + * call free(io_msg->extra_data); + */ + errlHndl_t sendrecv(queue_id_t i_q_id, msg_t * io_msg); + +}; // end namespace MBOX + #endif |