mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 12:30:20 +03:00
[nap] Formalise the CPU sleeping API
This commit is contained in:
@@ -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" ) : : );
|
||||
}
|
||||
@@ -5,6 +5,4 @@
|
||||
#define BDA_FBMS 0x0013
|
||||
#define BDA_NUM_DRIVES 0x0075
|
||||
|
||||
extern void cpu_nap ( void );
|
||||
|
||||
#endif /* BIOS_H */
|
||||
|
||||
12
src/arch/i386/include/bits/nap.h
Normal file
12
src/arch/i386/include/bits/nap.h
Normal file
@@ -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 */
|
||||
16
src/arch/i386/include/gpxe/bios_nap.h
Normal file
16
src/arch/i386/include/gpxe/bios_nap.h
Normal file
@@ -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 */
|
||||
14
src/arch/i386/interface/pcbios/bios_nap.c
Normal file
14
src/arch/i386/interface/pcbios/bios_nap.c
Normal file
@@ -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 );
|
||||
Reference in New Issue
Block a user