diff options
author | Michael Brown <mcb30@etherboot.org> | 2008-10-12 23:34:45 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-10-12 23:36:53 +0100 |
commit | c0835339d06716b133aa653847023742a967f188 (patch) | |
tree | 25f22e63175c7919c8de678f5a5f1513bed516c8 /src/arch | |
parent | 658c6dba597402c82d9558448bd928cd4c202657 (diff) | |
download | ipxe-c0835339d06716b133aa653847023742a967f188.tar.gz |
[nap] Formalise the CPU sleeping API
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/i386/core/nap.c | 12 | ||||
-rw-r--r-- | src/arch/i386/include/bios.h | 2 | ||||
-rw-r--r-- | src/arch/i386/include/bits/nap.h | 12 | ||||
-rw-r--r-- | src/arch/i386/include/gpxe/bios_nap.h | 16 | ||||
-rw-r--r-- | src/arch/i386/interface/pcbios/bios_nap.c | 14 |
5 files changed, 42 insertions, 14 deletions
diff --git a/src/arch/i386/core/nap.c b/src/arch/i386/core/nap.c deleted file mode 100644 index 12bb5699c..000000000 --- a/src/arch/i386/core/nap.c +++ /dev/null @@ -1,12 +0,0 @@ - -#include <realmode.h> -#include <bios.h> - -/************************************************************************** - * Save power by halting the CPU until the next interrupt - **************************************************************************/ -void cpu_nap ( void ) { - __asm__ __volatile__ ( REAL_CODE ( "sti\n\t" - "hlt\n\t" - "cli\n\t" ) : : ); -} diff --git a/src/arch/i386/include/bios.h b/src/arch/i386/include/bios.h index 5f9d6ab09..979a092c9 100644 --- a/src/arch/i386/include/bios.h +++ b/src/arch/i386/include/bios.h @@ -5,6 +5,4 @@ #define BDA_FBMS 0x0013 #define BDA_NUM_DRIVES 0x0075 -extern void cpu_nap ( void ); - #endif /* BIOS_H */ diff --git a/src/arch/i386/include/bits/nap.h b/src/arch/i386/include/bits/nap.h new file mode 100644 index 000000000..2c85444ad --- /dev/null +++ b/src/arch/i386/include/bits/nap.h @@ -0,0 +1,12 @@ +#ifndef _BITS_NAP_H +#define _BITS_NAP_H + +/** @file + * + * i386-specific CPU sleeping API implementations + * + */ + +#include <gpxe/bios_nap.h> + +#endif /* _BITS_MAP_H */ diff --git a/src/arch/i386/include/gpxe/bios_nap.h b/src/arch/i386/include/gpxe/bios_nap.h new file mode 100644 index 000000000..f1c721e9d --- /dev/null +++ b/src/arch/i386/include/gpxe/bios_nap.h @@ -0,0 +1,16 @@ +#ifndef _GPXE_BIOS_NAP_H +#define _GPXE_BIOS_NAP_H + +/** @file + * + * BIOS CPU sleeping + * + */ + +#ifdef NAP_PCBIOS +#define NAP_PREFIX_pcbios +#else +#define NAP_PREFIX_pcbios __pcbios_ +#endif + +#endif /* _GPXE_BIOS_NAP_H */ diff --git a/src/arch/i386/interface/pcbios/bios_nap.c b/src/arch/i386/interface/pcbios/bios_nap.c new file mode 100644 index 000000000..2f4a05131 --- /dev/null +++ b/src/arch/i386/interface/pcbios/bios_nap.c @@ -0,0 +1,14 @@ +#include <gpxe/nap.h> +#include <realmode.h> + +/** + * Save power by halting the CPU until the next interrupt + * + */ +static void bios_cpu_nap ( void ) { + __asm__ __volatile__ ( REAL_CODE ( "sti\n\t" + "hlt\n\t" + "cli\n\t" ) : : ); +} + +PROVIDE_NAP ( pcbios, cpu_nap, bios_cpu_nap ); |