[ntoskrnl]
[reactos.git] / reactos / hal / halx86 / include / halp.h
1 /*
2 *
3 */
4
5 #ifndef __INTERNAL_HAL_HAL_H
6 #define __INTERNAL_HAL_HAL_H
7
8 #define HAL_APC_REQUEST 0
9 #define HAL_DPC_REQUEST 1
10
11 /* CMOS Registers and Ports */
12 #define CMOS_CONTROL_PORT (PUCHAR)0x70
13 #define CMOS_DATA_PORT (PUCHAR)0x71
14 #define RTC_REGISTER_A 0x0A
15 #define RTC_REGISTER_B 0x0B
16 #define RTC_REG_A_UIP 0x80
17 #define RTC_REGISTER_CENTURY 0x32
18
19 /* Timer Registers and Ports */
20 #define TIMER_CONTROL_PORT 0x43
21 #define TIMER_DATA_PORT0 0x40
22 #define TIMER_SC0 0
23 #define TIMER_BOTH 0x30
24 #define TIMER_MD2 0x4
25
26 /* Conversion functions */
27 #define BCD_INT(bcd) \
28 (((bcd & 0xF0) >> 4) * 10 + (bcd & 0x0F))
29 #define INT_BCD(int) \
30 (UCHAR)(((int / 10) << 4) + (int % 10))
31
32 /* adapter.c */
33 PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses);
34
35 /* bus.c */
36 VOID NTAPI HalpInitNonBusHandler (VOID);
37
38 /* irql.c */
39 VOID NTAPI HalpInitPICs(VOID);
40
41 /* udelay.c */
42 VOID NTAPI HalpInitializeClock(VOID);
43
44 VOID
45 NTAPI
46 HalpCalibrateStallExecution(VOID);
47
48 ULONG
49 NTAPI
50 HalpQuery8254Counter(
51 VOID
52 );
53
54 /* pci.c */
55 VOID HalpInitPciBus (VOID);
56
57 /* dma.c */
58 VOID HalpInitDma (VOID);
59
60 /* Non-generic initialization */
61 VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
62 VOID HalpInitPhase1(VOID);
63 VOID NTAPI HalpClockInterrupt(VOID);
64
65 //
66 // KD Support
67 //
68 VOID
69 NTAPI
70 HalpCheckPowerButton(
71 VOID
72 );
73
74 VOID
75 NTAPI
76 HalpRegisterKdSupportFunctions(
77 VOID
78 );
79
80 NTSTATUS
81 NTAPI
82 HalpSetupPciDeviceForDebugging(
83 IN PVOID LoaderBlock,
84 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
85 );
86
87 NTSTATUS
88 NTAPI
89 HalpReleasePciDeviceForDebugging(
90 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
91 );
92
93 //
94 // Memory routines
95 //
96 PVOID
97 NTAPI
98 HalpMapPhysicalMemory64(
99 IN PHYSICAL_ADDRESS PhysicalAddress,
100 IN ULONG NumberPage
101 );
102
103 VOID
104 NTAPI
105 HalpUnmapVirtualAddress(
106 IN PVOID VirtualAddress,
107 IN ULONG NumberPages
108 );
109
110 /* sysinfo.c */
111 NTSTATUS
112 NTAPI
113 HaliQuerySystemInformation(
114 IN HAL_QUERY_INFORMATION_CLASS InformationClass,
115 IN ULONG BufferSize,
116 IN OUT PVOID Buffer,
117 OUT PULONG ReturnedLength
118 );
119
120 NTSTATUS
121 NTAPI
122 HaliSetSystemInformation(
123 IN HAL_SET_INFORMATION_CLASS InformationClass,
124 IN ULONG BufferSize,
125 IN OUT PVOID Buffer
126 );
127
128 //
129 // BIOS Routines
130 //
131 BOOLEAN
132 NTAPI
133 HalpBiosDisplayReset(
134 VOID
135 );
136
137 ULONG
138 NTAPI
139 HalpBorrowTss(
140 VOID
141 );
142
143 ULONG
144 NTAPI
145 HalpReturnTss(
146 ULONG SavedTss
147 );
148
149 VOID
150 NTAPI
151 HalpBiosCall(
152 VOID
153 );
154
155 VOID
156 NTAPI
157 HalpTrap0D(
158 VOID
159 );
160
161 VOID
162 NTAPI
163 HalpTrap06(
164 VOID
165 );
166
167 #ifdef _M_AMD64
168 #define KfLowerIrql KeLowerIrql
169 #ifndef CONFIG_SMP
170 /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
171 #define KiAcquireSpinLock(SpinLock)
172 #define KiReleaseSpinLock(SpinLock)
173 #define KfAcquireSpinLock(SpinLock) KfRaiseIrql(DISPATCH_LEVEL);
174 #define KfReleaseSpinLock(SpinLock, OldIrql) KeLowerIrql(OldIrql);
175 #endif // !CONFIG_SMP
176 #endif // _M_AMD64
177
178 extern PVOID HalpRealModeStart;
179 extern PVOID HalpRealModeEnd;
180
181 extern KSPIN_LOCK HalpSystemHardwareLock;
182
183 #endif /* __INTERNAL_HAL_HAL_H */