[Cbe-oss-dev] [PATCH 02/10 v3]MARS/core: Workload module split make headers public

Yuji Mano yuji.mano at am.sony.com
Wed Nov 26 09:43:58 EST 2008


This moves some of the internal headers needed to implement workload modules
into public headers.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
v2:
- keep the workload bit definitions in the internal header
v3:
- keep the workload state, signal, priority, counter defines in internal header

 core/include/common/mars/mutex_types.h    |   13 
 core/include/common/mars/workload_types.h |   65 +++
 core/include/host/mars/workload_queue.h   |   90 +++++
 core/include/mpu/mars/dma.h               |  493 ++++++++++++++++++++++++++++++
 core/src/common/mutex_internal_types.h    |   54 ---
 core/src/common/workload_internal_types.h |   40 --
 core/src/host/lib/workload_queue.h        |   90 -----
 core/src/mpu/lib/dma.h                    |  493 ------------------------------
 core/src/mpu/lib/workload_types.h         |  139 --------
 9 files changed, 673 insertions(+), 804 deletions(-)

--- a/core/include/common/mars/mutex_types.h
+++ b/core/include/common/mars/mutex_types.h
@@ -44,12 +44,23 @@
  * \brief MARS Mutex Types
  */
 
+#include <stdint.h>
+
+#define MARS_MUTEX_SIZE		128
+#define MARS_MUTEX_ALIGN	128
+#define MARS_MUTEX_ALIGN_MASK	0x7f
+#define MARS_MUTEX_LOCKED	0x1
+#define MARS_MUTEX_UNLOCKED	0x0
+
 /**
  * \ingroup group_mars_mutex
  * \brief MARS mutex structure
  *
  * An instance of this structure must be created when using the MARS Mutex API.
  */
-struct mars_mutex;
+struct mars_mutex {
+	uint32_t lock;
+	uint8_t pad[124];
+} __attribute__((aligned(MARS_MUTEX_ALIGN)));
 
 #endif
--- /dev/null
+++ b/core/include/common/mars/workload_types.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2008 Sony Corporation of America
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this Library and associated documentation files (the
+ * "Library"), to deal in the Library without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Library, and to
+ * permit persons to whom the Library is furnished to do so, subject to
+ * the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be
+ *  included in all copies or substantial portions of the Library.
+ *
+ *  If you modify the Library, you may copy and distribute your modified
+ *  version of the Library in object code or as an executable provided
+ *  that you also do one of the following:
+ *
+ *   Accompany the modified version of the Library with the complete
+ *   corresponding machine-readable source code for the modified version
+ *   of the Library; or,
+ *
+ *   Accompany the modified version of the Library with a written offer
+ *   for a complete machine-readable copy of the corresponding source
+ *   code of the modified version of the Library.
+ *
+ *
+ * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
+ */
+
+#ifndef MARS_WORKLOAD_TYPES_H
+#define MARS_WORKLOAD_TYPES_H
+
+#include <stdint.h>
+
+#define MARS_WORKLOAD_MODULE_ELF_VADDR		0x4000  /* elf vaddr */
+
+#define MARS_WORKLOAD_MODULE_SIZE		16	/* size of 16 bytes */
+#define MARS_WORKLOAD_MODULE_ALIGN		16	/* align to 16 bytes */
+
+#define MARS_WORKLOAD_CONTEXT_SIZE		128	/* size of 128 bytes */
+#define MARS_WORKLOAD_CONTEXT_ALIGN		128	/* align to 128 bytes */
+
+/* mars workload module */
+struct mars_workload_module {
+	uint64_t exec_ea;	/* ea of exec */
+	uint16_t exec_size;	/* size of text and data of exec */
+	uint16_t bss_size;	/* size of bss in memory of exec */
+	uint32_t entry;		/* entry address of exec */
+} __attribute__((aligned(MARS_WORKLOAD_MODULE_ALIGN)));
+
+/* mars workload context */
+struct mars_workload_context {
+	struct mars_workload_module module;
+	uint8_t context[MARS_WORKLOAD_CONTEXT_SIZE - MARS_WORKLOAD_MODULE_SIZE];
+} __attribute__((aligned(MARS_WORKLOAD_CONTEXT_ALIGN)));
+
+#endif
--- /dev/null
+++ b/core/include/host/mars/workload_queue.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2008 Sony Corporation of America
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this Library and associated documentation files (the
+ * "Library"), to deal in the Library without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Library, and to
+ * permit persons to whom the Library is furnished to do so, subject to
+ * the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be
+ *  included in all copies or substantial portions of the Library.
+ *
+ *  If you modify the Library, you may copy and distribute your modified
+ *  version of the Library in object code or as an executable provided
+ *  that you also do one of the following:
+ *
+ *   Accompany the modified version of the Library with the complete
+ *   corresponding machine-readable source code for the modified version
+ *   of the Library; or,
+ *
+ *   Accompany the modified version of the Library with a written offer
+ *   for a complete machine-readable copy of the corresponding source
+ *   code of the modified version of the Library.
+ *
+ *
+ * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
+ */
+
+#ifndef MARS_WORKLOAD_QUEUE_H
+#define MARS_WORKLOAD_QUEUE_H
+
+#include <mars/workload_types.h>
+
+struct mars_context;
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+int mars_workload_queue_create(struct mars_context *mars);
+int mars_workload_queue_destroy(struct mars_context *mars);
+int mars_workload_queue_exit(struct mars_context *mars);
+
+int mars_workload_queue_add_begin(struct mars_context *mars,
+				uint16_t *id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_add_end(struct mars_context *mars,
+				uint16_t id);
+int mars_workload_queue_add_cancel(struct mars_context *mars,
+				uint16_t id);
+
+int mars_workload_queue_remove_begin(struct mars_context *mars,
+				uint16_t id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_remove_end(struct mars_context *mars,
+				uint16_t id);
+int mars_workload_queue_remove_cancel(struct mars_context *mars,
+				uint16_t id);
+
+int mars_workload_queue_schedule_begin(struct mars_context *mars,
+				uint16_t id, uint8_t priority,
+				struct mars_workload_context **workload);
+int mars_workload_queue_schedule_end(struct mars_context *mars,
+				uint16_t id);
+int mars_workload_queue_schedule_cancel(struct mars_context *mars,
+				uint16_t id);
+
+int mars_workload_queue_wait(struct mars_context *mars,
+				uint16_t id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_try_wait(struct mars_context *mars,
+				uint16_t id,
+				struct mars_workload_context **workload);
+int mars_workload_queue_signal_send(struct mars_context *mars,
+				uint16_t id);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
--- /dev/null
+++ b/core/include/mpu/mars/dma.h
@@ -0,0 +1,493 @@
+/*
+ * Copyright 2008 Sony Corporation of America
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this Library and associated documentation files (the
+ * "Library"), to deal in the Library without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Library, and to
+ * permit persons to whom the Library is furnished to do so, subject to
+ * the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be
+ *  included in all copies or substantial portions of the Library.
+ *
+ *  If you modify the Library, you may copy and distribute your modified
+ *  version of the Library in object code or as an executable provided
+ *  that you also do one of the following:
+ *
+ *   Accompany the modified version of the Library with the complete
+ *   corresponding machine-readable source code for the modified version
+ *   of the Library; or,
+ *
+ *   Accompany the modified version of the Library with a written offer
+ *   for a complete machine-readable copy of the corresponding source
+ *   code of the modified version of the Library.
+ *
+ *
+ * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
+ */
+
+#ifndef MARS_DMA_H
+#define MARS_DMA_H
+
+/*
+ * \file
+ * \ingroup group_mars_dma
+ * \brief [MPU] MARS DMA API
+ */
+
+#include <assert.h>
+#include <spu_mfcio.h>
+
+/* dma tag reserved for MARS */
+#define MARS_DMA_TAG			31
+/* dma tag 0~31 */
+#define MARS_DMA_TAG_MAX		31
+/* dma 16 byte alignment mask */
+#define MARS_DMA_ALIGN_MASK		0xf
+/* dma 16 byte size mask */
+#define MARS_DMA_SIZE_MASK		0xf
+/* dma single tranfer size max 16KB */
+#define MARS_DMA_SIZE_MAX		16384
+/* dma large transfer boundary max */
+#define MARS_DMA_LIST_BOUNDARY_MASK	0xffffffff00000000ULL
+/* dma list array size */
+#define MARS_DMA_LIST_SIZE		16
+/* dma large transfer size max */
+#define MARS_DMA_LARGE_SIZE_MAX		(MARS_DMA_SIZE_MAX * MARS_DMA_LIST_SIZE)
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/* size max 16 KB */
+static inline unsigned int _list_init(mfc_list_element_t *list,
+				unsigned int size, unsigned int eal)
+{
+	unsigned int count = 0;
+
+	while (size) {
+		unsigned int block_size;
+		block_size = (size < MARS_DMA_SIZE_MAX) ?
+				size : MARS_DMA_SIZE_MAX;
+		list[count].notify = 0;
+		list[count].reserved = 0;
+		list[count].size = block_size;
+		list[count].eal = eal;
+		size -= block_size;
+		eal += block_size;
+		count++;
+	}
+
+	return (count * sizeof(mfc_list_element_t));
+}
+
+static inline void _mars_dma_large_get(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mfc_list_element_t list[MARS_DMA_LIST_SIZE] __attribute__((aligned(8)));
+	unsigned int list_size;
+	uint64_t ea2 = (ea + size - 1) & MARS_DMA_LIST_BOUNDARY_MASK;
+
+	if (mfc_ea2h(ea) != mfc_ea2h(ea2)) {
+		uint32_t size1 = ea2 - ea;
+		uint32_t size2 = size - size1;
+
+		list_size = _list_init(list, size1, mfc_ea2l(ea));
+		mfc_getl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
+
+		list_size = _list_init(list, size2, mfc_ea2l(ea2));
+		mfc_getl((volatile void *)ls, ea2, &list, list_size, tag, 0, 0);
+	} else {
+		list_size = _list_init(list, size, mfc_ea2l(ea));
+		mfc_getl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
+	}
+}
+
+static inline void _mars_dma_large_put(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mfc_list_element_t list[MARS_DMA_LIST_SIZE] __attribute__((aligned(8)));
+	unsigned int list_size;
+	uint64_t ea2 = (ea + size - 1) & MARS_DMA_LIST_BOUNDARY_MASK;
+
+	if (mfc_ea2h(ea) != mfc_ea2h(ea2)) {
+		uint32_t size1 = ea2 - ea;
+		uint32_t size2 = size - size1;
+
+		list_size = _list_init(list, size1, mfc_ea2l(ea));
+		mfc_putl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
+
+		list_size = _list_init(list, size2, mfc_ea2l(ea2));
+		mfc_putl((volatile void *)ls, ea2, &list, list_size, tag, 0, 0);
+	} else {
+		list_size = _list_init(list, size, mfc_ea2l(ea));
+		mfc_putl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
+	}
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Waits for a dma transfer to complete.
+ *
+ * This function will wait until all dma transfer operations currently
+ * initialized with the specified tag completes.
+ *
+ * \param[in] tag	- tag identifier of dma transfer to wait completion of\n
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_wait(uint32_t tag)
+{
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_write_tag_mask(1 << tag);
+	mfc_write_tag_update_all();
+	mfc_read_tag_status();
+}
+
+static inline void mars_dma_sync(uint32_t tag)
+{
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_sync(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma transfer from host storage to MPU storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from host storage to MPU storage. This function should be used
+ * when transferring data sizes between 16 bytes and 16 KB. For transfers
+ * of sizes smaller than 16 bytes use \ref mars_dma_small_get. For transfers
+ * of sizes larger than 16 KB use \ref mars_dma_large_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_get(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert((size & MARS_DMA_SIZE_MASK) == 0);
+	assert(size && size <= MARS_DMA_SIZE_MAX);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma get operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_get_and_wait(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mars_dma_get(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma transfer from MPU storage to host storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from MPU storage to host storage. This function should be used
+ * when transferring data sizes between 16 bytes and 16 KB. For transfers
+ * of sizes smaller than 16 bytes use \ref mars_dma_small_get. For transfers
+ * of sizes larger than 16 KB use \ref mars_dma_large_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_put(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert((size & MARS_DMA_SIZE_MASK) == 0);
+	assert(size && size <= MARS_DMA_SIZE_MAX);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_put((volatile void *)ls, ea, size, tag, 0, 0);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma put operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_put_and_wait(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mars_dma_put(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts small dma transfer from host storage to MPU storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from host storage to MPU storage. This function should be used
+ * when transferring data sizes of 1, 2, 4, or 8 bytes. For transfers
+ * of larger sizes use \ref mars_dma_get or \ref mars_dma_large_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[lower 4 bits must be same as ea]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[lower 4 bits must be same as ls]
+ * \param[in] size	- size of bytes to transfer
+ *			[1, 2, 4, or 8 bytes]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_small_get(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert(size == 1 || size == 2 || size == 4 || size == 8);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_get(ls, ea, size, tag, 0, 0);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma small get operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[lower 4 bits must be same as ea]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[lower 4 bits must be same as ls]
+ * \param[in] size	- size of bytes to transfer
+ *			[1, 2, 4, or 8 bytes]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_small_get_and_wait(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mars_dma_small_get(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts small dma transfer from MPU storage to host storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from MPU storage to host storage. This function should be used
+ * when transferring data sizes of 1, 2, 4, or 8 bytes. For transfers
+ * of larger sizes use \ref mars_dma_get or \ref mars_dma_large_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_small_put(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert(size == 1 || size == 2 || size == 4 || size == 8);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	mfc_put((volatile void *)ls, ea, size, tag, 0, 0);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma small put operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_small_put_and_wait(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mars_dma_small_put(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts large dma transfer from host storage to MPU storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from host storage to MPU storage. This function should be used
+ * when transferring data sizes of 16 KB and larger. This function can be
+ * used for transfer sizes of 16KB and smaller, but for efficiency transfers
+ * of smaller sizes should use \ref mars_dma_get or \ref mars_dma_small_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+			[16 KB and larger recommended]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_large_get(void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert(size && size <= MARS_DMA_LARGE_SIZE_MAX);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	_mars_dma_large_get(ls, ea, size, tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma large get operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+			[16 KB and larger recommended]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_large_get_and_wait(void *ls, uint64_t ea,
+						uint32_t size, uint32_t tag)
+{
+	mars_dma_large_get(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts large dma transfer from MPU storage to host storage.
+ *
+ * This function will start a dma transfer to copy the specified number of
+ * bytes from MPU storage to host storage. This function should be used
+ * when transferring data sizes of 16 KB and larger. This function can be
+ * used for transfer sizes of 16KB and smaller, but for efficiency transfers
+ * of smaller sizes should use \ref mars_dma_get or \ref mars_dma_small_get.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_large_put(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
+	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
+	assert(size && size <= MARS_DMA_LARGE_SIZE_MAX);
+	assert(tag <= MARS_DMA_TAG_MAX);
+
+	_mars_dma_large_put(ls, ea, size, tag);
+}
+
+/*
+ * \ingroup group_mars_dma
+ * \brief [MPU] Starts dma large put operation and waits for completion.
+ *
+ * \param[in] ls	- address of MPU storage to transfer from
+ *			[aligned to a 16 byte address]
+ * \param[in] ea	- address of host storage to transfer to
+ *			[aligned to a 16 byte address]
+ * \param[in] size	- size of bytes to transfer
+ *			[multiple of 16 bytes and no larger than 16 KB]
+ * \param[in] tag	- tag identifier of dma transfer
+ *			[between 0 and 31]
+ * \return
+ *	none
+ */
+static inline void mars_dma_large_put_and_wait(const void *ls, uint64_t ea,
+					uint32_t size, uint32_t tag)
+{
+	mars_dma_large_put(ls, ea, size, tag);
+	mars_dma_wait(tag);
+}
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
--- a/core/src/common/mutex_internal_types.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation of America
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this Library and associated documentation files (the
- * "Library"), to deal in the Library without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Library, and to
- * permit persons to whom the Library is furnished to do so, subject to
- * the following conditions:
- *
- *  The above copyright notice and this permission notice shall be
- *  included in all copies or substantial portions of the Library.
- *
- *  If you modify the Library, you may copy and distribute your modified
- *  version of the Library in object code or as an executable provided
- *  that you also do one of the following:
- *
- *   Accompany the modified version of the Library with the complete
- *   corresponding machine-readable source code for the modified version
- *   of the Library; or,
- *
- *   Accompany the modified version of the Library with a written offer
- *   for a complete machine-readable copy of the corresponding source
- *   code of the modified version of the Library.
- *
- *
- * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
- */
-
-#ifndef MARS_MUTEX_INTERNAL_TYPES_H
-#define MARS_MUTEX_INTERNAL_TYPES_H
-
-#include <stdint.h>
-
-#define MARS_MUTEX_SIZE				128
-#define MARS_MUTEX_ALIGN			128
-#define MARS_MUTEX_ALIGN_MASK			0x7f
-#define MARS_MUTEX_LOCKED			0x1
-#define MARS_MUTEX_UNLOCKED			0x0
-
-struct mars_mutex {
-	uint32_t lock;
-	uint8_t pad[124];
-} __attribute__((aligned(MARS_MUTEX_ALIGN)));
-
-#endif
--- a/core/src/common/workload_internal_types.h
+++ b/core/src/common/workload_internal_types.h
@@ -42,9 +42,6 @@
 
 #define MARS_WORKLOAD_ID_NONE			0xffff	/* workload id none */
 
-#define MARS_WORKLOAD_TYPE_NONE			0x00	/* workload undefined */
-#define MARS_WORKLOAD_TYPE_TASK			0x01	/* workload type */
-
 #define MARS_WORKLOAD_STATE_NONE		0x00	/* workload undefined */
 #define MARS_WORKLOAD_STATE_ADDING		0x01	/* adding now */
 #define MARS_WORKLOAD_STATE_REMOVING		0x02	/* removing now */
@@ -67,39 +64,33 @@
 #define MARS_WORKLOAD_NUM_BLOCKS		100	/* total blocks */
 #define MARS_WORKLOAD_MAX			1500	/* blocks * wl/block */
 
-#define MARS_WORKLOAD_CONTEXT_SIZE		128	/* size of 128 bytes */
-#define MARS_WORKLOAD_CONTEXT_ALIGN		128	/* align to 128 bytes */
-
 #define MARS_WORKLOAD_QUEUE_ALIGN		128	/* align to 128 bytes */
 #define MARS_WORKLOAD_QUEUE_HEADER_ALIGN	128	/* align to 128 bytes */
 #define MARS_WORKLOAD_QUEUE_BLOCK_ALIGN		128	/* align to 128 bytes */
 
 #define MARS_WORKLOAD_QUEUE_FLAG_NONE		0x0	/* no flag set */
 #define MARS_WORKLOAD_QUEUE_FLAG_EXIT		0x1	/* exit flag */
-
 /*
  * MARS workload queue block bits
- * ----------------------------------------------------------------------------
- * |[63...60]|[59...56]|[55....48]|[  47  ]|[46....32]|[31.....16]|[15......0]|
- * ----------------------------------------------------------------------------
- * |  4-bits |  4-bits |  8-bits  |  1-bit |  15-bits |  16-bits  |  16-bits  |
- * ----------------------------------------------------------------------------
- * |   TYPE  |  STATE  | PRIORITY | SIGNAL | RESERVED |  WAIT_ID  |  COUNTER  |
- * ----------------------------------------------------------------------------
+ * ------------------------------------------------------------------
+ * |[63...60]|[59....52]|[51....33]|[  32  ]|[31.....16]|[15......0]|
+ * ------------------------------------------------------------------
+ * |  4-bits |  8-bits  |  19-bits |  1-bit |  16-bits  |  16-bits  |
+ * ------------------------------------------------------------------
+ * |  STATE  | PRIORITY | RESERVED | SIGNAL |  WAIT_ID  |  COUNTER  |
+ * ------------------------------------------------------------------
  */
 #define MARS_BITS_SIZE				64
 
-#define MARS_BITS_SHIFT_TYPE			60
-#define MARS_BITS_SHIFT_STATE			56
-#define MARS_BITS_SHIFT_PRIORITY		48
-#define MARS_BITS_SHIFT_SIGNAL			47
+#define MARS_BITS_SHIFT_STATE			60
+#define MARS_BITS_SHIFT_PRIORITY		52
+#define MARS_BITS_SHIFT_SIGNAL			32
 #define MARS_BITS_SHIFT_WAIT_ID			16
 #define MARS_BITS_SHIFT_COUNTER			0
 
-#define MARS_BITS_MASK_TYPE			0xf000000000000000ULL
-#define MARS_BITS_MASK_STATE			0x0f00000000000000ULL
-#define MARS_BITS_MASK_PRIORITY			0x00ff000000000000ULL
-#define MARS_BITS_MASK_SIGNAL			0x0000800000000000ULL
+#define MARS_BITS_MASK_STATE			0xf000000000000000ULL
+#define MARS_BITS_MASK_PRIORITY			0x0ff0000000000000ULL
+#define MARS_BITS_MASK_SIGNAL			0x0000000100000000ULL
 #define MARS_BITS_MASK_WAIT_ID			0x00000000ffff0000ULL
 #define MARS_BITS_MASK_COUNTER			0x000000000000ffffULL
 
@@ -110,11 +101,6 @@
 	(*bits) = ((*(bits) & ~MARS_BITS_MASK_##name) | \
 		((uint64_t)(val) << MARS_BITS_SHIFT_##name))
 
-/* mars workload context */
-struct mars_workload_context {
-	uint8_t context[MARS_WORKLOAD_CONTEXT_SIZE];
-} __attribute__((aligned(MARS_WORKLOAD_CONTEXT_ALIGN)));
-
 /* 128 byte workload queue header structure */
 struct mars_workload_queue_header {
 	uint64_t queue_ea;
--- a/core/src/host/lib/workload_queue.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation of America
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this Library and associated documentation files (the
- * "Library"), to deal in the Library without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Library, and to
- * permit persons to whom the Library is furnished to do so, subject to
- * the following conditions:
- *
- *  The above copyright notice and this permission notice shall be
- *  included in all copies or substantial portions of the Library.
- *
- *  If you modify the Library, you may copy and distribute your modified
- *  version of the Library in object code or as an executable provided
- *  that you also do one of the following:
- *
- *   Accompany the modified version of the Library with the complete
- *   corresponding machine-readable source code for the modified version
- *   of the Library; or,
- *
- *   Accompany the modified version of the Library with a written offer
- *   for a complete machine-readable copy of the corresponding source
- *   code of the modified version of the Library.
- *
- *
- * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
- */
-
-#ifndef MARS_WORKLOAD_QUEUE_H
-#define MARS_WORKLOAD_QUEUE_H
-
-#include "workload_internal_types.h"
-
-struct mars_context;
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-int mars_workload_queue_create(struct mars_context *mars);
-int mars_workload_queue_destroy(struct mars_context *mars);
-int mars_workload_queue_exit(struct mars_context *mars);
-
-int mars_workload_queue_add_begin(struct mars_context *mars,
-				uint16_t *id, uint8_t type,
-				struct mars_workload_context **workload);
-int mars_workload_queue_add_end(struct mars_context *mars,
-				uint16_t id);
-int mars_workload_queue_add_cancel(struct mars_context *mars,
-				uint16_t id);
-
-int mars_workload_queue_remove_begin(struct mars_context *mars,
-				uint16_t id,
-				struct mars_workload_context **workload);
-int mars_workload_queue_remove_end(struct mars_context *mars,
-				uint16_t id);
-int mars_workload_queue_remove_cancel(struct mars_context *mars,
-				uint16_t id);
-
-int mars_workload_queue_schedule_begin(struct mars_context *mars,
-				uint16_t id, uint8_t priority,
-				struct mars_workload_context **workload);
-int mars_workload_queue_schedule_end(struct mars_context *mars,
-				uint16_t id);
-int mars_workload_queue_schedule_cancel(struct mars_context *mars,
-				uint16_t id);
-
-int mars_workload_queue_wait(struct mars_context *mars,
-				uint16_t id,
-				struct mars_workload_context **workload);
-int mars_workload_queue_try_wait(struct mars_context *mars,
-				uint16_t id,
-				struct mars_workload_context **workload);
-int mars_workload_queue_signal_send(struct mars_context *mars,
-				uint16_t id);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
--- a/core/src/mpu/lib/dma.h
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation of America
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this Library and associated documentation files (the
- * "Library"), to deal in the Library without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Library, and to
- * permit persons to whom the Library is furnished to do so, subject to
- * the following conditions:
- *
- *  The above copyright notice and this permission notice shall be
- *  included in all copies or substantial portions of the Library.
- *
- *  If you modify the Library, you may copy and distribute your modified
- *  version of the Library in object code or as an executable provided
- *  that you also do one of the following:
- *
- *   Accompany the modified version of the Library with the complete
- *   corresponding machine-readable source code for the modified version
- *   of the Library; or,
- *
- *   Accompany the modified version of the Library with a written offer
- *   for a complete machine-readable copy of the corresponding source
- *   code of the modified version of the Library.
- *
- *
- * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
- */
-
-#ifndef MARS_DMA_H
-#define MARS_DMA_H
-
-/*
- * \file
- * \ingroup group_mars_dma
- * \brief [MPU] MARS DMA API
- */
-
-#include <assert.h>
-#include <spu_mfcio.h>
-
-/* dma tag reserved for MARS */
-#define MARS_DMA_TAG			31
-/* dma tag 0~31 */
-#define MARS_DMA_TAG_MAX		31
-/* dma 16 byte alignment mask */
-#define MARS_DMA_ALIGN_MASK		0xf
-/* dma 16 byte size mask */
-#define MARS_DMA_SIZE_MASK		0xf
-/* dma single tranfer size max 16KB */
-#define MARS_DMA_SIZE_MAX		16384
-/* dma large transfer boundary max */
-#define MARS_DMA_LIST_BOUNDARY_MASK	0xffffffff00000000ULL
-/* dma list array size */
-#define MARS_DMA_LIST_SIZE		16
-/* dma large transfer size max */
-#define MARS_DMA_LARGE_SIZE_MAX		(MARS_DMA_SIZE_MAX * MARS_DMA_LIST_SIZE)
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-/* size max 16 KB */
-static inline unsigned int _list_init(mfc_list_element_t *list,
-				unsigned int size, unsigned int eal)
-{
-	unsigned int count = 0;
-
-	while (size) {
-		unsigned int block_size;
-		block_size = (size < MARS_DMA_SIZE_MAX) ?
-				size : MARS_DMA_SIZE_MAX;
-		list[count].notify = 0;
-		list[count].reserved = 0;
-		list[count].size = block_size;
-		list[count].eal = eal;
-		size -= block_size;
-		eal += block_size;
-		count++;
-	}
-
-	return (count * sizeof(mfc_list_element_t));
-}
-
-static inline void _mars_dma_large_get(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mfc_list_element_t list[MARS_DMA_LIST_SIZE] __attribute__((aligned(8)));
-	unsigned int list_size;
-	uint64_t ea2 = (ea + size - 1) & MARS_DMA_LIST_BOUNDARY_MASK;
-
-	if (mfc_ea2h(ea) != mfc_ea2h(ea2)) {
-		uint32_t size1 = ea2 - ea;
-		uint32_t size2 = size - size1;
-
-		list_size = _list_init(list, size1, mfc_ea2l(ea));
-		mfc_getl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
-
-		list_size = _list_init(list, size2, mfc_ea2l(ea2));
-		mfc_getl((volatile void *)ls, ea2, &list, list_size, tag, 0, 0);
-	} else {
-		list_size = _list_init(list, size, mfc_ea2l(ea));
-		mfc_getl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
-	}
-}
-
-static inline void _mars_dma_large_put(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mfc_list_element_t list[MARS_DMA_LIST_SIZE] __attribute__((aligned(8)));
-	unsigned int list_size;
-	uint64_t ea2 = (ea + size - 1) & MARS_DMA_LIST_BOUNDARY_MASK;
-
-	if (mfc_ea2h(ea) != mfc_ea2h(ea2)) {
-		uint32_t size1 = ea2 - ea;
-		uint32_t size2 = size - size1;
-
-		list_size = _list_init(list, size1, mfc_ea2l(ea));
-		mfc_putl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
-
-		list_size = _list_init(list, size2, mfc_ea2l(ea2));
-		mfc_putl((volatile void *)ls, ea2, &list, list_size, tag, 0, 0);
-	} else {
-		list_size = _list_init(list, size, mfc_ea2l(ea));
-		mfc_putl((volatile void *)ls, ea, &list, list_size, tag, 0, 0);
-	}
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Waits for a dma transfer to complete.
- *
- * This function will wait until all dma transfer operations currently
- * initialized with the specified tag completes.
- *
- * \param[in] tag	- tag identifier of dma transfer to wait completion of\n
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_wait(uint32_t tag)
-{
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_write_tag_mask(1 << tag);
-	mfc_write_tag_update_all();
-	mfc_read_tag_status();
-}
-
-static inline void mars_dma_sync(uint32_t tag)
-{
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_sync(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma transfer from host storage to MPU storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from host storage to MPU storage. This function should be used
- * when transferring data sizes between 16 bytes and 16 KB. For transfers
- * of sizes smaller than 16 bytes use \ref mars_dma_small_get. For transfers
- * of sizes larger than 16 KB use \ref mars_dma_large_get.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_get(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert((size & MARS_DMA_SIZE_MASK) == 0);
-	assert(size && size <= MARS_DMA_SIZE_MAX);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_get((volatile void *)ls, ea, size, tag, 0, 0);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma get operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_get_and_wait(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mars_dma_get(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma transfer from MPU storage to host storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from MPU storage to host storage. This function should be used
- * when transferring data sizes between 16 bytes and 16 KB. For transfers
- * of sizes smaller than 16 bytes use \ref mars_dma_small_get. For transfers
- * of sizes larger than 16 KB use \ref mars_dma_large_get.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_put(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert((size & MARS_DMA_SIZE_MASK) == 0);
-	assert(size && size <= MARS_DMA_SIZE_MAX);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_put((volatile void *)ls, ea, size, tag, 0, 0);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma put operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_put_and_wait(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mars_dma_put(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts small dma transfer from host storage to MPU storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from host storage to MPU storage. This function should be used
- * when transferring data sizes of 1, 2, 4, or 8 bytes. For transfers
- * of larger sizes use \ref mars_dma_get or \ref mars_dma_large_get.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[lower 4 bits must be same as ea]
- * \param[in] ea	- address of host storage to transfer from
- *			[lower 4 bits must be same as ls]
- * \param[in] size	- size of bytes to transfer
- *			[1, 2, 4, or 8 bytes]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_small_get(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size == 1 || size == 2 || size == 4 || size == 8);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_get(ls, ea, size, tag, 0, 0);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma small get operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[lower 4 bits must be same as ea]
- * \param[in] ea	- address of host storage to transfer from
- *			[lower 4 bits must be same as ls]
- * \param[in] size	- size of bytes to transfer
- *			[1, 2, 4, or 8 bytes]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_small_get_and_wait(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mars_dma_small_get(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts small dma transfer from MPU storage to host storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from MPU storage to host storage. This function should be used
- * when transferring data sizes of 1, 2, 4, or 8 bytes. For transfers
- * of larger sizes use \ref mars_dma_get or \ref mars_dma_large_get.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_small_put(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size == 1 || size == 2 || size == 4 || size == 8);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	mfc_put((volatile void *)ls, ea, size, tag, 0, 0);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma small put operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_small_put_and_wait(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mars_dma_small_put(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts large dma transfer from host storage to MPU storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from host storage to MPU storage. This function should be used
- * when transferring data sizes of 16 KB and larger. This function can be
- * used for transfer sizes of 16KB and smaller, but for efficiency transfers
- * of smaller sizes should use \ref mars_dma_get or \ref mars_dma_small_get.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
-			[16 KB and larger recommended]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_large_get(void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size && size <= MARS_DMA_LARGE_SIZE_MAX);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	_mars_dma_large_get(ls, ea, size, tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma large get operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
-			[16 KB and larger recommended]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_large_get_and_wait(void *ls, uint64_t ea,
-						uint32_t size, uint32_t tag)
-{
-	mars_dma_large_get(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts large dma transfer from MPU storage to host storage.
- *
- * This function will start a dma transfer to copy the specified number of
- * bytes from MPU storage to host storage. This function should be used
- * when transferring data sizes of 16 KB and larger. This function can be
- * used for transfer sizes of 16KB and smaller, but for efficiency transfers
- * of smaller sizes should use \ref mars_dma_get or \ref mars_dma_small_get.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_large_put(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	assert(((uintptr_t)ls & MARS_DMA_ALIGN_MASK) == 0);
-	assert(((uintptr_t)ea & MARS_DMA_ALIGN_MASK) == 0);
-	assert(size && size <= MARS_DMA_LARGE_SIZE_MAX);
-	assert(tag <= MARS_DMA_TAG_MAX);
-
-	_mars_dma_large_put(ls, ea, size, tag);
-}
-
-/*
- * \ingroup group_mars_dma
- * \brief [MPU] Starts dma large put operation and waits for completion.
- *
- * \param[in] ls	- address of MPU storage to transfer from
- *			[aligned to a 16 byte address]
- * \param[in] ea	- address of host storage to transfer to
- *			[aligned to a 16 byte address]
- * \param[in] size	- size of bytes to transfer
- *			[multiple of 16 bytes and no larger than 16 KB]
- * \param[in] tag	- tag identifier of dma transfer
- *			[between 0 and 31]
- * \return
- *	none
- */
-static inline void mars_dma_large_put_and_wait(const void *ls, uint64_t ea,
-					uint32_t size, uint32_t tag)
-{
-	mars_dma_large_put(ls, ea, size, tag);
-	mars_dma_wait(tag);
-}
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
--- a/core/src/mpu/lib/workload_types.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright 2008 Sony Corporation of America
- *
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this Library and associated documentation files (the
- * "Library"), to deal in the Library without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Library, and to
- * permit persons to whom the Library is furnished to do so, subject to
- * the following conditions:
- *
- *  The above copyright notice and this permission notice shall be
- *  included in all copies or substantial portions of the Library.
- *
- *  If you modify the Library, you may copy and distribute your modified
- *  version of the Library in object code or as an executable provided
- *  that you also do one of the following:
- *
- *   Accompany the modified version of the Library with the complete
- *   corresponding machine-readable source code for the modified version
- *   of the Library; or,
- *
- *   Accompany the modified version of the Library with a written offer
- *   for a complete machine-readable copy of the corresponding source
- *   code of the modified version of the Library.
- *
- *
- * THE LIBRARY IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * LIBRARY OR THE USE OR OTHER DEALINGS IN THE LIBRARY.
- */
-
-#ifndef MARS_WORKLOAD_TYPES_H
-#define MARS_WORKLOAD_TYPES_H
-
-#include <stdint.h>
-
-#define MARS_WORKLOAD_ID_NONE			0xffff	/* workload id none */
-
-#define MARS_WORKLOAD_TYPE_NONE			0x00	/* workload undefined */
-#define MARS_WORKLOAD_TYPE_TASK			0x01	/* workload type */
-
-#define MARS_WORKLOAD_STATE_NONE		0x00	/* workload undefined */
-#define MARS_WORKLOAD_STATE_ADDING		0x01	/* adding now */
-#define MARS_WORKLOAD_STATE_REMOVING		0x02	/* removing now */
-#define MARS_WORKLOAD_STATE_SCHEDULING		0x03	/* scheduling now */
-#define MARS_WORKLOAD_STATE_READY		0x04	/* ready to schedule */
-#define MARS_WORKLOAD_STATE_WAITING		0x05	/* waiting for sync */
-#define MARS_WORKLOAD_STATE_RUNNING		0x06	/* currently running */
-#define MARS_WORKLOAD_STATE_FINISHED		0x07	/* not allow schedule */
-
-#define MARS_WORKLOAD_PRIORITY_MIN		0x00	/* minimum priority */
-#define MARS_WORKLOAD_PRIORITY_MAX		0xff	/* maximum priority */
-
-#define MARS_WORKLOAD_COUNTER_MIN		0x0000	/* minimum counter */
-#define MARS_WORKLOAD_COUNTER_MAX		0xffff	/* maximum counter */
-
-#define MARS_WORKLOAD_SIGNAL_OFF		0x0	/* signal set off */
-#define MARS_WORKLOAD_SIGNAL_ON			0x1	/* signal set on */
-
-#define MARS_WORKLOAD_PER_BLOCK			15	/* wl/block */
-#define MARS_WORKLOAD_NUM_BLOCKS		100	/* total blocks */
-#define MARS_WORKLOAD_MAX			1500	/* blocks * wl/block */
-
-#define MARS_WORKLOAD_CONTEXT_SIZE		128	/* size of 128 bytes */
-#define MARS_WORKLOAD_CONTEXT_ALIGN		128	/* align to 128 bytes */
-
-#define MARS_WORKLOAD_QUEUE_ALIGN		128	/* align to 128 bytes */
-#define MARS_WORKLOAD_QUEUE_HEADER_ALIGN	128	/* align to 128 bytes */
-#define MARS_WORKLOAD_QUEUE_BLOCK_ALIGN		128	/* align to 128 bytes */
-
-#define MARS_WORKLOAD_QUEUE_FLAG_NONE		0x0	/* no flag set */
-#define MARS_WORKLOAD_QUEUE_FLAG_EXIT		0x1	/* exit flag */
-
-/*
- * MARS workload queue block bits
- * ----------------------------------------------------------------------------
- * |[63...60]|[59...56]|[55....48]|[  47  ]|[46....32]|[31.....16]|[15......0]|
- * ----------------------------------------------------------------------------
- * |  4-bits |  4-bits |  8-bits  |  1-bit |  15-bits |  16-bits  |  16-bits  |
- * ----------------------------------------------------------------------------
- * |   TYPE  |  STATE  | PRIORITY | SIGNAL | RESERVED |  WAIT_ID  |  COUNTER  |
- * ----------------------------------------------------------------------------
- */
-#define MARS_BITS_SIZE				64
-
-#define MARS_BITS_SHIFT_TYPE			60
-#define MARS_BITS_SHIFT_STATE			56
-#define MARS_BITS_SHIFT_PRIORITY		48
-#define MARS_BITS_SHIFT_SIGNAL			47
-#define MARS_BITS_SHIFT_WAIT_ID			16
-#define MARS_BITS_SHIFT_COUNTER			0
-
-#define MARS_BITS_MASK_TYPE			0xf000000000000000ULL
-#define MARS_BITS_MASK_STATE			0x0f00000000000000ULL
-#define MARS_BITS_MASK_PRIORITY			0x00ff000000000000ULL
-#define MARS_BITS_MASK_SIGNAL			0x0000800000000000ULL
-#define MARS_BITS_MASK_WAIT_ID			0x00000000ffff0000ULL
-#define MARS_BITS_MASK_COUNTER			0x000000000000ffffULL
-
-#define MARS_BITS_GET(bits, name)  \
-	((*(bits) & MARS_BITS_MASK_##name) >> MARS_BITS_SHIFT_##name)
-
-#define MARS_BITS_SET(bits, name, val) \
-	(*bits) = ((*(bits) & ~MARS_BITS_MASK_##name) | \
-		((uint64_t)(val) << MARS_BITS_SHIFT_##name))
-
-/* mars workload context */
-struct mars_workload_context {
-	uint8_t context[MARS_WORKLOAD_CONTEXT_SIZE];
-} __attribute__((aligned(MARS_WORKLOAD_CONTEXT_ALIGN)));
-
-/* 128 byte workload queue header structure */
-struct mars_workload_queue_header {
-	uint64_t queue_ea;
-	uint64_t context_ea;
-	uint8_t flag;
-} __attribute__((aligned(MARS_WORKLOAD_QUEUE_HEADER_ALIGN)));
-
-/* 128 byte workload queue block structure */
-struct mars_workload_queue_block {
-	uint32_t lock;
-	uint32_t pad;
-	uint64_t bits[MARS_WORKLOAD_PER_BLOCK];
-} __attribute__((aligned(MARS_WORKLOAD_QUEUE_BLOCK_ALIGN)));
-
-/* mars workload queue structure */
-struct mars_workload_queue {
-	struct mars_workload_queue_header header;
-	struct mars_workload_queue_block block[MARS_WORKLOAD_NUM_BLOCKS];
-	struct mars_workload_context context[MARS_WORKLOAD_MAX];
-} __attribute__((aligned(MARS_WORKLOAD_QUEUE_ALIGN)));
-
-#endif





More information about the cbe-oss-dev mailing list