EFI_STATUS EFIAPI PlatformEarlyInitEntry ( IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices ) { EFI_STATUS Status; SYSTEM_CONFIGURATION SystemConfiguration; EFI_PLATFORM_INFO_HOB *PlatformInfo; EFI_PEI_HOB_POINTERS Hob; EFI_PLATFORM_CPU_INFO PlatformCpuInfo; // // Initialize SmbusPolicy PPI // Status = (*PeiServices)->InstallPpi(PeiServices, &mInstallSmbusPolicyPpi); ASSERT_EFI_ERROR (Status); // // Initialize Stall PPIs // Status = (*PeiServices)->InstallPpi (PeiServices, &mInstallStallPpi); ASSERT_EFI_ERROR (Status); // // Initialize platform PPIs // Status = (*PeiServices)->InstallPpi (PeiServices, &mInstallSpeakerInterfacePpi); ASSERT_EFI_ERROR (Status); // // Variable initialization // ZeroMem(&PlatformCpuInfo, sizeof(EFI_PLATFORM_CPU_INFO)); // // Set the some PCI and chipset range as UC // And align to 1M at leaset // Hob.Raw = GetFirstGuidHob (&gEfiPlatformInfoGuid); ASSERT (Hob.Raw != NULL); PlatformInfo = GET_GUID_HOB_DATA(Hob.Raw); // // Initialize PlatformInfo HOB // MultiPlatformInfoInit(PeiServices, PlatformInfo); // // Do basic MCH init // MchInit (PeiServices); // // Set the new boot mode // Status = UpdateBootMode (PeiServices, PlatformInfo); ASSERT_EFI_ERROR (Status); SetPlatformBootMode (PeiServices, PlatformInfo); // // Get setup variable. This can only be done after BootMode is updated // GetSetupVariable (PeiServices, &SystemConfiguration); CheckOsSelection(PeiServices, &SystemConfiguration); // // Update PlatformInfo HOB according to setup variable // PlatformInfoUpdate(PeiServices, PlatformInfo, &SystemConfiguration); InitializePlatform (PeiServices, PlatformInfo, &SystemConfiguration); // // Initialize VlvPolicy PPI // Status = VlvPolicyInit (PeiServices, &SystemConfiguration); ASSERT_EFI_ERROR (Status); // // Soc specific GPIO setting // ConfigureSoCGpio(&SystemConfiguration); // // Baylake Board specific. // if (PlatformInfo->BoardId == BOARD_ID_BL_RVP || PlatformInfo->BoardId == BOARD_ID_BL_FFRD || PlatformInfo->BoardId == BOARD_ID_BL_FFRD8 || PlatformInfo->BoardId == BOARD_ID_BL_RVP_DDR3L || PlatformInfo->BoardId == BOARD_ID_BL_STHI || PlatformInfo->BoardId == BOARD_ID_BB_RVP || PlatformInfo->BoardId == BOARD_ID_BS_RVP || PlatformInfo->BoardId == BOARD_ID_MINNOW2 || PlatformInfo->BoardId == BOARD_ID_MINNOW2_TURBOT|| PlatformInfo->BoardId == BOARD_ID_CVH) { ConfigureLpssAndSccGpio(&SystemConfiguration, PlatformInfo); } // // Configure LPE // Alpine Valley and Bayley Bay board specific // ConfigureLpeGpio(&SystemConfiguration); // // Bayley Bay Board specific. // ConfigureSciSmiGpioRout(PlatformInfo); if (SystemConfiguration.LpssI2C3Enabled == 1) { ConfigureMipiCsi(); } // // Do basic CPU init // Status = PlatformCpuInit (PeiServices, &SystemConfiguration, &PlatformCpuInfo); // // Perform basic SSA related platform initialization // PlatformSsaInit (&SystemConfiguration,PeiServices); // // Do basic PCH init // Status = PlatformPchInit (&SystemConfiguration, PeiServices, PlatformInfo->PlatformType); ASSERT_EFI_ERROR (Status); // // Initialize platform PPIs // Status = (*PeiServices)->InstallPpi (PeiServices, &mPpiList[0]); ASSERT_EFI_ERROR (Status); if (PlatformInfo->BoardId != BOARD_ID_CVH) { InstallPlatformClocksNotify (PeiServices); InstallPlatformSysCtrlGPIONotify(PeiServices); } // // Initialize platform PPIs // Status = (*PeiServices)->NotifyPpi(PeiServices, &mNotifyList[0]); ASSERT_EFI_ERROR (Status); // // Initialize Measured Boot // Status = MeasuredBootInit (PeiServices, &SystemConfiguration); ASSERT_EFI_ERROR (Status); return Status; }
/** This is the entry point of PEIM @param[in] FileHandle Handle of the file being invoked. @param[in] PeiServices Describes the list of possible PEI Services. @retval EFI_SUCCESS If it is completed successfully. **/ EFI_STATUS EFIAPI PeiInitPlatform ( IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices ) { EFI_STATUS Status = EFI_SUCCESS; UINTN Size; SYSTEM_CONFIGURATION SystemConfiguration; // // Get setup variable. This can only be done after BootMode is updated // Status = GetSetupVariable (PeiServices, &SystemConfiguration); Size = sizeof(SYSTEM_CONFIGURATION); if(EFI_ERROR(Status)){ // // For OC solution, there is no setup variable, so set the SystemConfiguration with default value. // CopyMem(&SystemConfiguration, &gDefaultSystemConfiguration,Size); // // Update the values according to PCD settings // // // Platform // SystemConfiguration.TurboModeEnable = PcdGet8(PcdTurboMode); // // South Complex // SystemConfiguration.SccSdcardEnabled = PcdGet8(PcdSdcardMode); SystemConfiguration.LpssHsuart0Enabled = PcdGet8(PcdEnableHsuart0); SystemConfiguration.LpssHsuart1Enabled = PcdGet8(PcdEnableHsuart1); SystemConfiguration.PchAzalia = PcdGet8(PcdEnableAzalia); SystemConfiguration.PchSata = PcdGet8(PcdEnableSata); SystemConfiguration.PchUsb30Mode = PcdGet8(PcdEnableXhci); SystemConfiguration.PchLpeEnabled = PcdGet8(PcdEnableLpe); SystemConfiguration.LpssDma0Enabled = PcdGet8(PcdEnableDma0); SystemConfiguration.LpssDma1Enabled = PcdGet8(PcdEnableDma1); SystemConfiguration.LpssI2C0Enabled = PcdGet8(PcdEnableI2C0); SystemConfiguration.LpssI2C1Enabled = PcdGet8(PcdEnableI2C1); SystemConfiguration.LpssI2C2Enabled = PcdGet8(PcdEnableI2C2); SystemConfiguration.LpssI2C3Enabled = PcdGet8(PcdEnableI2C3); SystemConfiguration.LpssI2C4Enabled = PcdGet8(PcdEnableI2C4); SystemConfiguration.LpssI2C5Enabled = PcdGet8(PcdEnableI2C5); SystemConfiguration.LpssI2C6Enabled = PcdGet8(PcdEnableI2C6); SystemConfiguration.ScceMMCEnabled = PcdGet8(PcdEmmcMode); SystemConfiguration.SataInterfaceSpeed = PcdGet8(PcdSataInterfaceSpeed); SystemConfiguration.ISPEn = PcdGet8(ISPEnable); SystemConfiguration.ISPDevSel = PcdGet8(ISPPciDevConfig); SystemConfiguration.PchSata = PcdGet8(PcdEnableSata); SystemConfiguration.MrcDvfsEnable = PcdGet8(PcdDvfsEnable); SystemConfiguration.PnpSettings = PcdGet8(PcdPnpSettings); // // North Complex // SystemConfiguration.GTTSize = PcdGet8(PcdGttSize); SystemConfiguration.IgdApertureSize = PcdGet8(PcdApertureSize); SystemConfiguration.IgdDvmt50PreAlloc = PcdGet8(PcdIgdDvmt50PreAlloc); SystemConfiguration.TSEGSizeSel = (UINT8)PcdGet16(PcdMrcInitTsegSize); DEBUG ((EFI_D_INFO, "PeiInitPlatform(): GetSetupVariable returns EFI_NOT_FOUND!! \n")); }else { // Chipsec: Go thrugh all setup items is corrupted one by one CheckSetupVarItem(&SystemConfiguration); } PcdSetPtr (PcdSystemConfiguration, &Size, &SystemConfiguration); DEBUG ((EFI_D_INFO, "PcdSystemConfiguration size - 0x%x\n", LibPcdGetExSize(&gEfiEdkIIPlatformTokenSpaceGuid, PcdTokenEx(&gEfiEdkIIPlatformTokenSpaceGuid, PcdSystemConfiguration)) )); // // Initialize Stall PPIs // Status = (*PeiServices)->InstallPpi (PeiServices, &mInstallStallPpi[0]); ASSERT_EFI_ERROR (Status); Status = (*PeiServices)->NotifyPpi (PeiServices, &mMemoryDiscoveredNotifyList[0]); ASSERT_EFI_ERROR (Status); Status = (*PeiServices)->NotifyPpi (PeiServices, &mEndOfPeiNotifyList[0]); ASSERT_EFI_ERROR (Status); // // Start board detection // Status = PeiServicesInstallPpi (mBoardDetectionStartPpi); ASSERT_EFI_ERROR (Status); // // Set the new boot mode for MRC // Status = UpdateBootMode (PeiServices); ASSERT_EFI_ERROR (Status); return Status; }