Dynamically allocate active processors affinity map
This commit is contained in:
@@ -32,8 +32,12 @@ HL::Cpu::InitializeProcessor(VOID)
|
||||
ProcessorBlock->StallScaleFactor = INITIAL_STALL_FACTOR;
|
||||
ProcessorBlock->Idr = 0xFFFFFFFF;
|
||||
|
||||
/* Register this CPU in the global active processors map */
|
||||
KE::Affinity::AtomicSetProcessorAffinity(&ActiveProcessors, ProcessorBlock->CpuNumber);
|
||||
/* Check if active processors map is initialized */
|
||||
if(ActiveProcessors != NULLPTR)
|
||||
{
|
||||
/* Register this CPU in the global active processors map */
|
||||
KE::Affinity::AtomicSetProcessorAffinity(ActiveProcessors, ProcessorBlock->CpuNumber);
|
||||
}
|
||||
|
||||
/* Initialize APIC for this processor */
|
||||
HL::Pic::InitializePic();
|
||||
@@ -42,6 +46,27 @@ HL::Cpu::InitializeProcessor(VOID)
|
||||
HL::RunLevel::SetRunLevel(ProcessorBlock->RunLevel);
|
||||
}
|
||||
|
||||
XTAPI
|
||||
XTSTATUS
|
||||
HL::Cpu::InitializeProcessorAffinity(VOID)
|
||||
{
|
||||
XTSTATUS Status;
|
||||
|
||||
/* Allocate an array of pointers */
|
||||
Status = KE::Affinity::CreateAffinityMap(KE::Processor::GetInstalledCpus(), &ActiveProcessors);
|
||||
if(Status != STATUS_SUCCESS)
|
||||
{
|
||||
/* Failed to allocate memory, return error */
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Register BSP in the global active processors map */
|
||||
KE::Affinity::SetProcessorAffinity(ActiveProcessors, 0);
|
||||
|
||||
/* Return success */
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wakes up and initializes all Application Processors (APs) and transitions them into the active kernel.
|
||||
*
|
||||
|
||||
@@ -18,10 +18,11 @@ namespace HL
|
||||
class Cpu
|
||||
{
|
||||
private:
|
||||
STATIC KAFFINITY_MAP ActiveProcessors;
|
||||
STATIC PKAFFINITY_MAP ActiveProcessors;
|
||||
|
||||
public:
|
||||
STATIC XTAPI VOID InitializeProcessor(VOID);
|
||||
STATIC XTAPI XTSTATUS InitializeProcessorAffinity(VOID);
|
||||
STATIC XTAPI XTSTATUS StartAllProcessors(VOID);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ KE::KernelInit::BootstrapKernel(VOID)
|
||||
|
||||
/* Start all application processors */
|
||||
KE::Processor::InitializeProcessorBlocks();
|
||||
HL::Cpu::InitializeProcessorAffinity();
|
||||
HL::Cpu::StartAllProcessors();
|
||||
|
||||
/* Register DISPATCH interrupt handler */
|
||||
|
||||
@@ -119,6 +119,7 @@ KE::KernelInit::BootstrapKernel(VOID)
|
||||
|
||||
/* Start all application processors */
|
||||
KE::Processor::InitializeProcessorBlocks();
|
||||
HL::Cpu::InitializeProcessorAffinity();
|
||||
HL::Cpu::StartAllProcessors();
|
||||
|
||||
/* Register DISPATCH interrupt handler */
|
||||
|
||||
Reference in New Issue
Block a user