diff options
author | Janosch Frank <frankja@linux.ibm.com> | 2020-06-24 03:52:17 -0400 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2020-07-02 09:59:51 +0200 |
commit | 12ea90dbd8fc38ca937acb53c730818077bf86fe (patch) | |
tree | e77d99b7b0a3764f2bc604d204c2d31da72941e9 /pc-bios/s390-ccw/helper.h | |
parent | e70bc57ba0c982944cf5b71f293122dbb2b462f4 (diff) | |
download | qemu-12ea90dbd8fc38ca937acb53c730818077bf86fe.zip qemu-12ea90dbd8fc38ca937acb53c730818077bf86fe.tar.gz qemu-12ea90dbd8fc38ca937acb53c730818077bf86fe.tar.bz2 |
pc-bios: s390x: Move sleep and yield to helper.h
They are definitely helper functions.
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20200624075226.92728-4-frankja@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'pc-bios/s390-ccw/helper.h')
-rw-r--r-- | pc-bios/s390-ccw/helper.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pc-bios/s390-ccw/helper.h b/pc-bios/s390-ccw/helper.h index 78d5bc7..32a453b 100644 --- a/pc-bios/s390-ccw/helper.h +++ b/pc-bios/s390-ccw/helper.h @@ -14,6 +14,7 @@ #define S390_CCW_HELPER_H #include "s390-ccw.h" +#include "s390-time.h" /* Avoids compiler warnings when casting a pointer to a u32 */ static inline uint32_t ptr2u32(void *ptr) @@ -28,4 +29,20 @@ static inline void *u32toptr(uint32_t n) return (void *)(uint64_t)n; } +static inline void yield(void) +{ + asm volatile ("diag 0,0,0x44" + : : + : "memory", "cc"); +} + +static inline void sleep(unsigned int seconds) +{ + ulong target = get_time_seconds() + seconds; + + while (get_time_seconds() < target) { + yield(); + } +} + #endif |