ReactOS  0.4.15-dev-2720-g5ee0925
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 }
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
unsigned char * PUCHAR
Definition: retypes.h:3
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG _In_opt_ PVOID Data
Definition: wdfdevice.h:4527
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1715
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN ULONG NumberPage)
Definition: misc.c:28
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:227
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
unsigned char UCHAR
Definition: xmlstorage.h:181
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
VOID NTAPI HalpWriteResetCommand(VOID)
Definition: reboot.c:20
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
unsigned short * PUSHORT
Definition: retypes.h:2
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:95
LONGLONG QuadPart
Definition: typedefs.h:114

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
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21

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
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:528
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:506