xref: /reactos/hal/halx86/apic/halinit.c (revision 09dde2cf)
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 #include <smp.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 VOID
17 NTAPI
18 ApicInitializeLocalApic(ULONG Cpu);
19 
20 /* FUNCTIONS ****************************************************************/
21 
22 VOID
23 NTAPI
24 HalpInitProcessor(
25     IN ULONG ProcessorNumber,
26     IN PLOADER_PARAMETER_BLOCK LoaderBlock)
27 {
28 #ifdef CONFIG_SMP
29     if (ProcessorNumber == 0)
30     {
31 #endif
32         HalpParseApicTables(LoaderBlock);
33 #ifdef CONFIG_SMP
34     }
35 
36     HalpSetupProcessorsTable(ProcessorNumber);
37 #endif
38 
39     /* Initialize the local APIC for this cpu */
40     ApicInitializeLocalApic(ProcessorNumber);
41 
42     /* Initialize profiling data (but don't start it) */
43     HalInitializeProfiling();
44 
45     /* Initialize the timer */
46     //ApicInitializeTimer(ProcessorNumber);
47 }
48 
49 VOID
50 HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
51 {
52     DPRINT1("Using HAL: APIC %s %s\n",
53             (HalpBuildType & PRCB_BUILD_UNIPROCESSOR) ? "UP" : "SMP",
54             (HalpBuildType & PRCB_BUILD_DEBUG) ? "DBG" : "REL");
55 
56     HalpPrintApicTables();
57 
58     /* Enable clock interrupt handler */
59     HalpEnableInterruptHandler(IDT_INTERNAL,
60                                0,
61                                APIC_CLOCK_VECTOR,
62                                CLOCK2_LEVEL,
63                                HalpClockInterrupt,
64                                Latched);
65 }
66 
67 VOID
68 HalpInitPhase1(VOID)
69 {
70     /* Initialize DMA. NT does this in Phase 0 */
71     HalpInitDma();
72 }
73 
74 /* EOF */
75