Skip to content

Commit 12ea90d

Browse files
frankjaahuth
authored andcommitted
pc-bios: s390x: Move sleep and yield to helper.h
They are definitely helper functions. Signed-off-by: Janosch Frank <[email protected]> Reviewed-by: Christian Borntraeger <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Message-Id: <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent e70bc57 commit 12ea90d

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

pc-bios/s390-ccw/helper.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define S390_CCW_HELPER_H
1515

1616
#include "s390-ccw.h"
17+
#include "s390-time.h"
1718

1819
/* Avoids compiler warnings when casting a pointer to a u32 */
1920
static inline uint32_t ptr2u32(void *ptr)
@@ -28,4 +29,20 @@ static inline void *u32toptr(uint32_t n)
2829
return (void *)(uint64_t)n;
2930
}
3031

32+
static inline void yield(void)
33+
{
34+
asm volatile ("diag 0,0,0x44"
35+
: :
36+
: "memory", "cc");
37+
}
38+
39+
static inline void sleep(unsigned int seconds)
40+
{
41+
ulong target = get_time_seconds() + seconds;
42+
43+
while (get_time_seconds() < target) {
44+
yield();
45+
}
46+
}
47+
3148
#endif

pc-bios/s390-ccw/s390-ccw.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -142,26 +142,8 @@ static inline void debug_print_addr(const char *desc, void *p)
142142
#define KVM_S390_VIRTIO_SET_STATUS 2
143143
#define KVM_S390_VIRTIO_CCW_NOTIFY 3
144144

145-
static inline void yield(void)
146-
{
147-
asm volatile ("diag 0,0,0x44"
148-
: :
149-
: "memory", "cc");
150-
}
151-
152145
#define MAX_SECTOR_SIZE 4096
153146

154-
#include "s390-time.h"
155-
156-
static inline void sleep(unsigned int seconds)
157-
{
158-
ulong target = get_time_seconds() + seconds;
159-
160-
while (get_time_seconds() < target) {
161-
yield();
162-
}
163-
}
164-
165147
static inline void IPL_assert(bool term, const char *message)
166148
{
167149
if (!term) {

pc-bios/s390-ccw/virtio-net.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "s390-ccw.h"
2121
#include "virtio.h"
2222
#include "s390-time.h"
23+
#include "helper.h"
2324

2425
#ifndef DEBUG_VIRTIO_NET
2526
#define DEBUG_VIRTIO_NET 0

pc-bios/s390-ccw/virtio-scsi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "scsi.h"
1616
#include "virtio-scsi.h"
1717
#include "s390-time.h"
18+
#include "helper.h"
1819

1920
static ScsiDevice default_scsi_device;
2021
static VirtioScsiCmdReq req;

0 commit comments

Comments
 (0)