ReactOS 0.4.15-dev-5893-g1bb4167
reboot.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS HAL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/generic/reboot.c
5 * PURPOSE: Reboot functions
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Eric Kohl
8 */
9
10/* INCLUDES ******************************************************************/
11
12#include <hal.h>
13#define NDEBUG
14#include <debug.h>
15
16/* PRIVATE FUNCTIONS *********************************************************/
17
18VOID
21{
22 /* Generate RESET signal via keyboard controller */
23 WRITE_PORT_UCHAR((PUCHAR)0x64, 0xFE);
24};
25
26VOID
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 */
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 */
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}
73
74/* PUBLIC FUNCTIONS **********************************************************/
75
76/*
77 * @implemented
78 */
79VOID
82{
83 /* Check what kind of action this is */
84 switch (Action)
85 {
86 /* All recognized actions */
87 case HalHaltRoutine:
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");
104 }
105}
106
107/* EOF */
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
Definition: ntoskrnl.c:81
VOID NTAPI KeFlushWriteBuffer(VOID)
Definition: misc.c:39
#define DbgPrint
Definition: hal.h:12
PVOID NTAPI HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress, IN PFN_COUNT PageCount)
Definition: memory.c:140
VOID NTAPI HalpAcquireCmosSpinLock(VOID)
Definition: spinlock.c:226
VOID NTAPI HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
Definition: reboot.c:22
VOID NTAPI HalpWriteResetCommand(VOID)
Definition: reboot.c:20
VOID NTAPI HalpReboot(VOID)
Definition: reboot.c:28
VOID NTAPI InbvAcquireDisplayOwnership(VOID)
Definition: inbv.c:289
NTSYSAPI void WINAPI DbgBreakPoint(void)
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
enum _FIRMWARE_REENTRY FIRMWARE_REENTRY
@ HalHaltRoutine
Definition: haltypes.h:34
@ HalRebootRoutine
Definition: haltypes.h:37
#define READ_PORT_UCHAR(p)
Definition: pc98vid.h:22
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
#define NTAPI
Definition: typedefs.h:36
uint16_t * PUSHORT
Definition: typedefs.h:56
#define IN
Definition: typedefs.h:39
unsigned char * PUCHAR
Definition: typedefs.h:53
LONGLONG QuadPart
Definition: typedefs.h:114
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
Definition: iotypes.h:1098
unsigned char UCHAR
Definition: xmlstorage.h:181