578d88324092f70fd7ce7acf99eadbe85f42b61e
[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 /* pci.c */
45 VOID HalpInitPciBus (VOID);
46
47 /* dma.c */
48 VOID HalpInitDma (VOID);
49
50 /* Non-generic initialization */
51 VOID HalpInitPhase0 (PLOADER_PARAMETER_BLOCK LoaderBlock);
52 VOID HalpInitPhase1(VOID);
53 VOID NTAPI HalpClockInterrupt(VOID);
54
55 //
56 // KD Support
57 //
58 VOID
59 NTAPI
60 HalpCheckPowerButton(
61 VOID
62 );
63
64 VOID
65 NTAPI
66 HalpRegisterKdSupportFunctions(
67 VOID
68 );
69
70 NTSTATUS
71 NTAPI
72 HalpSetupPciDeviceForDebugging(
73 IN PVOID LoaderBlock,
74 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
75 );
76
77 NTSTATUS
78 NTAPI
79 HalpReleasePciDeviceForDebugging(
80 IN OUT PDEBUG_DEVICE_DESCRIPTOR PciDevice
81 );
82
83 //
84 // Memory routines
85 //
86 PVOID
87 NTAPI
88 HalpMapPhysicalMemory64(
89 IN PHYSICAL_ADDRESS PhysicalAddress,
90 IN ULONG NumberPage
91 );
92
93 VOID
94 NTAPI
95 HalpUnmapVirtualAddress(
96 IN PVOID VirtualAddress,
97 IN ULONG NumberPages
98 );
99
100 /* sysinfo.c */
101 NTSTATUS
102 NTAPI
103 HaliQuerySystemInformation(
104 IN HAL_QUERY_INFORMATION_CLASS InformationClass,
105 IN ULONG BufferSize,
106 IN OUT PVOID Buffer,
107 OUT PULONG ReturnedLength
108 );
109
110 NTSTATUS
111 NTAPI
112 HaliSetSystemInformation(
113 IN HAL_SET_INFORMATION_CLASS InformationClass,
114 IN ULONG BufferSize,
115 IN OUT PVOID Buffer
116 );
117
118 //
119 // BIOS Routines
120 //
121 BOOLEAN
122 NTAPI
123 HalpBiosDisplayReset(
124 VOID
125 );
126
127 ULONG
128 NTAPI
129 HalpBorrowTss(
130 VOID
131 );
132
133 ULONG
134 NTAPI
135 HalpReturnTss(
136 ULONG SavedTss
137 );
138
139 VOID
140 NTAPI
141 HalpBiosCall(
142 VOID
143 );
144
145 VOID
146 NTAPI
147 HalpTrap0D(
148 VOID
149 );
150
151 VOID
152 NTAPI
153 HalpTrap06(
154 VOID
155 );
156
157 #ifdef _M_AMD64
158 #define KfLowerIrql KeLowerIrql
159 #ifndef CONFIG_SMP
160 /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */
161 #define KiAcquireSpinLock(SpinLock)
162 #define KiReleaseSpinLock(SpinLock)
163 #define KfAcquireSpinLock(SpinLock) KfRaiseIrql(DISPATCH_LEVEL);
164 #define KfReleaseSpinLock(SpinLock, OldIrql) KeLowerIrql(OldIrql);
165 #endif // !CONFIG_SMP
166 #endif // _M_AMD64
167
168 extern PVOID HalpRealModeStart;
169 extern PVOID HalpRealModeEnd;
170
171 extern KSPIN_LOCK HalpSystemHardwareLock;
172
173 #endif /* __INTERNAL_HAL_HAL_H */