3322643ec01127ffa590ed26ac46b5efd53b83db
[reactos.git] / reactos / hal / halx86 / generic / misc.c
1 /*
2 * PROJECT: ReactOS HAL
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: hal/halx86/generic/misc.c
5 * PURPOSE: Miscellanous Routines
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 * Eric Kohl (ekohl@abo.rhein-zeitung.de)
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #include <hal.h>
13 #define NDEBUG
14 #include <debug.h>
15
16 /* PRIVATE FUNCTIONS *********************************************************/
17
18 VOID
19 NTAPI
20 HalpCheckPowerButton(VOID)
21 {
22 /* Nothing to do on non-ACPI */
23 return;
24 }
25
26 PVOID
27 NTAPI
28 HalpMapPhysicalMemory64(IN PHYSICAL_ADDRESS PhysicalAddress,
29 IN ULONG NumberPage)
30 {
31 /* Use kernel memory manager I/O map facilities */
32 return MmMapIoSpace(PhysicalAddress,
33 NumberPage << PAGE_SHIFT,
34 MmNonCached);
35 }
36
37 VOID
38 NTAPI
39 HalpUnmapVirtualAddress(IN PVOID VirtualAddress,
40 IN ULONG NumberPages)
41 {
42 /* Use kernel memory manager I/O map facilities */
43 MmUnmapIoSpace(VirtualAddress, NumberPages << PAGE_SHIFT);
44 }
45
46 /* FUNCTIONS *****************************************************************/
47
48 /*
49 * @implemented
50 */
51 VOID
52 NTAPI
53 HalHandleNMI(IN PVOID NmiInfo)
54 {
55 UCHAR ucStatus;
56
57 /* Get the NMI Flag */
58 ucStatus = READ_PORT_UCHAR((PUCHAR)0x61);
59
60 /* Display NMI failure string */
61 HalDisplayString ("\n*** Hardware Malfunction\n\n");
62 HalDisplayString ("Call your hardware vendor for support\n\n");
63
64 /* Check for parity error */
65 if (ucStatus & 0x80)
66 {
67 /* Display message */
68 HalDisplayString ("NMI: Parity Check / Memory Parity Error\n");
69 }
70
71 /* Check for I/O failure */
72 if (ucStatus & 0x40)
73 {
74 /* Display message */
75 HalDisplayString ("NMI: Channel Check / IOCHK\n");
76 }
77
78 /* Halt the system */
79 HalDisplayString("\n*** The system has halted ***\n");
80 KeEnterKernelDebugger();
81 }
82
83 /*
84 * @implemented
85 */
86 BOOLEAN
87 FASTCALL
88 HalSystemVectorDispatchEntry(IN ULONG Vector,
89 OUT PKINTERRUPT_ROUTINE **FlatDispatch,
90 OUT PKINTERRUPT_ROUTINE *NoConnection)
91 {
92 /* Not implemented on x86 */
93 return FALSE;
94 }
95
96 /*
97 * @implemented
98 */
99 VOID
100 NTAPI
101 KeFlushWriteBuffer(VOID)
102 {
103 /* Not implemented on x86 */
104 return;
105 }