/** * Enable Application Power Management (APM) * * @param[in] EntryPoint Timepoint designator. * @param[in] PlatformConfig Contains the runtime modifiable feature input data. * @param[in] StdHeader Config Handle for library, services. * * @retval AGESA_SUCCESS Always succeeds. * */ AGESA_STATUS InitializeApmFeature ( IN UINT64 EntryPoint, IN PLATFORM_CONFIGURATION *PlatformConfig, IN AMD_CONFIG_PARAMS *StdHeader ) { APM_FAMILY_SERVICES *FamilyServices; IDS_HDT_CONSOLE (CPU_TRACE, " APM mode is enabled\n"); GetFeatureServicesOfCurrentCore (&ApmFamilyServiceTable, (CONST VOID **)&FamilyServices, StdHeader); if ((EntryPoint & CPU_FEAT_AFTER_POST_MTRR_SYNC) != 0) { FamilyServices->ProgramApmWeights (FamilyServices, StdHeader); } else if ((EntryPoint & CPU_FEAT_AFTER_RESUME_MTRR_SYNC) != 0) { if (!CheckPspPlatformSecureEnable ()) { FamilyServices->ProgramApmWeights (FamilyServices, StdHeader); } } else { FamilyServices->EnableApm (FamilyServices, StdHeader); } return AGESA_SUCCESS; }
/** * Should Application Power Management (APM) be enabled * * @param[in] PlatformConfig Contains the runtime modifiable feature input data. * @param[in] StdHeader Config Handle for library, services. * * @retval TRUE APM is supported. * @retval FALSE APM cannot be enabled. * */ BOOLEAN STATIC IsApmFeatureEnabled ( IN PLATFORM_CONFIGURATION *PlatformConfig, IN AMD_CONFIG_PARAMS *StdHeader ) { UINT32 Socket; BOOLEAN IsEnabled; APM_FAMILY_SERVICES *FamilyServices; IsEnabled = FALSE; for (Socket = 0; Socket < GetPlatformNumberOfSockets (); Socket++) { if (IsProcessorPresent (Socket, StdHeader)) { GetFeatureServicesOfSocket (&ApmFamilyServiceTable, Socket, (CONST VOID **)&FamilyServices, StdHeader); if (FamilyServices != NULL) { if (FamilyServices->IsApmSupported (FamilyServices, PlatformConfig, Socket, StdHeader)) { IsEnabled = TRUE; break; } } } } return IsEnabled; }
/** * AP task to enable APM * * @param[in] StdHeader Config Handle for library, services. * */ VOID EnableApmOnSocket ( IN AMD_CONFIG_PARAMS *StdHeader ) { APM_FAMILY_SERVICES *FamilyServices; GetFeatureServicesOfCurrentCore (&ApmFamilyServiceTable, (CONST VOID **)&FamilyServices, StdHeader); FamilyServices->EnableApmOnSocket (FamilyServices, StdHeader); }
/** * Should Application Power Management (APM) be enabled * * @param[in] PlatformConfig Contains the runtime modifiable feature input data. * @param[in] StdHeader Config Handle for library, services. * * @retval TRUE APM is supported. * @retval FALSE APM cannot be enabled. * */ BOOLEAN IsApmFeatureEnabled ( IN PLATFORM_CONFIGURATION *PlatformConfig, IN AMD_CONFIG_PARAMS *StdHeader ) { BOOLEAN IsEnabled; APM_FAMILY_SERVICES *FamilyServices; IsEnabled = FALSE; GetFeatureServicesOfCurrentCore (&ApmFamilyServiceTable, (CONST VOID **)&FamilyServices, StdHeader); if (FamilyServices != NULL) { if (FamilyServices->IsApmSupported (FamilyServices, PlatformConfig, StdHeader)) { IsEnabled = TRUE; } } return IsEnabled; }