pc-bios: s390x: Consolidate timing functions into time.h

Let's consolidate timing related functions into one header.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200624075226.92728-3-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Janosch Frank 2020-06-24 03:52:16 -04:00 committed by Thomas Huth
parent 8c6cc7b9df
commit e70bc57ba0
7 changed files with 36 additions and 31 deletions

View file

@ -35,6 +35,7 @@
#include "s390-ccw.h"
#include "cio.h"
#include "virtio.h"
#include "s390-time.h"
#define DEFAULT_BOOT_RETRIES 10
#define DEFAULT_TFTP_RETRIES 20
@ -57,24 +58,14 @@ static SubChannelId net_schid = { .one = 1 };
static uint8_t mac[6];
static uint64_t dest_timer;
static uint64_t get_timer_ms(void)
{
uint64_t clk;
asm volatile(" stck %0 " : : "Q"(clk) : "memory");
/* Bit 51 is incremented each microsecond */
return (clk >> (63 - 51)) / 1000;
}
void set_timer(int val)
{
dest_timer = get_timer_ms() + val;
dest_timer = get_time_ms() + val;
}
int get_timer(void)
{
return dest_timer - get_timer_ms();
return dest_timer - get_time_ms();
}
int get_sec_ticks(void)