xref: /reactos/hal/halx86/apic/halinit.c (revision 81f8bcea)
1 /*
2  * PROJECT:     ReactOS Hardware Abstraction Layer
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Initialize the APIC HAL
5  * COPYRIGHT:   Copyright 2011 Timo Kreuzer <timo.kreuzer@reactos.org>
6  */
7 
8 /* INCLUDES *****************************************************************/
9 
10 #include <hal.h>
11 #include "apicp.h"
12 #define NDEBUG
13 #include <debug.h>
14 
15 VOID
16 NTAPI
17 ApicInitializeLocalApic(ULONG Cpu);
18 
19 /* FUNCTIONS ****************************************************************/
20 
21 VOID
22 NTAPI
23 HalpInitProcessor(
24     IN ULONG ProcessorNumber,
25     IN PLOADER_PARAMETER_BLOCK LoaderBlock)
26 {
27     /* Initialize the local APIC for this cpu */
28     ApicInitializeLocalApic(ProcessorNumber);
29 
30     /* Initialize profiling data (but don't start it) */
31     HalInitializeProfiling();
32 
33     /* Initialize the timer */
34     //ApicInitializeTimer(ProcessorNumber);
35 }
36 
37 VOID
38 HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
39 {
40     DPRINT1("Using HAL: APIC %s %s\n",
41             (HalpBuildType & PRCB_BUILD_UNIPROCESSOR) ? "UP" : "SMP",
42             (HalpBuildType & PRCB_BUILD_DEBUG) ? "DBG" : "REL");
43 
44     /* Enable clock interrupt handler */
45     HalpEnableInterruptHandler(IDT_INTERNAL,
46                                0,
47                                APIC_CLOCK_VECTOR,
48                                CLOCK2_LEVEL,
49                                HalpClockInterrupt,
50                                Latched);
51 }
52 
53 VOID
54 HalpInitPhase1(VOID)
55 {
56     /* Initialize DMA. NT does this in Phase 0 */
57     HalpInitDma();
58 }
59 
60 /* EOF */
61