Author: tkreuzer Date: Thu Mar 29 08:25:20 2012 New Revision: 56270
URL: http://svn.reactos.org/svn/reactos?rev=56270&view=rev Log: [FREELDR] - Implement HwIdle() function to put cpu in idle mode, when waiting for keyboard input. - Patch by Carlo Bramini (carlo dot bramix at libero.it) See issue #6453 for more details.
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h trunk/reactos/boot/freeldr/freeldr/include/machine.h trunk/reactos/boot/freeldr/freeldr/ui/tui.c trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/a... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -165,6 +165,12 @@ }
VOID +ArmHwIdle(VOID) +{ + /* UNIMPLEMENTED */ +} + +VOID MachInit(IN PCCH CommandLine) { /* Copy Machine Routines from Firmware Table */ @@ -217,4 +223,5 @@ MachVtbl.GetMemoryMap = ArmMemGetMemoryMap; MachVtbl.HwDetect = ArmHwDetect; MachVtbl.DiskGetBootPath = ArmDiskGetBootPath; -} + MachVtbl.HwIdle = ArmHwIdle; +}
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hardware.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -1731,4 +1731,28 @@ return SystemKey; }
+VOID +PcHwIdle(VOID) +{ + REGS Regs; + + /* Select APM 1.0+ function */ + Regs.b.ah = 0x53; + + /* Function 05h: CPU idle */ + Regs.b.al = 0x05; + + /* Call INT 15h */ + Int386(0x15, &Regs, &Regs); + + /* Check if successfull (CF set on error) */ + if (INT386_SUCCESS(Regs)) + return; + + /* + * No futher processing here. + * Optionally implement HLT instruction handling. + */ +} + /* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machpc.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -47,6 +47,7 @@ MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount; MachVtbl.GetTime = PcGetTime; MachVtbl.HwDetect = PcHwDetect; + MachVtbl.HwIdle = PcHwIdle; }
VOID
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/machxbox.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -53,6 +53,7 @@ MachVtbl.DiskGetCacheableBlockCount = XboxDiskGetCacheableBlockCount; MachVtbl.GetTime = XboxGetTime; MachVtbl.HwDetect = XboxHwDetect; + MachVtbl.HwIdle = XboxHwIdle;
/* Set LEDs to orange after init */ XboxSetLED("oooo");
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/i386/xboxhw.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -512,4 +512,9 @@ return SystemKey; }
+VOID XboxHwIdle(VOID) +{ + /* UNIMPLEMENTED */ +} + /* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/p... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -414,6 +414,12 @@ return RootKey; }
+VOID +PpcHwIdle(VOID) +{ + /* UNIMPLEMENTED */ +} + /* Compatibility functions that don't do much */ VOID PpcVideoPrepareForReactOS(BOOLEAN Setup) { } @@ -448,6 +454,7 @@ MachVtbl.GetTime = PpcGetTime;
MachVtbl.HwDetect = PpcHwDetect; + MachVtbl.HwIdle = PpcHwIdle; }
void PpcOfwInit()
Modified: trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/p... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/arch/powerpc/prep.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -118,6 +118,12 @@ return SystemKey; }
+VOID +PpcPrepHwIdle(VOID) +{ + /* UNIMPLEMENTED */ +} + void PpcPrepInit() { MachVtbl.ConsPutChar = PpcPrepPutChar; @@ -139,6 +145,7 @@
MachVtbl.GetMemoryMap = PpcPrepGetMemoryMap; MachVtbl.HwDetect = PpcPrepHwDetect; + MachVtbl.HwIdle = PcPrepHwIdle;
printf( "FreeLDR version [%s]\n", GetFreeLoaderVersionString() );
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/i386/machxbox.h [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -59,6 +59,7 @@ TIMEINFO* XboxGetTime(VOID);
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID); +VOID XboxHwIdle(VOID);
VOID XboxSetLED(PCSTR Pattern);
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/machpc.h [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -57,6 +57,7 @@ TIMEINFO* PcGetTime(VOID);
PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID); +VOID PcHwIdle(VOID);
extern BIOS_MEMORY_MAP PcBiosMemoryMap[]; extern ULONG PcBiosMapCount;
Modified: trunk/reactos/boot/freeldr/freeldr/include/machine.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/includ... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/include/machine.h [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -69,6 +69,7 @@ ULONG (*GetRelativeTime)(VOID);
PCONFIGURATION_COMPONENT_DATA (*HwDetect)(VOID); + VOID (*HwIdle)(VOID); } MACHVTBL, *PMACHVTBL;
VOID MachInit(const char *CmdLine); @@ -97,6 +98,7 @@ BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber); VOID MachPrepareForReactOS(IN BOOLEAN Setup); +VOID MachHwIdle(VOID);
#define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) #define MachConsKbHit() MachVtbl.ConsKbHit() @@ -121,5 +123,6 @@ #define MachDiskGetDriveGeometry(Drive, Geom) MachVtbl.DiskGetDriveGeometry((Drive), (Geom)) #define MachDiskGetCacheableBlockCount(Drive) MachVtbl.DiskGetCacheableBlockCount(Drive) #define MachHwDetect() MachVtbl.HwDetect() +#define MachHwIdle() MachVtbl.HwIdle()
/* EOF */
Modified: trunk/reactos/boot/freeldr/freeldr/ui/tui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tui... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/tui.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -624,6 +624,8 @@ TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM(); + + MachHwIdle(); }
} @@ -944,6 +946,8 @@ TuiUpdateDateTime();
VideoCopyOffScreenBufferToVRAM(); + + MachHwIdle(); }
// Hide the cursor again
Modified: trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/ui/tui... ============================================================================== --- trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c [iso-8859-1] (original) +++ trunk/reactos/boot/freeldr/freeldr/ui/tuimenu.c [iso-8859-1] Thu Mar 29 08:25:20 2012 @@ -119,6 +119,8 @@ // break; } + + MachHwIdle(); }
//