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)
10 /* INCLUDES ******************************************************************/
14 /* PRIVATE FUNCTIONS *********************************************************/
17 HalpWriteResetCommand(VOID
)
19 /* Generate RESET signal via keyboard controller */
20 WRITE_PORT_UCHAR((PUCHAR
)0x64, 0xFE);
27 PHYSICAL_ADDRESS PhysicalAddress
;
29 PVOID ZeroPageMapping
;
31 /* Map the first physical page */
32 PhysicalAddress
.QuadPart
= 0;
33 ZeroPageMapping
= HalpMapPhysicalMemory64(PhysicalAddress
, 1);
35 /* Enable warm reboot */
36 ((PUSHORT
)ZeroPageMapping
)[0x239] = 0x1234;
38 /* Lock CMOS Access (and disable interrupts) */
39 HalpAcquireCmosSpinLock();
41 /* Setup control register B */
42 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x0B);
43 KeStallExecutionProcessor(1);
45 /* Read periodic register and clear the interrupt enable */
46 Data
= READ_PORT_UCHAR((PUCHAR
)0x71);
47 WRITE_PORT_UCHAR((PUCHAR
)0x71, Data
& ~0x40);
48 KeStallExecutionProcessor(1);
50 /* Setup control register A */
51 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x0A);
52 KeStallExecutionProcessor(1);
54 /* Read divider rate and reset it */
55 Data
= READ_PORT_UCHAR((PUCHAR
)0x71);
56 WRITE_PORT_UCHAR((PUCHAR
)0x71, (Data
& ~0x9) | 0x06);
57 KeStallExecutionProcessor(1);
59 /* Reset neutral CMOS address */
60 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x15);
61 KeStallExecutionProcessor(1);
63 /* Flush write buffers and send the reset command */
65 HalpWriteResetCommand();
72 /* PUBLIC FUNCTIONS **********************************************************/
81 _In_ FIRMWARE_REENTRY Action
)
83 /* Check what kind of action this is */
86 /* All recognized actions */
88 case HalPowerDownRoutine
:
89 case HalRestartRoutine
:
90 case HalRebootRoutine
:
92 /* Acquire the display */
93 InbvAcquireDisplayOwnership();
95 /* Call the internal reboot function */
102 /* Print message and break */
103 DbgPrint("HalReturnToFirmware called!\n");