/** The function is invoked after SMBASE relocation in S3 path to restors CPU status. The function is invoked after SMBASE relocation in S3 path. It restores configuration according to data saved by normal boot path for both BSP and APs. **/ VOID InitializeCpu ( VOID ) { CPU_REGISTER_TABLE *RegisterTableList; UINT32 InitApicId; UINTN Index; RegisterTableList = (CPU_REGISTER_TABLE *) (UINTN) mAcpiCpuData.RegisterTable; InitApicId = GetInitialApicId (); for (Index = 0; Index < mAcpiCpuData.NumberOfCpus; Index++) { if (RegisterTableList[Index].InitialApicId == InitApicId) { SetProcessorRegister (&RegisterTableList[Index]); break; } } mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1; mExchangeInfo->ApFunction = (VOID *) (UINTN) MPRendezvousProcedure; // // Send INIT IPI - SIPI to all APs // SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector); while (mNumberToFinish > 0) { CpuPause (); } }
/** The function is invoked after SMBASE relocation in S3 path to restores CPU status. The function is invoked after SMBASE relocation in S3 path. It restores configuration according to data saved by normal boot path for both BSP and APs. **/ VOID InitializeCpu ( VOID ) { CPU_REGISTER_TABLE *RegisterTableList; UINT32 InitApicId; UINTN Index; RegisterTableList = (CPU_REGISTER_TABLE *) (UINTN) mAcpiCpuData.RegisterTable; InitApicId = GetInitialApicId (); for (Index = 0; Index < mAcpiCpuData.NumberOfCpus; Index++) { if (RegisterTableList[Index].InitialApicId == InitApicId) { SetProcessorRegister (&RegisterTableList[Index]); break; } } mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1; // // StackStart was updated when APs were waken up in EarlyInitializeCpu. // Re-initialize StackAddress to original beginning address. // mExchangeInfo->StackStart = (VOID *) (UINTN) mAcpiCpuData.StackAddress; mExchangeInfo->ApFunction = (VOID *) (UINTN) MPRendezvousProcedure; // // Send INIT IPI - SIPI to all APs // SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector); while (mNumberToFinish > 0) { CpuPause (); } }
/** The function is invoked before SMBASE relocation in S3 path to restores CPU status. The function is invoked before SMBASE relocation in S3 path. It does first time microcode load and restores MTRRs for both BSP and APs. **/ VOID InitializeCpuBeforeRebase ( VOID ) { LoadMtrrData (mAcpiCpuData.MtrrTable); SetProcessorRegister ((CPU_REGISTER_TABLE *) (UINTN) mAcpiCpuData.PreSmmInitRegisterTable, mAcpiCpuData.NumberOfCpus); ProgramVirtualWireMode (); PrepareApStartupVector (mAcpiCpuData.StartupVector); mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1; mExchangeInfo->ApFunction = (VOID *) (UINTN) InitializeAp; // // Execute code for before SmmBaseReloc. Note: This flag is maintained across S3 boots. // mInitApsAfterSmmBaseReloc = FALSE; // // Send INIT IPI - SIPI to all APs // SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector); while (mNumberToFinish > 0) { CpuPause (); } }
/** The function is invoked before SMBASE relocation in S3 path to restors CPU status. The function is invoked before SMBASE relocation in S3 path. It does first time microcode load and restores MTRRs for both BSP and APs. **/ VOID EarlyInitializeCpu ( VOID ) { CPU_REGISTER_TABLE *RegisterTableList; UINT32 InitApicId; UINTN Index; LoadMtrrData (mAcpiCpuData.MtrrTable); // // Find processor number for this CPU. // RegisterTableList = (CPU_REGISTER_TABLE *) (UINTN) mAcpiCpuData.PreSmmInitRegisterTable; InitApicId = GetInitialApicId (); for (Index = 0; Index < mAcpiCpuData.NumberOfCpus; Index++) { if (RegisterTableList[Index].InitialApicId == InitApicId) { SetProcessorRegister (&RegisterTableList[Index]); break; } } ProgramVirtualWireMode (); PrepareAPStartupVector (mAcpiCpuData.StartupVector); mNumberToFinish = mAcpiCpuData.NumberOfCpus - 1; mExchangeInfo->ApFunction = (VOID *) (UINTN) EarlyMPRendezvousProcedure; // // Send INIT IPI - SIPI to all APs // SendInitSipiSipiAllExcludingSelf ((UINT32)mAcpiCpuData.StartupVector); while (mNumberToFinish > 0) { CpuPause (); } }