ReactOS  0.4.14-dev-323-g6fe6a88
reboot.c File Reference
#include <hal.h>
#include <debug.h>
Include dependency graph for reboot.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI HalpWriteResetCommand (VOID)
 
VOID NTAPI HalpReboot (VOID)
 
VOID NTAPI HalReturnToFirmware (IN FIRMWARE_REENTRY Action)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file reboot.c.

Function Documentation

◆ HalpReboot()

VOID NTAPI HalpReboot ( VOID  )

Definition at line 28 of file reboot.c.

29 {
31  UCHAR Data;
32  PVOID ZeroPageMapping;
33 
34  /* Map the first physical page */
36  ZeroPageMapping = HalpMapPhysicalMemory64(PhysicalAddress, 1);
37 
38  /* Enable warm reboot */
39  ((PUSHORT)ZeroPageMapping)[0x239] = 0x1234;
40 
41  /* Lock CMOS Access (and disable interrupts) */
43 
44  /* Setup control register B */
45  WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0B);
47 
48  /* Read periodic register and clear the interrupt enable */
49  Data = READ_PORT_UCHAR((PUCHAR)0x71);
50  WRITE_PORT_UCHAR((PUCHAR)0x71, Data & ~0x40);
52 
53  /* Setup control register A */
54  WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0A);
56 
57  /* Read divider rate and reset it */
58  Data = READ_PORT_UCHAR((PUCHAR)0x71);
59  WRITE_PORT_UCHAR((PUCHAR)0x71, (Data & ~0x9) | 0x06);
61 
62  /* Reset neutral CMOS address */
63  WRITE_PORT_UCHAR((PUCHAR)0x70, 0x15);
65 
66  /* Flush write buffers and send the reset command */
69 
70  /* Halt the CPU */
71  __halt();
72 }
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1595
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPage)
Definition: misc.c:28
_In_ LPGUID _In_ PVOID Data
Definition: classpnp.h:778
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:227
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1061
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI HalpWriteResetCommand(VOID)
Definition: reboot.c:20
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
unsigned short * PUSHORT
Definition: retypes.h:2
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:99
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by HalReturnToFirmware().

◆ HalpWriteResetCommand()

VOID NTAPI HalpWriteResetCommand ( VOID  )

Definition at line 20 of file reboot.c.

21 {
22  /* Generate RESET signal via keyboard controller */
23  WRITE_PORT_UCHAR((PUCHAR)0x64, 0xFE);
24 };
unsigned char * PUCHAR
Definition: retypes.h:3
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by HalpReboot().

◆ HalReturnToFirmware()

VOID NTAPI HalReturnToFirmware ( IN FIRMWARE_REENTRY  Action)

Definition at line 81 of file reboot.c.

82 {
83  /* Check what kind of action this is */
84  switch (Action)
85  {
86  /* All recognized actions */
87  case HalHaltRoutine:
88  case HalRebootRoutine:
89 
90 #ifndef _MINIHAL_
91  /* Acquire the display */
93 #endif
94 
95  /* Call the internal reboot function */
96  HalpReboot();
97 
98  /* Anything else */
99  default:
100 
101  /* Print message and break */
102  DbgPrint("HalReturnToFirmware called!\n");
103  DbgBreakPoint();
104  }
105 }
#define DbgPrint
Definition: loader.c:25
void DbgBreakPoint()
Definition: mach.c:553
VOID NTAPI HalpReboot(VOID)
Definition: reboot.c:28
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG Action
Definition: fsrtlfuncs.h:738
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:532