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 ******************************************************************/
16 /* PRIVATE FUNCTIONS *********************************************************/
20 HalpWriteResetCommand(VOID
)
22 /* Generate RESET signal via keyboard controller */
23 WRITE_PORT_UCHAR((PUCHAR
)0x64, 0xFE);
30 PHYSICAL_ADDRESS PhysicalAddress
;
32 PVOID ZeroPageMapping
;
34 /* Map the first physical page */
35 PhysicalAddress
.QuadPart
= 0;
36 ZeroPageMapping
= HalpMapPhysicalMemory64(PhysicalAddress
, 1);
38 /* Enable warm reboot */
39 ((PUSHORT
)ZeroPageMapping
)[0x239] = 0x1234;
41 /* Lock CMOS Access (and disable interrupts) */
42 HalpAcquireCmosSpinLock();
44 /* Setup control register B */
45 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x0B);
46 KeStallExecutionProcessor(1);
48 /* Read periodic register and clear the interrupt enable */
49 Data
= READ_PORT_UCHAR((PUCHAR
)0x71);
50 WRITE_PORT_UCHAR((PUCHAR
)0x71, Data
& ~0x40);
51 KeStallExecutionProcessor(1);
53 /* Setup control register A */
54 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x0A);
55 KeStallExecutionProcessor(1);
57 /* Read divider rate and reset it */
58 Data
= READ_PORT_UCHAR((PUCHAR
)0x71);
59 WRITE_PORT_UCHAR((PUCHAR
)0x71, (Data
& ~0x9) | 0x06);
60 KeStallExecutionProcessor(1);
62 /* Reset neutral CMOS address */
63 WRITE_PORT_UCHAR((PUCHAR
)0x70, 0x15);
64 KeStallExecutionProcessor(1);
66 /* Flush write buffers and send the reset command */
68 HalpWriteResetCommand();
74 /* PUBLIC FUNCTIONS **********************************************************/
81 HalReturnToFirmware(IN FIRMWARE_REENTRY Action
)
83 /* Check what kind of action this is */
86 /* All recognized actions */
88 case HalRebootRoutine
:
91 /* Acquire the display */
92 InbvAcquireDisplayOwnership();
95 /* Call the internal reboot function */
101 /* Print message and break */
102 DbgPrint("HalReturnToFirmware called!\n");