diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/mbox/mailboxsp.C | 18 | ||||
-rw-r--r-- | src/usr/mbox/mbox_dma_buffer.C | 45 | ||||
-rw-r--r-- | src/usr/mbox/mbox_dma_buffer.H | 29 | ||||
-rw-r--r-- | src/usr/mvpd/makefile | 2 |
4 files changed, 65 insertions, 29 deletions
diff --git a/src/usr/mbox/mailboxsp.C b/src/usr/mbox/mailboxsp.C index 9361e613e..c9b2b9822 100644 --- a/src/usr/mbox/mailboxsp.C +++ b/src/usr/mbox/mailboxsp.C @@ -161,7 +161,7 @@ errlHndl_t MailboxSp::_init() msg_t * msg = msg_allocate(); msg->type = MSG_INITIAL_DMA; msg->data[0] = 0; - msg->data[1] = reinterpret_cast<uint64_t>(iv_dmaBuffer.getDmaBufferHead()); + msg->data[1] =iv_dmaBuffer.toPhysAddr(iv_dmaBuffer.getDmaBufferHead()); msg->extra_data = NULL; MBOX::send(FSP_MAILBOX_MSGQ,msg); @@ -446,15 +446,16 @@ void MailboxSp::send_msg(mbox_msg_t * i_msg) if(payload->extra_data != NULL) { memcpy(dma_buffer,payload->extra_data,payload->data[1]); - iv_msg_to_send.msg_payload.extra_data = dma_buffer; + iv_msg_to_send.msg_payload.extra_data = + reinterpret_cast<void*>(iv_dmaBuffer.toPhysAddr(dma_buffer)); free(payload->extra_data); } else // DMA buffer request from FSP { iv_msg_to_send.msg_payload.data[0] = dma_size; // bitmap - iv_msg_to_send.msg_payload.data[1] = - reinterpret_cast<uint64_t>(dma_buffer); + iv_msg_to_send.msg_payload.data[1] = + iv_dmaBuffer.toPhysAddr(dma_buffer); } iv_sendq.pop_front(); } @@ -1151,6 +1152,15 @@ errlHndl_t MailboxSp::handleInterrupt() if(mbox_status & MBOX_DATA_PENDING) { trace_msg("RECV",mbox_msg); + //Adjust address back to Virt here if present + uint64_t l_dma = reinterpret_cast<uint64_t>( + mbox_msg.msg_payload.extra_data); + if(l_dma) + { + mbox_msg.msg_payload.extra_data = + iv_dmaBuffer.toVirtAddr(l_dma); + } + if(mbox_msg.msg_queue_id == HB_MAILBOX_MSGQ) { // msg to hb mailbox from fsp mbox diff --git a/src/usr/mbox/mbox_dma_buffer.C b/src/usr/mbox/mbox_dma_buffer.C index 0becfb168..2580aaab3 100644 --- a/src/usr/mbox/mbox_dma_buffer.C +++ b/src/usr/mbox/mbox_dma_buffer.C @@ -1,25 +1,25 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/mbox/mbox_dma_buffer.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/mbox_dma_buffer.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 otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* Origin: 30 */ +/* */ +/* IBM_PROLOG_END_TAG */ #include "mbox_dma_buffer.H" #include <stdlib.h> #include <assert.h> @@ -41,6 +41,7 @@ DmaBuffer::DmaBuffer() : iv_dir(makeMask(VmmManager::MBOX_DMA_PAGES)) { iv_head = reinterpret_cast<void*>(VmmManager::MBOX_DMA_ADDR); + iv_phys_head = mm_virt_to_phys(iv_head); } diff --git a/src/usr/mbox/mbox_dma_buffer.H b/src/usr/mbox/mbox_dma_buffer.H index ab208717d..dc4e86af3 100644 --- a/src/usr/mbox/mbox_dma_buffer.H +++ b/src/usr/mbox/mbox_dma_buffer.H @@ -108,6 +108,30 @@ namespace MBOX VmmManager::MBOX_DMA_PAGESIZE))); } + /** + * Get the physical address of DMA buf to send to the FSP + * @param[in] i_address, The HB address to translate + * @return [FSP physical address] + */ + ALWAYS_INLINE + uint64_t toPhysAddr(void * i_address) const + { + return mm_virt_to_phys(i_address); + } + + /** + * Get the virtual address of DMA buf to sent by the FSP + * @param[in] i_address, The FSP Physical address to translate + * @return [HB virtual address] + */ + ALWAYS_INLINE + void* toVirtAddr(uint64_t i_address) const + { + uint64_t base = reinterpret_cast<uint64_t>(iv_head); + return reinterpret_cast<void*>( + base + (i_address-iv_phys_head)); + } + private: /** @@ -123,8 +147,9 @@ namespace MBOX MAX_MASK_SIZE = sizeof(uint64_t) * 8, }; - void * iv_head; //!< Start of DMA memory - uint64_t iv_dir; //!< 1 bit per 1k buffer, 1 = available + void * iv_head; //!< Start of DMA memory + uint64_t iv_phys_head; //!< Physical translation of iv_head + uint64_t iv_dir; //!< 1 bit per 1k buffer, 1 = available }; }; // namespace diff --git a/src/usr/mvpd/makefile b/src/usr/mvpd/makefile index 705f9f4d5..03d6b8355 100644 --- a/src/usr/mvpd/makefile +++ b/src/usr/mvpd/makefile @@ -27,6 +27,6 @@ OBJS = mvpd.o SUBDIRS = test.d -BINARY_FILES = $(IMGDIR)/procmvpd.dat:92a31d2157813b6a2a8680f1cda2ed98d3ff1c51 +BINARY_FILES = $(IMGDIR)/procmvpd.dat:034614d95e3ffb7d0802d4edbd8fad60dc15b40d include ${ROOTPATH}/config.mk |