mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
eda08b1bef
Not respecting udelay causes problems with any virtual hardware that is passed through to real hardware. This can be noticed by any device that interacts with the real world in real time - like AP startup, which takes real time. Or keyboard LEDs, which should blink in real-time. Or floppy drives, but only when passed through to a real floppy controller on OSes which can't sufficiently buffer the floppy commands to emulate a zero latency floppy. Or IDE drives, when connecting to a physical CDROM. This was mostly a hack to get the kernel to boot faster, but it introduced a number of misvirtualization bugs, and Alan and Pavel argued pretty strongly against it. We were the only client, and now want to clean up this cruft. Signed-off-by: Zachary Amsden <zach@vmware.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
32 lines
861 B
C
32 lines
861 B
C
#ifndef _I386_DELAY_H
|
|
#define _I386_DELAY_H
|
|
|
|
/*
|
|
* Copyright (C) 1993 Linus Torvalds
|
|
*
|
|
* Delay routines calling functions in arch/i386/lib/delay.c
|
|
*/
|
|
|
|
/* Undefined functions to get compile-time errors */
|
|
extern void __bad_udelay(void);
|
|
extern void __bad_ndelay(void);
|
|
|
|
extern void __udelay(unsigned long usecs);
|
|
extern void __ndelay(unsigned long nsecs);
|
|
extern void __const_udelay(unsigned long usecs);
|
|
extern void __delay(unsigned long loops);
|
|
|
|
/* 0x10c7 is 2**32 / 1000000 (rounded up) */
|
|
#define udelay(n) (__builtin_constant_p(n) ? \
|
|
((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \
|
|
__udelay(n))
|
|
|
|
/* 0x5 is 2**32 / 1000000000 (rounded up) */
|
|
#define ndelay(n) (__builtin_constant_p(n) ? \
|
|
((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
|
|
__ndelay(n))
|
|
|
|
void use_tsc_delay(void);
|
|
|
|
#endif /* defined(_I386_DELAY_H) */
|