Reactos
at master 78 lines 2.0 kB view raw
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 16VOID 17NTAPI 18ApicInitializeLocalApic(ULONG Cpu); 19 20/* FUNCTIONS ****************************************************************/ 21 22VOID 23NTAPI 24HalpInitProcessor( 25 IN ULONG ProcessorNumber, 26 IN PLOADER_PARAMETER_BLOCK LoaderBlock) 27{ 28 if (ProcessorNumber == 0) 29 { 30 HalpParseApicTables(LoaderBlock); 31 } 32 33 HalpSetupProcessorsTable(ProcessorNumber); 34 35 /* Initialize the local APIC for this cpu */ 36 ApicInitializeLocalApic(ProcessorNumber); 37 38 /* Initialize profiling data (but don't start it) */ 39 HalInitializeProfiling(); 40 41 /* Initialize the timer */ 42 //ApicInitializeTimer(ProcessorNumber); 43} 44 45VOID 46HalpInitPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock) 47{ 48 DPRINT1("Using HAL: APIC %s %s\n", 49 (HalpBuildType & PRCB_BUILD_UNIPROCESSOR) ? "UP" : "SMP", 50 (HalpBuildType & PRCB_BUILD_DEBUG) ? "DBG" : "REL"); 51 52 HalpPrintApicTables(); 53 54 /* Enable clock interrupt handler */ 55 HalpEnableInterruptHandler(IDT_INTERNAL, 56 0, 57 APIC_CLOCK_VECTOR, 58 CLOCK2_LEVEL, 59 HalpClockInterrupt, 60 Latched); 61 62 /* Enable profile interrupt handler */ 63 HalpEnableInterruptHandler(IDT_DEVICE, 64 0, 65 APIC_PROFILE_VECTOR, 66 APIC_PROFILE_LEVEL, 67 HalpProfileInterrupt, 68 Latched); 69} 70 71VOID 72HalpInitPhase1(VOID) 73{ 74 /* Initialize DMA. NT does this in Phase 0 */ 75 HalpInitDma(); 76} 77 78/* EOF */