Use 64-bit time instead of 32-bit time for work queue utility.
Current timer has been upgraded to 64-bit but work queue utility
still uses 32-bit.
So timer->hitime can't be added rightly because the 64-bit time
is truncated by work queue utility.
"rmbox" will still receive 32-bit timestamp value only and can't
be upgraded to 64-bit timestamp.
Signed-off-by: Yan Wang <yan.wang@linux.intel.com>
diff --git a/src/lib/work.c b/src/lib/work.c
index a267b80..587113e 100644
--- a/src/lib/work.c
+++ b/src/lib/work.c
@@ -40,6 +40,7 @@
#include <reef/debug.h>
#include <platform/clk.h>
#include <platform/platform.h>
+#include <limits.h>
/*
* Generic delayed work queue support.
@@ -98,8 +99,8 @@
{
struct list_item *wlist;
struct work *work;
- uint32_t win_end;
- uint32_t win_start;
+ uint64_t win_end;
+ uint64_t win_start;
int pending_count = 0;
/* get the current valid window of work */
@@ -131,7 +132,8 @@
/* if work has timed out then mark it as pending to run */
if (work->timeout <= win_end ||
- (work->timeout >= win_start && work->timeout < MAX_INT)) {
+ (work->timeout >= win_start &&
+ work->timeout < ULONG_LONG_MAX)) {
work->pending = 1;
pending_count++;
} else {
@@ -144,7 +146,7 @@
}
static inline void work_next_timeout(struct work_queue *queue,
- struct work *work, uint32_t reschedule_usecs)
+ struct work *work, uint64_t reschedule_usecs)
{
/* reschedule work */
if (work->flags & WORK_SYNC) {
@@ -162,8 +164,8 @@
struct list_item *wlist;
struct list_item *tlist;
struct work *work;
- uint32_t reschedule_usecs;
- uint32_t udelay;
+ uint64_t reschedule_usecs;
+ uint64_t udelay;
/* check each work item in queue for pending */
list_for_item_safe(wlist, tlist, &queue->work) {
@@ -192,9 +194,9 @@
}
}
-static inline uint32_t calc_delta_ticks(uint32_t current, uint32_t work)
+static inline uint64_t calc_delta_ticks(uint64_t current, uint64_t work)
{
- uint32_t max = MAX_INT;
+ uint64_t max = ULONG_LONG_MAX;
/* does work run in next cycle ? */
if (work < current) {
@@ -210,10 +212,10 @@
{
struct list_item *wlist;
struct work *work;
- uint32_t delta = MAX_INT;
- uint32_t current;
- uint32_t d;
- uint32_t ticks;
+ uint64_t delta = ULONG_LONG_MAX;
+ uint64_t current;
+ uint64_t d;
+ uint64_t ticks;
/* only recalc if work list not empty */
if (list_is_empty(&queue->work)) {
@@ -246,9 +248,9 @@
{
struct list_item *wlist;
struct work *work;
- uint32_t delta_ticks;
- uint32_t delta_usecs;
- uint32_t current;
+ uint64_t delta_ticks;
+ uint64_t delta_usecs;
+ uint64_t current;
/* get current time */
current = work_get_timer(queue);