ReactOS 0.4.15-dev-7924-g5949c20
reboot.c File Reference
#include <hal.h>
Include dependency graph for reboot.c:

Go to the source code of this file.

Functions

static VOID HalpWriteResetCommand (VOID)
 
DECLSPEC_NORETURN VOID HalpReboot (VOID)
 
VOID NTAPI HalReturnToFirmware (_In_ FIRMWARE_REENTRY Action)
 

Function Documentation

◆ HalpReboot()

DECLSPEC_NORETURN VOID HalpReboot ( VOID  )

Definition at line 25 of file reboot.c.

26{
28 UCHAR Data;
29 PVOID ZeroPageMapping;
30
31 /* Map the first physical page */
33 ZeroPageMapping = HalpMapPhysicalMemory64(PhysicalAddress, 1);
34
35 /* Enable warm reboot */
36 ((PUSHORT)ZeroPageMapping)[0x239] = 0x1234;
37
38 /* Lock CMOS Access (and disable interrupts) */
40
41 /* Setup control register B */
42 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0B);
44
45 /* Read periodic register and clear the interrupt enable */
47 WRITE_PORT_UCHAR((PUCHAR)0x71, Data & ~0x40);
49
50 /* Setup control register A */
51 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x0A);
53
54 /* Read divider rate and reset it */
56 WRITE_PORT_UCHAR((PUCHAR)0x71, (Data & ~0x9) | 0x06);
58
59 /* Reset neutral CMOS address */
60 WRITE_PORT_UCHAR((PUCHAR)0x70, 0x15);
62
63 /* Flush write buffers and send the reset command */
66
67 /* Halt the CPU */
68 __halt();
70}
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:81
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount)
Definition: memory.c:140
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:226
static VOID HalpWriteResetCommand(VOID)
Definition: reboot.c:17
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
#define UNREACHABLE
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
uint16_t * PUSHORT
Definition: typedefs.h:56
unsigned char * PUCHAR
Definition: typedefs.h:53
LONGLONG QuadPart
Definition: typedefs.h:114
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by HalReturnToFirmware().

◆ HalpWriteResetCommand()

static VOID HalpWriteResetCommand ( VOID  )
static

Definition at line 17 of file reboot.c.

18{
19 /* Generate RESET signal via keyboard controller */
20 WRITE_PORT_UCHAR((PUCHAR)0x64, 0xFE);
21};

Referenced by HalpReboot().

◆ HalReturnToFirmware()

VOID NTAPI HalReturnToFirmware ( _In_ FIRMWARE_REENTRY  Action)

Definition at line 80 of file reboot.c.

82{
83 /* Check what kind of action this is */
84 switch (Action)
85 {
86 /* All recognized actions */
87 case HalHaltRoutine:
91 {
92 /* Acquire the display */
94
95 /* Call the internal reboot function */
96 HalpReboot();
97 }
98
99 /* Anything else */
100 default:
101 {
102 /* Print message and break */
103 DbgPrint("HalReturnToFirmware called!\n");
105 }
106 }
107}
#define DbgPrint
Definition: hal.h:12
DECLSPEC_NORETURN VOID HalpReboot(VOID)
Definition: reboot.c:25
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:290
NTSYSAPI void WINAPI DbgBreakPoint(void)
@ HalRestartRoutine
Definition: haltypes.h:36
@ HalHaltRoutine
Definition: haltypes.h:34
@ HalPowerDownRoutine
Definition: haltypes.h:35
@ HalRebootRoutine
Definition: haltypes.h:37
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510