aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuji Mano <yuji.mano@am.sony.com>2009-02-11 11:07:05 -0800
committerYuji Mano <yuji.mano@am.sony.com>2009-02-11 11:07:05 -0800
commitfcbd38e67e3a460979c0d1d849fc13bfdea31185 (patch)
tree8a6bc5661ac2a1b573cf8d71eb95923b1ea9c4ef
parent5a75bee3bede60f03ad9de113fadaecf3a2e3a50 (diff)
downloadmars-src-fcbd38e67e3a460979c0d1d849fc13bfdea31185.tar.gz
base: Rename defines
This renames the workload bits macros to add WORKLOAD_* prefix in preparation for another patch that adds a new set of BLOCK_* bit definitions. Signed-off-by: Yuji Mano <yuji.mano@am.sony.com> Acked-by: Kazunori Asayama <asayama@sm.sony.co.jp>
-rw-r--r--base/src/common/workload_internal_types.h29
-rw-r--r--base/src/host/lib/workload_queue.c32
-rw-r--r--base/src/mpu/kernel/kernel.c49
3 files changed, 56 insertions, 54 deletions
diff --git a/base/src/common/workload_internal_types.h b/base/src/common/workload_internal_types.h
index f35358b..8530769 100644
--- a/base/src/common/workload_internal_types.h
+++ b/base/src/common/workload_internal_types.h
@@ -73,8 +73,9 @@
#define MARS_WORKLOAD_QUEUE_FLAG_NONE 0x0 /* no flag set */
#define MARS_WORKLOAD_QUEUE_FLAG_EXIT 0x1 /* exit flag */
+
/*
- * MARS workload queue block bits
+ * MARS workload queue block workload bits (64-bits)
* ------------------------------------------------------------------
* |[63...60]|[59....52]|[51....33]|[ 32 ]|[31.....16]|[15......0]|
* ------------------------------------------------------------------
@@ -83,19 +84,17 @@
* | STATE | PRIORITY | RESERVED | SIGNAL | WAIT_ID | COUNTER |
* ------------------------------------------------------------------
*/
-#define MARS_BITS_SIZE 64
-
-#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_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
+#define MARS_BITS_SHIFT_WORKLOAD_STATE 60
+#define MARS_BITS_SHIFT_WORKLOAD_PRIORITY 52
+#define MARS_BITS_SHIFT_WORKLOAD_SIGNAL 32
+#define MARS_BITS_SHIFT_WORKLOAD_WAIT_ID 16
+#define MARS_BITS_SHIFT_WORKLOAD_COUNTER 0
+
+#define MARS_BITS_MASK_WORKLOAD_STATE 0xf000000000000000ULL
+#define MARS_BITS_MASK_WORKLOAD_PRIORITY 0x0ff0000000000000ULL
+#define MARS_BITS_MASK_WORKLOAD_SIGNAL 0x0000000100000000ULL
+#define MARS_BITS_MASK_WORKLOAD_WAIT_ID 0x00000000ffff0000ULL
+#define MARS_BITS_MASK_WORKLOAD_COUNTER 0x000000000000ffffULL
#define MARS_BITS_GET(bits, name) \
((*(bits) & MARS_BITS_MASK_##name) >> MARS_BITS_SHIFT_##name)
@@ -104,7 +103,7 @@
(*bits) = ((*(bits) & ~MARS_BITS_MASK_##name) | \
((uint64_t)(val) << MARS_BITS_SHIFT_##name))
-#define MARS_HOST_SIGNAL_EXIT 0
+#define MARS_HOST_SIGNAL_EXIT 0x0 /* host exit flag */
/* 128 byte workload queue header structure */
struct mars_workload_queue_header {
diff --git a/base/src/host/lib/workload_queue.c b/base/src/host/lib/workload_queue.c
index 677a6bc..74f1f72 100644
--- a/base/src/host/lib/workload_queue.c
+++ b/base/src/host/lib/workload_queue.c
@@ -115,7 +115,7 @@ static void init_blocks(uint64_t queue_ea)
uint64_t bits = 0;
/* create initial bit pattern of workload queue blocks */
- MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_NONE);
+ MARS_BITS_SET(&bits, WORKLOAD_STATE, MARS_WORKLOAD_STATE_NONE);
/* other bits are set by mars_workload_queue_schedule_begin properly */
@@ -171,7 +171,7 @@ static int is_block_empty(uint64_t block_ea)
/* check status */
for (index = 0; index < MARS_WORKLOAD_PER_BLOCK; index++) {
- if (MARS_BITS_GET(&block->bits[index], STATE) !=
+ if (MARS_BITS_GET(&block->bits[index], WORKLOAD_STATE) !=
MARS_WORKLOAD_STATE_NONE)
return MARS_ERROR_STATE;
}
@@ -245,8 +245,10 @@ static int alloc_block(uint64_t block_ea)
/* check status */
for (index = 0; index < MARS_WORKLOAD_PER_BLOCK; index++) {
uint64_t bits = block->bits[index];
- if (MARS_BITS_GET(&bits, STATE) == MARS_WORKLOAD_STATE_NONE) {
- MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_ADDING);
+ if (MARS_BITS_GET(&bits, WORKLOAD_STATE) ==
+ MARS_WORKLOAD_STATE_NONE) {
+ MARS_BITS_SET(&bits, WORKLOAD_STATE,
+ MARS_WORKLOAD_STATE_ADDING);
mars_ea_put_uint64(get_block_bits_ea(block_ea, index),
bits);
ret = index;
@@ -364,17 +366,17 @@ static int change_bits(struct mars_context *mars,
static int check_state_bits(uint64_t bits, uint64_t state)
{
- return (MARS_BITS_GET(&bits, STATE) == state);
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) == state);
}
static int check_state_bits_not(uint64_t bits, uint64_t state)
{
- return (MARS_BITS_GET(&bits, STATE) != state);
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) != state);
}
static uint64_t set_state_bits(uint64_t bits, uint64_t state)
{
- MARS_BITS_SET(&bits, STATE, state);
+ MARS_BITS_SET(&bits, WORKLOAD_STATE, state);
return bits;
}
@@ -442,11 +444,11 @@ int mars_workload_queue_remove_cancel(struct mars_context *mars,
static uint64_t set_schedule_bits(uint64_t bits, uint64_t priority)
{
/* set the info bits inside queue block for this workload */
- MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_SCHEDULING);
- MARS_BITS_SET(&bits, PRIORITY, priority);
- MARS_BITS_SET(&bits, COUNTER, MARS_WORKLOAD_COUNTER_MIN);
- MARS_BITS_SET(&bits, SIGNAL, MARS_WORKLOAD_SIGNAL_OFF);
- MARS_BITS_SET(&bits, WAIT_ID, MARS_WORKLOAD_ID_NONE);
+ MARS_BITS_SET(&bits, WORKLOAD_STATE, MARS_WORKLOAD_STATE_SCHEDULING);
+ MARS_BITS_SET(&bits, WORKLOAD_PRIORITY, priority);
+ MARS_BITS_SET(&bits, WORKLOAD_COUNTER, MARS_WORKLOAD_COUNTER_MIN);
+ MARS_BITS_SET(&bits, WORKLOAD_SIGNAL, MARS_WORKLOAD_SIGNAL_OFF);
+ MARS_BITS_SET(&bits, WORKLOAD_WAIT_ID, MARS_WORKLOAD_ID_NONE);
return bits;
}
@@ -483,10 +485,10 @@ static int is_workload_finished(uint32_t upper, void *param)
{
(void)param;
- /* this function assumes 'STATE' is stored in upper 32bits */
+ /* this function assumes 'WORKLOAD_STATE' is stored in upper 32 bits */
uint64_t bits = (uint64_t)upper << 32;
- switch (MARS_BITS_GET(&bits, STATE)) {
+ switch (MARS_BITS_GET(&bits, WORKLOAD_STATE)) {
case MARS_WORKLOAD_STATE_FINISHED:
return MARS_SUCCESS;
case MARS_WORKLOAD_STATE_NONE:
@@ -560,7 +562,7 @@ int mars_workload_queue_try_wait(struct mars_context *mars,
static uint64_t set_signal_bits(uint64_t bits, uint64_t signal)
{
- MARS_BITS_SET(&bits, SIGNAL, signal);
+ MARS_BITS_SET(&bits, WORKLOAD_SIGNAL, signal);
return bits;
}
diff --git a/base/src/mpu/kernel/kernel.c b/base/src/mpu/kernel/kernel.c
index b368103..928940a 100644
--- a/base/src/mpu/kernel/kernel.c
+++ b/base/src/mpu/kernel/kernel.c
@@ -224,22 +224,22 @@ static int workload_query(uint16_t id, int query)
switch (query) {
case MARS_QUERY_IS_INITIALIZED:
- return (MARS_BITS_GET(&bits, STATE) !=
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) !=
MARS_WORKLOAD_STATE_NONE);
case MARS_QUERY_IS_READY:
- return (MARS_BITS_GET(&bits, STATE) ==
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) ==
MARS_WORKLOAD_STATE_READY);
case MARS_QUERY_IS_WAITING:
- return (MARS_BITS_GET(&bits, STATE) ==
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) ==
MARS_WORKLOAD_STATE_WAITING);
case MARS_QUERY_IS_RUNNING:
- return (MARS_BITS_GET(&bits, STATE) ==
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) ==
MARS_WORKLOAD_STATE_RUNNING);
case MARS_QUERY_IS_FINISHED:
- return (MARS_BITS_GET(&bits, STATE) ==
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) ==
MARS_WORKLOAD_STATE_FINISHED);
case MARS_QUERY_IS_SIGNAL_SET:
- return (MARS_BITS_GET(&bits, SIGNAL) ==
+ return (MARS_BITS_GET(&bits, WORKLOAD_SIGNAL) ==
MARS_WORKLOAD_SIGNAL_ON);
}
@@ -298,7 +298,7 @@ static int change_bits(uint16_t id,
static int check_state_bits(uint64_t bits, uint64_t state)
{
- return (MARS_BITS_GET(&bits, STATE) == state);
+ return (MARS_BITS_GET(&bits, WORKLOAD_STATE) == state);
}
static int check_state_bits_not(uint64_t bits, uint64_t state)
@@ -308,7 +308,7 @@ static int check_state_bits_not(uint64_t bits, uint64_t state)
static uint64_t set_state_bits(uint64_t bits, uint64_t state)
{
- MARS_BITS_SET(&bits, STATE, state);
+ MARS_BITS_SET(&bits, WORKLOAD_STATE, state);
return bits;
}
@@ -326,7 +326,7 @@ static int change_state(uint16_t id,
static uint64_t set_wait_id_bits(uint64_t bits, uint64_t id)
{
- MARS_BITS_SET(&bits, WAIT_ID, id);
+ MARS_BITS_SET(&bits, WORKLOAD_WAIT_ID, id);
return bits;
}
@@ -352,7 +352,7 @@ static int workload_wait_reset(void)
static uint64_t set_signal_bits(uint64_t bits, uint64_t signal)
{
- MARS_BITS_SET(&bits, SIGNAL, signal);
+ MARS_BITS_SET(&bits, WORKLOAD_SIGNAL, signal);
return bits;
}
@@ -379,11 +379,11 @@ static int workload_signal_reset(void)
static uint64_t set_schedule_bits(uint64_t bits, uint64_t priority)
{
/* set the info bits inside queue block for this workload */
- MARS_BITS_SET(&bits, STATE, MARS_WORKLOAD_STATE_SCHEDULING);
- MARS_BITS_SET(&bits, PRIORITY, priority);
- MARS_BITS_SET(&bits, COUNTER, MARS_WORKLOAD_COUNTER_MIN);
- MARS_BITS_SET(&bits, SIGNAL, MARS_WORKLOAD_SIGNAL_OFF);
- MARS_BITS_SET(&bits, WAIT_ID, MARS_WORKLOAD_ID_NONE);
+ MARS_BITS_SET(&bits, WORKLOAD_STATE, MARS_WORKLOAD_STATE_SCHEDULING);
+ MARS_BITS_SET(&bits, WORKLOAD_PRIORITY, priority);
+ MARS_BITS_SET(&bits, WORKLOAD_COUNTER, MARS_WORKLOAD_COUNTER_MIN);
+ MARS_BITS_SET(&bits, WORKLOAD_SIGNAL, MARS_WORKLOAD_SIGNAL_OFF);
+ MARS_BITS_SET(&bits, WORKLOAD_WAIT_ID, MARS_WORKLOAD_ID_NONE);
return bits;
}
@@ -512,7 +512,8 @@ static int search_block(int block)
/* increment wait counter without overflowing */
if (counter < MARS_WORKLOAD_COUNTER_MAX)
- MARS_BITS_SET(bits, COUNTER, counter + 1);
+ MARS_BITS_SET(bits, WORKLOAD_COUNTER,
+ counter + 1);
/* found workload in waiting state */
} else if (state == MARS_WORKLOAD_STATE_WAITING) {
/* waiting for workload to finish so check status */
@@ -540,21 +541,21 @@ static int search_block(int block)
/* get state of workload its waiting for */
wait_state =
MARS_BITS_GET(&p_wait_block->bits[id],
- STATE);
+ WORKLOAD_STATE);
/* check if workload is finished and reset */
if (wait_state ==
MARS_WORKLOAD_STATE_FINISHED) {
- MARS_BITS_SET(bits, WAIT_ID,
+ MARS_BITS_SET(bits, WORKLOAD_WAIT_ID,
MARS_WORKLOAD_ID_NONE);
- MARS_BITS_SET(bits, STATE,
+ MARS_BITS_SET(bits, WORKLOAD_STATE,
MARS_WORKLOAD_STATE_READY);
}
/* waiting for signal so check signal bit and reset */
} else if (signal == MARS_WORKLOAD_SIGNAL_ON) {
- MARS_BITS_SET(bits, SIGNAL,
+ MARS_BITS_SET(bits, WORKLOAD_SIGNAL,
MARS_WORKLOAD_SIGNAL_OFF);
- MARS_BITS_SET(bits, STATE,
+ MARS_BITS_SET(bits, WORKLOAD_STATE,
MARS_WORKLOAD_STATE_READY);
}
}
@@ -575,11 +576,11 @@ static int reserve_block(int block)
index = search_block(block);
if (index >= 0) {
/* update the current state of the workload */
- MARS_BITS_SET(&queue_block.bits[index], STATE,
+ MARS_BITS_SET(&queue_block.bits[index], WORKLOAD_STATE,
MARS_WORKLOAD_STATE_RUNNING);
/* reset the counter for reserved workload */
- MARS_BITS_SET(&queue_block.bits[index], COUNTER,
+ MARS_BITS_SET(&queue_block.bits[index], WORKLOAD_COUNTER,
MARS_WORKLOAD_COUNTER_MIN);
}
@@ -605,7 +606,7 @@ static void release_block(int block, int index)
mars_mutex_lock_get(block_ea, (struct mars_mutex *)&queue_block);
/* update current workload state in workload queue block */
- MARS_BITS_SET(&queue_block.bits[index], STATE, workload_state);
+ MARS_BITS_SET(&queue_block.bits[index], WORKLOAD_STATE, workload_state);
mars_mutex_unlock_put(block_ea, (struct mars_mutex *)&queue_block);