2 * arch/s390/kernel/delay.c
3 * Precise Delay Loops for S390
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
9 * Derived from "arch/i386/lib/delay.c"
10 * Copyright (C) 1993 Linus Torvalds
11 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
14 #include <linux/config.h>
15 #include <linux/sched.h>
16 #include <linux/delay.h>
22 void __delay(unsigned long loops)
25 * To end the bloody studid and useless discussion about the
26 * BogoMips number I took the liberty to define the __delay
27 * function in a way that that resulting BogoMips number will
28 * yield the megahertz number of the cpu. The important function
29 * is udelay and that is done using the tod clock. -- martin.
33 : /* no outputs */ : "r" ((loops/2) + 1));
37 * Waits for 'usecs' microseconds using the tod clock, giving up the time slice
38 * of the virtual PU inbetween to avoid congestion.
40 void __udelay(unsigned long usecs)
42 uint64_t start_cc, end_cc;
46 asm volatile ("STCK %0" : "=m" (start_cc));
49 asm volatile ("STCK %0" : "=m" (end_cc));
50 } while (((end_cc - start_cc)/4096) < usecs);